Commit 399f1cb9 authored by Vidhya V P's avatar Vidhya V P
Browse files

Fix for issue#368 in SBA

parent 89dedadd
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -203,6 +203,10 @@ ivas_error pre_proc_front_ivas(
    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*/
    const int32_t ivas_total_brate                             /* i  : IVAS total bitrate                         */
#ifdef FIX_368_SBA_MODE
    ,
    const int16_t sba_mode_flag
#endif
);

ivas_error pre_proc_ivas(
+1 −1
Original line number Diff line number Diff line
@@ -163,7 +163,7 @@
#define FIX_SP2A                                        /* VA: Issue 412: Adjust threshold for the S_p2a feature in the tonal detector */
#define FIX_413_SBA_DTX                                 /* Dlb: Fix for issue 413, SBA DTX CNG in 2TC mode*/
#define FIX_417_TD_DECORR_BRATE_SW                      /* VA: Issue 417: fix incorrect use of TD decorrelator in bitrate switching */

#define FIX_368_SBA_MODE                                /* Issue 368: Fix for the SBA mode*/

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+4 −0
Original line number Diff line number Diff line
@@ -3866,6 +3866,10 @@ void dtx(
    const int32_t ivas_total_brate, /* i  : IVAS total bitrate                */
    const int16_t vad,              /* i  : VAD flag for DTX                            */
    const float speech[]            /* i  : Pointer to the speech frame                 */
#ifdef FIX_368_SBA_MODE
    ,
    const int16_t sba_mode_flag
#endif
);

void dtx_hangover_control(
+4 −0
Original line number Diff line number Diff line
@@ -310,7 +310,11 @@ void amr_wb_enc(
    {
        st->fd_cng_reset_flag = 0;
    }
#ifndef FIX_368_SBA_MODE
    dtx( st, -1, vad_flag_dtx, inp );
#else
    dtx( st, -1, vad_flag_dtx, inp, 0 );
#endif
    /*----------------------------------------------------------------*
     * Noise energy down-ward update and total noise energy estimation
     * Long-term energies and relative frame energy updates
+27 −2
Original line number Diff line number Diff line
@@ -65,7 +65,9 @@

#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 */

#ifdef FIX_368_SBA_MODE
#define MAX_BRATE_DTX_IVAS_SBA IVAS_80k
#endif
/*-------------------------------------------------------------------*
 * Local function prototypes
 *-------------------------------------------------------------------*/
@@ -83,10 +85,17 @@ void dtx(
    const int32_t ivas_total_brate, /* i  : IVAS total bitrate                 */
    const int16_t vad,              /* i  : VAD flag for DTX                   */
    const float speech[]            /* i  : Pointer to the speech frame        */
#ifdef FIX_368_SBA_MODE
    ,
    const int16_t sba_mode_flag
#endif
)
{
    float alpha;

#ifdef FIX_368_SBA_MODE
    int32_t max_brate_dtx_ivas;
    max_brate_dtx_ivas = ( sba_mode_flag ) ? MAX_BRATE_DTX_IVAS_SBA : MAX_BRATE_DTX_IVAS;
#endif
    DTX_ENC_HANDLE hDtxEnc = st->hDtxEnc;

    int16_t last_br_cng_flag, last_br_flag, br_dtx_flag;
@@ -98,9 +107,15 @@ void dtx(
    }
    else
    {
#ifdef FIX_368_SBA_MODE
        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 <= 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 );
#endif
        br_dtx_flag = 0;
    }

@@ -176,9 +191,15 @@ void dtx(

    if ( st->dtx_sce_sba == 0 )
    {
#ifdef FIX_368_SBA_MODE
        br_dtx_flag = ( st->element_mode == EVS_MONO && st->total_brate <= max_brate_dtx_ivas ) ||
                      ( st->element_mode != EVS_MONO && ivas_total_brate <= max_brate_dtx_ivas ) ||
                      st->lp_noise < 15;
#else
        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;
#endif
    }

    if ( st->Opt_DTX_ON && vad == 0 &&
@@ -238,7 +259,11 @@ void dtx(
        }
        else
        {
#ifdef FIX_368_SBA_MODE
            if ( ( st->cng_type == FD_CNG && ( st->total_brate <= MAX_BRATE_DTX_EVS || ( st->element_mode == IVAS_SCE && ivas_total_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 <= MAX_BRATE_DTX_EVS || ( st->element_mode == IVAS_SCE && ivas_total_brate <= MAX_BRATE_DTX_IVAS ) ) ) || ( 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