Commit 56e89acf authored by reutelhuber's avatar reutelhuber
Browse files

fix problems for bitrate switching

parent 82f15f3d
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -655,7 +655,11 @@ void applyDmxMdctStereo(
        fade = 0.f;
        dmx_len = crossfade_len;
    }
#ifdef FIX_MDCT_AND_MC_MONO_ISSUES
    else if ( hCPE->last_element_mode == IVAS_CPE_DFT && hCPE->last_element_brate <= IVAS_32k )
#else
    else if ( hCPE->last_element_mode == IVAS_CPE_DFT && hCPE->last_element_brate <= IVAS_24k4 )
#endif
    {
        crossfade_len = NS2SA( hCPE->hCoreCoder[0]->output_Fs, DELAY_CLDFB_NS );
        step /= crossfade_len;
+33 −0
Original line number Diff line number Diff line
@@ -716,8 +716,19 @@ ivas_error stereo_memory_dec(

            if ( hCPE->last_element_mode == IVAS_CPE_DFT )
            {
#ifdef FIX_MDCT_AND_MC_MONO_ISSUES
                if ( hCPE->nchan_out == 1 )
                {
                    cpy_tcx_ltp_data( hCPE->hCoreCoder[0]->hTcxLtpDec, hCPE->hCoreCoder[1]->hTcxLtpDec, output_Fs );
                }
                else
                {
                    cpy_tcx_ltp_data( &tcxLtpTmp, hCPE->hCoreCoder[1]->hTcxLtpDec, output_Fs );
                }
#else
                cpy_tcx_ltp_data( &tcxLtpTmp, hCPE->hCoreCoder[1]->hTcxLtpDec, output_Fs );
#endif
            }

            if ( hCPE->last_element_mode == IVAS_CPE_TD )
            {
@@ -1047,6 +1058,14 @@ void synchro_synthesis(
            }
        }

#ifdef FIX_MDCT_AND_MC_MONO_ISSUES
        if ( hCPE->nchan_out == 1 && hCPE->last_element_mode == IVAS_CPE_MDCT )
        {
            v_add( sts[0]->prev_synth_buffer, sts[1]->prev_synth_buffer, sts[0]->prev_synth_buffer, delay_comp_DFT );
            v_multc( sts[0]->prev_synth_buffer, INV_SQRT_2, sts[0]->prev_synth_buffer, delay_comp_DFT );
        }
#endif

        if ( use_cldfb_for_last_dft )
        {
            /* delay CLDFB-based mono output (<= 24.4 kbps) to be aligned with DFT-based mono output (32 kbps), needed to avoid discontinuities with TCX-LTP. */
@@ -1142,6 +1161,16 @@ void synchro_synthesis(
            }
        }

#ifdef FIX_MDCT_AND_MC_MONO_ISSUES
        /* if previous frame had only one channel copy buffers to other channel */
        if ( hCPE->nchan_out == 1 && hCPE->element_mode == IVAS_CPE_MDCT && hCPE->last_element_mode == IVAS_CPE_DFT )
        {
            mvr2r( sts[0]->prev_synth_buffer, sts[1]->prev_synth_buffer, delay_comp_TD );
            mvr2r( tmp_out[0], tmp_out[1], delay_cldfb );
            mvr2r( p_output_mem[0], p_output_mem[1], delay_diff );
        }
#endif

        /*----------------------------------------------------------------*
         * update DFT synthesis overlap memory @output_Fs; needed for TD->DFT stereo switching
         *----------------------------------------------------------------*/
@@ -1263,7 +1292,11 @@ void synchro_synthesis(
            }

            /* cross-fading between DFT OLA memory and TD output */
#ifdef FIX_MDCT_AND_MC_MONO_ISSUES
            for ( n = 0; n < nChannels; n++ )
#else
            for ( n = 0; n < hCPE->nchan_out; n++ )
#endif
            {
                if ( hCPE->element_mode == IVAS_CPE_MDCT )
                {