[xiph-commits] r9020 - trunk/speex/libspeex

jm at motherfish-iii.xiph.org jm at motherfish-iii.xiph.org
Wed Mar 2 22:08:37 PST 2005


Author: jm
Date: 2005-03-02 22:08:34 -0800 (Wed, 02 Mar 2005)
New Revision: 9020

Modified:
   trunk/speex/libspeex/cb_search.c
   trunk/speex/libspeex/filters.c
   trunk/speex/libspeex/nb_celp.c
   trunk/speex/libspeex/sb_celp.c
Log:
First cleanup step for stack allocation


Modified: trunk/speex/libspeex/cb_search.c
===================================================================
--- trunk/speex/libspeex/cb_search.c	2005-03-03 04:35:50 UTC (rev 9019)
+++ trunk/speex/libspeex/cb_search.c	2005-03-03 06:08:34 UTC (rev 9020)
@@ -222,7 +222,8 @@
    /* Update target: only update target if necessary */
    if (update_target)
    {
-      spx_sig_t *r2 = PUSH(stack, nsf, spx_sig_t);
+      spx_sig_t *r2;
+      r2 = PUSH(stack, nsf, spx_sig_t);
       syn_percep_zero(e, ak, awk1, awk2, r2, nsf,p, stack);
       for (j=0;j<nsf;j++)
          target[j]-=r2[j];
@@ -593,7 +594,8 @@
 )
 {
    int i;
-   spx_sig_t *tmp=PUSH(stack, nsf, spx_sig_t);
+   spx_sig_t *tmp;
+   tmp = PUSH(stack, nsf, spx_sig_t);
    residue_percep_zero(target, ak, awk1, awk2, tmp, nsf, p, stack);
 
    for (i=0;i<nsf;i++)

Modified: trunk/speex/libspeex/filters.c
===================================================================
--- trunk/speex/libspeex/filters.c	2005-03-03 04:35:50 UTC (rev 9019)
+++ trunk/speex/libspeex/filters.c	2005-03-03 06:08:34 UTC (rev 9020)
@@ -337,7 +337,8 @@
 void syn_percep_zero(const spx_sig_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_sig_t *y, int N, int ord, char *stack)
 {
    int i;
-   spx_mem_t *mem = PUSH(stack,ord, spx_mem_t);
+   spx_mem_t *mem;
+   mem = PUSH(stack,ord, spx_mem_t);
    for (i=0;i<ord;i++)
      mem[i]=0;
    iir_mem2(xx, ak, y, N, ord, mem);
@@ -349,7 +350,8 @@
 void residue_percep_zero(const spx_sig_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_sig_t *y, int N, int ord, char *stack)
 {
    int i;
-   spx_mem_t *mem = PUSH(stack,ord, spx_mem_t);
+   spx_mem_t *mem;
+   mem = PUSH(stack,ord, spx_mem_t);
    for (i=0;i<ord;i++)
       mem[i]=0;
    filter_mem2(xx, ak, awk1, y, N, ord, mem);

Modified: trunk/speex/libspeex/nb_celp.c
===================================================================
--- trunk/speex/libspeex/nb_celp.c	2005-03-03 04:35:50 UTC (rev 9019)
+++ trunk/speex/libspeex/nb_celp.c	2005-03-03 06:08:34 UTC (rev 9020)
@@ -858,17 +858,19 @@
          /* In some (rare) modes, we do a second search (more bits) to reduce noise even more */
          if (SUBMODE(double_codebook)) {
             char *tmp_stack=stack;
-            spx_sig_t *innov2 = PUSH(tmp_stack, st->subframeSize, spx_sig_t);
+            spx_sig_t *innov2;
+            innov2 = PUSH(stack, st->subframeSize, spx_sig_t);
             for (i=0;i<st->subframeSize;i++)
                innov2[i]=0;
             for (i=0;i<st->subframeSize;i++)
                target[i]*=2.2;
             SUBMODE(innovation_quant)(target, st->interp_qlpc, st->bw_lpc1, st->bw_lpc2, 
                                       SUBMODE(innovation_params), st->lpcSize, st->subframeSize, 
-                                      innov2, syn_resp, bits, tmp_stack, st->complexity, 0);
+                                      innov2, syn_resp, bits, stack, st->complexity, 0);
             signal_mul(innov2, innov2, (spx_word32_t) (ener*(1/2.2)), st->subframeSize);
             for (i=0;i<st->subframeSize;i++)
                exc[i] += innov2[i];
+            stack = tmp_stack;
          }
 
       }
@@ -1565,13 +1567,15 @@
          if (SUBMODE(double_codebook))
          {
             char *tmp_stack=stack;
-            spx_sig_t *innov2 = PUSH(tmp_stack, st->subframeSize, spx_sig_t);
+            spx_sig_t *innov2;
+            innov2 = PUSH(stack, st->subframeSize, spx_sig_t);
             for (i=0;i<st->subframeSize;i++)
                innov2[i]=0;
-            SUBMODE(innovation_unquant)(innov2, SUBMODE(innovation_params), st->subframeSize, bits, tmp_stack);
+            SUBMODE(innovation_unquant)(innov2, SUBMODE(innovation_params), st->subframeSize, bits, stack);
             signal_mul(innov2, innov2, (spx_word32_t) (ener*(1/2.2)), st->subframeSize);
             for (i=0;i<st->subframeSize;i++)
                exc[i] += innov2[i];
+            stack = tmp_stack;
          }
 
       }

