// file: extract_feature/extf_func_2.cc
//

// isip include files
//
#include "extract_feature.h"
#include <Signal.h>

#include "extract_feature_constants.h"
#include <signal_constants.h>

#include <fourier_transform.h>
#include <fourier_transform_constants.h>

//method: func_cosf_cc
//
// arguments:
//  float_8* wcos_a: (output) array of cosine weightings
//  int_4* num_coeff_a: (input) number of points in the fft spectrum
//  int_4*  nfilt_a: (input) number of samples of auditory spectrum

//
//This method computes the cosine weightings for the IDFT
//
logical_1 func_cosf_cc(int_4 num_coeff_a,int_4 nfilt_a,float_8* wcos_a){
  
  // Local variables 
  //
  static int_4 ii, jj;
  static float_8 pai;
  
  // Parameter adjustments --- no int_4er needed
  //
  //  wcos_a -= 24;
 
  // Function Body 
  // 
  pai = atan((float_8)1.) * (float_8)4.;
  int_4 i_1 = num_coeff_a + 1;
  for (ii = 1; ii <= i_1; ++ii) {
    int_4 i_2 = nfilt_a - 1;
    for (jj = 2; jj <= i_2; jj++) {
      wcos_a[(jj + ii * 23) - 24] =
	cos(pai * (float_8)2.0 * (ii - 1) * (jj - 1) / (nfilt_a - 1 << 1))
	* (float_8)2.0;
    }
    wcos_a[(nfilt_a + ii * 23) - 24] =
      cos(pai * (float_8)2.0 * (ii - 1) * (jj - 1) / (nfilt_a - 1 << 1));
  }
  
  //exit gracefully
  //
  return ISIP_TRUE;
}  

