Skip to content

Commit 30bc980

Browse files
committed
Revert "Revert "Use non in-place FFT for dft_speech().""
This reverts commit c30adfd.
1 parent a1aa88a commit 30bc980

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/codec2.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,7 +2088,11 @@ void analyse_one_frame(struct CODEC2 *c2, MODEL *model, short speech[])
20882088
for(i=0; i<n_samp; i++)
20892089
c2->Sn[i+m_pitch-n_samp] = speech[i];
20902090

2091+
#if defined(STM32F40_41xxx)
20912092
dft_speech(&c2->c2const, c2->fft_fwd_cfg, Sw, c2->Sn, c2->w);
2093+
#else
2094+
dft_speech(&c2->c2const, c2->fftr_fwd_cfg, Sw, c2->Sn, c2->w);
2095+
#endif // STM32F40_41xxx
20922096

20932097
/* Estimate pitch */
20942098
nlp(c2->nlp, c2->Sn, n_samp, &pitch, Sw, c2->W, &c2->prev_f0_enc);

src/sine.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ float hpf(float x, float states[])
231231

232232
// TODO: we can either go for a faster FFT using fftr and some stack usage
233233
// or we can reduce stack usage to almost zero on STM32 by switching to fft_inplace
234-
#if 1
234+
#if defined(STM32F40_41xxx)
235235
void dft_speech(C2CONST *c2const, codec2_fft_cfg fft_fwd_cfg, COMP Sw[], float Sn[], float w[])
236236
{
237237
int i;
@@ -259,10 +259,12 @@ void dft_speech(C2CONST *c2const, codec2_fft_cfg fft_fwd_cfg, COMP Sw[], float S
259259
codec2_fft_inplace(fft_fwd_cfg, Sw);
260260
}
261261
#else
262-
void dft_speech(codec2_fftr_cfg fftr_fwd_cfg, COMP Sw[], float Sn[], float w[])
262+
void dft_speech(C2CONST* c2const, codec2_fftr_cfg fftr_fwd_cfg, COMP Sw[], float Sn[], float w[])
263263
{
264264
int i;
265265
float sw[FFT_ENC];
266+
int m_pitch = c2const->m_pitch;
267+
int nw = c2const->nw;
266268

267269
for(i=0; i<FFT_ENC; i++) {
268270
sw[i] = 0.0;

src/sine.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ C2CONST c2const_create(int Fs, float framelength_ms);
3636

3737
void make_analysis_window(C2CONST *c2const, codec2_fft_cfg fft_fwd_cfg, float w[], float W[]);
3838
float hpf(float x, float states[]);
39+
#if defined(STM32F40_41xxx)
3940
void dft_speech(C2CONST *c2const, codec2_fft_cfg fft_fwd_cfg, COMP Sw[], float Sn[], float w[]);
41+
#else
42+
void dft_speech(C2CONST* c2const, codec2_fftr_cfg fftr_fwd_cfg, COMP Sw[], float Sn[], float w[]);
43+
#endif
4044
void two_stage_pitch_refinement(C2CONST *c2const, MODEL *model, COMP Sw[]);
4145
void estimate_amplitudes(MODEL *model, COMP Sw[], float W[], int est_phase);
4246
float est_voicing_mbe(C2CONST *c2const, MODEL *model, COMP Sw[], float W[]);

0 commit comments

Comments
 (0)