Modified: trunk/speex/libspeex/sb_celp.c
===================================================================
--- trunk/speex/libspeex/sb_celp.c	2005-03-03 04:35:50 UTC (rev 9019)
+++ trunk/speex/libspeex/sb_celp.c	2005-03-03 06:08:34 UTC (rev 9020)
@@ -298,7 +298,8 @@
    mode = (SpeexSBMode*)(st->mode->mode);
 
    {
-      spx_word16_t *low = PUSH(stack, st->frame_size, spx_word16_t);
+      spx_word16_t *low;
+      low = PUSH(stack, st->frame_size, spx_word16_t);
 
       /* Compute the two sub-bands by filtering with h0 and h1*/
       qmf_decomp(in, h0, st->x0d, st->x1d, st->full_frame_size, QMF_ORDER, st->h0_mem, stack);
@@ -569,13 +570,14 @@
             char *tmp_stack=stack;
             float *tmp_sig;
             float g2;
-            tmp_sig = PUSH(tmp_stack, st->subframeSize, spx_sig_t);
+            tmp_sig = PUSH(stack, st->subframeSize, spx_sig_t);
             for (i=0;i<st->lpcSize;i++)
                mem[i]=st->mem_sp[i];
             iir_mem2(low_innov+offset, st->interp_qlpc, tmp_sig, st->subframeSize, st->lpcSize, mem);
             g2 = compute_rms(sp, st->subframeSize)/(.01+compute_rms(tmp_sig, st->subframeSize));
             /*fprintf (stderr, "gains: %f %f\n", g, g2);*/
             g = g2;
+            stack = tmp_stack;
          }
 #endif
 
@@ -679,18 +681,20 @@
 
          if (SUBMODE(double_codebook)) {
             char *tmp_stack=stack;
-            spx_sig_t *innov2 = PUSH(tmp_stack, st->subframeSize, spx_sig_t);
+            spx_sig_t *innov2;
+            innov2 = PUSH(stack, st->subframeSize, spx_sig_t);
             for (i=0;i<st->subframeSize;i++)
                innov2[i]=0;
             for (i=0;i<st->subframeSize;i++)
                target[i]*=2.5;
             SUBMODE(innovation_quant)(target, st->interp_qlpc, st->bw_lpc1, st->bw_lpc2, 
                                       SUBMODE(innovation_params), st->lpcSize, st->subframeSize, 
-                                      innov2, syn_resp, bits, tmp_stack, (st->complexity+1)>>1, 0);
+                                      innov2, syn_resp, bits, stack, (st->complexity+1)>>1, 0);
             for (i=0;i<st->subframeSize;i++)
                innov2[i]*=scale*(1/2.5)/SIG_SCALING;
             for (i=0;i<st->subframeSize;i++)
                exc[i] += innov2[i];
+            stack = tmp_stack;
          }
 
       }
@@ -1086,15 +1090,17 @@
 
          if (SUBMODE(double_codebook)) {
             char *tmp_stack=stack;
-            spx_sig_t *innov2 = PUSH(tmp_stack, st->subframeSize, spx_sig_t);
+            spx_sig_t *innov2;
+            innov2 = PUSH(stack, st->subframeSize, spx_sig_t);
             for (i=0;i<st->subframeSize;i++)
                innov2[i]=0;
             SUBMODE(innovation_unquant)(innov2, SUBMODE(innovation_params), st->subframeSize, 
-                                bits, tmp_stack);
+                                bits, stack);
             for (i=0;i<st->subframeSize;i++)
                innov2[i]*=scale/(float)SIG_SCALING*(1/2.5);
             for (i=0;i<st->subframeSize;i++)
                exc[i] += innov2[i];
+            stack = tmp_stack;
          }
 
       }



More information about the commits mailing list