// file: $ECE_8993/util/calculate_lpc/v1.0/clpc_comp_2.cc // // computes the magnitude dft coefficients of the input data // // isip include files // #include #include // local include files // #include "calculate_lpc.h" #include "calculate_lpc_constants.h" // function: compute_dft_cc // // arguments: // // float_4* data: (input) a single channel of sampled data // float_4* dft_data: (output) magnitude of the dft coefficients // int_4 num_samples: (input) number of samples in the data stream // // return value: a logical_1 indicating status // // this function computes the dft of the input data and stores the // magnitude coefficients in the dft_data array // logical_1 compute_dft_cc(float_4* data_a, float_4* dft_data_a, int_4 num_samples_a) { // loop over all frequency bins // for (int_4 k = (int_4)0; k < num_samples_a; k++) { // declare local accumulators // float_4 sumr = (float_4)0.0; float_4 sumi = (float_4)0.0; // loop over all time samples // for (int_4 n = (int_4)0; n < num_samples_a; n++) { // compute the argument // float_4 arg = ISIP_TWOPI * (float_4)n * (float_4)k / (float_4)num_samples_a; // compute the real part // sumr += data_a[n] * cos(arg); // compute the imaginary part // sumi += -data_a[n] * sin(arg); } // store the frequency value in magnitude form // dft_data_a[k] = sqrt((sumr * sumr) + (sumi * sumi)); } // exit gracefully // return ISIP_TRUE; }