Commit abfc13af authored by reutelhuber's avatar reutelhuber
Browse files

Merge branch...

Merge branch '85-bug-in-itd-estimation-if-input-sampling-rate-is-48-khz-but-max_band-is-set-to-wb-or-swb' into 'main'

[Non-BE] fix bug where wrong number of bands is used in ITD estimator function...

See merge request !94
parents 45976f51 41a60d1a
Loading
Loading
Loading
Loading
Loading

lib_com/options.h

100644 → 100755
+3 −1
Original line number Diff line number Diff line
@@ -149,6 +149,8 @@

#define LBR_SBA_CORE_CODING_TUNING                      /* Contribution "3 Core Coder Tuning for low bitrate SBA with 2 TCs" */

#define FIX_WRONG_NBANDS_IN_ITD_ESTIMATION              /* Issue 85: fix incorrect setting of nbands in calc_mean_E_ratio() if bwidth is limited on commandline*/


#define FIX_I87                                         /*  fix for issue 86: incorrect Ambisonics order set for head rotation in SBA */

+14 −0
Original line number Diff line number Diff line
@@ -446,7 +446,9 @@ static float calc_mean_E_ratio(
    ITD_DATA_HANDLE hItd,
    int16_t nbands,
    int16_t band_limits[],
#ifndef FIX_WRONG_NBANDS_IN_ITD_ESTIMATION
    const int16_t NFFT,
#endif
    const float sfm,
    const float nrg_L[STEREO_DFT_N_32k_ENC / 2],
    const float nrg_R[STEREO_DFT_N_32k_ENC / 2],
@@ -467,7 +469,11 @@ static float calc_mean_E_ratio(
    grand_sum_xcorr_img = 0.0f;

    /*take bands up to 32kHz bandwidth as ITD is always calculated at 32kHz sampling rate*/
#ifdef FIX_WRONG_NBANDS_IN_ITD_ESTIMATION
    nbands -= ( band_limits[nbands] > STEREO_DFT_N_32k_ENC / 2 );
#else
    nbands -= ( NFFT > STEREO_DFT_N_32k_ENC );
#endif

    sum_Er = 0;
    for ( b = 0; b < nbands; b++ )
@@ -1238,7 +1244,11 @@ void stereo_dft_enc_compute_itd(
    /*calculate mean E ratio of main to background signal for cohSNR*/
    if ( hCPE->element_mode == IVAS_CPE_DFT )
    {
#ifdef FIX_WRONG_NBANDS_IN_ITD_ESTIMATION
        mEr = calc_mean_E_ratio( hItd, hStereoDft->nbands, hStereoDft->band_limits, sfm_L, pNrgL, pNrgR, &total_mEr );
#else
        mEr = calc_mean_E_ratio( hItd, hStereoDft->nbands, hStereoDft->band_limits, hStereoDft->NFFT, sfm_L, pNrgL, pNrgR, &total_mEr );
#endif
    }
    else
    {
@@ -1247,7 +1257,11 @@ void stereo_dft_enc_compute_itd(

        set_s( band_limits, 0, STEREO_DFT_BAND_MAX + 1 );
        set_band_limits( &nbands, band_limits, hCPE->hStereoMdct->hDft_ana->NFFT );
#ifdef FIX_WRONG_NBANDS_IN_ITD_ESTIMATION
        mEr = calc_mean_E_ratio( hItd, nbands, band_limits, sfm_L, pNrgL, pNrgR, &total_mEr );
#else
        mEr = calc_mean_E_ratio( hItd, nbands, band_limits, hCPE->hStereoMdct->hDft_ana->NFFT, sfm_L, pNrgL, pNrgR, &total_mEr );
#endif
    }

    /*calculate total cohSNR for frame in dB*/