reduced Aw[] array size in codec2_decode routines for each mode, sounds OK for each...
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 19 Aug 2014 01:52:52 +0000 (01:52 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 19 Aug 2014 01:52:52 +0000 (01:52 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1808 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/src/codec2.c

index 7867911248db1c67717e47763a68cf47efb8e16b..60489e1cbe6970ff71bd933752689aad20a18d20 100644 (file)
@@ -368,7 +368,7 @@ void codec2_decode_3200(struct CODEC2 *c2, short speech[], const unsigned char *
     float   ak[2][LPC_ORD+1];
     int     i,j;
     unsigned int nbit = 0;
-    COMP    Aw[2][FFT_ENC];
+    COMP    Aw[FFT_ENC];
 
     assert(c2 != NULL);
     
@@ -413,15 +413,11 @@ void codec2_decode_3200(struct CODEC2 *c2, short speech[], const unsigned char *
     for(i=0; i<2; i++) {
        lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD);
        aks_to_M2(c2->fft_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0, 
-                  c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, &Aw[i][0]); 
+                  c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); 
        apply_lpc_correction(&model[i]);
+       synthesise_one_frame(c2, &speech[N*i], &model[i], Aw);
     }
 
-    /* synthesise ------------------------------------------------*/
-
-    for(i=0; i<2; i++)
-       synthesise_one_frame(c2, &speech[N*i], &model[i], &Aw[i][0]);
-
     /* update memories for next frame ----------------------------*/
 
     c2->prev_model_dec = model[1];
@@ -517,7 +513,7 @@ void codec2_decode_2400(struct CODEC2 *c2, short speech[], const unsigned char *
     float   ak[2][LPC_ORD+1];
     int     i,j;
     unsigned int nbit = 0;
-    COMP    Aw[2][FFT_ENC];
+    COMP    Aw[FFT_ENC];
 
     assert(c2 != NULL);
     
@@ -560,15 +556,11 @@ void codec2_decode_2400(struct CODEC2 *c2, short speech[], const unsigned char *
     for(i=0; i<2; i++) {
        lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD);
        aks_to_M2(c2->fft_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0, 
-                  c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, &Aw[i][0]); 
+                  c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); 
        apply_lpc_correction(&model[i]);
+       synthesise_one_frame(c2, &speech[N*i], &model[i], Aw);
     }
 
-    /* synthesise ------------------------------------------------*/
-
-    for(i=0; i<2; i++)
-       synthesise_one_frame(c2, &speech[N*i], &model[i], &Aw[i][0]);
-
     /* update memories for next frame ----------------------------*/
 
     c2->prev_model_dec = model[1];
@@ -687,7 +679,7 @@ void codec2_decode_1600(struct CODEC2 *c2, short speech[], const unsigned char *
     int     i,j;
     unsigned int nbit = 0;
     float   weight;
-    COMP    Aw[4][FFT_ENC];
+    COMP    Aw[FFT_ENC];
     
     assert(c2 != NULL);
 
@@ -748,15 +740,11 @@ void codec2_decode_1600(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_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0,
-                  c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, &Aw[i][0]); 
+                  c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); 
        apply_lpc_correction(&model[i]);
+       synthesise_one_frame(c2, &speech[N*i], &model[i], Aw);
     }
 
-    /* synthesise ------------------------------------------------*/
-
-    for(i=0; i<4; i++)
-       synthesise_one_frame(c2, &speech[N*i], &model[i], &Aw[i][0]);
-
     /* update memories for next frame ----------------------------*/
 
     c2->prev_model_dec = model[3];
@@ -869,7 +857,7 @@ void codec2_decode_1400(struct CODEC2 *c2, short speech[], const unsigned char *
     int     i,j;
     unsigned int nbit = 0;
     float   weight;
-    COMP    Aw[4][FFT_ENC];
+    COMP    Aw[FFT_ENC];
 
     assert(c2 != NULL);
 
@@ -922,15 +910,11 @@ 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_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0,
-                  c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, &Aw[i][0]); 
+                  c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); 
        apply_lpc_correction(&model[i]);
+       synthesise_one_frame(c2, &speech[N*i], &model[i], Aw);
     }
 
-    /* synthesise ------------------------------------------------*/
-
-    for(i=0; i<4; i++)
-       synthesise_one_frame(c2, &speech[N*i], &model[i], &Aw[i][0]);
-
     /* update memories for next frame ----------------------------*/
 
     c2->prev_model_dec = model[3];
@@ -1050,7 +1034,7 @@ void codec2_decode_1300(struct CODEC2 *c2, short speech[], const unsigned char *
     int     i,j;
     unsigned int nbit = 0;
     float   weight;
-    COMP    Aw[4][FFT_ENC];
+    COMP    Aw[FFT_ENC];
     PROFILE_VAR(recover_start);
     
     assert(c2 != NULL);
@@ -1109,8 +1093,9 @@ void codec2_decode_1300(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_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0,
-                  c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, &Aw[i][0]); 
+                  c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); 
        apply_lpc_correction(&model[i]);
+       synthesise_one_frame(c2, &speech[N*i], &model[i], Aw);
     }
     PROFILE_SAMPLE_AND_LOG2(recover_start, "    recover"); 
     #ifdef DUMP
@@ -1118,11 +1103,6 @@ void codec2_decode_1300(struct CODEC2 *c2, short speech[], const unsigned char *
     dump_ak_(&ak[3][0], LPC_ORD);
     #endif
 
-    /* synthesise ------------------------------------------------*/
-
-    for(i=0; i<4; i++)
-       synthesise_one_frame(c2, &speech[N*i], &model[i], &Aw[i][0]);
-
     /* update memories for next frame ----------------------------*/
 
     c2->prev_model_dec = model[3];
@@ -1240,7 +1220,7 @@ void codec2_decode_1200(struct CODEC2 *c2, short speech[], const unsigned char *
     int     i,j;
     unsigned int nbit = 0;
     float   weight;
-    COMP    Aw[4][FFT_ENC];
+    COMP    Aw[FFT_ENC];
 
     assert(c2 != NULL);
 
@@ -1293,15 +1273,11 @@ 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_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0,
-                  c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, &Aw[i][0]); 
+                  c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw); 
        apply_lpc_correction(&model[i]);
+       synthesise_one_frame(c2, &speech[N*i], &model[i], Aw);
     }
 
-    /* synthesise ------------------------------------------------*/
-
-    for(i=0; i<4; i++)
-       synthesise_one_frame(c2, &speech[N*i], &model[i], &Aw[i][0]);
-
     /* update memories for next frame ----------------------------*/
 
     c2->prev_model_dec = model[3];