@@ -126,11 +126,7 @@ typedef struct {
126126 float sq [PMAX_M ]; /* squared speech samples */
127127 float mem_x ,mem_y ; /* memory for notch filter */
128128 float mem_fir [NLP_NTAP ]; /* decimation FIR filter memory */
129- #if defined(STM32F40_41xxx )
130129 codec2_fft_cfg fft_cfg ; /* kiss FFT config */
131- #else
132- codec2_fftr_cfg fft_cfg ;
133- #endif // defined(STM32F40_41xxx)
134130 float * Sn16k ; /* Fs=16kHz input speech vector */
135131 FILE * f ;
136132} NLP ;
@@ -194,11 +190,7 @@ void *nlp_create(C2CONST *c2const)
194190 for (i = 0 ; i < NLP_NTAP ; i ++ )
195191 nlp -> mem_fir [i ] = 0.0 ;
196192
197- #if defined(STM32F40_41xxx )
198193 nlp -> fft_cfg = codec2_fft_alloc (PE_FFT_SIZE , 0 , NULL , NULL );
199- #else
200- nlp -> fft_cfg = codec2_fftr_alloc (PE_FFT_SIZE , 0 , NULL , NULL );
201- #endif // defined(STM32F40_41xxx)
202194 assert (nlp -> fft_cfg != NULL );
203195
204196 return (void * )nlp ;
@@ -218,11 +210,7 @@ void nlp_destroy(void *nlp_state)
218210 assert (nlp_state != NULL );
219211 nlp = (NLP * )nlp_state ;
220212
221- #if defined(STM32F40_41xxx )
222213 codec2_fft_free (nlp -> fft_cfg );
223- #else
224- codec2_fftr_free (nlp -> fft_cfg );
225- #endif // defined(STM32F40_41xxx)
226214 if (nlp -> Fs == 16000 ) {
227215 free (nlp -> Sn16k );
228216 }
@@ -363,35 +351,15 @@ float nlp(
363351 #ifdef DUMP
364352 dump_dec (Fw );
365353 #endif
366-
367- #if defined(STM32F40_41xxx )
354+
368355 // FIXME: check if this can be converted to a real fft
369356 // since all imag inputs are 0
370357 codec2_fft_inplace (nlp -> fft_cfg , Fw );
371358 PROFILE_SAMPLE_AND_LOG (fft , window , " fft" );
372359
373360 for (i = 0 ; i < PE_FFT_SIZE ; i ++ )
374- Fw [i ].real = Fw [i ].real * Fw [i ].real + Fw [i ].imag * Fw [i ].imag ;
375- #else
376- float Fw_input [PE_FFT_SIZE ];
377- for (i = 0 ; i < PE_FFT_SIZE ; i ++ )
378- {
379- Fw_input [i ] = Fw [i ].real ;
380- }
381- codec2_fftr (nlp -> fft_cfg , & Fw_input [0 ], & Fw [0 ]);
382- PROFILE_SAMPLE_AND_LOG (fft , window , " fft" );
383-
384- for (i = 0 ; i < PE_FFT_SIZE /2 ; i ++ )
385- {
386- Fw [i ].real = Fw [i ].real * Fw [i ].real + Fw [i ].imag * Fw [i ].imag ;
387-
388- // Set Fw[PE_FFT_SIZE - i - 1] to the same as Fw[i] due to the real FFT's symmetry
389- // (and to avoid having to change anything else further down).
390- Fw [PE_FFT_SIZE - i - 1 ].real = Fw [i ].real ;
391- }
392-
393- #endif // defined(STM32F40_41xxx)
394-
361+ Fw [i ].real = Fw [i ].real * Fw [i ].real + Fw [i ].imag * Fw [i ].imag ;
362+
395363 PROFILE_SAMPLE_AND_LOG (magsq , fft , " mag sq" );
396364 #ifdef DUMP
397365 dump_sq (m , nlp -> sq );
0 commit comments