diff --git a/lib_com/pvq_com_fx.c b/lib_com/pvq_com_fx.c index a6c0bc462d6757c2a53af013c84dff95f6b44461..be2542de91bbcd64499c9f975c02be0062dfd009 100644 --- a/lib_com/pvq_com_fx.c +++ b/lib_com/pvq_com_fx.c @@ -483,7 +483,7 @@ void apply_gain_fx( const Word16 *band_end, /* i : Sub band end indices Q0 */ const Word16 num_sfm, /* i : Number of bands Q0 */ const Word16 *gains, /* i : Band gain vector Qx */ - Word16 *xq /* i/o: Float synthesis / Gain adjusted synth Q15/Qx */ + Word16 *xq /* i/o: Float synthesis / Gain adjusted synth Q15/Qx+1 */ ) { Word16 band, i; @@ -496,8 +496,10 @@ void apply_gain_fx( FOR( i = band_start[band]; i < band_end[band]; i++ ) { /*xq[i] *= g; */ - xq[i] = mult_r( g, xq[i] ); - move16(); /*12+15+1-16=12 */ + xq[i] = mult_r( g, xq[i] ); /*11+15+1-16=11 */ + xq[i] = shl( xq[i], 1 ); /*Q11 -> Q12 : Align Q for furthur operations*/ + move16(); + move16(); } } @@ -514,7 +516,7 @@ void fine_gain_quant_fx( const Word16 *ord, /* i : Indices for energy order Q0 */ const Word16 num_sfm, /* i : Number of bands Q0 */ const Word16 *gain_bits, /* i : Gain adjustment bits per sub band Q0 */ - Word16 *fg_pred, /* i/o: Predicted gains / Corrected gains Q12 */ + Word16 *fg_pred, /* i/o: Predicted gains / Corrected gains Q12/Q11 */ const Word16 *gopt /* i : Optimal gains Q12 */ ) { @@ -565,9 +567,13 @@ void fine_gain_quant_fx( exp1 = sub( 14, exp1 ); L_tmp = L_mult0( fg_pred[band], tmp1 ); /*12+exp1 */ - fg_pred[band] = round_fx( L_shl( L_tmp, sub( 16, exp1 ) ) ); /*12+exp1+16-exp1-16=12 */ + fg_pred[band] = round_fx( L_shl( L_tmp, sub( 15, exp1 ) ) ); /*12+exp1+15-exp1-16=11 */ move16(); } + ELSE + { + fg_pred[band] = shr( fg_pred[band], 1 ); // Q12 -> Q11 To align all the fg_pred indices in same Q. + } } return;