1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Add ff_ prefix to non-static functions

Patch by Francesco Lavra (firstnamelastname@interfree.it)

Originally committed as revision 23574 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Francesco Lavra 2010-06-11 08:03:43 +00:00 committed by Vitor Sessak
parent 0acaf8b0f2
commit 6ea6c8ebcf
3 changed files with 61 additions and 59 deletions

View File

@ -23,7 +23,7 @@
#include "avcodec.h" #include "avcodec.h"
#include "ra144.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}, { 541, 956, 768}, { 877, 581, 568}, { 675,1574, 635}, {1248,1464, 668},
{1246, 839, 1394}, {2560,1386, 991}, { 925, 687, 608}, {2208, 797, 1144}, {1246, 839, 1394}, {2560,1386, 991}, { 925, 687, 608}, {2208, 797, 1144},
{ 535, 832, 799}, { 762, 605, 1154}, { 832,1122, 1003}, {1180, 687, 1176}, { 535, 832, 799}, { 762, 605, 1154}, { 832,1122, 1003}, {1180, 687, 1176},
@ -90,7 +90,7 @@ const int16_t gain_val_tab[256][3] = {
{9216,1020, 2028}, {9968, 924, 1188}, {5424, 909, 1206}, {6512, 744, 1086} {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, 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, 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, 13, 13, 13, 13, 14, 13, 12, 12, 13, 13, 13, 12, 13, 13, 13, 13,
@ -109,7 +109,7 @@ const uint8_t gain_exp_tab[256] = {
12, 12, 11, 12, 12, 12, 12, 13, 11, 12, 12, 12, 13, 13, 12, 12 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, 38, -4, 15, -4, 14, -13, 12, -11, -2, -6,
-6, -11, -45, -16, -11, -13, -7, 6, -12, 4, -6, -11, -45, -16, -11, -13, -7, 6, -12, 4,
@ -753,7 +753,7 @@ const int8_t cb1_vects[128][40]={
} }
}; };
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, 73, -32, -60, -15, -26, 59, 2, -33, 30, -10,
-3, -17, 8, 30, -1, -26, -4, -22, 10, 16, -3, -17, 8, 30, -1, -26, -4, -22, 10, 16,
@ -1397,7 +1397,7 @@ const int8_t cb2_vects[128][40]={
} }
}; };
const uint16_t cb1_base[128]={ const uint16_t ff_cb1_base[128]={
19657, 18474, 18365, 17520, 21048, 18231, 18584, 16671, 19657, 18474, 18365, 17520, 21048, 18231, 18584, 16671,
20363, 19069, 19409, 18430, 21844, 18753, 19613, 17411, 20363, 19069, 19409, 18430, 21844, 18753, 19613, 17411,
20389, 21772, 20129, 21702, 20978, 20472, 19627, 19387, 20389, 21772, 20129, 21702, 20978, 20472, 19627, 19387,
@ -1416,7 +1416,7 @@ const uint16_t cb1_base[128]={
16671, 18584, 18231, 21048, 17520, 18365, 18474, 19657, 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, 12174, 13380, 13879, 13832, 13170, 13227, 13204, 12053,
12410, 13988, 14348, 14631, 13100, 13415, 13224, 12268, 12410, 13988, 14348, 14631, 13100, 13415, 13224, 12268,
11982, 13825, 13499, 14210, 13877, 14788, 13811, 13109, 11982, 13825, 13499, 14210, 13877, 14788, 13811, 13109,
@ -1435,7 +1435,7 @@ const uint16_t cb2_base[128]={
12053, 13204, 13227, 13170, 13832, 13879, 13380, 12174, 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, 0, 16, 20, 25, 32, 41, 51, 65,
81, 103, 129, 163, 205, 259, 326, 410, 81, 103, 129, 163, 205, 259, 326, 410,
516, 650, 819, 1031, 1298, 1634, 2057, 2590, 516, 650, 819, 1031, 1298, 1634, 2057, 2590,
@ -1497,12 +1497,12 @@ static const int16_t lpc_refl_cb10[4]={
-617, 190, 802, 1483 -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_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 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) const int8_t *s2, const int8_t *s3)
{ {
int i; int i;
@ -1510,7 +1510,7 @@ void add_wav(int16_t *dest, int n, int skip_first, int *m, const int16_t *s1,
v[0] = 0; v[0] = 0;
for (i=!skip_first; i<3; i++) 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]) { if (v[0]) {
for (i=0; i < BLOCKSIZE; i++) for (i=0; i < BLOCKSIZE; i++)
@ -1525,7 +1525,7 @@ void add_wav(int16_t *dest, int n, int skip_first, int *m, const int16_t *s1,
* Copy the last offset values of *source to *target. If those values are not * 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. * 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; source += BUFFERSIZE - offset;
@ -1540,7 +1540,7 @@ void copy_and_dup(int16_t *target, const int16_t *source, int offset)
* @return 1 if one of the reflection coefficients is greater than * @return 1 if one of the reflection coefficients is greater than
* 4095, 0 if not. * 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 b, i, j;
int buffer1[10]; int buffer1[10];
@ -1581,7 +1581,7 @@ int eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx)
* Evaluate the LPC filter coefficients from the reflection coefficients. * Evaluate the LPC filter coefficients from the reflection coefficients.
* Does the inverse of the eval_refl() function. * 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 buffer[10];
int *b1 = buffer; int *b1 = buffer;
@ -1601,7 +1601,7 @@ void eval_coefs(int *coefs, const int *refl)
coefs[i] >>= 4; 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; int i;
@ -1613,7 +1613,7 @@ void int_to_int16(int16_t *out, const int *inp)
* Evaluate sqrt(x << 24). x must fit in 20 bits. This value is evaluated in an * 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. * 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; int s = 2;
while (x > 0xfff) { while (x > 0xfff) {
@ -1624,7 +1624,7 @@ int t_sqrt(unsigned int x)
return ff_sqrt(x << 20) << s; return ff_sqrt(x << 20) << s;
} }
unsigned int rms(const int *data) unsigned int ff_rms(const int *data)
{ {
int i; int i;
unsigned int res = 0x10000; unsigned int res = 0x10000;
@ -1642,10 +1642,10 @@ unsigned int rms(const int *data)
} }
} }
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 work[10];
int b = NBLOCKS - a; int b = NBLOCKS - a;
@ -1656,23 +1656,23 @@ int interp(RA144Context *ractx, int16_t *out, int a, int copyold, int energy)
for (i=0; i<10; i++) for (i=0; i<10; i++)
out[i] = (a * ractx->lpc_coef[0][i] + b * ractx->lpc_coef[1][i])>> 2; 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 // The interpolated coefficients are unstable, copy either new or old
// coefficients. // coefficients.
int_to_int16(out, ractx->lpc_coef[copyold]); ff_int_to_int16(out, ractx->lpc_coef[copyold]);
return rescale_rms(ractx->lpc_refl_rms[copyold], energy); return ff_rescale_rms(ractx->lpc_refl_rms[copyold], energy);
} else { } 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; return (rms * energy) >> 10;
} }
/** inverse root mean square */ /** inverse root mean square */
int irms(const int16_t *data) int ff_irms(const int16_t *data)
{ {
unsigned int i, sum = 0; unsigned int i, sum = 0;
@ -1682,5 +1682,5 @@ int irms(const int16_t *data)
if (sum == 0) if (sum == 0)
return 0; /* OOPS - division by zero */ return 0; /* OOPS - division by zero */
return 0x20000000 / (t_sqrt(sum) >> 8); return 0x20000000 / (ff_t_sqrt(sum) >> 8);
} }

View File

@ -49,25 +49,26 @@ typedef struct {
uint16_t adapt_cb[146+2]; uint16_t adapt_cb[146+2];
} RA144Context; } 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); const int8_t *s2, const int8_t *s3);
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);
int eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx); int ff_eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx);
void eval_coefs(int *coefs, const int *refl); void ff_eval_coefs(int *coefs, const int *refl);
void int_to_int16(int16_t *out, const int *inp); void ff_int_to_int16(int16_t *out, const int *inp);
int t_sqrt(unsigned int x); int ff_t_sqrt(unsigned int x);
unsigned int rms(const int *data); unsigned int ff_rms(const int *data);
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,
unsigned int rescale_rms(unsigned int rms, unsigned int energy); int energy);
int irms(const int16_t *data); 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 int16_t ff_gain_val_tab[256][3];
extern const uint8_t gain_exp_tab[256]; extern const uint8_t ff_gain_exp_tab[256];
extern const int8_t cb1_vects[128][40]; extern const int8_t ff_cb1_vects[128][40];
extern const int8_t cb2_vects[128][40]; extern const int8_t ff_cb2_vects[128][40];
extern const uint16_t cb1_base[128]; extern const uint16_t ff_cb1_base[128];
extern const uint16_t cb2_base[128]; extern const uint16_t ff_cb2_base[128];
extern const int16_t energy_tab[32]; extern const int16_t ff_energy_tab[32];
extern const int16_t * const lpc_refl_cb[10]; extern const int16_t * const ff_lpc_refl_cb[10];
#endif /* AVCODEC_RA144_H */ #endif /* AVCODEC_RA144_H */

