diff --git a/lib_com/options.h b/lib_com/options.h index b693d06fa49ad8d6bafd64d555c397ebbee60d88..3bc10a191e06cedf885474468f31482908e30b1f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -173,6 +173,7 @@ #define FIX_1435_MOVE_STEREO_PANNING /* VA: issue 1435: do the EVS stereo panning in the renderer */ #define FIX_1454_FIX_STEREO_TO_FOA_JBM /* VA: issue 1454: fix buggy stereo to FOA in JBM */ +#define FIX_1461_CNG_BW_SWITCHING /* Eri: 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.c b/lib_enc/ivas_cpe_enc.c index ebd5bb1281e48fc59901007aa8a07548b1e3a9fd..01b13ba2699393ad49466a3034374cc7de7e9a90 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -112,6 +112,9 @@ ivas_error ivas_cpe_enc( int32_t cpe_brate; int32_t element_brate_ref; int16_t last_bits_frame_nominal; /* last_bits_frame_nominal for M or PCh channel */ +#ifdef FIX_1461_CNG_BW_SWITCHING + int16_t NFFT_inner; +#endif error = IVAS_ERR_OK; push_wmops( "ivas_cpe_enc" ); @@ -628,6 +631,11 @@ ivas_error ivas_cpe_enc( if ( 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 = STEREO_DFT_N_MAX_ENC * inner_frame_tbl[sts[0]->bwidth] / L_FRAME48k; + hCPE->hStereoDft->nbands = stereo_dft_band_config( hCPE->hStereoDft->band_limits, hCPE->hStereoDft->hConfig->band_res, NFFT_inner, ENC ); +#endif if ( sts[0]->core_brate == SID_2k40 ) { stereo_dft_config( hConfigDft, IVAS_SID_5k2, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); diff --git a/lib_enc/ivas_stereo_dft_enc.c b/lib_enc/ivas_stereo_dft_enc.c index 26b2ad7b4ddf96b1b7a473848beca15f675522da..49f7c33d47f5d64b51165f3eeec323ad3e31e178 100644 --- a/lib_enc/ivas_stereo_dft_enc.c +++ b/lib_enc/ivas_stereo_dft_enc.c @@ -2879,6 +2879,15 @@ static void stereo_dft_enc_compute_prm( hStereoDft->nrg_past_pos = ( pos + 1 ) % STEREO_DFT_NRG_PAST_LEN; +#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]; + pSideGain[i] = pSideGain[i - 1]; + } +#endif + #ifdef DEBUG_MODE_DFT { float tmp_f;