Commit 4f16a083 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Precision improvements and bug fixes for encoder

[x] Bug fix in core_signal_analysis_high_bitrate_ivas_fx
[x] [Bug-fix] minor logic correction in stereo_td_get_td_itd_fx
[x] Precision improvement inside wb_vad_ivas_fx for the selection of snr_outlier_index
[x] Minor bug fix in stereo_mdct_core_enc_fx
[x] Fixes in unclr_classifier
parent a0c504c4
Loading
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -691,7 +691,7 @@ void core_signal_analysis_high_bitrate_ivas_fx(
    Word16 *speech_fx = NULL;
    Word16 q_out_wtda = 0;
    move16();
    Word16 win_len = 0;
    Word16 win_len[2];
    move16();
    set32_fx( buf_powerSPec, 0, N_MAX + L_MDCT_OVLP_MAX );
    set16_fx( buf_powerSPec_exp, 0, N_MAX + L_MDCT_OVLP_MAX );
@@ -953,9 +953,12 @@ void core_signal_analysis_high_bitrate_ivas_fx(
            IF( windowed_samples != NULL ) /* save windowed speech_TCX samples */
            {
                assert( L_subframe + ( left_overlap + right_overlap ) / 2 < 2 * L_FRAME_MAX / nSubframes - L_FRAME_MAX / 8 );
                win_len = add( L_subframe, shr( add( left_overlap, right_overlap ), 1 ) );
                win_len[frameno] = add( L_subframe, shr( add( left_overlap, right_overlap ), 1 ) );
                move16();
                windowed_samples[frameno * L_FRAME_MAX + 0] = L_deposit_l( overlap_mode[frameno] ); // Q0
                move32();
                windowed_samples[frameno * L_FRAME_MAX + 1] = L_deposit_l( overlap_mode[frameno + 1] ); // Q0
                move32();
                Copy_Scale_sig_16_32( tcx20Win, windowed_samples + add( imult1616( frameno, L_FRAME_MAX ), 2 ), add( L_subframe, shr( add( left_overlap, right_overlap ), 1 ) ), 0 );
                *q_win = s_min( *q_win, sub( L_norm_arr( windowed_samples + add( imult1616( frameno, L_FRAME_MAX ), 2 ), add( L_subframe, shr( add( left_overlap, right_overlap ), 1 ) ) ), 1 ) );
                move16();
@@ -963,12 +966,12 @@ void core_signal_analysis_high_bitrate_ivas_fx(
                move16();

#ifdef MSAN_FIX
                Scale_sig32( windowed_samples + frameno * L_FRAME_MAX + 2, win_len, *q_win ); // q_win
                Scale_sig32( windowed_samples + frameno * L_FRAME_MAX + 2, win_len[frameno], *q_win ); // q_win

#endif
                IF( EQ_16( frameno, 1 ) )
                {
                    Scale_sig32( windowed_samples + 2, win_len, sub( *q_win, Q_win_temp[0] ) ); // q_win
                    Scale_sig32( windowed_samples + 2, win_len[0], sub( *q_win, Q_win_temp[0] ) ); // q_win
                }
            }
        }
+1 −7
Original line number Diff line number Diff line
@@ -282,13 +282,7 @@ ivas_error front_vad_fx(
            noise_est_pre_32fx( Etot_fx, hFrontVads[0]->ini_frame, hFrontVad->hNoiseEst, 0, 0, 0 );

            /* wb_vad */
            Word16 scale = add( hFrontVads[n]->hNoiseEst->q_bckr, L_norm_arr( hFrontVads[n]->hNoiseEst->bckr_fx, NB_BANDS ) );
            scale = s_min( scale, add( hFrontVads[n]->hNoiseEst->q_enrO, L_norm_arr( hFrontVads[n]->hNoiseEst->enrO_fx, NB_BANDS ) ) );
            scale = s_min( q_fr_bands[n], scale );

            scale_sig32( hFrontVads[n]->hNoiseEst->bckr_fx, NB_BANDS, sub( scale, hFrontVads[n]->hNoiseEst->q_bckr ) ); // scale
            hFrontVads[n]->hNoiseEst->q_bckr = scale;
            move16();
            Word16 scale = s_min( q_fr_bands[n], add( hFrontVads[n]->hNoiseEst->q_enrO, L_norm_arr( hFrontVads[n]->hNoiseEst->enrO_fx, NB_BANDS ) ) );

            scale_sig32( hFrontVads[n]->hNoiseEst->enrO_fx, NB_BANDS, sub( scale, hFrontVads[n]->hNoiseEst->q_enrO ) ); // scale
            hFrontVads[n]->hNoiseEst->q_enrO = scale;
+37 −6
Original line number Diff line number Diff line
@@ -909,15 +909,30 @@ void unclr_classifier_td_fx(
    score = Mpy_32_32( score, hStereoClassif->relE_0_1_fx ); // Q31

    /* rising edge detection on relE */
    Word32 L_tmp = 0;
    Word32 L_tmp = 0, tmp32;
    move32();
    Word16 L_tmp_e = 0;
    Word16 L_tmp_e = 0, flag = 0;
    move16();
    move16();
    tmp32 = hStereoClassif->relE_buf_fx[0];
    FOR( i = 0; i < UNCLR_L_RELE; i++ )
    {
        L_tmp = BASOP_Util_Add_Mant32Exp( L_tmp, L_tmp_e, hStereoClassif->relE_buf_fx[i], 0, &L_tmp_e );
        IF( NE_32( tmp32, hStereoClassif->relE_buf_fx[i] ) )
        {
            flag = 1;
            move16();
        }
    }
    IF( EQ_16( flag, 1 ) )
    {
        relE_ST = L_shl( Mpy_32_32( L_tmp, ONE_BY_UNCLR_L_RELE_Q31 ), L_tmp_e ); // Q31
    }
    ELSE
    {
        relE_ST = hStereoClassif->relE_buf_fx[0];
        move16();
    }

    IF( hStereoClassif->relE_0_1_fx > relE_ST )
    {
@@ -1020,15 +1035,31 @@ void unclr_classifier_dft_fx(

    /* rising edge detector on relE */
    // relE_ST = mean(hStereoClassif->relE_buf, UNCLR_L_RELE);
    Word32 L_tmp = 0;
    Word32 L_tmp = 0, tmp32;
    move32();
    Word16 L_tmp_e = 0;
    Word16 L_tmp_e = 0, flag = 0;
    move16();
    move16();
    tmp32 = hStereoClassif->relE_buf_fx[0];
    move32();
    FOR( i = 0; i < UNCLR_L_RELE; i++ )
    {
        L_tmp = BASOP_Util_Add_Mant32Exp( L_tmp, L_tmp_e, hStereoClassif->relE_buf_fx[i], 0, &L_tmp_e );
        IF( NE_32( tmp32, hStereoClassif->relE_buf_fx[i] ) )
        {
            flag = 1;
            move16();
        }
    }
    IF( EQ_16( flag, 1 ) )
    {
        relE_ST = L_shl( Mpy_32_32( L_tmp, ONE_BY_UNCLR_L_RELE_Q31 ), L_tmp_e ); // Q31
    }
    ELSE
    {
        relE_ST = hStereoClassif->relE_buf_fx[0];
        move16();
    }

    IF( GT_32( hStereoClassif->relE_0_1_fx, relE_ST ) )
    {
+1 −1
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ static void stereo_td_get_td_itd_fx(

        IF( itd != 0 )
        {
            *td_itd_32 = extract_l( L_shr( L_add( temp_add, EPSILON_FX ), sub( 14, temp_e ) ) );
            *td_itd_32 = extract_l( L_shl( L_shr( L_add( temp_add, EPSILON_FX ), sub( 15, temp_e ) ), 1 ) );
        }
        ELSE
        {
+4 −2
Original line number Diff line number Diff line
@@ -665,9 +665,10 @@ void stereo_mdct_core_enc_fx(
                        {
                            q_spectrum = s_min( q_spectrum, sub( Q31, st->hIGFEnc->spec_be_igf_e ) );
                        }
                        q_spectrum = sub( Q31, st->hTcxEnc->spectrum_e[n] );

                        Scale_sig32( orig_spectrum_fx[ch][n], N_TCX10_MAX, sub( q_spectrum, sub( Q31, p_orig_spectrum_e[ch] ) ) ); /* q_spectrum */

                        q_spectrum = sub( Q31, st->hTcxEnc->spectrum_e[n] );
                        set16_fx( exp_powerSpec[ch], sub( Q31, q_powSpec[ch] ), N_MAX + L_MDCT_OVLP_MAX );

                        ProcessIGF_ivas_fx( st, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[ch][n], &q_spectrum, &powerSpec_fx[ch][n * L_subframeTCX], &exp_powerSpec[ch][n * L_subframeTCX], st->core == TCX_20_CORE, n, hCPE->hCoreCoder[0]->sp_aud_decision0, 0 );
@@ -706,9 +707,10 @@ void stereo_mdct_core_enc_fx(
                        {
                            q_spectrum = s_min( q_spectrum, sub( Q31, st->hIGFEnc->spec_be_igf_e ) );
                        }
                        q_spectrum = sub( Q31, st->hTcxEnc->spectrum_e[n] );

                        Scale_sig32( orig_spectrum_fx[ch][n], N_TCX10_MAX, sub( q_spectrum, sub( Q31, p_orig_spectrum_e[ch] ) ) ); /* q_spectrum */

                        q_spectrum = sub( Q31, st->hTcxEnc->spectrum_e[n] );
                        set16_fx( exp_powerSpec[ch], sub( Q31, q_powSpec[ch] ), N_MAX + L_MDCT_OVLP_MAX );

                        ProcessIGF_ivas_fx( st, st->hTcxEnc->spectrum_fx[n], orig_spectrum_fx[ch][n], &q_spectrum, &powerSpec_fx[ch][n * L_subframeTCX], &exp_powerSpec[ch][n * L_subframeTCX], st->core == TCX_20_CORE, n, hCPE->hCoreCoder[0]->sp_aud_decision0, 0 );
Loading