# HG changeset patch # User vitor # Date 1214332735 0 # Node ID 614bc53e67a88772f8eae6ae0f21ae0166b572c7 # Parent 8ab2d77fd502f614665fd3a9d37b720c5f05788e Use lpc_coef[2] instead of lpc_coef and lpc_coef_old diff -r 8ab2d77fd502 -r 614bc53e67a8 ra144.c --- a/ra144.c Tue Jun 24 18:13:44 2008 +0000 +++ b/ra144.c Tue Jun 24 18:38:55 2008 +0000 @@ -32,10 +32,12 @@ 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 @@ { 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 @@ // 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 @@ 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 @@ 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 @@ } 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;