diff --git a/lib_com/options.h b/lib_com/options.h old mode 100644 new mode 100755 index 98d71f99c3137d48b0079b5304e349b62e238129..196b139bfbf922376b7ebf4fd8c29d48538714d9 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -147,7 +147,9 @@ /*#define FIX_I1_113*/ /* under review : MCT bit distribution optimization for SBA high bitrates*/ -#define LBR_SBA_CORE_CODING_TUNING /* Contribution "3 Core Coder Tuning for low bitrate SBA with 2 TCs" */ +#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*/ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_enc/ivas_stereo_dft_enc_itd.c b/lib_enc/ivas_stereo_dft_enc_itd.c old mode 100644 new mode 100755 index 5b47e9dc5240c2a25bb2dd17723d91304cc692cc..fd39db32d3b68f2a9d249fe29c2d14efda7921cc --- a/lib_enc/ivas_stereo_dft_enc_itd.c +++ b/lib_enc/ivas_stereo_dft_enc_itd.c @@ -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*/