Exemplo n.º 1
0
        internal static IPredictor CreateLpcPredictor(int[] coefficients, int shift, int[] samples)
        {
            IPredictor basePredictor;
            switch (coefficients.Length)
            {
                case 0:
                    throw new NotSupportedException();
                case 1:
                    basePredictor = new LpcFirstOrderPredictor(coefficients[0]);
                    break;
                case 2:
                    basePredictor = new LpcSecondOrderPredictor(coefficients[0], coefficients[1], samples[0]);
                    break;
                default:
                    basePredictor = new LpcPredictor(coefficients, samples);
                    break;
            }

            if (shift == 0)
                return basePredictor;
            else if (shift > 0)
                return new RightShiftPedictor(basePredictor, shift);
            else
                return new LeftShiftPedictor(basePredictor, shift);
        }
Exemplo n.º 2
0
        internal static IPredictor CreateLpcPredictor(int[] coefficients, int shift, int[] samples)
        {
            IPredictor basePredictor;

            switch (coefficients.Length)
            {
            case 0:
                throw new NotSupportedException();

            case 1:
                basePredictor = new LpcFirstOrderPredictor(coefficients[0]);
                break;

            case 2:
                basePredictor = new LpcSecondOrderPredictor(coefficients[0], coefficients[1], samples[0]);
                break;

            default:
                basePredictor = new LpcPredictor(coefficients, samples);
                break;
            }

            if (shift == 0)
            {
                return(basePredictor);
            }
            else if (shift > 0)
            {
                return(new RightShiftPedictor(basePredictor, shift));
            }
            else
            {
                return(new LeftShiftPedictor(basePredictor, shift));
            }
        }