Commit 2e7ef9ac authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch '3gpp_issue_1230_fix' into 'main'

Fix for 3GPP issue 1230: Basop Enc audible differences and distortion @16kbps

See merge request !1050
parents 794bda24 48a7412b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@
#define FIX_1010_OPT_GIVENS_INV                 /* FhG: SVD complexity optimizations (non-be) */
#define FIX_1010_OPT_NORM_NOSAT                 /* FhG: SVD complexity optimizations (non-be) */
#define FIX_1010_OPT_SEC_SINGLE_RESCALE         /* FhG: SVD complexity optimizations (non-be) */
#define FIX_ISSUE_1230                          /* Ittiam: Fix for issue 1230: Basop Enc audible differences and distortion @16kbps */
#define NONBE_1211_DTX_BR_SWITCHING             /* VA: port float issue 1211: fix crash in MASA DTX bitrate switching */
#define FIX_1189_GSC_IVAS_OMASA                 /* VA: Fix for issue 1189: Bitstream desynchornization due to reading/writing of the GSC_IVAS_mode parameter */
#define FIX_ISSUE_1237                          /* VA: replacement of Copy_Scale_sig_16_32_DEPREC() that are doing 16 bits left shift by Copy_Scale_sig_16_32_no_sat() */
+4 −0
Original line number Diff line number Diff line
@@ -418,6 +418,10 @@ void core_switching_pre_enc_ivas_fx(

        tmp = sub( L_LOOK_16k + L_SUBFR16k, Sample_Delay_HP );
        Copy( &hBWE_TD->old_speech_shb_fx[tmp], hBWE_FD->new_input_hp_fx, Sample_Delay_HP );
#ifdef FIX_ISSUE_1230
        hBWE_FD->Q_new_input_hp = 0;
        move16();
#endif

        IF( NE_16( st_fx->last_extl, WB_BWE ) )
        {
+8 −5
Original line number Diff line number Diff line
@@ -1008,7 +1008,10 @@ typedef struct td_bwe_enc_structure

typedef struct fd_bwe_enc_structure
{
    Word16 new_input_hp_fx[NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_NS + DELAY_FIR_RESAMPL_NS - DELAY_CLDFB_NS )]; // q0
    Word16 new_input_hp_fx[NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_NS + DELAY_FIR_RESAMPL_NS - DELAY_CLDFB_NS )]; // Q_new_input_hp
#ifdef FIX_ISSUE_1230
    Word16 Q_new_input_hp;
#endif
    Word16 old_input_fx[NS2SA( 48000, DELAY_FD_BWE_ENC_NS + DELAY_FIR_RESAMPL_NS )]; // q0
    Word16 old_input_wb_fx[NS2SA( 16000, DELAY_FD_BWE_ENC_NS )];                     /* Q(-1) */
    Word16 old_input_lp_fx[NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_NS )];     // st->hBWE_FD->prev_Q_input_lp
+28 −0
Original line number Diff line number Diff line
@@ -325,6 +325,9 @@ void swb_bwe_enc_ivas_fx(
    move32();
#endif
    Word16 fb_band_begin;
#ifdef FIX_ISSUE_1230
    Word16 q_new_input_hp;
#endif

    FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD;
    TD_BWE_ENC_HANDLE hBWE_TD = st_fx->hBWE_TD;
@@ -400,8 +403,25 @@ void swb_bwe_enc_ivas_fx(
        Copy( old_input_16k_fx + L_INP_MEM + L_FRAME16k - Sample_Delay_LP, hBWE_FD->old_input_lp_fx, Sample_Delay_LP );
    }

#ifdef FIX_ISSUE_1230
    q_new_input_hp = s_min( Q_shb_speech, hBWE_FD->Q_new_input_hp );
    IF( LT_16( Q_shb_speech, hBWE_FD->Q_new_input_hp ) )
    {
        Copy_Scale_sig( hBWE_FD->new_input_hp_fx, new_input_hp_fx, Sample_Delay_HP, sub( Q_shb_speech, hBWE_FD->Q_new_input_hp ) ); // Q_shb_speech
        Copy( shb_speech_fx, &new_input_hp_fx[Sample_Delay_HP], L_FRAME16k - Sample_Delay_HP );                                     // Q_shb_speech
    }
    ELSE
    {
        Copy( hBWE_FD->new_input_hp_fx, new_input_hp_fx, Sample_Delay_HP );                                                                             // hBWE_FD->Q_new_input_hp
        Copy_Scale_sig( shb_speech_fx, &new_input_hp_fx[Sample_Delay_HP], L_FRAME16k - Sample_Delay_HP, sub( hBWE_FD->Q_new_input_hp, Q_shb_speech ) ); // hBWE_FD->Q_new_input_hp
    }

    hBWE_FD->Q_new_input_hp = Q_shb_speech;
    move16();
#else
    Copy( hBWE_FD->new_input_hp_fx, new_input_hp_fx, Sample_Delay_HP );
    Copy( shb_speech_fx, &new_input_hp_fx[Sample_Delay_HP], L_FRAME16k - Sample_Delay_HP );
#endif
    Copy( shb_speech_fx + L_FRAME16k - Sample_Delay_HP, hBWE_FD->new_input_hp_fx, Sample_Delay_HP );
    new_input_fx = old_input_fx + Sample_Delay_SWB_BWE;
    Copy( hBWE_FD->old_input_fx, old_input_fx, Sample_Delay_SWB_BWE );
@@ -511,7 +531,11 @@ void swb_bwe_enc_ivas_fx(
    {
        Q_shb = sub( Q_synth_hf, 4 );
    }
#ifdef FIX_ISSUE_1230
    Copy_Scale_sig( new_input_hp_fx, new_input_hp_fx, L_FRAME16k, sub( Q_shb, q_new_input_hp ) );
#else
    Copy_Scale_sig( new_input_hp_fx, new_input_hp_fx, L_FRAME16k, sub( Q_shb, Q_shb_speech ) );
#endif

    /* FB BWE encoding */
    IF( EQ_16( st_fx->extl, FB_BWE ) )
@@ -4123,6 +4147,10 @@ void fd_bwe_enc_init_fx(
)
{
    set16_fx( hBWE_FD->new_input_hp_fx, 0, NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS - DELAY_CLDFB_NS ) );
#ifdef FIX_ISSUE_1230
    hBWE_FD->Q_new_input_hp = 0;
    move16();
#endif
    set16_fx( hBWE_FD->old_input_fx, 0, NS2SA( 48000, DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS ) );
    set16_fx( hBWE_FD->old_input_wb_fx, 0, NS2SA( 16000, DELAY_FD_BWE_ENC_12k8_NS ) );
#ifndef MSAN_FIX