found out kiss fft direction was the wrong way around so went back and fixed it every...
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 11 Jun 2012 00:53:37 +0000 (00:53 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 11 Jun 2012 00:53:37 +0000 (00:53 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@541 01035d8c-6547-0410-b346-abe4f91aad63

19 files changed:
codec2-dev/octave/tfdmdv.m
codec2-dev/src/Makefile.am
codec2-dev/src/Makefile.in
codec2-dev/src/c2sim.c
codec2-dev/src/codec2.c
codec2-dev/src/codec2_internal.h
codec2-dev/src/fdmdv.c
codec2-dev/src/fdmdv_internal.h
codec2-dev/src/interp.c
codec2-dev/src/nlp.c
codec2-dev/src/phase.c
codec2-dev/src/quantise.c
codec2-dev/src/quantise.h
codec2-dev/src/sine.c
codec2-dev/src/sine.h
codec2-dev/unittest/Makefile.am
codec2-dev/unittest/Makefile.in
codec2-dev/unittest/tlspsens.c
codec2-dev/unittest/tnlp.c

index 67f4ac02f0df1e28a9aa1286fc5c0885940abce3..787913cf850860cff037f47ed20396730df8ade4 100644 (file)
@@ -270,7 +270,7 @@ function check(a, b, test_name)
   end
   printf(": ");  
   
-  if abs(sum(a - b))/n < 1E-3
+  if sum(abs(a - b))/n < 1E-3
     printf("OK\n");
     passes++;
   else
index 6ba4136740ef67952cf80c5a83637c0a7340a951..84904375b451fdb958d80cb1d202d7f459829170 100644 (file)
@@ -101,7 +101,6 @@ postfilter.c \
 sine.c \
 codec2.c \
 fdmdv.c \
-fft.c \
 kiss_fft.c \
 interp.c \
 lsp.c \
index 1989a457f386de15010254d9c4ee6c20f90f1490..0c62be50a24800c87b80e4d06878fb21712f06ec 100644 (file)
@@ -66,14 +66,13 @@ libcodec2_la_LIBADD =
 am_libcodec2_la_OBJECTS = libcodec2_la-dump.lo libcodec2_la-lpc.lo \
        libcodec2_la-nlp.lo libcodec2_la-postfilter.lo \
        libcodec2_la-sine.lo libcodec2_la-codec2.lo \
-       libcodec2_la-fdmdv.lo libcodec2_la-fft.lo \
-       libcodec2_la-kiss_fft.lo libcodec2_la-interp.lo \
-       libcodec2_la-lsp.lo libcodec2_la-phase.lo \
-       libcodec2_la-quantise.lo libcodec2_la-pack.lo \
-       libcodec2_la-codebook.lo libcodec2_la-codebookd.lo \
-       libcodec2_la-codebookvq.lo libcodec2_la-codebookjnd.lo \
-       libcodec2_la-codebookjvm.lo libcodec2_la-codebookdt.lo \
-       libcodec2_la-codebookge.lo
+       libcodec2_la-fdmdv.lo libcodec2_la-kiss_fft.lo \
+       libcodec2_la-interp.lo libcodec2_la-lsp.lo \
+       libcodec2_la-phase.lo libcodec2_la-quantise.lo \
+       libcodec2_la-pack.lo libcodec2_la-codebook.lo \
+       libcodec2_la-codebookd.lo libcodec2_la-codebookvq.lo \
+       libcodec2_la-codebookjnd.lo libcodec2_la-codebookjvm.lo \
+       libcodec2_la-codebookdt.lo libcodec2_la-codebookge.lo
 libcodec2_la_OBJECTS = $(am_libcodec2_la_OBJECTS)
 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
@@ -309,7 +308,6 @@ postfilter.c \
 sine.c \
 codec2.c \
 fdmdv.c \
-fft.c \
 kiss_fft.c \
 interp.c \
 lsp.c \
@@ -511,7 +509,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-codec2.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-dump.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-fdmdv.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-fft.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-interp.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-kiss_fft.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-lpc.Plo@am__quote@
@@ -594,13 +591,6 @@ libcodec2_la-fdmdv.lo: fdmdv.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-fdmdv.lo `test -f 'fdmdv.c' || echo '$(srcdir)/'`fdmdv.c
 
-libcodec2_la-fft.lo: fft.c
-@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-fft.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-fft.Tpo" -c -o libcodec2_la-fft.lo `test -f 'fft.c' || echo '$(srcdir)/'`fft.c; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/libcodec2_la-fft.Tpo" "$(DEPDIR)/libcodec2_la-fft.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-fft.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='fft.c' object='libcodec2_la-fft.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-fft.lo `test -f 'fft.c' || echo '$(srcdir)/'`fft.c
-
 libcodec2_la-kiss_fft.lo: kiss_fft.c
 @am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-kiss_fft.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-kiss_fft.Tpo" -c -o libcodec2_la-kiss_fft.lo `test -f 'kiss_fft.c' || echo '$(srcdir)/'`kiss_fft.c; \
 @am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/libcodec2_la-kiss_fft.Tpo" "$(DEPDIR)/libcodec2_la-kiss_fft.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-kiss_fft.Tpo"; exit 1; fi
index 51089be4fd07ba86d9d9f567fbfcab320d6bd178..5a412ea2ad0fe08991b2353c6a65d5161fdda363 100644 (file)
@@ -47,7 +47,7 @@
 #include "postfilter.h"
 #include "interp.h"
 
-void synth_one_frame(kiss_fft_cfg fft_dec_cfg, short buf[], MODEL *model, float Sn_[], float Pn[]);
+void synth_one_frame(kiss_fft_cfg fft_inv_cfg, short buf[], MODEL *model, float Sn_[], float Pn[]);
 void print_help(const struct option *long_options, int num_opts, char* argv[]);
 
 /*---------------------------------------------------------------------------*\
@@ -63,8 +63,8 @@ int main(int argc, char *argv[])
     short buf[N];      /* input/output buffer                   */
     float Sn[M];       /* float input speech samples            */
     COMP  Sw[FFT_ENC]; /* DFT of Sn[]                           */
-    kiss_fft_cfg  fft_enc_cfg;
-    kiss_fft_cfg  fft_dec_cfg;
+    kiss_fft_cfg  fft_fwd_cfg;
+    kiss_fft_cfg  fft_inv_cfg;
     float w[M];                /* time domain hamming window            */
     COMP  W[FFT_ENC];  /* DFT of w[]                            */
     MODEL model;
@@ -309,9 +309,9 @@ int main(int argc, char *argv[])
 
     /* Initialise ------------------------------------------------------------*/
 
-    fft_enc_cfg = kiss_fft_alloc(FFT_ENC, 1, NULL, NULL);
-    fft_dec_cfg = kiss_fft_alloc(FFT_DEC, 0, NULL, NULL);
-    make_analysis_window(fft_enc_cfg, w, W);
+    fft_fwd_cfg = kiss_fft_alloc(FFT_ENC, 0, NULL, NULL); /* fwd FFT,used in several places   */
+    fft_inv_cfg = kiss_fft_alloc(FFT_DEC, 1, NULL, NULL); /* inverse FFT, used just for synth */
+    make_analysis_window(fft_fwd_cfg, w, W);
     make_synthesis_window(Pn);
     quantise_init();
 
@@ -343,7 +343,7 @@ int main(int argc, char *argv[])
        nlp(nlp_states,Sn,N,M,P_MIN,P_MAX,&pitch,Sw,&prev_uq_Wo);
        model.Wo = TWO_PI/pitch;
        
-       dft_speech(fft_enc_cfg, Sw, Sn, w); 
+       dft_speech(fft_fwd_cfg, Sw, Sn, w); 
        two_stage_pitch_refinement(&model, Sw);
        estimate_amplitudes(&model, Sw, W);
        uq_Wo = model.Wo;
@@ -574,7 +574,7 @@ int main(int argc, char *argv[])
 
            }
 
-           aks_to_M2(fft_dec_cfg, ak, order, &model, e, &snr, 1); 
+           aks_to_M2(fft_fwd_cfg, ak, order, &model, e, &snr, 1); 
 
            /* note SNR on interpolated frames can't be measured properly
               by comparing Am as L has changed.  We can dump interp lsps
@@ -625,7 +625,7 @@ int main(int argc, char *argv[])
 
                interp_model.voiced = voiced1;
                
-               interpolate_lsp(fft_dec_cfg, &interp_model, &prev_model, &model,
+               interpolate_lsp(fft_fwd_cfg, &interp_model, &prev_model, &model,
                                prev_lsps_, prev_e, lsps_, e, ak_interp, lsps_interp);          
                apply_lpc_correction(&interp_model);
 
@@ -660,11 +660,11 @@ int main(int argc, char *argv[])
                 #endif
 
                if (phase0)
-                   phase_synth_zero_order(fft_dec_cfg, &interp_model, ak_interp, ex_phase,
+                   phase_synth_zero_order(fft_fwd_cfg, &interp_model, ak_interp, ex_phase,
                                           order);      
                if (postfilt)
                    postfilter(&interp_model, &bg_est);
-               synth_one_frame(fft_dec_cfg, buf, &interp_model, Sn_, Pn);
+               synth_one_frame(fft_inv_cfg, buf, &interp_model, Sn_, Pn);
                //printf("  buf[0] %d\n", buf[0]);
                if (fout != NULL) 
                    fwrite(buf,sizeof(short),N,fout);
@@ -672,10 +672,10 @@ int main(int argc, char *argv[])
                /* decode this frame */
 
                if (phase0)
-                   phase_synth_zero_order(fft_dec_cfg, &model, ak, ex_phase, order);   
+                   phase_synth_zero_order(fft_fwd_cfg, &model, ak, ex_phase, order);   
                if (postfilt)
                    postfilter(&model, &bg_est);
-               synth_one_frame(fft_dec_cfg, buf, &model, Sn_, Pn);
+               synth_one_frame(fft_inv_cfg, buf, &model, Sn_, Pn);
                //printf("  buf[0] %d\n", buf[0]);
                if (fout != NULL) 
                    fwrite(buf,sizeof(short),N,fout);
@@ -695,10 +695,10 @@ int main(int argc, char *argv[])
            /* no decimation - sythesise each 10ms frame immediately */
 
            if (phase0)
-               phase_synth_zero_order(fft_dec_cfg, &model, ak, ex_phase, order);       
+               phase_synth_zero_order(fft_fwd_cfg, &model, ak, ex_phase, order);       
            if (postfilt)
                postfilter(&model, &bg_est);
-           synth_one_frame(fft_dec_cfg, buf, &model, Sn_, Pn);
+           synth_one_frame(fft_inv_cfg, buf, &model, Sn_, Pn);
            if (fout != NULL) fwrite(buf,sizeof(short),N,fout);
        }
 
