changeset 7425:ed615bbf4f8d libavcodec

Change slightly the meaning of RA288Context.phase. This allows to remove two intermediary buffers and avoid a few memcpy's.
author vitor
date Sun, 27 Jul 2008 20:35:32 +0000
parents 69766900be2d
children c4766376a3cf
files ra288.c
diffstat 1 files changed, 6 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/ra288.c	Sun Jul 27 13:49:04 2008 +0000
+++ b/ra288.c	Sun Jul 27 20:35:32 2008 +0000
@@ -195,24 +195,18 @@
  */
 static void backward_filter(RA288Context *ractx)
 {
-    float buffer1[40], temp1[37];
-    float buffer2[8], temp2[11];
+    float temp1[37];
+    float temp2[11];
     float st1[37];
     float st2[11];
 
-    memcpy(buffer1     , ractx->output + 20, 20*sizeof(*buffer1));
-    memcpy(buffer1 + 20, ractx->output     , 20*sizeof(*buffer1));
-
-    do_hybrid_window(36, 40, 35, buffer1, temp1, ractx->sp_hist, ractx->sp_rec,
+    do_hybrid_window(36, 40, 35, ractx->output, temp1, ractx->sp_hist, ractx->sp_rec,
                      syn_window);
 
     if (!eval_lpc_coeffs(temp1, st1, 36))
         colmult(ractx->pr1, st1, syn_bw_tab, 36);
 
-    memcpy(buffer2    , ractx->history + 4, 4*sizeof(*buffer2));
-    memcpy(buffer2 + 4, ractx->history    , 4*sizeof(*buffer2));
-
-    do_hybrid_window(10, 8, 20, buffer2, temp2, ractx->gain_hist, ractx->gain_rec,
+    do_hybrid_window(10, 8, 20, ractx->history, temp2, ractx->gain_hist, ractx->gain_rec,
                      gain_window);
 
     if (!eval_lpc_coeffs(temp2, st2, 10))
@@ -241,13 +235,13 @@
     for (x=0; x < 32; x++) {
         float gain = amptable[get_bits(&gb, 3)];
         int cb_coef = get_bits(&gb, 6 + (x&1));
-        ractx->phase = x & 7;
+        ractx->phase = (x + 4) & 7;
         decode(ractx, gain, cb_coef);
 
         for (y=0; y < 5; y++)
             *(out++) = 8 * ractx->output[ractx->phase*5 + y];
 
-        if (ractx->phase == 3)
+        if (ractx->phase == 7)
             backward_filter(ractx);
     }