changeset 11866:0d8f35836b20 libavcodec

Add ff_ prefix to non-static functions Patch by Francesco Lavra (firstnamelastname@interfree.it)
author vitor
date Fri, 11 Jun 2010 08:03:43 +0000
parents 6111134a3d94
children ba4e21f7bd3a
files ra144.c ra144.h ra144dec.c
diffstat 3 files changed, 61 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/ra144.c	Fri Jun 11 08:01:51 2010 +0000
+++ b/ra144.c	Fri Jun 11 08:03:43 2010 +0000
@@ -23,7 +23,7 @@
 #include "avcodec.h"
 #include "ra144.h"
 
-const int16_t gain_val_tab[256][3] = {
+const int16_t ff_gain_val_tab[256][3] = {
     { 541, 956,  768}, { 877, 581,  568}, { 675,1574,  635}, {1248,1464,  668},
     {1246, 839, 1394}, {2560,1386,  991}, { 925, 687,  608}, {2208, 797, 1144},
     { 535, 832,  799}, { 762, 605, 1154}, { 832,1122, 1003}, {1180, 687, 1176},
@@ -90,7 +90,7 @@
     {9216,1020, 2028}, {9968, 924, 1188}, {5424, 909, 1206}, {6512, 744, 1086}
 };
 
-const uint8_t gain_exp_tab[256] = {
+const uint8_t ff_gain_exp_tab[256] = {
    15, 15, 15, 15, 15, 16, 14, 15, 14, 14, 14, 14, 14, 14, 14, 14,
    14, 13, 14, 14, 13, 14, 13, 14, 13, 13, 13, 14, 13, 13, 14, 13,
    13, 13, 13, 13, 14, 13, 12, 12, 13, 13, 13, 12, 13, 13, 13, 13,
@@ -109,7 +109,7 @@
    12, 12, 11, 12, 12, 12, 12, 13, 11, 12, 12, 12, 13, 13, 12, 12
 };
 
-const int8_t cb1_vects[128][40]={
+const int8_t ff_cb1_vects[128][40]={
     {
      38,  -4,  15,  -4,  14, -13,  12, -11,  -2,  -6,
      -6, -11, -45, -16, -11, -13,  -7,   6, -12,   4,
@@ -753,7 +753,7 @@
     }
 };
 
-const int8_t cb2_vects[128][40]={
+const int8_t ff_cb2_vects[128][40]={
     {
      73, -32, -60, -15, -26,  59,   2, -33,  30, -10,
      -3, -17,   8,  30,  -1, -26,  -4, -22,  10,  16,
@@ -1397,7 +1397,7 @@
     }
 };
 
-const uint16_t cb1_base[128]={
+const uint16_t ff_cb1_base[128]={
     19657, 18474, 18365, 17520, 21048, 18231, 18584, 16671,
     20363, 19069, 19409, 18430, 21844, 18753, 19613, 17411,
     20389, 21772, 20129, 21702, 20978, 20472, 19627, 19387,
@@ -1416,7 +1416,7 @@
     16671, 18584, 18231, 21048, 17520, 18365, 18474, 19657,
 };
 
-const uint16_t cb2_base[128]={
+const uint16_t ff_cb2_base[128]={
     12174, 13380, 13879, 13832, 13170, 13227, 13204, 12053,
     12410, 13988, 14348, 14631, 13100, 13415, 13224, 12268,
     11982, 13825, 13499, 14210, 13877, 14788, 13811, 13109,
@@ -1435,7 +1435,7 @@
     12053, 13204, 13227, 13170, 13832, 13879, 13380, 12174,
 };
 
-const int16_t energy_tab[32]={
+const int16_t ff_energy_tab[32]={
         0,    16,    20,    25,    32,    41,    51,    65,
        81,   103,   129,   163,   205,   259,   326,   410,
       516,   650,   819,  1031,  1298,  1634,  2057,  2590,
@@ -1497,12 +1497,12 @@
      -617,   190,   802,  1483
 };
 
-const int16_t * const lpc_refl_cb[10]={
+const int16_t * const ff_lpc_refl_cb[10]={
     lpc_refl_cb1, lpc_refl_cb2, lpc_refl_cb3, lpc_refl_cb4, lpc_refl_cb5,
     lpc_refl_cb6, lpc_refl_cb7, lpc_refl_cb8, lpc_refl_cb9, lpc_refl_cb10
 };
 
-void add_wav(int16_t *dest, int n, int skip_first, int *m, const int16_t *s1,
+void ff_add_wav(int16_t *dest, int n, int skip_first, int *m, const int16_t *s1,
              const int8_t *s2, const int8_t *s3)
 {
     int i;
@@ -1510,7 +1510,7 @@
 
     v[0] = 0;
     for (i=!skip_first; i<3; i++)
-        v[i] = (gain_val_tab[n][i] * m[i]) >> gain_exp_tab[n];
+        v[i] = (ff_gain_val_tab[n][i] * m[i]) >> ff_gain_exp_tab[n];
 
     if (v[0]) {
         for (i=0; i < BLOCKSIZE; i++)
@@ -1525,7 +1525,7 @@
  * Copy the last offset values of *source to *target. If those values are not
  * enough to fill the target buffer, fill it with another copy of those values.
  */
-void copy_and_dup(int16_t *target, const int16_t *source, int offset)
+void ff_copy_and_dup(int16_t *target, const int16_t *source, int offset)
 {
     source += BUFFERSIZE - offset;
 
@@ -1540,7 +1540,7 @@
  * @return 1 if one of the reflection coefficients is greater than
  *         4095, 0 if not.
  */
-int eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx)
+int ff_eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx)
 {
     int b, i, j;
     int buffer1[10];
@@ -1581,7 +1581,7 @@
  * Evaluate the LPC filter coefficients from the reflection coefficients.
  * Does the inverse of the eval_refl() function.
  */
-void eval_coefs(int *coefs, const int *refl)
+void ff_eval_coefs(int *coefs, const int *refl)
 {
     int buffer[10];
     int *b1 = buffer;
@@ -1601,7 +1601,7 @@
         coefs[i] >>= 4;
 }
 
-void int_to_int16(int16_t *out, const int *inp)
+void ff_int_to_int16(int16_t *out, const int *inp)
 {
     int i;
 
@@ -1613,7 +1613,7 @@
  * Evaluate sqrt(x << 24). x must fit in 20 bits. This value is evaluated in an
  * odd way to make the output identical to the binary decoder.
  */
-int t_sqrt(unsigned int x)
+int ff_t_sqrt(unsigned int x)
 {
     int s = 2;
     while (x > 0xfff) {
@@ -1624,7 +1624,7 @@
     return ff_sqrt(x << 20) << s;
 }
 
-unsigned int rms(const int *data)
+unsigned int ff_rms(const int *data)
 {
     int i;
     unsigned int res = 0x10000;
@@ -1642,10 +1642,10 @@
         }
     }
 
-    return t_sqrt(res) >> b;
+    return ff_t_sqrt(res) >> b;
 }
 
-int interp(RA144Context *ractx, int16_t *out, int a, int copyold, int energy)
+int ff_interp(RA144Context *ractx, int16_t *out, int a, int copyold, int energy)
 {
     int work[10];
     int b = NBLOCKS - a;
@@ -1656,23 +1656,23 @@
     for (i=0; i<10; i++)
         out[i] = (a * ractx->lpc_coef[0][i] + b * ractx->lpc_coef[1][i])>> 2;
 
-    if (eval_refl(work, out, ractx->avctx)) {
+    if (ff_eval_refl(work, out, ractx->avctx)) {
         // The interpolated coefficients are unstable, copy either new or old
         // coefficients.
-        int_to_int16(out, ractx->lpc_coef[copyold]);
-        return rescale_rms(ractx->lpc_refl_rms[copyold], energy);
+        ff_int_to_int16(out, ractx->lpc_coef[copyold]);
+        return ff_rescale_rms(ractx->lpc_refl_rms[copyold], energy);
     } else {
-        return rescale_rms(rms(work), energy);
+        return ff_rescale_rms(ff_rms(work), energy);
     }
 }
 
-unsigned int rescale_rms(unsigned int rms, unsigned int energy)
+unsigned int ff_rescale_rms(unsigned int rms, unsigned int energy)
 {
     return (rms * energy) >> 10;
 }
 
 /** inverse root mean square */
-int irms(const int16_t *data)
+int ff_irms(const int16_t *data)
 {
     unsigned int i, sum = 0;
 
@@ -1682,5 +1682,5 @@
     if (sum == 0)
         return 0; /* OOPS - division by zero */
 
-    return 0x20000000 / (t_sqrt(sum) >> 8);
+    return 0x20000000 / (ff_t_sqrt(sum) >> 8);
 }
--- a/ra144.h	Fri Jun 11 08:01:51 2010 +0000
+++ b/ra144.h	Fri Jun 11 08:03:43 2010 +0000
@@ -49,25 +49,26 @@
     uint16_t adapt_cb[146+2];
 } RA144Context;
 
-void add_wav(int16_t *dest, int n, int skip_first, int *m, const int16_t *s1,
+void ff_add_wav(int16_t *dest, int n, int skip_first, int *m, const int16_t *s1,
              const int8_t *s2, const int8_t *s3);
-void copy_and_dup(int16_t *target, const int16_t *source, int offset);
-int eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx);
-void eval_coefs(int *coefs, const int *refl);
-void int_to_int16(int16_t *out, const int *inp);
-int t_sqrt(unsigned int x);
-unsigned int rms(const int *data);
-int interp(RA144Context *ractx, int16_t *out, int a, int copyold, int energy);
-unsigned int rescale_rms(unsigned int rms, unsigned int energy);
-int irms(const int16_t *data);
+void ff_copy_and_dup(int16_t *target, const int16_t *source, int offset);
+int ff_eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx);
+void ff_eval_coefs(int *coefs, const int *refl);
+void ff_int_to_int16(int16_t *out, const int *inp);
+int ff_t_sqrt(unsigned int x);
+unsigned int ff_rms(const int *data);
+int ff_interp(RA144Context *ractx, int16_t *out, int a, int copyold,
+              int energy);
+unsigned int ff_rescale_rms(unsigned int rms, unsigned int energy);
+int ff_irms(const int16_t *data);
 
-extern const int16_t gain_val_tab[256][3];
-extern const uint8_t gain_exp_tab[256];
-extern const int8_t cb1_vects[128][40];
-extern const int8_t cb2_vects[128][40];
-extern const uint16_t cb1_base[128];
-extern const uint16_t cb2_base[128];
-extern const int16_t energy_tab[32];
-extern const int16_t * const lpc_refl_cb[10];
+extern const int16_t ff_gain_val_tab[256][3];
+extern const uint8_t ff_gain_exp_tab[256];
+extern const int8_t ff_cb1_vects[128][40];
+extern const int8_t ff_cb2_vects[128][40];
+extern const uint16_t ff_cb1_base[128];
+extern const uint16_t ff_cb2_base[128];
+extern const int16_t ff_energy_tab[32];
+extern const int16_t * const ff_lpc_refl_cb[10];
 
 #endif /* AVCODEC_RA144_H */
--- a/ra144dec.c	Fri Jun 11 08:01:51 2010 +0000
+++ b/ra144dec.c	Fri Jun 11 08:03:43 2010 +0000
@@ -55,22 +55,22 @@
 
     if (cba_idx) {
         cba_idx += BLOCKSIZE/2 - 1;
-        copy_and_dup(buffer_a, ractx->adapt_cb, cba_idx);
-        m[0] = (irms(buffer_a) * gval) >> 12;
+        ff_copy_and_dup(buffer_a, ractx->adapt_cb, cba_idx);
+        m[0] = (ff_irms(buffer_a) * gval) >> 12;
     } else {
         m[0] = 0;
     }
 
-    m[1] = (cb1_base[cb1_idx] * gval) >> 8;
-    m[2] = (cb2_base[cb2_idx] * gval) >> 8;
+    m[1] = (ff_cb1_base[cb1_idx] * gval) >> 8;
+    m[2] = (ff_cb2_base[cb2_idx] * gval) >> 8;
 
     memmove(ractx->adapt_cb, ractx->adapt_cb + BLOCKSIZE,
             (BUFFERSIZE - BLOCKSIZE) * sizeof(*ractx->adapt_cb));
 
     block = ractx->adapt_cb + BUFFERSIZE - BLOCKSIZE;
 
-    add_wav(block, gain, cba_idx, m, cba_idx? buffer_a: NULL,
-            cb1_vects[cb1_idx], cb2_vects[cb2_idx]);
+    ff_add_wav(block, gain, cba_idx, m, cba_idx? buffer_a: NULL,
+               ff_cb1_vects[cb1_idx], ff_cb2_vects[cb2_idx]);
 
     memcpy(ractx->curr_sblock, ractx->curr_sblock + 40,
            10*sizeof(*ractx->curr_sblock));
@@ -109,20 +109,21 @@
     init_get_bits(&gb, buf, 20 * 8);
 
     for (i=0; i<10; i++)
-        lpc_refl[i] = lpc_refl_cb[i][get_bits(&gb, sizes[i])];
+        lpc_refl[i] = ff_lpc_refl_cb[i][get_bits(&gb, sizes[i])];
 
-    eval_coefs(ractx->lpc_coef[0], lpc_refl);
-    ractx->lpc_refl_rms[0] = rms(lpc_refl);
+    ff_eval_coefs(ractx->lpc_coef[0], lpc_refl);
+    ractx->lpc_refl_rms[0] = ff_rms(lpc_refl);
 
-    energy = energy_tab[get_bits(&gb, 5)];
+    energy = ff_energy_tab[get_bits(&gb, 5)];
 
-    refl_rms[0] = interp(ractx, block_coefs[0], 1, 1, ractx->old_energy);
-    refl_rms[1] = interp(ractx, block_coefs[1], 2, energy <= ractx->old_energy,
-                    t_sqrt(energy*ractx->old_energy) >> 12);
-    refl_rms[2] = interp(ractx, block_coefs[2], 3, 0, energy);
-    refl_rms[3] = rescale_rms(ractx->lpc_refl_rms[0], energy);
+    refl_rms[0] = ff_interp(ractx, block_coefs[0], 1, 1, ractx->old_energy);
+    refl_rms[1] = ff_interp(ractx, block_coefs[1], 2,
+                            energy <= ractx->old_energy,
+                            ff_t_sqrt(energy*ractx->old_energy) >> 12);
+    refl_rms[2] = ff_interp(ractx, block_coefs[2], 3, 0, energy);
+    refl_rms[3] = ff_rescale_rms(ractx->lpc_refl_rms[0], energy);
 
-    int_to_int16(block_coefs[3], ractx->lpc_coef[0]);
+    ff_int_to_int16(block_coefs[3], ractx->lpc_coef[0]);
 
     for (i=0; i < 4; i++) {
         do_output_subblock(ractx, block_coefs[i], refl_rms[i], &gb);