Commit c939ee8b authored by emerit's avatar emerit
Browse files

Merge branch 'main' into 1963_basop_portFltMR-1568-1471-1690

parents 5a088988 e70d9604
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@
#define FIX_ISSUE_2013_MDCT_STEREO_DTX_DISCONTINUITIES       /* Eri/FhG: Issue 2013 fix for dtx discontinuities */
#define FIX_ISSUE_2013_MDCT_STEREO_FER_DISCONTINUITIES       /* Eri/FhG: Issue 2013 fix for FER discontinuities */
#define FIX_2000_NON_LINEARITY_OVERSHOOT                     /* Eri: Issue 2000: SWB TBE energy overshoot in non-linearity. Aligns with float */
#define FIX_2010_PREP_TBE_EXC                                /* FhG: fix issues with varying Q-values for code_preQ_fx[] */

/* #################### Start BASOP porting switches ############################ */

+12 −9
Original line number Diff line number Diff line
@@ -3192,6 +3192,9 @@ void prep_tbe_exc_fx(
    Word16 bwe_exc_fx[],         /* i/o: excitation for TBE                Q_exc*/
    const Word16 gain_preQ_fx,   /* i  : prequantizer excitation gain           */
    const Word16 code_preQ_fx[], /* i  : prequantizer excitation                */
#ifdef FIX_2010_PREP_TBE_EXC
    const Word16 Q_code_preQ, /* i  : Q, prequantizer excitation             */
#endif
    const Word16 Q_exc,        /* i  : Excitation,           bwe_exc Q-factor */
    const Word16 T0,           /* i  : integer pitch variables             Q0 */
    const Word16 T0_frac,      /* i  : Fractional pitch variables           Q0*/

lib_com/swb_tbe_com_fx.c

100755 → 100644
+32 −11
Original line number Diff line number Diff line
@@ -7203,6 +7203,9 @@ void prep_tbe_exc_fx(
    Word16 bwe_exc_fx[],         /* i/o: excitation for TBE                Q_exc*/
    const Word16 gain_preQ_fx,   /* i  : prequantizer excitation gain           */
    const Word16 code_preQ_fx[], /* i  : prequantizer excitation                */
#ifdef FIX_2010_PREP_TBE_EXC
    const Word16 Q_code_preQ, /* i  : Q, prequantizer excitation             */
#endif
    const Word16 Q_exc,        /* i  : Excitation,           bwe_exc Q-factor */
    const Word16 T0,           /* i  : integer pitch variables             Q0 */
    const Word16 T0_frac,      /* i  : Fractional pitch variables           Q0*/
@@ -7307,6 +7310,20 @@ void prep_tbe_exc_fx(
    ELSE
    {
        Word16 shift = 4;
#ifdef FIX_2010_PREP_TBE_EXC
        /* multrus 2025-09-15
           TODO:
           - leave shift = 4, since this is legacy code from EVS;
           - check with vaillancourt, whether we really have a different scaling of code_preQ_fx[] for IVAS
           - if the different scalings are confirmed, this condition could be simplified
        */
        IF( NE_16( element_mode, EVS_MONO ) )
        {
            /* shift of 4 assumes code_preQ_fx[] in Q10 - this is however not always given */
            shift = add( 2 + 1 - 1, Q_code_preQ ); /* gain_preQ_fx in Q2, code_preQ_fx[] in Q_code_preQ, 1 additional left-shift by L_mult() - factor of 2 (from "2 * gain_preQ * code_preQ[i]") */
            shift = sub( 16, shift );
        }
#endif
        move16();
        IF( gain_preQ_fx != 0 )
        {
@@ -7314,7 +7331,11 @@ void prep_tbe_exc_fx(
            {
                /*code in the encoder is Q9 and there is no <<1 with Mult_32_16 Q16 * Q9 -> Q9 */
                Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */
#ifdef FIX_2010_PREP_TBE_EXC
                Ltemp2 = L_mult( gain_preQ_fx, code_preQ_fx[i] ); /* Q2 + Q_code_preQ */
#else
                Ltemp2 = L_mult( gain_preQ_fx, code_preQ_fx[i] );                                         /*Q2 * Q10 -> Q12  */
#endif

#ifdef ISSUE_1836_replace_overflow_libcom
                Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ );                   /*Q_exc+16 */
+5 −0
Original line number Diff line number Diff line
@@ -532,8 +532,13 @@ void decoder_acelp_fx(
            move16();
            IF( st->igf != 0 )
            {
#ifdef FIX_2010_PREP_TBE_EXC
                prep_tbe_exc_fx( st->L_frame, L_SUBFR, i_subfr, gain_pit, gain_code, code, st->voice_fac, &voice_factors[idx], bwe_exc,
                                 gain_preQ, code_preQ, Q10, st->Q_exc, T0, T0_frac, st->coder_type, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, 0 );
#else
                prep_tbe_exc_fx( st->L_frame, L_SUBFR, i_subfr, gain_pit, gain_code, code, st->voice_fac, &voice_factors[idx], bwe_exc,
                                 gain_preQ, code_preQ, st->Q_exc, T0, T0_frac, st->coder_type, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, 0 );
#endif
            }

            /*---------------------------------------------------------*
+27 −0
Original line number Diff line number Diff line
@@ -100,6 +100,10 @@ ivas_error decod_gen_voic_fx(
    Word16 pf_temp[MAXLAG_WI];
    Word16 pf_n2[MAXLAG_WI];
    MUSIC_POSTFILT_HANDLE hMusicPF;
#ifdef FIX_2010_PREP_TBE_EXC
    Word16 Q_code_preQ;
#endif

    gain_pit_fx = 0;
    gain_code_fx = 0;
    norm_gain_code_fx = 0;
@@ -322,10 +326,33 @@ ivas_error decod_gen_voic_fx(
            idx = idiv1616( i_subfr_fx, L_SUBFR );
        }

#ifdef FIX_2010_PREP_TBE_EXC
        /*
          2025-09-15 multrus:
          TODO:
          check with vaillancourt
          - where this difference between EVS and IVAS comes from
          - where Q_code_preQ could be derived
          - whether any of the above calculations need to be adjusted
         */
        Q_code_preQ = Q6;
        move16();
        if ( EQ_16( st_fx->element_mode, EVS_MONO ) )
        {
            Q_code_preQ = Q10;
            move16();
        }

        prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr_fx, gain_pit_fx, gain_code_fx, code_fx, voice_fac_fx,
                         &voice_factors_fx[idx], bwe_exc_fx, gain_preQ_fx, code_preQ_fx, Q_code_preQ,
                         st_fx->Q_exc, T0_fx, T0_frac_fx, st_fx->coder_type, st_fx->core_brate,
                         st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag );
#else
        prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr_fx, gain_pit_fx, gain_code_fx, code_fx, voice_fac_fx,
                         &voice_factors_fx[idx], bwe_exc_fx, gain_preQ_fx, code_preQ_fx,
                         st_fx->Q_exc, T0_fx, T0_frac_fx, st_fx->coder_type, st_fx->core_brate,
                         st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag );
#endif


        /*----------------------------------------------------------------*
Loading