Commit 6ff997cc authored by vaclav's avatar vaclav
Browse files

Issue 118: fix the DTX usage: default DTX up to 64 kbps, otherwise only in...

Issue 118: fix the DTX usage: default DTX up to 64 kbps, otherwise only in silence; under FIX_DTX_RANGE
parent 3055ca9e
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -185,6 +185,9 @@ ivas_error pre_proc_front_ivas(
    const int16_t front_vad_flag,                               /* i  : front-VAD flag to overwrite VAD decision   */
    const int16_t force_front_vad,                              /* i  : flag to force VAD decision                 */
    const int16_t front_vad_dtx_flag                            /* i  : front-VAD DTX flag to overwrite VAD decision*/
#ifdef FIX_DTX_RANGE
   ,const int32_t ivas_total_brate                             /* i  : IVAS total bitrate                       */
#endif
);

ivas_error pre_proc_ivas(
+1 −1
Original line number Diff line number Diff line
@@ -149,7 +149,7 @@
#define FIX_I106_TDREND_5MS                             /* Issue 106: 5 ms update rate in TD object renderer */
#define ALIGN_SID_SIZE                                  /* Issue 111: make all DTX modes use one SID frame bitrate (5.2 kbps) */
#define FIX_135_MDCT_STEREO_MODE_UNINITIALIZED          /* Issue 135: fix uninitialized value usage in SBA MDCT-Stereo core with PLC */

#define FIX_DTX_RANGE                                   /* Issue 118: fix the DTX usage: default DTX up to 64 kbps, otherwise only in silence */



+4 −1
Original line number Diff line number Diff line
@@ -3890,6 +3890,9 @@ void td_cng_enc_init(

void dtx(
    Encoder_State *st, /* i/o: encoder state structure                     */
#ifdef FIX_DTX_RANGE
    const int32_t ivas_total_brate, /* i  : IVAS total bitrate                */
#endif
    const int16_t vad,   /* i  : VAD flag for DTX                            */
    const float speech[] /* i  : Pointer to the speech frame                 */
);
+4 −0
Original line number Diff line number Diff line
@@ -311,7 +311,11 @@ void amr_wb_enc(
        st->fd_cng_reset_flag = 0;
    }

#ifdef FIX_DTX_RANGE
    dtx( st, -1, vad_flag_dtx, inp );
#else
    dtx( st, vad_flag_dtx, inp );
#endif

    /*----------------------------------------------------------------*
     * Noise energy down-ward update and total noise energy estimation
+24 −1
Original line number Diff line number Diff line
@@ -63,6 +63,10 @@

#define LTE_VAR -4.0f

#ifdef FIX_DTX_RANGE
#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 */
#endif

/*-------------------------------------------------------------------*
 * Local function prototypes
@@ -78,6 +82,9 @@ static void update_SID_cnt( DTX_ENC_HANDLE hDtxEnc, const int32_t core_brate, co

void dtx(
    Encoder_State *st, /* i/o: encoder state structure            */
#ifdef FIX_DTX_RANGE
    const int32_t ivas_total_brate, /* i  : IVAS total bitrate                 */
#endif
    const int16_t vad,   /* i  : VAD flag for DTX                   */
    const float speech[] /* i  : Pointer to the speech frame        */
)
@@ -96,9 +103,15 @@ void dtx(
    }
    else
    {
#ifdef FIX_DTX_RANGE
        last_br_cng_flag = st->last_total_brate_cng <= MAX_BRATE_DTX_EVS || st->lp_noise < 15 || ( st->element_mode == IVAS_SCE && st->last_total_brate_cng <= MAX_BRATE_DTX_IVAS );

        last_br_flag = st->last_total_brate <= MAX_BRATE_DTX_EVS || st->lp_noise < 15 || ( st->element_mode == IVAS_SCE && st->last_total_brate <= MAX_BRATE_DTX_IVAS );
#else
        last_br_cng_flag = st->last_total_brate_cng <= ACELP_24k40 || st->lp_noise < 15 || ( ( st->element_mode == IVAS_SCE ) && st->last_total_brate_cng <= ACELP_32k );

        last_br_flag = st->last_total_brate <= ACELP_24k40 || st->lp_noise < 15 || ( ( st->element_mode == IVAS_SCE ) && st->last_total_brate <= ACELP_32k );
#endif
        br_dtx_flag = 0;
    }

@@ -174,8 +187,14 @@ void dtx(

    if ( st->dtx_sce_sba == 0 )
    {
#ifdef FIX_DTX_RANGE
        br_dtx_flag = ( st->element_mode == EVS_MONO && st->total_brate <= MAX_BRATE_DTX_EVS ) ||
                      ( st->element_mode != EVS_MONO && ivas_total_brate <= MAX_BRATE_DTX_IVAS ) ||
                      st->lp_noise < 15;
#else
        br_dtx_flag = st->total_brate <= ACELP_24k40 || st->lp_noise < 15 || ( st->element_mode == IVAS_SCE && st->total_brate <= ACELP_32k ) ||
                      st->element_mode == IVAS_CPE_DFT || ( st->element_mode == IVAS_CPE_MDCT && ( st->element_brate <= IVAS_64k || st->lp_noise < 15 ) );
#endif
    }

    if ( st->Opt_DTX_ON && vad == 0 &&
@@ -235,7 +254,11 @@ void dtx(
        }
        else
        {
#ifdef FIX_DTX_RANGE
            if ( ( st->cng_type == FD_CNG && ( st->total_brate <= MAX_BRATE_DTX_EVS || ( st->element_mode == IVAS_SCE && st->element_brate <= MAX_BRATE_DTX_IVAS ) ) ) || ( st->element_mode == IVAS_CPE_MDCT ) ) /* at highest bitrates, use exclusively LP_CNG */
#else
            if ( ( st->cng_type == FD_CNG && ( st->total_brate <= ACELP_24k40 || ( st->element_mode == IVAS_SCE && st->total_brate <= ACELP_32k ) ) ) || ( st->element_mode == IVAS_CPE_MDCT ) ) /* at highest bitrates, use exclusively LP_CNG */
#endif
            {
                if ( st->element_mode == EVS_MONO && ( st->total_brate == ACELP_9k60 || st->total_brate == ACELP_16k40 || st->total_brate == ACELP_24k40 ) )
                {
Loading