Commit edfb9521 authored by multrus's avatar multrus
Browse files

Merge branch 'basop-2518-regression2553-artifact-in-hoa3-bitrate-switching' into 'main'

[non-BE][split-non-BE][allow regression] Resolve "[Regression2553] Artifact in HOA3, Bitrate Switching"

Closes #2518

See merge request !2976
parents 510f03e9 210f5ad1
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -154,6 +154,8 @@
#define FIX_BASOP_2562_HQ_PREECHO_SAT                   /* Eri/Orange: Basop issue 2562: Add saturation to L_add in preecho calculations */
#define FIX_BASOP_2561_STEREO_DFT_ENC_COMPUTE_ITD       /* BASOP issue 2561: fix diffs in stereo_dft_enc_compute_itd() between float and BASOP */
#define FIX_BASOP_2517_CLICK_IN_OMASA_LTV               /* FhG: BASOP #2517: preserve precision by removing one-bit headroom from Q_min and allowing saturation during buffer scaling */
#define NONBE_FIX_ISSUE_2518                            /* FhG: Fix issue 2518, noise during ACELP switching from 16KHz to 12k8Hz by improving Q_new calculation. */
#define NONBE_FIX_ISSUE_2518_TRANSENC_SAT_FIX           /* FhG: Fix issue 2518, fix wrong amplitude because of saturation of x_tran in transf_cdbk_enc_fx() for transient signals. */
#define FIX_BASOP_2559_Q_SYNTH_HISTORY_RESET            /* FhG: BASOP issue 2559: reset hTcxDec->q_synth_history_fx in allocate_CoreCoder_TCX_fx() */
#define FIX_FLOAT_1578_OMASA_REND_SPIKES                /* Nokia: Float issue 1578: Fix spikes and collapsed perception in OMASA/MASA rendering to FOA/HOA */
#define FIX_1521_SBA_LOUDNESS_STEREO                    /* FhG: issue 1521: Fix loudness for SBA to stereo rendering */
+5 −0
Original line number Diff line number Diff line
@@ -117,6 +117,9 @@ ivas_error acelp_core_enc_fx(
            move16();
            hLPDmem->q_mem_syn = sub( Q_new, 1 );
            move16();
#ifdef NONBE_FIX_ISSUE_2518
            st->mem_deemp_preQ_fx = shl_sat( st->mem_deemp_preQ_fx, sub( Q_new, st->prev_Q_new ) );
#endif
        }

        Scale_sig32( st->Bin_E_old_fx, L_FFT / 2, sub( add( Q_new, Q_SCALE - 2 ), st->q_Bin_E_old ) ); // Q_new + Q_scale - 2
@@ -973,6 +976,7 @@ ivas_error acelp_core_enc_fx(
     * Updates
     *-----------------------------------------------------------------*/

#ifndef NONBE_FIX_ISSUE_2518
    IF( st->element_mode > EVS_MONO )
    {
        if ( st->hBWE_TD != NULL )
@@ -983,6 +987,7 @@ ivas_error acelp_core_enc_fx(
        hLPDmem->q_lpd_old_exc = Q_new;
        move16();
    }
#endif

    updt_enc_fx( st, old_exc_fx, pitch_buf, Es_pred_fx, Aq, lsf_new_fx, lsp_new, old_bwe_exc_fx );

+17 −0
Original line number Diff line number Diff line
@@ -28,7 +28,11 @@ static void init_tcx_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const
static void init_core_sig_ana_ivas_fx( Encoder_State *st );
static void init_modes_ivas_fx( Encoder_State *st, const Word32 last_total_brate );
static void init_sig_buffers_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr, const Word32 last_total_brate );
#ifdef NONBE_FIX_ISSUE_2518
static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, const Word32 last_total_brate );
#else
static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 shift, const Word32 last_total_brate );
#endif

/*-----------------------------------------------------------------------*
 * init_coder_ace_plus_fx()
@@ -1085,7 +1089,11 @@ void init_coder_ace_plus_ivas_fx(

    /* Initialize ACELP */

#ifdef NONBE_FIX_ISSUE_2518
    init_acelp_ivas_fx( st, L_frame_old, last_total_brate );
#else
    init_acelp_ivas_fx( st, L_frame_old, 0, last_total_brate );
#endif

    if ( st->ini_frame == 0 )
    {
@@ -1538,7 +1546,11 @@ static void init_core_sig_ana_ivas_fx( Encoder_State *st )
 *
 *
 *-----------------------------------------------------------------------*/
#ifdef NONBE_FIX_ISSUE_2518
static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, const Word32 last_total_brate )
#else
static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 shift, const Word32 last_total_brate )
#endif
{
    Word16 mem_syn_r_size_old;
    Word16 mem_syn_r_size_new;
@@ -1721,8 +1733,13 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh
                    move16();
                    Copy( hLPDmem->mem_syn2, tmp_buf + 1, M );
                    deemph_fx( tmp_buf + 1, st->preemph_fac, M, &tmp );
#ifdef NONBE_FIX_ISSUE_2518
                    Residu3_fx( Ap, tmp_buf + M, &tmp, 1, 0 );
                    hLPDmem->mem_w0 = sub_sat( shl_sat( st->wspeech_enc[-1], sub( hLPDmem->q_mem_syn, sub( Q15, st->exp_buf_wspeech_enc ) ) ), tmp );
#else
                    Residu3_fx( Ap, tmp_buf + M, &tmp, 1, 1 );
                    hLPDmem->mem_w0 = sub_sat( shr_sat( st->wspeech_enc[-1], shift ), tmp );
#endif
                    move16();
                }
            }
+4 −0
Original line number Diff line number Diff line
@@ -386,6 +386,7 @@ void core_coder_mode_switch_ivas_fx(
        move32();
        st->currEnergyHF_e_fx = 0;
        move16();
#ifndef NONBE_FIX_ISSUE_2518
        Word16 shift = getScaleFactor16( st->old_inp_16k_fx, L_INP_MEM );
        Scale_sig( st->old_inp_16k_fx, L_INP_MEM, shift );
        st->exp_old_inp_16k = sub( st->exp_old_inp_16k, shift );
@@ -394,12 +395,15 @@ void core_coder_mode_switch_ivas_fx(
        Scale_sig( st->old_inp_12k8_fx, L_INP_MEM, shift );
        st->exp_old_inp_12k8 = sub( st->exp_old_inp_12k8, shift );
        move16();
#endif
        init_coder_ace_plus_ivas_fx( st, last_total_brate, st->total_brate, MCT_flag );
#ifndef NONBE_FIX_ISSUE_2518
        if ( st->hLPDmem != NULL )
        {
            st->hLPDmem->q_lpd_old_exc = st->prev_Q_new;
            move16();
        }
#endif
    }

    test();
+1 −0
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ void core_encode_update_cng_fx(
        p_A += ( M + 1 );
    }

    assert( st->element_mode == EVS_MONO );
    tmp = sub( st->wspeech_enc[-1], shl( hLPDmem->mem_w0, shift ) );
    E_UTIL_deemph2( negate( shift ), wsyn, st->preemph_fac, st->L_frame, &tmp );
    hLPDmem->mem_w0 = sub_sat( st->wspeech_enc[st->L_frame - 1], tmp );
Loading