// file: $ECE_8993/util/calculate_lpc/v1.0/clpc_comp_3.cc // // computes the linear prediction spectrum coefficients of the input data // // isip include files // #include #include // local include files // #include "calculate_lpc.h" #include "calculate_lpc_constants.h" // function: compute_lp_cc // // arguments: // // float_4* data: (input) a single channel of sampled data // float_4* lp_spectrum_coeffs: (output) magnitude of the lp coefficients // int_4 num_samples: (input) number of samples in the data stream // int_4 lp_order: (input) order of the lp model // // return value: a logical_1 indicating status // // this function computes the lp spectrum coefficients of the input data and // stores the magnitude spectrum coefficients in the output array array // logical_1 compute_lp_cc(float_4* data_a, float_4* lp_spectrum_coeffs_a, int_4 num_samples_a, int_4 lp_order_a) { // allocate memory for the autocorrelation terms // float_4* autocor_coeffs = new float_4[lp_order_a + 1]; // calculate the autocorrelation terms for the lp analysis // compute_autocorrelation_cc(data_a, autocor_coeffs, num_samples_a, lp_order_a); // debugging output // for (int_4 i = 0; i < lp_order_a+1; i++) { fprintf(stdout, "AUTOCORRELATION COEFFS: index = %ld value = %.6f\n", i, autocor_coeffs[i]); } // setup variables for the predictor coefficients and the gain // float_4 lp_gain = (float_4)1.0; float_4* lp_predictor_coeffs = new float_4[lp_order_a + 1]; // compute the lp predictor coefficients // compute_lp_coeffs_cc(lp_predictor_coeffs, lp_order_a, autocor_coeffs, lp_gain); // debugging output // for (int_4 i = 0; i < lp_order_a+1; i++) { fprintf(stdout, "LP PREDICTOR COEFFS: index = %ld value = %.6f\n", i, lp_predictor_coeffs[i]); } // debugging output // fprintf(stdout, "LP_GAIN: %.6f\n", lp_gain); // compute the spectrum of the lp signal // compute_lp_spect_cc(lp_predictor_coeffs, lp_spectrum_coeffs_a, lp_order_a, num_samples_a, lp_gain); // delete memory and clean up // delete [] autocor_coeffs; delete [] lp_predictor_coeffs; // exit gracefully // return ISIP_TRUE; }