Commit d78a4fbe authored by vaillancour's avatar vaillancour
Browse files

fix proposal for 778, solve some bitrate switching issues

parent 1d43b578
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -138,6 +138,7 @@
#define FIX_770_DISCONTINUITIES_SW_TCX2ACELP  // Fix discontinuities when switching from TCX to ACELP
#define FIX_680_CNG_FRAME_BOUNDARIES_ISSUE /* Step was right shift by 2, which made the OVA wrong */
#define NONBE_FIX_1069_SVD_TUNING                       /* FhG: issue 1069: tune SVD constants */
#define FIX_778_STEREO_BRATE_SWITCHING
/* ################## End DEVELOPMENT switches ######################### */

/* clang-format on */
+4 −0
Original line number Diff line number Diff line
@@ -576,6 +576,10 @@ ivas_error ivas_core_dec(
                    {
                        st->hHQ_core->Q_fer_samples = 0;
                    }
#ifdef FIX_778_STEREO_BRATE_SWITCHING
                    st->Q_syn = 0;
                    move16();
#endif
                    st->prev_Q_syn = st->Q_syn;

                    Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, st->Q_syn - st->hHQ_core->Q_old_wtda_LB );
+37 −17
Original line number Diff line number Diff line
@@ -47,7 +47,9 @@ void tcx_decoder_memory_update(
    Copy(xn_buf, synth, L_frame_glob);
    Copy(synth + sub(L_frame_glob, M+1), st->syn, M+1);

#ifndef FIX_778_STEREO_BRATE_SWITCHING
    IF (NE_16(st->element_mode, IVAS_CPE_MDCT))
#endif
    {
        IF(!fb)    /* TV2FhG -> Condition differs from floating point */
        {
@@ -55,11 +57,26 @@ void tcx_decoder_memory_update(
            /* Emphasis of synth -> synth_pe */
            tmp = synth[-M - 1];
            move16();
#ifdef FIX_778_STEREO_BRATE_SWITCHING
            IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) )
            {
#endif
                st->Q_syn = E_UTIL_f_preemph3( synth - M, preemph, add( M, L_frame_glob ), &tmp, 1 );
                st->prev_Q_syn = st->Q_syn = st->Q_syn - 1;
#ifdef FIX_778_STEREO_BRATE_SWITCHING
            }
            ELSE
            {
                E_UTIL_f_preemph2( 2, synth - M, preemph, add( M, L_frame_glob ), &tmp );
                st->prev_Q_syn = st->Q_syn = 0; /* in case of MDCT, Q0 seems to be used*/
            }
#endif
            Copy(synth + sub(L_frame_glob, M), st->mem_syn2_fx, M);
            Copy(synth + sub(L_frame_glob, L_SYN_MEM), st->mem_syn_r, L_SYN_MEM);

#ifdef FIX_778_STEREO_BRATE_SWITCHING
            IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) )
            {
#endif
                test();
                IF(st->tcxonly == 0 || LE_16(L_frame_glob, L_FRAME16k))
                {
@@ -77,6 +94,9 @@ void tcx_decoder_memory_update(
                }
                /* Update old_Aq */
                Copy(A, st->old_Aq_12_8_fx, M + 1);
#ifdef FIX_778_STEREO_BRATE_SWITCHING
            }
#endif
            }
    }
    return;