Commit 383e7f47 authored by multrus's avatar multrus
Browse files

Merge branch '1688_basop_portFlpMr1861_SwitchingMdctDftStereo' into 'main'

[non-BE] [allow regression] Port Flt MR1861 to main - Switching artifact in MDCT -> DFT stereo switching

Closes #1688

See merge request !2326
parents 27bee556 51a3b437
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -137,6 +137,7 @@
#define FIX_1053_REVERB_RECONFIGURATION
#define TMP_FIX_1119_SPLIT_RENDERING_VOIP               /* FhG: Add error check for unsupported config: split rendering with VoIP mode */
#define FIX_1113_EXTREND_ISAR                           /* FhG: issue 1113: fix external renderer asserts for FOA/HOA2 and CLDFB config */
#define NONBE_1203_MDCT2DFT_SWITCHING                   /* VA: issue 1203: fix severe artifacts during MDCT to DFT stereo switching when MDCT ITD is not used */
#define NONBE_1122_JBM_FIX_PLAYOUT_DELAY_IN_DTX         /* FhG: Avoid JBM ignoring safety margin and setting playout delay to 0 during DTX */
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define FIX_938_COMPILER_WARNING                        /* FhG: Fix compiler warning in ivas_mdct_core_reconstruct() */
+19 −0
Original line number Diff line number Diff line
@@ -573,6 +573,10 @@ void stereo_td_itd_mdct_stereo_fx(
    Word16 DFT_e[CPE_CHANNELS];
    Word16 DFT_tmp_e[CPE_CHANNELS][STEREO_DFT_N_MAX_ENC];
    STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct;
#ifdef NONBE_1203_MDCT2DFT_SWITCHING
    Word16 dft_ovl;
    Word16 sf;
#endif

    test();
    IF( hCPE->hStereoMdct != NULL && hCPE->hStereoMdct->hItd != NULL )
@@ -611,6 +615,21 @@ void stereo_td_itd_mdct_stereo_fx(
        /* Time Domain ITD compensation using extrapolation */
        stereo_td_itd_fx( hStereoMdct->hItd, NULL, NULL, 1, hStereoMdct->hDft_ana->dft_ovl, hCPE->hCoreCoder, input_frame, hCPE->input_mem_fx, hCPE->q_input_mem );
    }
#ifdef NONBE_1203_MDCT2DFT_SWITCHING
    ELSE IF( hCPE->input_mem_fx[0] != NULL )
    {
        dft_ovl = extract_l( Mpy_32_32( imult3216( input_frame, STEREO_DFT_OVL_MAX ), 2236963 ) ); // 1/L_FRAME48k = 2236963 (Q31)

        FOR( i = 0; i < CPE_CHANNELS; i++ )
        {
            sf = L_norm_arr( hCPE->hCoreCoder[i]->input32_fx + input_frame - dft_ovl, dft_ovl );
            Copy_Scale_sig32_16( hCPE->hCoreCoder[i]->input32_fx + input_frame - dft_ovl, hCPE->input_mem_fx[i], dft_ovl, sf );
            hCPE->q_input_mem[i] = sub( add( hCPE->hCoreCoder[i]->q_inp32, sf ), 16 );
            move16();
        }
    }
#endif


    return;
}
+11 −1
Original line number Diff line number Diff line
@@ -649,15 +649,25 @@ void stereo_switching_enc_fx(
    dft_ovl = extract_l( Mpy_32_32( imult3216( input_frame, STEREO_DFT_OVL_MAX ), 2236963 ) ); // 1/L_FRAME48k = 2236963 (Q31)

    /* update DFT analysis overlap memory */
#ifdef NONBE_1203_MDCT2DFT_SWITCHING
    /* note: in MDCT stereo, the update is done in stereo_td_itd_mdct_stereo() */
#endif
    test();
    test();
    IF( GT_16( hCPE->element_mode, IVAS_CPE_DFT ) && hCPE->input_mem_fx[0] != NULL && NE_16( hCPE->element_mode, IVAS_CPE_MDCT ) )
    {
        FOR( n = 0; n < CPE_CHANNELS; n++ )
        {
#ifdef NONBE_1203_MDCT2DFT_SWITCHING
            Word16 sf = L_norm_arr( sts[n]->input32_fx + input_frame - dft_ovl, dft_ovl );
            Copy_Scale_sig32_16( sts[n]->input32_fx + input_frame - dft_ovl, hCPE->input_mem_fx[n], dft_ovl, sf ); /* sts[n]->q_inp32 - 16 */
            hCPE->q_input_mem[n] = sub( add( sts[n]->q_inp32, sf ), 16 );
            move16();
#else
            Copy_Scale_sig32_16( sts[n]->input32_fx + input_frame - dft_ovl, hCPE->input_mem_fx[n], dft_ovl, 0 ); /* sts[n]->q_inp32 - 16 */
            hCPE->q_input_mem[n] = sub( sts[n]->q_inp32, 16 );
            move16();
#endif
        }
    }