Commit 92576ece authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Fix for 3GPP issue 1424: Audible differences in the CNG generated at SBA 32...

Fix for 3GPP issue 1424: Audible differences in the CNG generated at SBA 32 kbps and 16.4 kbps, DTX ON

Link #1424
parent ac8a0328
Loading
Loading
Loading
Loading
Loading
+35 −4
Original line number Diff line number Diff line
@@ -666,14 +666,45 @@ ivas_error front_vad_spar_fx(

        old_pitch = st->pitch[1];
        move16();
        Scale_sig( wsp_fx, 368, sub( Q8, Q_inp_12k8 ) ); // Q8
        pitch_ol_ivas_fx( st->pitch, st->voicing_fx, &st->old_pitch, &st->old_corr_fx, corr_shift_fx, &st->old_thres_fx, &st->delta_pit, st->old_wsp2_fx, wsp_fx, st->mem_decim2_fx, relE_fx, st->clas, st->input_bwidth, st->Opt_SC_VBR, Q8 );
        Word16 shift, Q_wsp;
        Word16 shift1 = norm_arr( old_wsp_fx, L_WSP_MEM );
        Word16 shift2 = norm_arr( wsp_fx, L_WSP - L_WSP_MEM );
        maximum_abs_16_fx( old_wsp_fx, L_WSP_MEM, &shift );
        if ( !shift )
        {
            shift1 = Q15;
            move16();
        }
        maximum_abs_16_fx( wsp_fx, L_WSP - L_WSP_MEM, &shift );
        if ( !shift )
        {
            shift2 = Q15;
            move16();
        }

        shift = s_min( Q15, s_min( add( Q_inp_12k8, shift1 ), add( Q_inp_12k8, shift2 ) ) );
        shift = s_min( shift, add( norm_arr( st->mem_decim2_fx, 3 ), st->Q_old_wsp2 ) );
        shift = s_min( shift, add( norm_arr( st->old_wsp2_fx, ( L_WSP_MEM - L_INTERPOL ) / OPL_DECIM ), st->Q_old_wsp2 ) );

        scale_sig( old_wsp_fx, L_WSP_MEM, sub( shift, Q_inp_12k8 ) );
        scale_sig( wsp_fx, L_WSP - L_WSP_MEM, sub( shift, Q_inp_12k8 ) );

        Q_wsp = shift;
        move16();

        scale_sig( st->mem_decim2_fx, 3, sub( Q_wsp, st->Q_old_wsp2 ) );                                    // Q( mem_decim ) = Q( old_wsp2 )
        scale_sig( st->old_wsp2_fx, ( L_WSP_MEM - L_INTERPOL ) / OPL_DECIM, sub( Q_wsp, st->Q_old_wsp2 ) ); // Q_wsp

        st->Q_old_wsp2 = Q_wsp;
        move16();

        pitch_ol_ivas_fx( st->pitch, st->voicing_fx, &st->old_pitch, &st->old_corr_fx, corr_shift_fx, &st->old_thres_fx, &st->delta_pit, st->old_wsp2_fx, wsp_fx, st->mem_decim2_fx, relE_fx, st->clas, st->input_bwidth, st->Opt_SC_VBR, Q_wsp );

        /* Updates for adaptive lag window memory */
        st->old_pitch_la = st->pitch[2]; /* Q0 */
        move16();
        Scale_sig( wsp_fx, 368, Q9 - Q8 ); /* Q9 */
        StableHighPitchDetect_ivas_fx( &flag_spitch, st->pitch, st->voicing_fx, wsp_fx, st->localVAD, &st->voicing_sm_fx, &st->voicing0_sm_fx, &st->LF_EnergyRatio_sm_fx, &st->predecision_flag, &st->diff_sm_fx, &st->energy_sm_fx, Q12, st->lgBin_E_fx );

        StableHighPitchDetect_ivas_fx( &flag_spitch, st->pitch, st->voicing_fx, wsp_fx, st->localVAD, &st->voicing_sm_fx, &st->voicing0_sm_fx, &st->LF_EnergyRatio_sm_fx, &st->predecision_flag, &st->diff_sm_fx, &st->energy_sm_fx, Q_wsp, st->lgBin_E_fx );
        IF( st->hSpMusClas != NULL )
        {
            Word16 dummy_int;