// file: extract_feature/extf_filt_0.cc
//
// preemphasizes the data using a standard pre-emphasis filter
//

// local include files
//
#include "extract_feature.h"
#include "extract_feature_constants.h"

// function: pre_emphasize_data_cc
//
// arguments:
//
//  float_8* data: (input/output) sampled data
//  float_8 coeff: (input) filter coefficient
//  int_4 num_samples: (input) number of samples in the data stream
//  
// return value: a logical_1 indicating status
//
// this function pre-emphasizes the input data using the filter:
//
//   1 - (a * z^(-1)).
//
// the input data is overwritten
//

logical_1 Extract_feature::pre_emphasize_data_cc(float_8* data_a) {
			
  // loop over all data
  //
  for (int_4 samp_num = window_num_samples_d - 1; samp_num > 0; samp_num--) {
    
    // compute and store the pre-emphasized x(n) value
    //
    data_a[samp_num] = data_a[samp_num] -
      (pre_emph_coeff_d * data_a[samp_num - 1]);    
  }
  data_a[0] = data_a[0] * (1 - pre_emph_coeff_d);
  
  // exit gracefully
  //
  return ISIP_TRUE;
}

