Commit ef8999bc authored by eichenseer's avatar eichenseer
Browse files

CNG fixes (force noise estimation for active frames, force FD_CNG for DiscISM) under DISC_CNG.

parent 9ec0c0f4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -164,6 +164,7 @@
/*#define MD_SMOOTH_PARAM_BE*/
/*#define DTX_PARAM_BE*/
#define UNIFY_MD_QUANTIZER
#define DISC_CNG

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+12 −0
Original line number Diff line number Diff line
@@ -414,6 +414,7 @@ void ApplyFdCng(
            hFdCngCom->sid_frame_counter = 0;
            /* set noise estimation inactive during concealment, as no update with noise generated by concealment should be performed. */
            /* set noise estimation inactive when we have bit errors, as no update with noise generated by corrupt frame (biterror) should be performed. */
#ifndef DISC_CNG
            if ( concealWholeFrame == 0 &&
                 ( timeDomainInput == NULL ||
                   ( *timeDomainInput<FLT_MAX && * timeDomainInput>( -FLT_MAX ) &&
@@ -423,6 +424,17 @@ void ApplyFdCng(
                     !( st->cng_type == LP_CNG && hFdCngDec->flag_dtx_mode ) && ( is_music == 0 ) ) ||
                   ( st->element_mode == IVAS_CPE_TD ) ) &&
                 ( !st->BER_detect ) )
#else /* ensure that the noise estimation is always performed outside of a CNG part (ISM only) */
            if ( concealWholeFrame == 0 &&
                 ( timeDomainInput == NULL ||
                   ( *timeDomainInput<FLT_MAX && * timeDomainInput>( -FLT_MAX ) &&
                     *( timeDomainInput + hFdCngCom->frameSize - 1 ) < FLT_MAX &&
                     *( timeDomainInput + hFdCngCom->frameSize - 1 ) > ( -FLT_MAX ) ) ) &&
                 ( ( ( ( st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT && hFdCngDec->flag_dtx_mode ) || !st->VAD || !st->cng_paramISM_flag ) &&
                     !( st->cng_type == LP_CNG && hFdCngDec->flag_dtx_mode ) && ( is_music == 0 ) ) ||
                   ( st->element_mode == IVAS_CPE_TD ) ) &&
                 ( !st->BER_detect ) )
#endif
            {
                /* Perform noise estimation at the decoder */
                perform_noise_estimation_dec( timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD );
+4 −0
Original line number Diff line number Diff line
@@ -78,7 +78,11 @@ ivas_error ivas_sce_dec(
    last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate;

#ifdef PARAM_ISM_DTX_CNG
#ifdef DISC_CNG
    if ( st_ivas->ivas_format == ISM_FORMAT )
#else
    if ( st_ivas->ism_mode == ISM_MODE_PARAM )
#endif
    {
        st->cng_type = FD_CNG; /* TODO: move to init if possible */
    }
+4 −0
Original line number Diff line number Diff line
@@ -730,7 +730,11 @@ void stereo_tcx_core_dec(
        if ( st->element_mode != IVAS_CPE_TD )
        {
#ifdef PARAM_ISM_DTX_CNG
#ifndef DISC_CNG
            if ( ivas_format == ISM_FORMAT && ism_mode == ISM_MODE_PARAM )
#else
            if ( ivas_format == ISM_FORMAT )
#endif
            {
                float buffer[L_FRAME16k];
                lerp( signal_outFB, buffer, st->L_frame, hTcxDec->L_frameTCX );