// file: $ECE_8993/util/calculate_lpc/v1.0/clpc_comp_1.cc // // applies a hamming window to the input data // // isip include files // #include #include // local include files // #include "calculate_lpc.h" #include "calculate_lpc_constants.h" // function: window_hamming_cc // // arguments: // // float_4* data: (input/output) sampled data // int_4 num_samples: (input) number of samples in the data stream // int_4 num_channels: (input) number of channels in the data stream // // return value: a logical_1 indicating status // // this function applies a hamming window to the input data by the function: // // y(n) = x(n) * (b - [(1 - b) * cos(2 * pi * n / num_samples)]) // // the center index of the input data is assumed to be time zero for the window // the input data is overwritten. // logical_1 window_hamming_cc(float_4* data_a, int_4 num_samples_a, int_4 num_channels_a) { // loop over all channels // for (int_4 chan = 0; chan < num_channels_a; chan++) { // loop over all data // for (int_4 samp_num = 0; samp_num < num_samples_a; samp_num++) { // store the sample data // float_4 x_n = data_a[samp_num * num_channels_a + chan]; // multiply by the window function // float_4 x_hamm_n = x_n * (float_4)(CLPC_HAMMING_COEFF - (((float_4)1.0 - CLPC_HAMMING_COEFF) * cos(ISIP_TWOPI * (float_4)samp_num / (float_4)(num_samples_a - 1)))); // store the windowed data // data_a[samp_num * num_channels_a + chan] = x_hamm_n; } } // exit gracefully // return ISIP_TRUE; }