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
+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 ) )
Loading