Signal Processing LibraryProgram name: int2double Language: C In file: window_lib.c Objective: Convert INT window to double window with normalize. Usage: void int2double(int *window, int window_size, double **d_window, int normalize) ); Parameters:
Mathematical Description: Comments: Routine to convert INT window to double window with normalize Code: void int2double(int *window, int window_size, double **d_window, int normalize) { int i; double max; max = 0.0; /* for each element, copy and check if greater than maximum */ for(i = 0; i < window_size; i++) { ((*d_window)[i]) = (double)window[i]; if(((*d_window)[i]) >= 0) { /* value positive or zero */ if(max < ((*d_window)[i])) { max = (*d_window)[i]; } } else { /* value negative, invert sign before comparison */ if(max < (-((*d_window)[i]))) { max = -(*d_window)[i]; } } } /* section to normalize vector */ if(normalize == 1) for(i = 0; i < window_size; i++) ((*d_window)[i]) /= max; return; } |
English Version > Documents and tutorials > D.Sc. projects > Routines for DSP > window_lib >