diff options
author | Vitor Sessak <vitor1001@gmail.com> | 2008-06-24 18:38:55 +0000 |
---|---|---|
committer | Vitor Sessak <vitor1001@gmail.com> | 2008-06-24 18:38:55 +0000 |
commit | 73cc419b271ac5af8c1aed36b5c0167c7016127a (patch) | |
tree | b49814bb916d5e2aef81c5a068eb3baef0c9d46f /libavcodec | |
parent | ae70f874baf8d3d229f0688522263b7e3e261b84 (diff) | |
download | ffmpeg-73cc419b271ac5af8c1aed36b5c0167c7016127a.tar.gz |
Use lpc_coef[2] instead of lpc_coef and lpc_coef_old
Originally committed as revision 13946 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/ra144.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/libavcodec/ra144.c b/libavcodec/ra144.c index 0d225ca041..9605b930ac 100644 --- a/libavcodec/ra144.c +++ b/libavcodec/ra144.c @@ -32,10 +32,12 @@ typedef struct { unsigned int old_energy; ///< previous frame energy unsigned int lpc_tables[2][10]; - unsigned int *lpc_coef; ///< LPC coefficients - unsigned int *lpc_coef_old; ///< previous frame LPC coefficients - unsigned int lpc_refl_rms; - unsigned int lpc_refl_rms_old; + + /** LPC coefficients: lpc_coef[0] is the coefficients of the current frame + * and lpc_coef[1] of the previous one */ + unsigned int *lpc_coef[2]; + + unsigned int lpc_refl_rms[2]; /** the current subblock padded by the last 10 values of the previous one*/ int16_t curr_sblock[50]; @@ -49,8 +51,8 @@ static int ra144_decode_init(AVCodecContext * avctx) { RA144Context *ractx = avctx->priv_data; - ractx->lpc_coef = ractx->lpc_tables[0]; - ractx->lpc_coef_old = ractx->lpc_tables[1]; + ractx->lpc_coef[0] = ractx->lpc_tables[0]; + ractx->lpc_coef[1] = ractx->lpc_tables[1]; return 0; } @@ -310,17 +312,17 @@ static int interp(RA144Context *ractx, int16_t *out, int block_num, // Interpolate block coefficients from the this frame forth block and // last frame forth block for (x=0; x<30; x++) - out[x] = (a * ractx->lpc_coef[x] + b * ractx->lpc_coef_old[x])>> 2; + out[x] = (a * ractx->lpc_coef[0][x] + b * ractx->lpc_coef[1][x])>> 2; if (eval_refl(work, out, ractx)) { // The interpolated coefficients are unstable, copy either new or old // coefficients if (copynew) { - int_to_int16(out, ractx->lpc_coef); - return rescale_rms(ractx->lpc_refl_rms, energy); + int_to_int16(out, ractx->lpc_coef[0]); + return rescale_rms(ractx->lpc_refl_rms[0], energy); } else { - int_to_int16(out, ractx->lpc_coef_old); - return rescale_rms(ractx->lpc_refl_rms_old, energy); + int_to_int16(out, ractx->lpc_coef[1]); + return rescale_rms(ractx->lpc_refl_rms[1], energy); } } else { return rescale_rms(rms(work), energy); @@ -354,8 +356,8 @@ static int ra144_decode_frame(AVCodecContext * avctx, for (i=0; i<10; i++) lpc_refl[i] = lpc_refl_cb[i][get_bits(&gb, sizes[i])]; - eval_coefs(ractx->lpc_coef, lpc_refl); - ractx->lpc_refl_rms = rms(lpc_refl); + eval_coefs(ractx->lpc_coef[0], lpc_refl); + ractx->lpc_refl_rms[0] = rms(lpc_refl); energy = energy_tab[get_bits(&gb, 5)]; @@ -363,9 +365,9 @@ static int ra144_decode_frame(AVCodecContext * avctx, refl_rms[1] = interp(ractx, block_coefs[1], 1, energy > ractx->old_energy, t_sqrt(energy*ractx->old_energy) >> 12); refl_rms[2] = interp(ractx, block_coefs[2], 2, 1, energy); - refl_rms[3] = rescale_rms(ractx->lpc_refl_rms, energy); + refl_rms[3] = rescale_rms(ractx->lpc_refl_rms[0], energy); - int_to_int16(block_coefs[3], ractx->lpc_coef); + int_to_int16(block_coefs[3], ractx->lpc_coef[0]); for (c=0; c<4; c++) { do_output_subblock(ractx, block_coefs[c], refl_rms[c], &gb); @@ -375,9 +377,9 @@ static int ra144_decode_frame(AVCodecContext * avctx, } ractx->old_energy = energy; - ractx->lpc_refl_rms_old = ractx->lpc_refl_rms; + ractx->lpc_refl_rms[1] = ractx->lpc_refl_rms[0]; - FFSWAP(unsigned int *, ractx->lpc_coef_old, ractx->lpc_coef); + FFSWAP(unsigned int *, ractx->lpc_coef[0], ractx->lpc_coef[1]); *data_size = 2*160; return 20; |