Commit a98b6a0b authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch '843-distortion-in-ism-4-binaural-and-ext-output-between-6khz-8khz' into 'main'

Resolve "Distortion in ISM 4 BINAURAL and EXT output between 6kHz-8kHz"

See merge request !529
parents 988d5fd6 7b78b916
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -163,6 +163,7 @@
#define FIX_844_Q_SYN_INIT                          /* VA : proposed fix to 844, initializing q_old_synth when switching to MDCT*/
#define FIX_839_FB_CONTENT_SOMETIME_MISSING     /* VA : Fix scaling error for FB TB BWE */
#define FIX_846_TILT_BWE                        /* VA : Proposed fix to 846, to solve saturation */
#define FIX_843_LOW_RATE_BWE                    /* VA : Proposed fix to 843 to solve mid band noise */
/* ################## End DEVELOPMENT switches ######################### */

/* clang-format on */
+10 −0
Original line number Diff line number Diff line
@@ -1187,7 +1187,11 @@ ivas_error acelp_core_dec_ivas_fx(
                /* Core synthesis at 12.8kHz or 16kHz */
                i = 1;
                move16();
#ifdef FIX_843_LOW_RATE_BWE
                if ( st->coder_type == INACTIVE && st->element_mode == EVS_MONO )
#else
                if ( st->coder_type == INACTIVE )
#endif
                {
                    i = 0;
                    move16();
@@ -2121,9 +2125,15 @@ ivas_error acelp_core_dec_ivas_fx(
            Copy_Scale_sig_32_16( synth_fx, synth_fx16, L_FRAME48k, 0 );
#endif
#ifdef FIX_774_ENERGY_BURST
#ifdef FIX_843_LOW_RATE_BWE
            hf_synth_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc2_fx,
                         psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2, st->hBWE_zero->delay_syn_hf_fx, &st->hBWE_zero->memExp1,
                         st->hBWE_zero->mem_hp_interp_fx, st->extl, st->CNG_mode );
#else
            hf_synth_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc_fx,
                         psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2, st->hBWE_zero->delay_syn_hf_fx, &st->hBWE_zero->memExp1,
                         st->hBWE_zero->mem_hp_interp_fx, st->extl, st->CNG_mode );
#endif
#else
            hf_synth_ivas_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc_fx,
                              psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2, st->hBWE_zero->delay_syn_hf_fx, &tmp_exp,
+4 −0
Original line number Diff line number Diff line
@@ -315,6 +315,10 @@ void tdm_low_rate_dec_fx(

    edct_16fx( exc_wo_nf_fx, exc_wo_nf_fx, L_FRAME, find_guarded_bits_fx( L_FRAME ), IVAS_CPE_TD );

#ifdef FIX_843_LOW_RATE_BWE
    Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, &exc[0], &bwe_exc[0], st->hGSCDec->last_exc_dct_in_fx,
                 L_FRAME, L_FRAME * HIBND_ACB_L_FAC, L_shl( st->lp_gainc_fx, 13 /* Q3 -> Q16*/ ), &( st->Q_exc ), st->Q_subfr, NULL, 0, st->coder_type );
#endif
    /*----------------------------------------------------------------------*
     * Remove potential pre-echo in case an onset has been detected
     *----------------------------------------------------------------------*/
+19 −1
Original line number Diff line number Diff line
@@ -368,7 +368,9 @@ Word16 ivas_wb_bwe_dec_fx(
    Word16 scl, new_input_fx_exp;
    Word16 i;
    FD_BWE_DEC_HANDLE hBWE_FD;

#ifdef FIX_843_LOW_RATE_BWE
    Word16 ysynth_frame_size;
#endif
    Word16 coder_type = st_fx->coder_type;
    move16();

@@ -389,6 +391,9 @@ Word16 ivas_wb_bwe_dec_fx(
        *Qpost = sub( new_input_fx_exp, 15 );
        move16();
        direct_transform_fx( L_wtda_synth_fx, ysynth_32, 0, /*st->L_frame*/ L_FRAME16k, &new_input_fx_exp, st_fx->element_mode );
#ifdef FIX_843_LOW_RATE_BWE
        ysynth_frame_size = L_FRAME16k;
#endif
    }
    ELSE
    {
@@ -398,10 +403,15 @@ Word16 ivas_wb_bwe_dec_fx(
        *Qpost = sub( new_input_fx_exp, 15 );
        move16();
        /* DCT of the ACELP core synthesis */
#ifdef FIX_843_LOW_RATE_BWE
        direct_transform_fx( L_wtda_synth_fx, ysynth_32, 0, output_frame, &new_input_fx_exp, st_fx->element_mode );
        ysynth_frame_size = output_frame;
#else
#ifdef MSAN_FIX
        direct_transform_fx( L_wtda_synth_fx, ysynth_32, 0, L_FRAME16k, &new_input_fx_exp, st_fx->element_mode );
#else
        direct_transform_fx( L_wtda_synth_fx, ysynth_32, 0, output_frame, &new_input_fx_exp, st_fx->element_mode );
#endif
#endif
    }
    /* Convert to 16 Bits (Calc Shift Required to Stay within MAX_Q_NEW_INPUT) */
@@ -411,18 +421,26 @@ Word16 ivas_wb_bwe_dec_fx(
    {
        /* Yes */
        /* Calc Room to Upscale */
#ifdef FIX_843_LOW_RATE_BWE
        Q_syn = Find_Max_Norm32( ysynth_32, ysynth_frame_size );
#else
#ifdef MSAN_FIX
        Q_syn = Find_Max_Norm32( ysynth_32, L_FRAME16k );
#else
        Q_syn = Find_Max_Norm32( ysynth_32, output_frame );
#endif
#endif
        /* Stay within MAX_Q_NEW_INPUT */
        scl = s_min( Q_syn, scl );
    }
#ifdef FIX_843_LOW_RATE_BWE
    Copy_Scale_sig32_16( ysynth_32, ysynth_fx, ysynth_frame_size, scl );
#else
#ifdef MSAN_FIX
    Copy_Scale_sig32_16( ysynth_32, ysynth_fx, L_FRAME16k, scl );
#else
    Copy_Scale_sig32_16( ysynth_32, ysynth_fx, output_frame, scl );
#endif
#endif
    Q_syn = add( sub( new_input_fx_exp, 16 ), scl );
    IF( !st_fx->bfi )