Commit 143eadea authored by eichenseer's avatar eichenseer
Browse files

Accepted PARAM_ISM_DTX_CNG_STABILIZE_SW_DECISION (part of PARAM_ISM_DTX_CNG).

parent ec5a6d17
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -155,9 +155,8 @@

#define FIX_310_TD_REND_DELAY                           /* Adding HRTF delay being read from ROM/Binary file, fix rounding for delay compensation in renderer */

#define PARAM_ISM_DTX_CNG                               /* Support of DTX/CNG for Param-ISM */ 
#define PARAM_ISM_DTX_CNG                               /* Support of DTX/CNG for Param-ISM, includes updates */ 
#ifdef PARAM_ISM_DTX_CNG
#define PARAM_ISM_DTX_CNG_STABILIZE_SW_DECISION         /* Patch to stabilize the switching decision */
#define PARAM_ISM_DTX_CNG_EST_RES_SPEC_DEC              /* Patch to estimate noise at decoder, includes USE_NOISE_EST_FROM_CORE_PARAM_ISM_DTX */
// choose one of the following:
//#define TMP_FIX                                         /* set cng_type to FD_CNG, quick hack; TODO: move init to correct place */
+3 −13
Original line number Diff line number Diff line
@@ -695,10 +695,7 @@ void ivas_param_ism_get_DTX_flag(
)
{
    int16_t i;
#ifdef PARAM_ISM_DTX_CNG_STABILIZE_SW_DECISION
    int16_t val;
#endif 


    /* Move the DTX/CNG speech buffer */
    for ( i = 0; i < ( PARAM_ISM_HYS_BUF_SIZE - 1 ); i++ )
@@ -738,9 +735,9 @@ void ivas_param_ism_get_DTX_flag(
        st_ivas->hDirAC->hParamIsm->dtx_speech_buffer_enc[i] = 0;
    }

    /* Do a decision based on hysterisis */
    /* Do a decision based on hysteresis */
    st_ivas->hDirAC->hParamIsm->paramISM_DTX_CNG_FLAG = 1;
#ifdef PARAM_ISM_DTX_CNG_STABILIZE_SW_DECISION

    for (i = 1;i < (PARAM_ISM_HYS_BUF_SIZE - 1);i++)
    {
        if ((st_ivas->hDirAC->hParamIsm->dtx_speech_buffer_enc[i + 1] == 1) && (st_ivas->hDirAC->hParamIsm->dtx_speech_buffer_enc[i - 1] == 1) && (st_ivas->hDirAC->hParamIsm->dtx_speech_buffer_enc[i] == 0))
@@ -758,12 +755,6 @@ void ivas_param_ism_get_DTX_flag(
            st_ivas->hDirAC->hParamIsm->paramISM_DTX_CNG_FLAG = st_ivas->hDirAC->hParamIsm->paramISM_DTX_CNG_FLAG && st_ivas->hDirAC->hParamIsm->dtx_speech_buffer_enc[i];
        }
    }
#else
    for (i = 0; i < PARAM_ISM_HYS_BUF_SIZE; i++)
    {
        st_ivas->hDirAC->hParamIsm->paramISM_DTX_CNG_FLAG = st_ivas->hDirAC->hParamIsm->paramISM_DTX_CNG_FLAG && st_ivas->hDirAC->hParamIsm->dtx_speech_buffer_enc[i];
    }
#endif
 

    if ( st_ivas->hDirAC->hParamIsm->paramISM_DTX_CNG_FLAG )
@@ -773,14 +764,13 @@ void ivas_param_ism_get_DTX_flag(
        st_ivas->hSCE[0]->hCoreCoder[0]->cng_type = FD_CNG;
        st_ivas->hSCE[1]->hCoreCoder[0]->cng_type = FD_CNG;

#ifdef PARAM_ISM_DTX_CNG_STABILIZE_SW_DECISION
        /* synchronize the core bitrate */
        if ( (st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == -1) && (st_ivas->hSCE[0]->hCoreCoder[0]->last_core_brate == SID_2k40 || st_ivas->hSCE[0]->hCoreCoder[0]->last_core_brate == FRAME_NO_DATA))
        {
            st_ivas->hSCE[0]->hCoreCoder[0]->core_brate = st_ivas->hSCE[0]->hCoreCoder[0]->last_core_brate;
            reset_indices_enc(st_ivas->hSCE[0]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES);
        }
#endif 

        st_ivas->hSCE[1]->hCoreCoder[0]->core_brate = st_ivas->hSCE[0]->hCoreCoder[0]->core_brate;
    }
    else