Inconsistent Q values for a variable in function stereo_tca_scale_R_channel()
# Basic info - Fixed point: - Encoder (fixed): 6dd0ecbeb92cab4a78df002aee12c299b7dc9863 - Decoder (fixed): 6dd0ecbeb92cab4a78df002aee12c299b7dc9863 # Issue description In function `stereo_tca_scale_R_channel_fx()` value of variable `winSlope_fx` is decided through a switch-case that may assign it values with Q31 or Q30 ! Later on, this variable is an operand for function `imult3216(`) multiple times, which accepts the first operand in Q31! (In function imult3216() subfunction Mpy_32_16_ss() clearly takes the first operand in Q31 only) This may be a cause for bugs. Please fix it. ``` SWITCH( output_Fs ) { case 16000: winSlope_fx = 26843546; // 0.0125 in Q31 move32(); BREAK; case 32000: winSlope_fx = 13421773; // 0.00625 in Q30 move32(); BREAK; case 48000: winSlope_fx = 8947849; // 0.00416 in Q30 move32(); BREAK; } ``` ``` IF( EQ_32( tempF1_fx, ONE_IN_Q27 ) && EQ_32( tempF_fx, ONE_IN_Q27 ) ) { FOR( j = 0; i_fx < flat_old + l_ica_ovl; ( i_fx++, j++ ) ) { Word32 slope_gain_decend = L_sub( ONE_IN_Q31, imult3216( winSlope_fx, j ) ); /* Q31 */ Word32 slope_gain_ascend = imult3216( winSlope_fx, j ); /* Q31 */ Word32 left_res = Mpy_32_32( slope_gain_decend, output_fx[i_fx] ); /* q_out */ Word32 right_res = Mpy_32_32( slope_gain_ascend, output_fx[i_fx] ); /* q_out */ output_fx[i_fx] = L_add( left_res, right_res ); /* q_out */ move32(); } } ELSE { FOR( j = 0; i_fx < flat_old + l_ica_ovl; ( i_fx++, j++ ) ) { Word32 slope_gain_decend = L_sub( ONE_IN_Q31, imult3216( winSlope_fx, j ) ); /* Q31 */ Word32 slope_gain_ascend = imult3216( winSlope_fx, j ); /* Q31 */ Word32 left_res = Mpy_32_32( slope_gain_decend, output_fx[i_fx] ); /* q_out */ Word32 right_res = Mpy_32_32( slope_gain_ascend, output_fx[i_fx] ); /* q_out */ output_fx[i_fx] = L_add_sat( L_shl_sat( Mpy_32_32( tempF_fx, left_res ), 4 ), L_shl_sat( Mpy_32_32( right_res, tempF1_fx ), 4 ) ); /* q_out */ move32(); } } ```
issue