Commit 11b6d880 authored by Mohammadreza Naghibzadeh's avatar Mohammadreza Naghibzadeh
Browse files

Increase precision of y_gainQ_fx calculation for more cases

parent 4e28d5cd
Loading
Loading
Loading
Loading
Loading
+15 −12
Original line number Diff line number Diff line
@@ -875,17 +875,18 @@ Word16 gsc_gainQ_ivas_fx(
        {
            IF( EQ_16( L_frame, L_FRAME ) )
            {
                idx_g = vquant_fx( y_gain_tmp, YG_mean16_fx, y_gain_tmp, YG_dicMR_1_fx, 4, 64 );
                idx_g = vquant_fx( y_gain_tmp, YG_mean16_fx2, y_gain_tmp, YG_dicMR_1_fx2, 4, 64 );
                push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 6 );

                idx_g = vquant_fx( y_gain_tmp + 4, YG_mean16_fx + 4, y_gain_tmp + 4, YG_dicMR_2_fx, 4, 32 );
                idx_g = vquant_fx( y_gain_tmp + 4, YG_mean16_fx2 + 4, y_gain_tmp + 4, YG_dicMR_2_fx2, 4, 32 );
                push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 5 );

                idx_g = vquant_fx( y_gain_tmp + 8, YG_mean16_fx + 8, y_gain_tmp + 8, YG_dicMR_3_fx, 4, 32 );
                idx_g = vquant_fx( y_gain_tmp + 8, YG_mean16_fx2 + 8, y_gain_tmp + 8, YG_dicMR_3_fx2, 4, 32 );
                push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 5 );

                idx_g = vquant_fx( y_gain_tmp + 12, YG_mean16_fx + 12, y_gain_tmp + 12, YG_dicMR_4_fx, 4, 16 );
                idx_g = vquant_fx( y_gain_tmp + 12, YG_mean16_fx2 + 12, y_gain_tmp + 12, YG_dicMR_4_fx2, 4, 16 );
                push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 4 );
                scale_sig( y_gain_tmp, 16, -3 );
            }
            ELSE
            {
@@ -1052,16 +1053,17 @@ Word16 gsc_gaindec_fx( /* o : average frequency gai
        ELSE
        {
            idx_g_fx = (Word16) get_next_indice_fx( st_fx, 6 );
            VDQ_vec_fx( y_gainQ_fx, YG_mean16_fx, YG_dicMR_1_fx, idx_g_fx, 4 );
            VDQ_vec_fx( y_gainQ_fx, YG_mean16_fx2, YG_dicMR_1_fx2, idx_g_fx, 4 );

            idx_g_fx = (Word16) get_next_indice_fx( st_fx, 5 );
            VDQ_vec_fx( y_gainQ_fx + 4, YG_mean16_fx + 4, YG_dicMR_2_fx, idx_g_fx, 4 );
            VDQ_vec_fx( y_gainQ_fx + 4, YG_mean16_fx2 + 4, YG_dicMR_2_fx2, idx_g_fx, 4 );

            idx_g_fx = (Word16) get_next_indice_fx( st_fx, 5 );
            VDQ_vec_fx( y_gainQ_fx + 8, YG_mean16_fx + 8, YG_dicMR_3_fx, idx_g_fx, 4 );
            VDQ_vec_fx( y_gainQ_fx + 8, YG_mean16_fx2 + 8, YG_dicMR_3_fx2, idx_g_fx, 4 );

            idx_g_fx = (Word16) get_next_indice_fx( st_fx, 4 );
            VDQ_vec_fx( y_gainQ_fx + 12, YG_mean16_fx + 12, YG_dicMR_4_fx, idx_g_fx, 4 );
            VDQ_vec_fx( y_gainQ_fx + 12, YG_mean16_fx2 + 12, YG_dicMR_4_fx2, idx_g_fx, 4 );
            scale_sig( y_gainQ_fx, 16, -3 );
        }
    }

@@ -1486,6 +1488,7 @@ Word16 gsc_gainQ_fx( /*Q12*/
            push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 5 );
            idx_g = vquant_fx( y_gain_tmp + 12, YG_mean16_fx + 12, y_gain_tmp + 12, YG_dicMR_4_fx, 4, 16 );
            push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 4 );
            scale_sig( y_gain_tmp, 16, -3 );
        }
    }