Commit 41b5c863 authored by multrus's avatar multrus
Browse files

prep_tbe_exc_fx(): introduce differen Q-factors for code_preQ_fx[]

parent e95243e9
Loading
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
+26 −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,14 @@ void prep_tbe_exc_fx(
    ELSE
    {
        Word16 shift = 4;
#ifdef FIX_2010_PREP_TBE_EXC
        IF( element_mode != EVS_MONO )
        {
            /* shift of 4 assumes code_preQ_fx[] in Q9 - 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 +7325,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, Q9, 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
            }

            /*---------------------------------------------------------*
+7 −0
Original line number Diff line number Diff line
@@ -322,10 +322,17 @@ ivas_error decod_gen_voic_fx(
            idx = idiv1616( i_subfr_fx, L_SUBFR );
        }

#ifdef FIX_2010_PREP_TBE_EXC
        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, Q6,
                         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