Mercurial > libavcodec.hg
changeset 6922:8b2d8d412558 libavcodec
Make lpc coefficients 16 bit wide
author | vitor |
---|---|
date | Wed, 28 May 2008 19:02:16 +0000 |
parents | fbcb4507aefe |
children | 71bde6319fa4 |
files | ra144.c |
diffstat | 1 files changed, 17 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/ra144.c Wed May 28 18:59:09 2008 +0000 +++ b/ra144.c Wed May 28 19:02:16 2008 +0000 @@ -34,11 +34,12 @@ 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 @@ { 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 @@ } /* 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 @@ } for (x=0; x < 10; x++) - a2[x] >>= 4; + a2[x] = buffer2[x] >> 4; } /* rotate block */ @@ -236,7 +241,7 @@ 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 @@ 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;