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

Merge branch '918-scaling-error-when-going-from-fd-stereo-to-td-stereo' into 'main'

possible fix to 918, correcting scaling for the secondary channel after switching mode

Closes #918

See merge request !647
parents 460d55c3 a79d7576
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -184,6 +184,7 @@
#define FIX_882_LOW_LEVEL_DISCONTINUITIES       /* VA: Fix 882, discontinuities for low level signal by adding a scaling function that uses rounding, this function is more complex than normal one, has to be used only when necessary*/
#define FIX_879_DIFF_CONCEAL_PATH               /* FhG: Fix for issue 879 and different concelalment paths that led to crash */
#define FIX_907_MEM_UPDATE_ISSUE                /* VA: fix for 907, multiples issues surrounding mem_syn_r and update of mem_syn2 when FS is changing */            
#define FIX_918_WRONG_SCALING_ON_MODE_SWITCHING   /* VA: Fix wrong scaling of secondary channel when switching from stereo DFT to TD */

/* ################## End DEVELOPMENT switches ######################### */

+35 −1
Original line number Diff line number Diff line
@@ -3256,8 +3256,42 @@ void stereo_switching_dec(

        sts[1]->last_L_frame = sts[0]->last_L_frame;
        move16();

#ifndef FIX_918_WRONG_SCALING_ON_MODE_SWITCHING
        Copy_Scale_sig( sts[0]->old_exc_fx, sts[1]->old_exc_fx, L_EXC_MEM_DEC, sub( sts[1]->Q_exc, sts[0]->Q_exc ) );
#else
        /* Should not force sts[1]->Q_exc on the data of st[0], instead it better to just reuse the current scaling of st[0]*/
        Copy( sts[0]->old_exc_fx, sts[1]->old_exc_fx, L_EXC_MEM_DEC );
        sts[1]->Q_exc = sts[0]->Q_exc;
        move16();
        sts[1]->Q_exc_cng = sts[0]->Q_exc_cng;
        move16();
        sts[1]->prev_Q_exc = sts[0]->prev_Q_exc;
        move16();
        Copy( sts[0]->Q_subfr, sts[1]->Q_subfr, L_Q_MEM );

        sts[1]->prev_Q_bwe_syn = sts[0]->prev_Q_bwe_syn;
        move16();
        sts[1]->prev_Q_bwe_syn2 = sts[0]->prev_Q_bwe_syn2;
        move16();

        sts[1]->prev_Q_bwe_exc_fb = sts[0]->prev_Q_bwe_exc_fb;
        move16();
        sts[1]->prev_Qx = sts[0]->prev_Qx;
        move16();
        sts[1]->prev_Q_bwe_exc = sts[0]->prev_Q_bwe_exc;
        move16();
        sts[1]->prev_Q_synth = sts[0]->prev_Q_synth;
        move16();
        sts[1]->Q_syn = sts[0]->Q_syn;
        move16();
        sts[1]->Q_syn2 = sts[0]->Q_syn2;
        move16();
        sts[1]->Q_syn_cng = sts[0]->Q_syn_cng;
        move16();
        sts[1]->prev_Q_syn = sts[0]->prev_Q_syn;
        move16();

#endif
        Copy( sts[0]->lsf_old_fx, sts[1]->lsf_old_fx, M );
        Copy( sts[0]->lsp_old_fx, sts[1]->lsp_old_fx, M );
        IF( EQ_16( hCPE->element_mode, IVAS_CPE_MDCT ) )