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); }
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)); } }