changeset 7412:51da3d8200d0 libavcodec

Give the context variables of ra288 a better name: s/glob/ractx/
author vitor
date Sat, 26 Jul 2008 14:31:47 +0000
parents d41948bf80a1
children d018af0d20a1
files ra288.c
diffstat 1 files changed, 26 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/ra288.c	Sat Jul 26 14:29:39 2008 +0000
+++ b/ra288.c	Sat Jul 26 14:31:47 2008 +0000
@@ -49,19 +49,19 @@
 }
 
 /* Decode and produce output */
-static void decode(RA288Context *glob, float gain, int cb_coef)
+static void decode(RA288Context *ractx, float gain, int cb_coef)
 {
     int x, y;
     double sumsum;
     float sum, buffer[5];
 
-    memmove(glob->sb + 5, glob->sb, 36 * sizeof(*glob->sb));
+    memmove(ractx->sb + 5, ractx->sb, 36 * sizeof(*ractx->sb));
 
     for (x=4; x >= 0; x--)
-        glob->sb[x] = -scalar_product_float(glob->sb + x + 1, glob->pr1, 36);
+        ractx->sb[x] = -scalar_product_float(ractx->sb + x + 1, ractx->pr1, 36);
 
     /* convert log and do rms */
-    sum = 32. - scalar_product_float(glob->pr2, glob->lhist, 10);
+    sum = 32. - scalar_product_float(ractx->pr2, ractx->lhist, 10);
 
     sum = av_clipf(sum, 0, 60);
 
@@ -75,18 +75,18 @@
     sum = FFMAX(sum, 1);
 
     /* shift and store */
-    memmove(glob->lhist, glob->lhist - 1, 10 * sizeof(*glob->lhist));
+    memmove(ractx->lhist, ractx->lhist - 1, 10 * sizeof(*ractx->lhist));
 
-    *glob->lhist = glob->history[glob->phase] = 10 * log10(sum) - 32;
+    *ractx->lhist = ractx->history[ractx->phase] = 10 * log10(sum) - 32;
 
     for (x=1; x < 5; x++)
         for (y=x-1; y >= 0; y--)
-            buffer[x] -= glob->pr1[x-y-1] * buffer[y];
+            buffer[x] -= ractx->pr1[x-y-1] * buffer[y];
 
     /* output */
     for (x=0; x < 5; x++) {
-        glob->output[glob->phase*5+x] = glob->sb[4-x] =
-            av_clipf(glob->sb[4-x] + buffer[x], -4095, 4095);
+        ractx->output[ractx->phase*5+x] = ractx->sb[4-x] =
+            av_clipf(ractx->sb[4-x] + buffer[x], -4095, 4095);
     }
 }
 
@@ -187,28 +187,28 @@
 /**
  * Backward synthesis filter. Find the LPC coefficients from past speech data.
  */
-static void backward_filter(RA288Context *glob)
+static void backward_filter(RA288Context *ractx)
 {
     float buffer1[40], temp1[37];
     float buffer2[8], temp2[11];
 
-    memcpy(buffer1     , glob->output + 20, 20*sizeof(*buffer1));
-    memcpy(buffer1 + 20, glob->output     , 20*sizeof(*buffer1));
+    memcpy(buffer1     , ractx->output + 20, 20*sizeof(*buffer1));
+    memcpy(buffer1 + 20, ractx->output     , 20*sizeof(*buffer1));
 
-    do_hybrid_window(36, 40, 35, buffer1, temp1, glob->st1a, glob->st1b,
+    do_hybrid_window(36, 40, 35, buffer1, temp1, ractx->st1a, ractx->st1b,
                      syn_window);
 
-    if (!eval_lpc_coeffs(temp1, glob->st1, 36))
-        colmult(glob->pr1, glob->st1, syn_bw_tab, 36);
+    if (!eval_lpc_coeffs(temp1, ractx->st1, 36))
+        colmult(ractx->pr1, ractx->st1, syn_bw_tab, 36);
 
-    memcpy(buffer2    , glob->history + 4, 4*sizeof(*buffer2));
-    memcpy(buffer2 + 4, glob->history    , 4*sizeof(*buffer2));
+    memcpy(buffer2    , ractx->history + 4, 4*sizeof(*buffer2));
+    memcpy(buffer2 + 4, ractx->history    , 4*sizeof(*buffer2));
 
-    do_hybrid_window(10, 8, 20, buffer2, temp2, glob->st2a, glob->st2b,
+    do_hybrid_window(10, 8, 20, buffer2, temp2, ractx->st2a, ractx->st2b,
                      gain_window);
 
-    if (!eval_lpc_coeffs(temp2, glob->st2, 10))
-        colmult(glob->pr2, glob->st2, gain_bw_tab, 10);
+    if (!eval_lpc_coeffs(temp2, ractx->st2, 10))
+        colmult(ractx->pr2, ractx->st2, gain_bw_tab, 10);
 }
 
 /* Decode a block (celp) */
@@ -218,7 +218,7 @@
 {
     int16_t *out = data;
     int x, y;
-    RA288Context *glob = avctx->priv_data;
+    RA288Context *ractx = avctx->priv_data;
     GetBitContext gb;
 
     if (buf_size < avctx->block_align) {
@@ -233,14 +233,14 @@
     for (x=0; x < 32; x++) {
         float gain = amptable[get_bits(&gb, 3)];
         int cb_coef = get_bits(&gb, 6 + (x&1));
-        glob->phase = x & 7;
-        decode(glob, gain, cb_coef);
+        ractx->phase = x & 7;
+        decode(ractx, gain, cb_coef);
 
         for (y=0; y < 5; y++)
-            *(out++) = 8 * glob->output[glob->phase*5 + y];
+            *(out++) = 8 * ractx->output[ractx->phase*5 + y];
 
-        if (glob->phase == 3)
-            backward_filter(glob);
+        if (ractx->phase == 3)
+            backward_filter(ractx);
     }
 
     *data_size = (char *)out - (char *)data;