summaryrefslogtreecommitdiff
path: root/libavcodec/ra144.c
diff options
context:
space:
mode:
authorVitor Sessak <vitor1001@gmail.com>2008-05-28 19:02:16 +0000
committerVitor Sessak <vitor1001@gmail.com>2008-05-28 19:02:16 +0000
commit594409a25cd7c29632d7f40a459103f285d835aa (patch)
tree218a8ba569f8279fa2db0e309f96564688f47e25 /libavcodec/ra144.c
parent121ec9e55a7ad9c4e3589cec03b47bc4ecb78e26 (diff)
Make lpc coefficients 16 bit wide
Originally committed as revision 13499 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ra144.c')
-rw-r--r--libavcodec/ra144.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/libavcodec/ra144.c b/libavcodec/ra144.c
index ec27b0151c..04b39d8c78 100644
--- a/libavcodec/ra144.c
+++ b/libavcodec/ra144.c
@@ -34,11 +34,12 @@ typedef struct {
unsigned int old_energy; ///< previous frame energy
/* the swapped buffers */
- unsigned int lpc_tables[4][10];
+ unsigned int refl_tables[2][10];
+ int16_t coef_tables[2][10];
unsigned int *lpc_refl; ///< LPC reflection coefficients
- unsigned int *lpc_coef; ///< LPC coefficients
+ int16_t *lpc_coef; ///< LPC coefficients
unsigned int *lpc_refl_old; ///< previous frame LPC reflection coefs
- unsigned int *lpc_coef_old; ///< previous frame LPC coefficients
+ int16_t *lpc_coef_old; ///< previous frame LPC coefficients
unsigned int buffer[5];
uint16_t adapt_cb[148]; ///< adaptive codebook
@@ -48,10 +49,10 @@ static int ra144_decode_init(AVCodecContext * avctx)
{
RA144Context *ractx = avctx->priv_data;
- ractx->lpc_refl = ractx->lpc_tables[0];
- ractx->lpc_coef = ractx->lpc_tables[1];
- ractx->lpc_refl_old = ractx->lpc_tables[2];
- ractx->lpc_coef_old = ractx->lpc_tables[3];
+ ractx->lpc_refl = ractx->refl_tables[0];
+ ractx->lpc_coef = ractx->coef_tables[0];
+ ractx->lpc_refl_old = ractx->refl_tables[1];
+ ractx->lpc_coef_old = ractx->coef_tables[1];
return 0;
}
@@ -72,13 +73,17 @@ static int t_sqrt(unsigned int x)
}
/* do 'voice' */
-static void do_voice(const int *a1, int *a2)
+static void do_voice(const int *a1, int16_t *a2)
{
int buffer[10];
+ int buffer2[10];
int *b1 = buffer;
- int *b2 = a2;
+ int *b2 = buffer2;
int x, y;
+ for (x=0; x<10; x++)
+ buffer2[x] = a2[x];
+
for (x=0; x < 10; x++) {
b1[x] = a1[x] << 4;
@@ -89,7 +94,7 @@ static void do_voice(const int *a1, int *a2)
}
for (x=0; x < 10; x++)
- a2[x] >>= 4;
+ a2[x] = buffer2[x] >> 4;
}
/* rotate block */
@@ -236,7 +241,7 @@ static void do_output_subblock(RA144Context *ractx,
final(gsp, block, output_buffer, ractx->buffer, BLOCKSIZE);
}
-static int dec1(int16_t *decsp, const int *data, const int *inp, int f)
+static int dec1(int16_t *decsp, const int *data, const int16_t *inp, int f)
{
int i;
@@ -364,7 +369,7 @@ static int ra144_decode_frame(AVCodecContext * avctx,
ractx->old_energy = energy;
FFSWAP(unsigned int *, ractx->lpc_refl_old, ractx->lpc_refl);
- FFSWAP(unsigned int *, ractx->lpc_coef_old, ractx->lpc_coef);
+ FFSWAP(int16_t * , ractx->lpc_coef_old, ractx->lpc_coef);
*data_size = 2*160;
return 20;