[FFmpeg-soc] [soc]: r4158 - amr/amrnbfloatdec.c
kmalaussene
subversion at mplayerhq.hu
Wed Mar 4 19:53:11 CET 2009
Author: kmalaussene
Date: Wed Mar 4 19:53:10 2009
New Revision: 4158
Log:
Remove ugly static variable gains_index_MODE_475 in decode_gains.
Modified:
amr/amrnbfloatdec.c
Modified: amr/amrnbfloatdec.c
==============================================================================
--- amr/amrnbfloatdec.c Wed Mar 4 19:44:41 2009 (r4157)
+++ amr/amrnbfloatdec.c Wed Mar 4 19:53:10 2009 (r4158)
@@ -696,8 +696,6 @@ static float fixed_gain_prediction(float
static void decode_gains(AMRContext *p, const AMRNBSubframe *amr_subframe, const enum Mode mode, const int subframe)
{
- static int gains_index_MODE_475;
-
// decode pitch gain and fixed gain correction factor
if(mode == MODE_122 || mode == MODE_795) {
p->pitch_gain[4] = qua_gain_pit [amr_subframe->p_gain];
@@ -710,9 +708,9 @@ static void decode_gains(AMRContext *p,
p->fixed_gain_factor = gains_low[amr_subframe->p_gain][1];
}else {
// gain index is only coded in subframes 0,2
- gains_index_MODE_475 = subframe&1 ? gains_index_MODE_475+1 : amr_subframe->p_gain<<1;
- p->pitch_gain[4] = gains_MODE_475[gains_index_MODE_475][0];
- p->fixed_gain_factor = gains_MODE_475[gains_index_MODE_475][1];
+ const int index = (p->frame.subframe[subframe&2].p_gain << 1) + (subframe&1);
+ p->pitch_gain[4] = gains_MODE_475[index][0];
+ p->fixed_gain_factor = gains_MODE_475[index][1];
}
// calculate the predicted fixed gain g_c'
More information about the FFmpeg-soc
mailing list