diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index b27a002513cf656605b7148f1397b68b4b7c8bc3..a8b5e905700c6a6dff1d10ef42dae0ccf70df46d 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3683,6 +3683,9 @@ void generate_masking_noise_lb_dirac( HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ float *tdBuffer, /* i/o: time-domain signal, if NULL no LB-CNA */ const int16_t nCldfbTs, /* i : number of CLDFB slots that will be rendered */ +#ifdef NONBE_FIX_951_MCMASA_5MS_RENDERING + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i : common spatial rendering parameters handle */ +#endif const int16_t cna_flag /* i : CNA flag for LB and HB */ ); diff --git a/lib_com/options.h b/lib_com/options.h index 5c0fb1b07c6ffaa2f1ba142c26d157fa51cf2913..81e208376ea513d1c996d371c786bf1c12f879c7 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -177,6 +177,7 @@ #define NONBE_FIX_968_ISM_BRIR_WITH_HEADROTATION_5MS_FIX /* FhG : issue #968: differences between 5ms and 20ms rendering for discrete ISM with BRIR and head rotation*/ #define NONBE_FIX_977_OSBA_GAIN_MISMATCH /* Dlb : issue 977 : Output gain mismatch for different bit rates in OSBA */ #define NONBE_FIX_973_HODIRAC_BAND_GROUPING /* FhG: issue 973: empty parameter band in DirAC */ +#define NONBE_FIX_951_MCMASA_5MS_RENDERING /* Nokia: issue #951: Differences for 5ms and 20ms rendering for McMASA at 13.2 kbps to BINAURAL */ #define BE_FIX_567_DOUBLE_STEREO_DMX /* NTT: Fix formal issues */ #define NONBE_FIX_567_DOUBLE_STEREO_DMX /* Orange: Double-precision replaced by single-precision */ diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 69d007825caed9dd17a7b9194eecbe406f4032ce..6d772f2a86da19cb9af185aa9d7e85c1f38ded4b 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -1805,7 +1805,10 @@ void generate_masking_noise_lb_dirac( HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ float *tdBuffer, /* i/o: time-domain signal, if NULL no LB-CNA */ const int16_t nCldfbTs, /* i : number of CLDFB slots that will be rendered */ - const int16_t cna_flag /* i : CNA flag for LB and HB */ +#ifdef NONBE_FIX_951_MCMASA_5MS_RENDERING + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i : common spatial rendering parameters handle */ +#endif + const int16_t cna_flag /* i : CNA flag for LB and HB */ ) { int16_t i; @@ -1857,6 +1860,13 @@ void generate_masking_noise_lb_dirac( /* LB CLDFB - CNA from STFT: CNA applied only in channel 0*/ if ( cna_flag && tdBuffer != NULL ) { +#ifdef NONBE_FIX_951_MCMASA_5MS_RENDERING + int16_t cur_subframe; + int16_t cur_subframe_start_outfs; + int16_t cur_subframe_start_cngfs; + int16_t slot_size_cng; +#endif + while ( n_samples_out > 0 ) { n_samples_out_loop = min( hFdCngCom->frameSize, n_samples_out ); @@ -1940,8 +1950,32 @@ void generate_masking_noise_lb_dirac( n_samples_out -= hFdCngCom->frameSize; n_samples_start += hFdCngCom->frameSize; } + +#ifdef NONBE_FIX_951_MCMASA_5MS_RENDERING + /* move generated noise to the 5ms subframe starts in the tc buffer according to the output sampling frequency to avoid + overwriting it with the synthesis in case of shared tc and synth channel memory, i.e. non-TSM mode */ + slot_size_cng = hFdCngCom->frameSize / DEFAULT_JBM_CLDFB_TIMESLOTS; + /* move start indices forward to the end of the last subframe */ + cur_subframe_start_outfs = nCldfbTs * hSpatParamRendCom->slot_size; + cur_subframe_start_cngfs = nCldfbTs * slot_size_cng; + + /* go from the last subframe back and move the LB noise */ + for ( cur_subframe = hSpatParamRendCom->nb_subframes - 1; cur_subframe >= 0; cur_subframe-- ) + { + int16_t move_size, subframe_size_outfs; + move_size = slot_size_cng * hSpatParamRendCom->subframe_nbslots[cur_subframe]; + subframe_size_outfs = hSpatParamRendCom->subframe_nbslots[cur_subframe] * hSpatParamRendCom->slot_size; + cur_subframe_start_outfs -= hSpatParamRendCom->subframe_nbslots[cur_subframe] * hSpatParamRendCom->slot_size; + cur_subframe_start_cngfs -= hSpatParamRendCom->subframe_nbslots[cur_subframe] * slot_size_cng; + /* move cna */ + mvr2r( tdBuffer + cur_subframe_start_cngfs, tdBuffer + cur_subframe_start_outfs, move_size ); + /* set everything else to zero */ + set_zero( tdBuffer + cur_subframe_start_outfs + move_size, subframe_size_outfs - move_size ); + } +#endif } + pop_wmops(); return; diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 804c1e8522c71af5abe750d858a527a5d1eb4166..b1ad6767a611aa98e1d74f4ad612e75f22df7688 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -1943,10 +1943,18 @@ void ivas_dirac_dec_render_sf( generate_masking_noise_dirac( st->hFdCngDec->hFdCngCom, st_ivas->cldfbAnaDec[1], +#ifdef NONBE_FIX_951_MCMASA_5MS_RENDERING + &st_ivas->hTcBuffer->tc[1][hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->slots_rendered], +#else st_ivas->hTcBuffer->tc[1], +#endif Cldfb_RealBuffer[1][0], Cldfb_ImagBuffer[1][0], +#ifdef NONBE_FIX_951_MCMASA_5MS_RENDERING + slot_idx, +#else index_slot, +#endif st->cna_dirac_flag && st->flag_cna, ( st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40 ) && st->cng_type == FD_CNG && st->cng_sba_flag ); } diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index dc394dda02babf81328e08467c59823141d749fc..93e2025d02e8a4ded827f00b3669510cb178cd78 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1400,7 +1400,6 @@ ivas_error ivas_jbm_dec_render( { int16_t offset = hSpatParamRendCom->slots_rendered * hSpatParamRendCom->slot_size; nchan_remapped = st_ivas->nchan_transport; - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { ivas_dirac_dec_binaural_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output ); diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 82e95467fd661f74f788cc27f36545761d22989f..bb4f17c381c67eaa1567f90b2286b107aae9e8aa 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -763,7 +763,11 @@ void ivas_sba_dec_digest_tc( ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) && ( nchan_transport == 1 && st_ivas->nchan_transport != 2 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) ) ) { Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; +#ifdef NONBE_FIX_951_MCMASA_5MS_RENDERING + generate_masking_noise_lb_dirac( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc[1], nCldfbSlots, st_ivas->hSpatParamRendCom, st->cna_dirac_flag && st->flag_cna ); +#else generate_masking_noise_lb_dirac( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc[1], nCldfbSlots, st->cna_dirac_flag && st->flag_cna ); +#endif } return; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 6909945ff6a3775173462320b6f3331e89d177f9..0d6d20e7edc8bbf0128fd6a8ffef223aa86b9ecc 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -673,16 +673,28 @@ static void ivas_dirac_dec_binaural_internal( if ( st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) { int16_t numCoreBands, b; +#ifndef NONBE_FIX_951_MCMASA_5MS_RENDERING int16_t slotInFrame; +#endif numCoreBands = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->numCoreBands; +#ifndef NONBE_FIX_951_MCMASA_5MS_RENDERING slotInFrame = hSpatParamRendCom->slots_rendered + slot; +#endif generate_masking_noise_dirac( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, st_ivas->cldfbAnaDec[1], +#ifdef NONBE_FIX_951_MCMASA_5MS_RENDERING + &st_ivas->hTcBuffer->tc[nchan_transport][hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->slots_rendered], +#else st_ivas->hTcBuffer->tc[nchan_transport], +#endif Cldfb_RealBuffer_in[2][slot], Cldfb_ImagBuffer_in[2][slot], +#ifdef NONBE_FIX_951_MCMASA_5MS_RENDERING + slot, +#else slotInFrame, +#endif st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->hSCE[0]->hCoreCoder[0]->flag_cna, ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA || st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 ) && ( st_ivas->hSCE[0]->hCoreCoder[0]->cng_type == FD_CNG ) && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ); @@ -690,7 +702,11 @@ static void ivas_dirac_dec_binaural_internal( st_ivas->cldfbAnaDec[1], /*nothing will be analyzed, just get cnst*/ NULL, Cldfb_RealBuffer_in[1][slot], Cldfb_ImagBuffer_in[1][slot], +#ifdef NONBE_FIX_951_MCMASA_5MS_RENDERING + slot, +#else slotInFrame, +#endif st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->hSCE[0]->hCoreCoder[0]->flag_cna, ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA || st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 ) && ( st_ivas->hSCE[0]->hCoreCoder[0]->cng_type == FD_CNG ) && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index b1961a514320fefe64426cb9007187f91e840267..bbc84410678ea1a6fae99d21b12a9b456d035555 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -524,6 +524,7 @@ static void accumulate2dArrayToBuffer( * In-place saturation control for multichannel buffers with adaptive release time *-------------------------------------------------------------------*/ +#ifndef DISABLE_LIMITER /*! r: number of clipped output samples */ static int32_t limitRendererOutput( IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ @@ -568,7 +569,7 @@ static int32_t limitRendererOutput( return numClipping; } - +#endif /*-------------------------------------------------------------------* * validateOutputAudioConfig()