@@ -737,11 +737,11 @@ int main(int argc, char *argv[])
     return 0;
 }
 
-void synth_one_frame(kiss_fft_cfg fft_dec_cfg, short buf[], MODEL *model, float Sn_[], float Pn[])
+void synth_one_frame(kiss_fft_cfg fft_inv_cfg, short buf[], MODEL *model, float Sn_[], float Pn[])
 {
     int     i;
 
-    synthesise(fft_dec_cfg, Sn_, model, Pn, 1);
+    synthesise(fft_inv_cfg, Sn_, model, Pn, 1);
 
     for(i=0; i<N; i++) {
        if (Sn_[i] > 32767.0)
index b981c7ef5e494d65c71e2a1a22ac35d615c34da7..7b848392578ff6aac922aa45822dcfc48cd251f7 100644 (file)
@@ -101,10 +101,10 @@ struct CODEC2 * CODEC2_WIN32SUPPORT codec2_create(int mode)
     c2->hpf_states[0] = c2->hpf_states[1] = 0.0;
     for(i=0; i<2*N; i++)
        c2->Sn_[i] = 0;
-    c2->fft_enc_cfg = kiss_fft_alloc(FFT_ENC, 1, NULL, NULL);
-    make_analysis_window(c2->fft_enc_cfg, c2->w,c2->W);
+    c2->fft_fwd_cfg = kiss_fft_alloc(FFT_ENC, 0, NULL, NULL);
+    make_analysis_window(c2->fft_fwd_cfg, c2->w,c2->W);
     make_synthesis_window(c2->Pn);
-    c2->fft_dec_cfg = kiss_fft_alloc(FFT_DEC, 0, NULL, NULL);
+    c2->fft_inv_cfg = kiss_fft_alloc(FFT_DEC, 1, NULL, NULL);
     quantise_init();
     c2->prev_Wo_enc = 0.0;
     c2->bg_est = 0.0;
@@ -147,8 +147,8 @@ void CODEC2_WIN32SUPPORT codec2_destroy(struct CODEC2 *c2)
 {
     assert(c2 != NULL);
     nlp_destroy(c2->nlp);
-    KISS_FFT_FREE(c2->fft_enc_cfg);
-    KISS_FFT_FREE(c2->fft_dec_cfg);
+    KISS_FFT_FREE(c2->fft_fwd_cfg);
+    KISS_FFT_FREE(c2->fft_inv_cfg);
     free(c2);
 }
 
@@ -356,7 +356,7 @@ void codec2_decode_2400(struct CODEC2 *c2, short speech[], const unsigned char *
     interpolate_lsp_ver2(&lsps[0][0], c2->prev_lsps_dec, &lsps[1][0], 0.5);
     for(i=0; i<2; i++) {
        lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD);
-       aks_to_M2(c2->fft_dec_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 1); 
+       aks_to_M2(c2->fft_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 1); 
        apply_lpc_correction(&model[i]);
     }
 
@@ -528,7 +528,7 @@ void codec2_decode_1400(struct CODEC2 *c2, short speech[], const unsigned char *
     }
     for(i=0; i<4; i++) {
        lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD);
-       aks_to_M2(c2->fft_dec_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 1); 
+       aks_to_M2(c2->fft_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 1); 
        apply_lpc_correction(&model[i]);
     }
 
@@ -705,7 +705,7 @@ void codec2_decode_1200(struct CODEC2 *c2, short speech[], const unsigned char *
     }
     for(i=0; i<4; i++) {
        lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD);
-       aks_to_M2(c2->fft_dec_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 1); 
+       aks_to_M2(c2->fft_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 1); 
        apply_lpc_correction(&model[i]);
     }
 
