diff --git a/lib_com/options.h b/lib_com/options.h index e9b94dbadab05e6867f7e01f0d4f17b0d0f7d937..6585df39188968e438e9d4386039276835ae1408 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -97,6 +97,7 @@ #define FIX_2015_PREMPH_SAT_ALT_PART2 /* VA: Add missing scaling factor to be passed to AVQ_cod() */ #define FIX_2253_CORRECT_GSC_MINIMUM_PIT_SEARCH /* VA: Fix Issue 2253 where the encoder and decoder could get out of sync */ #define NONBE_FIX_1967_SBA_DECODER_MONO_OUT_BIG_DIFFERENCES /* Dolby: Fix basop issue 1967 */ +#define FIX_1461_CNG_BW_SWITCHING /* Eri: float issue 1461: Stereo parameters are not updated when SID/NODATA forces BW to stay the same */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index 033e13034c4c260f7bfc5fdec574d9a384a2bbb5..4aea3ff61df1eb4ed8b56b719104eb1dd6447175 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -130,6 +130,9 @@ ivas_error ivas_cpe_enc_fx( Word16 old_wsp_fx[CPE_CHANNELS][L_WSP]; Word16 e_old_wsp[CPE_CHANNELS], q_old_wsp; Word16 Q_new[CPE_CHANNELS] = { 0 }; +#ifdef FIX_1461_CNG_BW_SWITCHING + Word16 NFFT_inner; +#endif move16(); move16(); Word16 q_com, shift, q_min, gb; @@ -1124,6 +1127,12 @@ ivas_error ivas_cpe_enc_fx( IF( EQ_32( sts[0]->core_brate, SID_2k40 ) || sts[0]->core_brate == FRAME_NO_DATA ) { /* Reconfigure DFT Stereo for inactive frames */ +#ifdef FIX_1461_CNG_BW_SWITCHING + /* -- nbands may need to be updated here in case the bandwidth was changed due to inactive frames */ + NFFT_inner = shl( inner_frame_tbl[sts[0]->bwidth], 1 ); + hCPE->hStereoDft->nbands = stereo_dft_band_config_fx( hCPE->hStereoDft->band_limits, hCPE->hStereoDft->hConfig->band_res, NFFT_inner, ENC ); + move16(); +#endif IF( EQ_32( sts[0]->core_brate, SID_2k40 ) ) { stereo_dft_config_fx( hConfigDft, IVAS_SID_5k2, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); diff --git a/lib_enc/ivas_stereo_dft_enc_fx.c b/lib_enc/ivas_stereo_dft_enc_fx.c index e5522fb377bf0ab53db392a8fae7c58230c46efa..5f78defdd579e50cd9655cc53519b47946506d5e 100644 --- a/lib_enc/ivas_stereo_dft_enc_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_fx.c @@ -3853,6 +3853,17 @@ static void stereo_dft_enc_compute_prm_fx( hStereoDft->nrg_past_pos = ( pos + 1 ) % STEREO_DFT_NRG_PAST_LEN; move16(); +#ifdef FIX_1461_CNG_BW_SWITCHING + /* Replicate last band for remaining bands in case the bandwidth is higher after SID/NODATA is considered */ + FOR( i = hStereoDft->nbands; i < STEREO_DFT_BAND_MAX; i++ ) + { + pPredGain[i] = pPredGain[i - 1]; + move32(); + pSideGain[i] = pSideGain[i - 1]; + move32(); + } +#endif + /*------------------------------------------------------------------* * Compute IPDs