Commit ca1ac4d1 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch '1226-lp-noise-threshold-mismatch-in-dtx' into 'main'

[non-BE] Resolve "LP noise threshold mismatch in DTX"

Closes #1226

See merge request !1150
parents c602cc48 2158608c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -932,6 +932,10 @@ typedef enum
#define GAIN_PRED_ORDER                     4                       /* Gain quantization - prediction order for gain quantizer (only for AMR-WB IO mode) */
#define MEAN_ENER                           30                      /* Gain quantization - average innovation energy */

#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD
#define DTX_THR                             5                       /* DTX - lp_noise threshold for DTX at higher bitrates */
#endif

#define DTX_HIST_SIZE                       8                       /* CNG & DTX - number of last signal frames used for CNG averaging */
#define CNG_ISF_FACT                        0.9f                    /* CNG & DTX - CNG spectral envelope smoothing factor */
#define STEP_AMR_WB_SID                     2.625f                  /* CNG & DTX - CNG energy quantization step */
+1 −0
Original line number Diff line number Diff line
@@ -170,4 +170,5 @@
#define FIX_1298                                /* VA: fix possible assert in gaus_enc */
#define FIX_1300_ICA_SHIFT_QUANT_IMPROV         /* VA: Fix to 1300 to improve precision of the lag quantizer */
#define FIX_1301_CORRECT_TD_CNST                /* VA: Fix 1301, correct wrong constant in TD stereo */
#define NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD      /* VA/Eri: FLP issue 1277: Fix Mismatch in DTX high-rate threshold between EVS float and BASOP */
#endif
+14 −12
Original line number Diff line number Diff line
@@ -30,9 +30,9 @@

#define CNG_TYPE_HO 20 /* hangover for switching between CNG types */

/* _DIFF_FLOAT_FIX_ : lp_noise_fx threshold is different between float (15) and fix (5*256) */
#define LP_NOISE_LV 5 /* LP_NOISE level */

#ifndef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD
#define DTX_THR 5 /* LP_NOISE level */
#endif