@@ -737,9 +737,9 @@ void synthesise_one_frame(struct CODEC2 *c2, short speech[], MODEL *model, float
 {
     int     i;
 
-    phase_synth_zero_order(c2->fft_dec_cfg, model, ak, &c2->ex_phase, LPC_ORD);
+    phase_synth_zero_order(c2->fft_fwd_cfg, model, ak, &c2->ex_phase, LPC_ORD);
     postfilter(model, &c2->bg_est);
-    synthesise(c2->fft_dec_cfg, c2->Sn_, model, c2->Pn, 1);
+    synthesise(c2->fft_inv_cfg, c2->Sn_, model, c2->Pn, 1);
 
     for(i=0; i<N; i++) {
        if (c2->Sn_[i] > 32767.0)
@@ -778,7 +778,7 @@ void analyse_one_frame(struct CODEC2 *c2, MODEL *model, short speech[])
     for(i=0; i<N; i++)
       c2->Sn[i+M-N] = speech[i];
 
-    dft_speech(c2->fft_enc_cfg, Sw, c2->Sn, c2->w);
+    dft_speech(c2->fft_fwd_cfg, Sw, c2->Sn, c2->w);
 
     /* Estimate pitch */
 
index 2060a97a99e8ef8f3401716d8c8817188c7a3fa0..df5b8e21b9f6f01fca5b125ccb178c0e5dc0d4a5 100644 (file)
@@ -31,7 +31,7 @@
 
 struct CODEC2 {
     int           mode;
-    kiss_fft_cfg  fft_enc_cfg;             /* FFT config for encoder                    */
+    kiss_fft_cfg  fft_fwd_cfg;             /* forward FFT config                        */
     float         w[M];                           /* time domain hamming window                */
     COMP          W[FFT_ENC];             /* DFT of w[]                                */
     float         Pn[2*N];                /* trapezoidal synthesis window              */
@@ -39,7 +39,7 @@ struct CODEC2 {
     float         hpf_states[2];           /* high pass filter states                   */
     void         *nlp;                     /* pitch predictor states                    */
 
-    kiss_fft_cfg  fft_dec_cfg;             /* FFT config for decoder                    */
+    kiss_fft_cfg  fft_inv_cfg;             /* inverse FFT config                        */
     float         Sn_[2*N];               /* synthesised output speech                 */
     float         ex_phase;                /* excitation model phase track              */
     float         bg_est;                  /* background noise estimate for post filter */
index 8b7c96402db1c3b2863b95d7541c364401e1d4ed..9f02ac1c9aef85bb4a6de456086c79c80232c524 100644 (file)
@@ -42,6 +42,7 @@
 #include "rn.h"
 #include "test_bits.h"
 #include "pilot_coeff.h"
+#include "kiss_fft.h"
 #include "fft.h"
 #include "hanning.h"
 #include "os.h"
@@ -195,6 +196,9 @@ struct FDMDV * CODEC2_WIN32SUPPORT fdmdv_create(void)
 
     /* freq Offset estimation states */
 
+    f->fft_pilot_cfg = kiss_fft_alloc (MPILOTFFT, 0, NULL, NULL);
+    assert(f->fft_pilot_cfg != NULL);
+
     for(i=0; i<NPILOTBASEBAND; i++) {
        f->pilot_baseband1[i].real = f->pilot_baseband2[i].real = 0.0;
        f->pilot_baseband1[i].imag = f->pilot_baseband2[i].imag = 0.0;
@@ -240,6 +244,7 @@ struct FDMDV * CODEC2_WIN32SUPPORT fdmdv_create(void)
 void CODEC2_WIN32SUPPORT fdmdv_destroy(struct FDMDV *fdmdv)
 {
     assert(fdmdv != NULL);
+    KISS_FFT_FREE(fdmdv->fft_pilot_cfg);
     free(fdmdv);
 }
 
@@ -561,10 +566,12 @@ void generate_pilot_lut(COMP pilot_lut[], COMP *pilot_freq)
 
 \*---------------------------------------------------------------------------*/
 
-void lpf_peak_pick(float *foff, float *max, COMP pilot_baseband[], COMP pilot_lpf[], COMP S[], int nin)
+void lpf_peak_pick(float *foff, float *max, COMP pilot_baseband[], 
+                  COMP pilot_lpf[], kiss_fft_cfg fft_pilot_cfg, COMP S[], int nin)
 {
     int   i,j,k;
     int   mpilot;
+    COMP  s[MPILOTFFT];
     float mag, imax;
     int   ix;
     float r;
@@ -583,13 +590,13 @@ void lpf_peak_pick(float *foff, float *max, COMP pilot_baseband[], COMP pilot_lp
 
     mpilot = FS/(2*200);  /* calc decimation rate given new sample rate is twice LPF freq */
     for(i=0; i<MPILOTFFT; i++) {
-       S[i].real = 0.0; S[i].imag = 0.0;
+       s[i].real = 0.0; s[i].imag = 0.0;
     }
     for(i=0,j=0; i<NPILOTLPF; i+=mpilot,j++) {
-       S[j] = fcmult(hanning[i], pilot_lpf[i]);
+       s[j] = fcmult(hanning[i], pilot_lpf[i]); 
     }
 
-    fft(&S[0].real, MPILOTFFT, -1);
+    kiss_fft(fft_pilot_cfg, (kiss_fft_cpx *)s, (kiss_fft_cpx *)S);
 
     /* peak pick and convert to Hz */
 
@@ -666,8 +673,8 @@ float rx_est_freq_offset(struct FDMDV *f, float rx_fdm[], int nin)
        f->pilot_baseband2[j] = fcmult(rx_fdm[i], cconj(prev_pilot[i]));
     }
 
-    lpf_peak_pick(&foff1, &max1, f->pilot_baseband1, f->pilot_lpf1, f->S1, nin);
-    lpf_peak_pick(&foff2, &max2, f->pilot_baseband2, f->pilot_lpf2, f->S2, nin);
+    lpf_peak_pick(&foff1, &max1, f->pilot_baseband1, f->pilot_lpf1, f->fft_pilot_cfg, f->S1, nin);
+    lpf_peak_pick(&foff2, &max2, f->pilot_baseband2, f->pilot_lpf2, f->fft_pilot_cfg, f->S2, nin);
 
     if (max1 > max2)
        foff = foff1;
@@ -1396,7 +1403,7 @@ void CODEC2_WIN32SUPPORT fdmdv_get_fft(struct FDMDV *f, float mag_dB[], float rx
        fft_io[i].real = 1.0;
        fft_io[i].imag = 0.0;
     }
-    fft(&fft_io[0].real, 2*FDMDV_NFFT, -1);
+    //fft(&fft_io[0].real, 2*FDMDV_NFFT, -1);
     printf("%d fft_io[%d] %f %f\n", FDMDV_NFFT,0, fft_io[0].real, fft_io[0].imag);
 
 #ifdef TMP
index fa49acc85abceda19b1074184a62530e293d7a2d..a712e57db8296fe3bf8503a90bfe358d6d74a270 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "comp.h"
 #include "fdmdv.h"
+#include "kiss_fft.h"
 
 /*---------------------------------------------------------------------------*\
                                                                              
@@ -100,6 +101,7 @@ struct FDMDV {
 
     /* freq offset estimation states */
 
+    kiss_fft_cfg fft_pilot_cfg;             
     COMP pilot_baseband1[NPILOTBASEBAND];
     COMP pilot_baseband2[NPILOTBASEBAND];
     COMP pilot_lpf1[NPILOTLPF];
@@ -150,7 +152,7 @@ void fdm_upconvert(COMP tx_fdm[], COMP tx_baseband[NC+1][M], COMP phase_tx[], CO
 void generate_pilot_fdm(COMP *pilot_fdm, int *bit, float *symbol, float *filter_mem, COMP *phase, COMP *freq);
 void generate_pilot_lut(COMP pilot_lut[], COMP *pilot_freq);
 float rx_est_freq_offset(struct FDMDV *f, float rx_fdm[], int nin);
-void lpf_peak_pick(float *foff, float *max, COMP pilot_baseband[], COMP pilot_lpf[], COMP S[], int nin);
+void lpf_peak_pick(float *foff, float *max, COMP pilot_baseband[], COMP pilot_lpf[], kiss_fft_cfg fft_pilot_cfg, COMP S[], int nin);
 void freq_shift(COMP rx_fdm_fcorr[], float rx_fdm[], float foff, COMP *foff_rect, COMP *foff_phase_rect, int nin);
 void fdm_downconvert(COMP rx_baseband[NC+1][M+M/P], COMP rx_fdm[], COMP phase_rx[], COMP freq[], int nin);
 void rx_filter(COMP rx_filt[NC+1][P+1], COMP rx_baseband[NC+1][M+M/P], COMP rx_filter_memory[NC+1][NFILTER], int nin);
index 2aca6b26de362c06469702adaf70867cb9774011..e7ae2d386233331cdddcb25a4f9fbd31eb4e7e3d 100644 (file)
@@ -146,7 +146,7 @@ float sample_log_amp(MODEL *model, float w)
 \*---------------------------------------------------------------------------*/
 
 void interpolate_lsp(
-  kiss_fft_cfg  fft_dec_cfg, 
+  kiss_fft_cfg  fft_fwd_cfg, 
   MODEL *interp,    /* interpolated model params                     */
   MODEL *prev,      /* previous frames model params                  */
   MODEL *next,      /* next frames model params                      */
@@ -201,7 +201,7 @@ void interpolate_lsp(
     /* convert back to amplitudes */
 
     lsp_to_lpc(lsps_interp, ak_interp, LPC_ORD);
-    aks_to_M2(fft_dec_cfg, ak_interp, LPC_ORD, interp, e, &snr, 0); 
+    aks_to_M2(fft_fwd_cfg, ak_interp, LPC_ORD, interp, e, &snr, 0); 
     //printf("  interp: ak[1]: %f A[1] %f\n", ak_interp[1], interp->A[1]);
 }
 
index c417020a9c4b42b12acaa753eba731b6c37a4780..ef58c57e8dc7227f06d9bde5d0ade3aedc34d781 100644 (file)
@@ -146,7 +146,7 @@ void *nlp_create()
     for(i=0; i<NLP_NTAP; i++)
        nlp->mem_fir[i] = 0.0;
 
-    nlp->fft_cfg = kiss_fft_alloc (PE_FFT_SIZE, 1, NULL, NULL);
+    nlp->fft_cfg = kiss_fft_alloc (PE_FFT_SIZE, 0, NULL, NULL);
     assert(nlp->fft_cfg != NULL);
 
     return (void*)nlp;
@@ -257,17 +257,18 @@ float nlp(
     for(i=0; i<m/DEC; i++) {
        fw[i].real = nlp->sq[i*DEC]*(0.5 - 0.5*cos(2*PI*i/(m/DEC-1)));
     }
-#ifdef DUMP
+    #ifdef DUMP
     dump_dec(Fw);
-#endif
+    #endif
+
     kiss_fft(nlp->fft_cfg, (kiss_fft_cpx *)fw, (kiss_fft_cpx *)Fw);
     for(i=0; i<PE_FFT_SIZE; i++)
        Fw[i].real = Fw[i].real*Fw[i].real + Fw[i].imag*Fw[i].imag;
 
-#ifdef DUMP
+    #ifdef DUMP
     dump_sq(nlp->sq);
     dump_Fw(Fw);
-#endif
+    #endif
 
     /* find global peak */
 
index 5701020f7fee5d7819ed5e27930d32e1165f4fac..563103cd520e596e9fcfb4fac4cd11bc8e7aa56b 100644 (file)
@@ -48,7 +48,7 @@
 \*---------------------------------------------------------------------------*/
 
 void aks_to_H(
-              kiss_fft_cfg fft_dec_cfg, 
+              kiss_fft_cfg fft_fwd_cfg, 
              MODEL *model,     /* model parameters */
              float  aks[],     /* LPC's */
              float  G,         /* energy term */
@@ -56,8 +56,8 @@ void aks_to_H(
              int    order
 )
 {
-  COMP  pw[FFT_DEC];   /* power spectrum (input) */
-  COMP  Pw[FFT_DEC];   /* power spectrum (output) */
+  COMP  pw[FFT_ENC];   /* power spectrum (input) */
+  COMP  Pw[FFT_ENC];   /* power spectrum (output) */
   int   i,m;           /* loop variables */
   int   am,bm;         /* limits of current band */
   float r;             /* no. rads/bin */
@@ -66,11 +66,11 @@ void aks_to_H(
   int   b;             /* centre bin of harmonic */
   float phi_;          /* phase of LPC spectra */
 
-  r = TWO_PI/(FFT_DEC);
+  r = TWO_PI/(FFT_ENC);
 
   /* Determine DFT of A(exp(jw)) ------------------------------------------*/
 
-  for(i=0; i<FFT_DEC; i++) {
+  for(i=0; i<FFT_ENC; i++) {
     pw[i].real = 0.0;
     pw[i].imag = 0.0;
   }
@@ -78,7 +78,7 @@ void aks_to_H(
   for(i=0; i<=order; i++)
     pw[i].real = aks[i];
 
-  kiss_fft(fft_dec_cfg, (kiss_fft_cpx *)pw, (kiss_fft_cpx *)Pw);
+  kiss_fft(fft_fwd_cfg, (kiss_fft_cpx *)pw, (kiss_fft_cpx *)Pw);
 
   /* Sample magnitude and phase at harmonics */
 
@@ -190,7 +190,7 @@ void aks_to_H(
 \*---------------------------------------------------------------------------*/
 
 void phase_synth_zero_order(
-    kiss_fft_cfg fft_dec_cfg,     
+    kiss_fft_cfg fft_fwd_cfg,     
     MODEL *model,
     float  aks[],
     float *ex_phase,            /* excitation phase of fundamental */
@@ -208,7 +208,7 @@ void phase_synth_zero_order(
   int   b;
 
   G = 1.0;
-  aks_to_H(fft_dec_cfg, model, aks, G, H, order);
+  aks_to_H(fft_fwd_cfg, model, aks, G, H, order);
 
   /* 
      Update excitation fundamental phase track, this sets the position
index b71989a650a31b2dee496a2c11ffce61774725bf..dd1464cba215dadfe62ebdbdafa42714fd64d0ce 100644 (file)
@@ -662,7 +662,7 @@ float lpc_model_amplitudes(
 \*---------------------------------------------------------------------------*/
 
 void aks_to_M2(
-  kiss_fft_cfg  fft_dec_cfg, 
+  kiss_fft_cfg  fft_fwd_cfg, 
   float         ak[],       /* LPC's */
   int           order,
   MODEL        *model,      /* sinusoidal model parameters for this frame */
@@ -671,8 +671,8 @@ void aks_to_M2(
   int           dump         /* true to dump sample to dump file */
 )
 {
-  COMP pw[FFT_DEC];    /* input to FFT for power spectrum */
-  COMP Pw[FFT_DEC];    /* output power spectrum */
+  COMP pw[FFT_ENC];    /* input to FFT for power spectrum */
+  COMP Pw[FFT_ENC];    /* output power spectrum */
   int i,m;             /* loop variables */
   int am,bm;           /* limits of current band */
   float r;             /* no. rads/bin */
@@ -680,22 +680,22 @@ void aks_to_M2(
   float Am;            /* spectral amplitude sample */
   float signal, noise;
 
-  r = TWO_PI/(FFT_DEC);
+  r = TWO_PI/(FFT_ENC);
 
   /* Determine DFT of A(exp(jw)) --------------------------------------------*/
 
-  for(i=0; i<FFT_DEC; i++) {
+  for(i=0; i<FFT_ENC; i++) {
     pw[i].real = 0.0;
     pw[i].imag = 0.0; 
   }
 
   for(i=0; i<=order; i++)
     pw[i].real = ak[i];
-  kiss_fft(fft_dec_cfg, (kiss_fft_cpx *)pw, (kiss_fft_cpx *)Pw);
+  kiss_fft(fft_fwd_cfg, (kiss_fft_cpx *)pw, (kiss_fft_cpx *)Pw);
 
   /* Determine power spectrum P(w) = E/(A(exp(jw))^2 ------------------------*/
 
-  for(i=0; i<FFT_DEC/2; i++)
+  for(i=0; i<FFT_ENC/2; i++)
     Pw[i].real = E/(Pw[i].real*Pw[i].real + Pw[i].imag*Pw[i].imag);
   #ifdef DUMP
   if (dump) 
@@ -1420,7 +1420,7 @@ float decode_energy(int index)
 
 \*---------------------------------------------------------------------------*/
 
-float decode_amplitudes(kiss_fft_cfg  fft_dec_cfg, 
+float decode_amplitudes(kiss_fft_cfg  fft_fwd_cfg, 
                        MODEL *model, 
                        float  ak[],
                        int    lsp_indexes[], 
index 59f880b8abd0f193cba6fdb37d6d0197d319749e..e184a189cd49ff6a2f34ca815b481a1833051e6e 100644 (file)
@@ -51,7 +51,7 @@
 void quantise_init();
 float lpc_model_amplitudes(float Sn[], float w[], MODEL *model, int order,
                           int lsp,float ak[]);
-void aks_to_M2(kiss_fft_cfg  fft_dec_cfg, float ak[], int order, MODEL *model, 
+void aks_to_M2(kiss_fft_cfg fft_fwd_cfg, float ak[], int order, MODEL *model, 
               float E, float *snr, int dump);
 
 int   encode_Wo(float Wo);
index 392554c9b5c9495154b9018b5dd776e6cc3e1ac2..4ada8d80c3386ab2fd1cf3ce9bd8a895fd84cedd 100644 (file)
@@ -66,7 +66,7 @@ void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax,
 
 \*---------------------------------------------------------------------------*/
 
-void make_analysis_window(kiss_fft_cfg fft_enc_cfg, float w[], COMP W[])
+void make_analysis_window(kiss_fft_cfg fft_fwd_cfg, float w[], COMP W[])
 {
   float m;
   COMP  wshift[FFT_ENC];
@@ -132,7 +132,7 @@ void make_analysis_window(kiss_fft_cfg fft_enc_cfg, float w[], COMP W[])
   for(i=FFT_ENC-NW/2,j=M/2-NW/2; i<FFT_ENC; i++,j++)
    wshift[i].real = w[j];
 
-  kiss_fft(fft_enc_cfg, (kiss_fft_cpx *)wshift, (kiss_fft_cpx *)W);
+  kiss_fft(fft_fwd_cfg, (kiss_fft_cpx *)wshift, (kiss_fft_cpx *)W);
 
   /* 
       Re-arrange W[] to be symmetrical about FFT_ENC/2.  Makes later 
@@ -199,7 +199,7 @@ float hpf(float x, float states[])
 
 \*---------------------------------------------------------------------------*/
 
-void dft_speech(kiss_fft_cfg fft_enc_cfg, COMP Sw[], float Sn[], float w[])
+void dft_speech(kiss_fft_cfg fft_fwd_cfg, COMP Sw[], float Sn[], float w[])
 {
   int  i;
   COMP sw[FFT_ENC];
@@ -222,7 +222,7 @@ void dft_speech(kiss_fft_cfg fft_enc_cfg, COMP Sw[], float Sn[], float w[])
   for(i=0; i<NW/2; i++)
     sw[FFT_ENC-NW/2+i].real = Sn[i+M/2-NW/2]*w[i+M/2-NW/2];
 
-  kiss_fft(fft_enc_cfg, (kiss_fft_cpx *)sw, (kiss_fft_cpx *)Sw);
+  kiss_fft(fft_fwd_cfg, (kiss_fft_cpx *)sw, (kiss_fft_cpx *)Sw);
 }
 
 /*---------------------------------------------------------------------------*\
@@ -366,7 +366,7 @@ void estimate_amplitudes(MODEL *model, COMP Sw[], COMP W[])
 
     /* Estimate phase of harmonic */
 
-    model->phi[m] = atan2(-Sw[b].imag,Sw[b].real);
+    model->phi[m] = atan2(Sw[b].imag,Sw[b].real);
   }
 }
 
@@ -557,7 +557,7 @@ void make_synthesis_window(float Pn[])
 \*---------------------------------------------------------------------------*/
 
 void synthesise(
-  kiss_fft_cfg fft_dec_cfg, 
+  kiss_fft_cfg fft_inv_cfg, 
   float  Sn_[],                /* time domain synthesised signal              */
   MODEL *model,                /* ptr to model parameters for this frame      */
   float  Pn[],         /* time domain Parzen window                   */
@@ -607,14 +607,14 @@ void synthesise(
                b = (FFT_DEC/2)-1;
        }
        Sw_[b].real = model->A[l]*cos(model->phi[l]);
-       Sw_[b].imag = -model->A[l]*sin(model->phi[l]);
+       Sw_[b].imag = model->A[l]*sin(model->phi[l]);
        Sw_[FFT_DEC-b].real = Sw_[b].real;
        Sw_[FFT_DEC-b].imag = -Sw_[b].imag;
     }
 
     /* Perform inverse DFT */
 
-    kiss_fft(fft_dec_cfg, (kiss_fft_cpx *)Sw_, (kiss_fft_cpx *)sw_);
+    kiss_fft(fft_inv_cfg, (kiss_fft_cpx *)Sw_, (kiss_fft_cpx *)sw_);
 #else
     /*
        Direct time domain synthesis using the cos() function.  Works
index 0a173a900daa7e8b468c0dfa61f405ac53c0bc25..202adfd2029356c3387d348eb71b7640bcd81a06 100644 (file)
 #include "comp.h"
 #include "kiss_fft.h"
 
-void make_analysis_window(kiss_fft_cfg fft_enc_cfg, float w[], COMP W[]);
+void make_analysis_window(kiss_fft_cfg fft_fwd_cfg, float w[], COMP W[]);
 float hpf(float x, float states[]);
-void dft_speech(kiss_fft_cfg fft_enc_cfg, COMP Sw[], float Sn[], float w[]);
+void dft_speech(kiss_fft_cfg fft_fwd_cfg, COMP Sw[], float Sn[], float w[]);
 void two_stage_pitch_refinement(MODEL *model, COMP Sw[]);
 void estimate_amplitudes(MODEL *model, COMP Sw[], COMP W[]);
 float est_voicing_mbe(MODEL *model, COMP Sw[], COMP W[], COMP Sw_[],COMP Ew[], 
                      float prev_Wo);
 void make_synthesis_window(float Pn[]);
-void synthesise(kiss_fft_cfg fft_dec_cfg, float Sn_[], MODEL *model, float Pn[], int shift);
+void synthesise(kiss_fft_cfg fft_inv_cfg, float Sn_[], MODEL *model, float Pn[], int shift);
 
 #endif
index 58e68d775968fb2d76959d14ffbd17eab33eb909..55f3df2edf62bf3c895de4181d726774d5bd6175 100644 (file)
@@ -3,7 +3,7 @@ AUTOMAKE_OPTS = gnu
 NAME = libcodec2
 AM_CPPFLAGS = $(AM_CFLAGS)
 
-noinst_PROGRAMS = genres genlsp extract vqtrain vqtrainjnd tnlp tinterp tquant tcodec2 vq_train_jvm scalarlsptest tfdmdv t48_8 lspsync create_interleaver tlspsens
+noinst_PROGRAMS = genres genlsp extract vqtrain vqtrainjnd tnlp tinterp tquant vq_train_jvm scalarlsptest tfdmdv t48_8 lspsync create_interleaver tlspsens
 
 genres_SOURCES = genres.c ../src/lpc.c
 genres_LDADD = $(lib_LTLIBRARIES) 
@@ -43,11 +43,6 @@ tquant_SOURCES = tquant.c ../src/quantise.c ../src/lpc.c ../src/lsp.c ../src/dum
 tquant_LDADD = $(lib_LTLIBRARIES) 
 tquant_LDFLAGS = $(LIBS)
 
-tcodec2_SOURCES = tcodec2.c ../src/quantise.c ../src/lpc.c ../src/lsp.c ../src/dump.c ../src/fft.c ../src/kiss_fft.c \
-../src/codec2.c ../src/sine.c ../src/nlp.c ../src/postfilter.c ../src/phase.c ../src/interp.c ../src/pack.c $(CODEBOOKS)
-tcodec2_LDADD = $(lib_LTLIBRARIES) 
-tcodec2_LDFLAGS = $(LIBS)
-
 scalarlsptest_SOURCES = scalarlsptest.c ../src/quantise.c ../src/lpc.c ../src/lsp.c ../src/dump.c ../src/fft.c ../src/kiss_fft.c $(CODEBOOKS)
 scalarlsptest_LDADD = $(lib_LTLIBRARIES) 
 scalarlsptest_LDFLAGS = $(LIBS)
index f912b00f7d53801e1ad317494fea69a53368a69e..86db4c2637bf79840ddf9c4b85f428fad7c532e2 100644 (file)
@@ -38,10 +38,9 @@ build_triplet = @build@
 host_triplet = @host@
 noinst_PROGRAMS = genres$(EXEEXT) genlsp$(EXEEXT) extract$(EXEEXT) \
        vqtrain$(EXEEXT) vqtrainjnd$(EXEEXT) tnlp$(EXEEXT) \
-       tinterp$(EXEEXT) tquant$(EXEEXT) tcodec2$(EXEEXT) \
-       vq_train_jvm$(EXEEXT) scalarlsptest$(EXEEXT) tfdmdv$(EXEEXT) \
-       t48_8$(EXEEXT) lspsync$(EXEEXT) create_interleaver$(EXEEXT) \
-       tlspsens$(EXEEXT)
+       tinterp$(EXEEXT) tquant$(EXEEXT) vq_train_jvm$(EXEEXT) \
+       scalarlsptest$(EXEEXT) tfdmdv$(EXEEXT) t48_8$(EXEEXT) \
+       lspsync$(EXEEXT) create_interleaver$(EXEEXT) tlspsens$(EXEEXT)
 subdir = unittest
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -83,13 +82,6 @@ am_t48_8_OBJECTS = t48_8.$(OBJEXT) fdmdv.$(OBJEXT) fft.$(OBJEXT) \
        kiss_fft.$(OBJEXT)
 t48_8_OBJECTS = $(am_t48_8_OBJECTS)
 t48_8_DEPENDENCIES =
-am_tcodec2_OBJECTS = tcodec2.$(OBJEXT) quantise.$(OBJEXT) \
-       lpc.$(OBJEXT) lsp.$(OBJEXT) dump.$(OBJEXT) fft.$(OBJEXT) \
-       kiss_fft.$(OBJEXT) codec2.$(OBJEXT) sine.$(OBJEXT) \
-       nlp.$(OBJEXT) postfilter.$(OBJEXT) phase.$(OBJEXT) \
-       interp.$(OBJEXT) pack.$(OBJEXT) $(am__objects_1)
-tcodec2_OBJECTS = $(am_tcodec2_OBJECTS)
-tcodec2_DEPENDENCIES =
 am_tfdmdv_OBJECTS = tfdmdv.$(OBJEXT) fdmdv.$(OBJEXT) fft.$(OBJEXT) \
        kiss_fft.$(OBJEXT) octave.$(OBJEXT)
 tfdmdv_OBJECTS = $(am_tfdmdv_OBJECTS)
@@ -138,16 +130,16 @@ LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
        $(AM_LDFLAGS) $(LDFLAGS) -o $@
 SOURCES = $(create_interleaver_SOURCES) $(extract_SOURCES) \
        $(genlsp_SOURCES) $(genres_SOURCES) $(lspsync_SOURCES) \
-       $(scalarlsptest_SOURCES) $(t48_8_SOURCES) $(tcodec2_SOURCES) \
-       $(tfdmdv_SOURCES) $(tinterp_SOURCES) $(tlspsens_SOURCES) \
-       $(tnlp_SOURCES) $(tquant_SOURCES) $(vq_train_jvm_SOURCES) \
-       $(vqtrain_SOURCES) $(vqtrainjnd_SOURCES)
+       $(scalarlsptest_SOURCES) $(t48_8_SOURCES) $(tfdmdv_SOURCES) \
+       $(tinterp_SOURCES) $(tlspsens_SOURCES) $(tnlp_SOURCES) \
+       $(tquant_SOURCES) $(vq_train_jvm_SOURCES) $(vqtrain_SOURCES) \
+       $(vqtrainjnd_SOURCES)
 DIST_SOURCES = $(create_interleaver_SOURCES) $(extract_SOURCES) \
        $(genlsp_SOURCES) $(genres_SOURCES) $(lspsync_SOURCES) \
-       $(scalarlsptest_SOURCES) $(t48_8_SOURCES) $(tcodec2_SOURCES) \
-       $(tfdmdv_SOURCES) $(tinterp_SOURCES) $(tlspsens_SOURCES) \
-       $(tnlp_SOURCES) $(tquant_SOURCES) $(vq_train_jvm_SOURCES) \
-       $(vqtrain_SOURCES) $(vqtrainjnd_SOURCES)
+       $(scalarlsptest_SOURCES) $(t48_8_SOURCES) $(tfdmdv_SOURCES) \
+       $(tinterp_SOURCES) $(tlspsens_SOURCES) $(tnlp_SOURCES) \
+       $(tquant_SOURCES) $(vq_train_jvm_SOURCES) $(vqtrain_SOURCES) \
+       $(vqtrainjnd_SOURCES)
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -287,11 +279,6 @@ tinterp_LDFLAGS = $(LIBS)
 tquant_SOURCES = tquant.c ../src/quantise.c ../src/lpc.c ../src/lsp.c ../src/dump.c ../src/fft.c ../src/kiss_fft.c $(CODEBOOKS)
 tquant_LDADD = $(lib_LTLIBRARIES) 
 tquant_LDFLAGS = $(LIBS)
-tcodec2_SOURCES = tcodec2.c ../src/quantise.c ../src/lpc.c ../src/lsp.c ../src/dump.c ../src/fft.c ../src/kiss_fft.c \
-../src/codec2.c ../src/sine.c ../src/nlp.c ../src/postfilter.c ../src/phase.c ../src/interp.c ../src/pack.c $(CODEBOOKS)
-
-tcodec2_LDADD = $(lib_LTLIBRARIES) 
-tcodec2_LDFLAGS = $(LIBS)
 scalarlsptest_SOURCES = scalarlsptest.c ../src/quantise.c ../src/lpc.c ../src/lsp.c ../src/dump.c ../src/fft.c ../src/kiss_fft.c $(CODEBOOKS)
 scalarlsptest_LDADD = $(lib_LTLIBRARIES) 
 scalarlsptest_LDFLAGS = $(LIBS)
@@ -373,9 +360,6 @@ scalarlsptest$(EXEEXT): $(scalarlsptest_OBJECTS) $(scalarlsptest_DEPENDENCIES)
 t48_8$(EXEEXT): $(t48_8_OBJECTS) $(t48_8_DEPENDENCIES) 
        @rm -f t48_8$(EXEEXT)
        $(LINK) $(t48_8_LDFLAGS) $(t48_8_OBJECTS) $(t48_8_LDADD) $(LIBS)
-tcodec2$(EXEEXT): $(tcodec2_OBJECTS) $(tcodec2_DEPENDENCIES) 
-       @rm -f tcodec2$(EXEEXT)
-       $(LINK) $(tcodec2_LDFLAGS) $(tcodec2_OBJECTS) $(tcodec2_LDADD) $(LIBS)
 tfdmdv$(EXEEXT): $(tfdmdv_OBJECTS) $(tfdmdv_DEPENDENCIES) 
        @rm -f tfdmdv$(EXEEXT)
        $(LINK) $(tfdmdv_LDFLAGS) $(tfdmdv_OBJECTS) $(tfdmdv_LDADD) $(LIBS)
@@ -436,7 +420,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scalarlsptest.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sine.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t48_8.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcodec2.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfdmdv.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tinterp.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlspsens.Po@am__quote@
index bc1c17a8299f69cdecfe78fc8b5f37b1ad920e18..e4d70809c1b2f83688966f388872d377450c9470 100644 (file)
@@ -43,6 +43,7 @@ float run_a_test(char raw_file_name[], int bit_to_corrupt)
     FILE   *fin;
     short   buf[N];
     struct  CODEC2 *c2;
+    kiss_fft_cfg  fft_fwd_cfg;
     MODEL   model;
     float   ak[LPC_ORD+1];
     float   lsps[LPC_ORD], e;
@@ -51,6 +52,7 @@ float run_a_test(char raw_file_name[], int bit_to_corrupt)
     int     frames, i, mask, index;
 
     c2 = codec2_create(CODEC2_MODE_2400);
+    fft_fwd_cfg = kiss_fft_alloc(FFT_ENC, 0, NULL, NULL);
 
     fin = fopen(raw_file_name, "rb");
     assert(fin != NULL);
@@ -91,7 +93,7 @@ float run_a_test(char raw_file_name[], int bit_to_corrupt)
        check_lsp_order(lsps, LPC_ORD);
        bw_expand_lsps(lsps, LPC_ORD);
        lsp_to_lpc(lsps, ak, LPC_ORD);
-       aks_to_M2(ak, LPC_ORD, &model, e, &snr, 1); 
+       aks_to_M2(fft_fwd_cfg, ak, LPC_ORD, &model, e, &snr, 1); 
 
        snr_sum += snr;
        frames++;
index 43ef9cb04250906c6d6887b08c6b2249fa456219..e44b392b31929665681c6222fc42cc0aa1fb7f78 100644 (file)
@@ -40,6 +40,7 @@
 #include "dump.h"
 #include "sine.h"
 #include "nlp.h"
+#include "kiss_fft.h"
 
 int   frames;
 
@@ -80,6 +81,7 @@ char *argv[];
     FILE *fin,*fout;
     short buf[N];
     float Sn[M];               /* float input speech samples */
+    kiss_fft_cfg  fft_fwd_cfg;
     COMP  Sw[FFT_ENC];         /* DFT of Sn[] */
     float w[M];                        /* time domain hamming window */
     COMP  W[FFT_ENC];          /* DFT of w[] */
@@ -121,7 +123,8 @@ char *argv[];
 #endif
 
     nlp_states = nlp_create();
-    make_analysis_window(w,W);
+    fft_fwd_cfg = kiss_fft_alloc(FFT_ENC, 0, NULL, NULL);
+    make_analysis_window(fft_fwd_cfg, w, W);
 
     frames = 0;
     prev_Wo = 0;
@@ -134,7 +137,7 @@ char *argv[];
         Sn[i] = Sn[i+N];
       for(i=0; i<N; i++)
         Sn[i+M-N] = buf[i];
-      dft_speech(Sw, Sn, w);
+      dft_speech(fft_fwd_cfg, Sw, Sn, w);
 #ifdef DUMP
       dump_Sn(Sn); dump_Sw(Sw); 
 #endif