View File

@ -55,22 +55,22 @@ static void do_output_subblock(RA144Context *ractx, const uint16_t *lpc_coefs,
if (cba_idx) { if (cba_idx) {
cba_idx += BLOCKSIZE/2 - 1; cba_idx += BLOCKSIZE/2 - 1;
copy_and_dup(buffer_a, ractx->adapt_cb, cba_idx); ff_copy_and_dup(buffer_a, ractx->adapt_cb, cba_idx);
m[0] = (irms(buffer_a) * gval) >> 12; m[0] = (ff_irms(buffer_a) * gval) >> 12;
} else { } else {
m[0] = 0; m[0] = 0;
} }
m[1] = (cb1_base[cb1_idx] * gval) >> 8; m[1] = (ff_cb1_base[cb1_idx] * gval) >> 8;
m[2] = (cb2_base[cb2_idx] * gval) >> 8; m[2] = (ff_cb2_base[cb2_idx] * gval) >> 8;
memmove(ractx->adapt_cb, ractx->adapt_cb + BLOCKSIZE, memmove(ractx->adapt_cb, ractx->adapt_cb + BLOCKSIZE,
(BUFFERSIZE - BLOCKSIZE) * sizeof(*ractx->adapt_cb)); (BUFFERSIZE - BLOCKSIZE) * sizeof(*ractx->adapt_cb));
block = ractx->adapt_cb + BUFFERSIZE - BLOCKSIZE; block = ractx->adapt_cb + BUFFERSIZE - BLOCKSIZE;
add_wav(block, gain, cba_idx, m, cba_idx? buffer_a: NULL, ff_add_wav(block, gain, cba_idx, m, cba_idx? buffer_a: NULL,
cb1_vects[cb1_idx], cb2_vects[cb2_idx]); ff_cb1_vects[cb1_idx], ff_cb2_vects[cb2_idx]);
memcpy(ractx->curr_sblock, ractx->curr_sblock + 40, memcpy(ractx->curr_sblock, ractx->curr_sblock + 40,
10*sizeof(*ractx->curr_sblock)); 10*sizeof(*ractx->curr_sblock));
@ -109,20 +109,21 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *vdata,
init_get_bits(&gb, buf, 20 * 8); init_get_bits(&gb, buf, 20 * 8);
for (i=0; i<10; i++) 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); ff_eval_coefs(ractx->lpc_coef[0], lpc_refl);
ractx->lpc_refl_rms[0] = rms(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[0] = ff_interp(ractx, block_coefs[0], 1, 1, ractx->old_energy);
refl_rms[1] = interp(ractx, block_coefs[1], 2, energy <= ractx->old_energy, refl_rms[1] = ff_interp(ractx, block_coefs[1], 2,
t_sqrt(energy*ractx->old_energy) >> 12); energy <= ractx->old_energy,
refl_rms[2] = interp(ractx, block_coefs[2], 3, 0, energy); ff_t_sqrt(energy*ractx->old_energy) >> 12);
refl_rms[3] = rescale_rms(ractx->lpc_refl_rms[0], energy); 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++) { for (i=0; i < 4; i++) {
do_output_subblock(ractx, block_coefs[i], refl_rms[i], &gb); do_output_subblock(ractx, block_coefs[i], refl_rms[i], &gb);