#define MAX_BRATE_DTX_EVS  ACELP_24k40 /* maximum bitrate to which the default DTX is applied in EVS; otherwise DTX is applied only in silence */
#define MAX_BRATE_DTX_IVAS IVAS_64k    /* maximum bitrate to which the default DTX is applied in IVAS; otherwise DTX is applied only in silence */
@@ -104,11 +104,10 @@ void dtx_ivas_fx(
    }
    ELSE
    {
        /* _DIFF_FLOAT_FIX_ : lp_noise_fx threshold is different between float (15) and fix (5*256) */
        test();
        test();
        test();
        last_br_cng_flag = LE_32( st_fx->last_total_brate_cng, ACELP_24k40 ) || LT_16( st_fx->lp_noise_fx, LP_NOISE_LV * 256 ) || ( EQ_16( st_fx->element_mode, IVAS_SCE ) && LE_32( st_fx->last_total_brate_cng, ACELP_32k ) );
        last_br_cng_flag = LE_32( st_fx->last_total_brate_cng, ACELP_24k40 ) || LT_16( st_fx->lp_noise_fx, DTX_THR * 256 ) || ( EQ_16( st_fx->element_mode, IVAS_SCE ) && LE_32( st_fx->last_total_brate_cng, ACELP_32k ) );

        test();
        test();
@@ -117,9 +116,9 @@ void dtx_ivas_fx(
#ifdef NONBE_1211_DTX_BR_SWITCHING
        last_br_flag = ( st_fx->element_mode == EVS_MONO && LE_32( st_fx->last_total_brate, MAX_BRATE_DTX_EVS ) ) ||
                       ( st_fx->element_mode != EVS_MONO && LE_32( last_ivas_total_brate, MAX_BRATE_DTX_IVAS ) ) ||
                       LT_16( st_fx->lp_noise_fx, LP_NOISE_LV * 256 );
                       LT_16( st_fx->lp_noise_fx, DTX_THR * 256 );
#else
        last_br_flag = LE_32( st_fx->last_total_brate, ACELP_24k40 ) || LT_16( st_fx->lp_noise_fx, LP_NOISE_LV * 256 ) || ( EQ_16( st_fx->element_mode, IVAS_SCE ) && LE_32( st_fx->last_total_brate, ACELP_32k ) );
        last_br_flag = LE_32( st_fx->last_total_brate, ACELP_24k40 ) || LT_16( st_fx->lp_noise_fx, DTX_THR * 256 ) || ( EQ_16( st_fx->element_mode, IVAS_SCE ) && LE_32( st_fx->last_total_brate, ACELP_32k ) );
        br_dtx_flag = 0;
        move16();
#endif
@@ -232,7 +231,11 @@ void dtx_ivas_fx(
        test();
        br_dtx_flag = ( ( st_fx->element_mode == EVS_MONO ) && LE_32( st_fx->total_brate, MAX_BRATE_DTX_EVS ) ) ||
                      ( ( st_fx->element_mode != EVS_MONO ) && LE_32( ivas_total_brate, MAX_BRATE_DTX_IVAS ) ) ||
#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD
                      LT_16( st_fx->lp_noise_fx, DTX_THR * 256 );
#else
                      LT_16( st_fx->lp_noise_fx, 3840 /*15 in Q8*/ );
#endif
    }
    test();
    test();
@@ -674,10 +677,9 @@ void dtx_fx(
    }
    ELSE
    {
        /* _DIFF_FLOAT_FIX_ : lp_noise_fx threshold is different between float (15) and fix (5*256) */
        last_br_cng_flag = LE_32( st_fx->last_total_brate_cng, ACELP_24k40 ) || LT_16( st_fx->lp_noise_fx, LP_NOISE_LV * 256 ) || ( EQ_16( st_fx->element_mode, IVAS_SCE ) && LE_32( st_fx->last_total_brate_cng, ACELP_32k ) );
        last_br_cng_flag = LE_32( st_fx->last_total_brate_cng, ACELP_24k40 ) || LT_16( st_fx->lp_noise_fx, DTX_THR * 256 ) || ( EQ_16( st_fx->element_mode, IVAS_SCE ) && LE_32( st_fx->last_total_brate_cng, ACELP_32k ) );

        last_br_flag = LE_32( st_fx->last_total_brate, ACELP_24k40 ) || LT_16( st_fx->lp_noise_fx, LP_NOISE_LV * 256 ) || ( EQ_16( st_fx->element_mode, IVAS_SCE ) && LE_32( st_fx->last_total_brate, ACELP_32k ) );
        last_br_flag = LE_32( st_fx->last_total_brate, ACELP_24k40 ) || LT_16( st_fx->lp_noise_fx, DTX_THR * 256 ) || ( EQ_16( st_fx->element_mode, IVAS_SCE ) && LE_32( st_fx->last_total_brate, ACELP_32k ) );
        br_dtx_flag = 0;
        move16();
    }
@@ -772,8 +774,8 @@ void dtx_fx(
    if ( st_fx->dtx_sce_sba == 0 )
#endif
    {
        br_dtx_flag = LE_32( st_fx->total_brate, ACELP_24k40 ) || LT_16( st_fx->lp_noise_fx, LP_NOISE_LV * 256 ) || ( EQ_16( st_fx->element_mode, IVAS_SCE ) && LE_32( st_fx->total_brate, ACELP_32k ) ) ||
                      EQ_16( st_fx->element_mode, IVAS_CPE_DFT ) || ( EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) && ( LE_32( st_fx->element_brate, IVAS_64k ) || LT_16( st_fx->lp_noise_fx, LP_NOISE_LV * 256 ) ) );
        br_dtx_flag = LE_32( st_fx->total_brate, ACELP_24k40 ) || LT_16( st_fx->lp_noise_fx, DTX_THR * 256 ) || ( EQ_16( st_fx->element_mode, IVAS_SCE ) && LE_32( st_fx->total_brate, ACELP_32k ) ) ||
                      EQ_16( st_fx->element_mode, IVAS_CPE_DFT ) || ( EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) && ( LE_32( st_fx->element_brate, IVAS_64k ) || LT_16( st_fx->lp_noise_fx, DTX_THR * 256 ) ) );
    }
    test();
    test();
+4 −0
Original line number Diff line number Diff line
@@ -177,7 +177,11 @@ Word16 ivas_ism_dtx_enc_fx(
            ( EQ_16( nchan_ism, 2 ) && LE_32( ivas_total_brate, IVAS_48k ) ) ||
            ( EQ_16( nchan_ism, 3 ) && LE_32( ivas_total_brate, IVAS_80k ) ) ||
            ( EQ_16( nchan_ism, 4 ) && LE_32( ivas_total_brate, IVAS_96k ) ) ||
#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD
            LT_16( lp_noise_max_fx, ( DTX_THR << 8 ) ) ) )
#else
            LT_16( lp_noise_max_fx, ( 15 << 8 ) ) ) )
#endif
    {
        dtx_flag = 0;
        move16();