Commit 35559473 authored by vaclav's avatar vaclav
Browse files

formal improvements

parent 8808300f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1165,9 +1165,9 @@ void ivas_get_ism_sid_quan_bitbudget(

#ifdef CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE
void ivas_ism_dtx_limit_noise_energy_for_near_silence(
    SCE_DEC_HANDLE hSCE[],
    const int16_t sce_id_dtx,
    const int16_t nchan_transport
    SCE_DEC_HANDLE hSCE[],                                      /* i/o: SCE encoder structures                      */
    const int16_t sce_id_dtx,                                   /* i  : SCE DTX ID                                  */
    const int16_t nchan_transport                               /* i  : number of transport channels                */
);
#endif

+1 −1
Original line number Diff line number Diff line
@@ -182,7 +182,7 @@ ivas_error ivas_dec(
            }
#ifdef CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE

            /* decode dominant object first so we can limit the noise energy of the other objects */
            /* decode dominant object first so the noise energy of the other objects can be limited */
            if ( ( error = ivas_sce_dec( st_ivas, st_ivas->hISMDTX.sce_id_dtx, &output[st_ivas->hISMDTX.sce_id_dtx], output_frame, nb_bits_metadata[st_ivas->hISMDTX.sce_id_dtx] ) ) != IVAS_ERR_OK )
            {
                return error;
+12 −14
Original line number Diff line number Diff line
@@ -158,21 +158,23 @@ ivas_error ivas_ism_dtx_dec(
    return IVAS_ERR_OK;
}


#ifdef CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE
/*-------------------------------------------------------------------*
 * ivs_ism_dtx_limit_noise_energy_for_near_silence
 * ivs_ism_dtx_limit_noise_energy_for_near_silence()
 *
 * for DTX frames where the energy of the sent noise estimate of the dominant object
 * is near silence, limit the other objects CNG energies to the same level
 *
 *-------------------------------------------------------------------*/

void ivas_ism_dtx_limit_noise_energy_for_near_silence(
    SCE_DEC_HANDLE hSCE[],
    const int16_t sce_id_dtx,
    const int16_t nchan_transport )
    SCE_DEC_HANDLE hSCE[],        /* i/o: SCE encoder structures          */
    const int16_t sce_id_dtx,     /* i  : SCE DTX ID                      */
    const int16_t nchan_transport /* i  : number of transport channels    */
)
{
    float cng_noise_nrg_dominant;
    int16_t cng_noise_level_len;
    float fac, cng_noise_nrg_obj, cng_noise_nrg_dominant;
    int16_t ch, cng_noise_level_len;
    HANDLE_FD_CNG_COM hFdCngCom;

    hFdCngCom = hSCE[sce_id_dtx]->hCoreCoder[0]->hFdCngDec->hFdCngCom;
@@ -181,23 +183,19 @@ void ivas_ism_dtx_limit_noise_energy_for_near_silence(

    if ( cng_noise_nrg_dominant < 1.f )
    {
        for ( int16_t n = 0; n < nchan_transport; n++ )
        for ( ch = 0; ch < nchan_transport; ch++ )
        {
            float cng_noise_nrg_obj;

            if ( n == sce_id_dtx )
            if ( ch == sce_id_dtx )
            {
                continue;
            }

            hFdCngCom = hSCE[n]->hCoreCoder[0]->hFdCngDec->hFdCngCom;
            hFdCngCom = hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom;
            cng_noise_level_len = hFdCngCom->stopFFTbin - hFdCngCom->startBand;
            cng_noise_nrg_obj = dotp( hFdCngCom->cngNoiseLevel, hFdCngCom->cngNoiseLevel, cng_noise_level_len );

            if ( cng_noise_nrg_obj > cng_noise_nrg_dominant )
            {
                float fac;

                fac = sqrtf( cng_noise_nrg_dominant / cng_noise_nrg_obj );
                v_multc( hFdCngCom->cngNoiseLevel, fac, hFdCngCom->cngNoiseLevel, cng_noise_level_len );
            }