diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 6c9166111ff804ab906449b4b2fc7ed20de5e85e..1d593881ae6949f04d6829022416e55ee8f9aca6 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -4999,13 +4999,9 @@ void generate_masking_noise_lb_dirac_fx( HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ Word32 *tdBuffer, /* i/o: time-domain signal, if NULL no LB-CNA */ const Word16 nCldfbTs, /* i : number of CLDFB slots that will be rendered */ - const Word16 cna_flag /* i : CNA flag for LB and HB */ -); - -void generate_masking_noise_lb_dirac_fx( - HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ - Word32 *tdBuffer, /* i/o: time-domain signal, if NULL no LB-CNA */ - const Word16 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 Word16 cna_flag /* i : CNA flag for LB and HB */ ); diff --git a/lib_com/options.h b/lib_com/options.h index 2e8fa88028d65cdf7834b9b8549314a1aebdc3d1..390ea85b86b2e4cd24d6343a2de2cf9e36976272 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -121,6 +121,7 @@ #define NONBE_FIX_947_STEREO_DMX_EVS_POC /* Orange: Fix clicks on POC */ #define NONBE_FIX_947_STEREO_DMX_EVS_PHA /* Orange: Fix issues on PHA */ +#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 NONBE_FIX_979_OSBA_STEREO_5MS /* FhG : issue #979 : 5ms and 20ms output different for OSBA and stereo */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 4c42a795997fa4bcc4b1372ce91ec35361e16bb3..6d73aa28ca523b7f1ea9c5c95a67b7b9f3b40b95 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -5447,7 +5447,10 @@ void generate_masking_noise_lb_dirac_fx( HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ Word32 *tdBuffer, /* i/o: time-domain signal, if NULL no LB-CNA Q11*/ const Word16 nCldfbTs, /* i : number of CLDFB slots that will be rendered Q0*/ - const Word16 cna_flag /* i : CNA flag for LB and HB Q0*/ +#ifdef NONBE_FIX_951_MCMASA_5MS_RENDERING + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i : common spatial rendering parameters handle */ +#endif + const Word16 cna_flag /* i : CNA flag for LB and HB Q0*/ ) { Word16 i; @@ -5465,7 +5468,7 @@ void generate_masking_noise_lb_dirac_fx( /* Init */ scale = 0; move32(); - n_samples_out = i_mult( shr( hFdCngCom->frameSize, 4 ), nCldfbTs ); + n_samples_out = i_mult( shr( hFdCngCom->frameSize, 4 /* DEFAULT_JBM_CLDFB_TIMESLOTS */ ), nCldfbTs ); n_samples_start = 0; move16(); Word16 exp_out = Q11; @@ -5498,6 +5501,13 @@ void generate_masking_noise_lb_dirac_fx( test(); IF( cna_flag && tdBuffer != NULL ) { +#ifdef NONBE_FIX_951_MCMASA_5MS_RENDERING + Word16 cur_subframe; + Word16 cur_subframe_start_outfs; + Word16 cur_subframe_start_cngfs; + Word16 slot_size_cng; +#endif + WHILE( n_samples_out > 0 ) { n_samples_out_loop = s_min( hFdCngCom->frameSize, n_samples_out ); @@ -5569,6 +5579,30 @@ void generate_masking_noise_lb_dirac_fx( n_samples_out = sub( n_samples_out, hFdCngCom->frameSize ); n_samples_start = add( 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 = shr( hFdCngCom->frameSize, 4 /* DEFAULT_JBM_CLDFB_TIMESLOTS */ ); + /* move start indices forward to the end of the last subframe */ + cur_subframe_start_outfs = mult( nCldfbTs, hSpatParamRendCom->slot_size ); + cur_subframe_start_cngfs = mult( nCldfbTs, slot_size_cng ); + + /* go from the last subframe back and move the LB noise */ + FOR( cur_subframe = sub( hSpatParamRendCom->nb_subframes, 1 ); cur_subframe >= 0; cur_subframe-- ) + { + Word16 move_size, subframe_size_outfs; + move_size = mult( slot_size_cng, hSpatParamRendCom->subframe_nbslots[cur_subframe] ); + subframe_size_outfs = mult( hSpatParamRendCom->subframe_nbslots[cur_subframe], hSpatParamRendCom->slot_size ); + cur_subframe_start_outfs = sub( cur_subframe_start_outfs, mult( hSpatParamRendCom->subframe_nbslots[cur_subframe], hSpatParamRendCom->slot_size ) ); + cur_subframe_start_cngfs = sub( cur_subframe_start_cngfs, mult( hSpatParamRendCom->subframe_nbslots[cur_subframe], slot_size_cng ) ); + /* move cna */ + Copy32( tdBuffer + cur_subframe_start_cngfs, tdBuffer + cur_subframe_start_outfs, move_size ); + + /* set everything else to zero */ + set_zero_fx( tdBuffer + cur_subframe_start_outfs + move_size, sub( subframe_size_outfs, move_size ) ); + } +#endif } pop_wmops(); diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index 44a024e549e94a5e1d49a59ba8c2233206dc2bdc..feca814c81df0cde0c91ffe3a266d042cfb865da 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -2871,10 +2871,18 @@ void ivas_dirac_dec_render_sf_fx( test(); generate_masking_noise_dirac_ivas_fx( st->hFdCngDec->hFdCngCom, st_ivas->cldfbAnaDec[1], +#ifdef NONBE_FIX_951_MCMASA_5MS_RENDERING + &st_ivas->hTcBuffer->tc_fx[1][hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->slots_rendered], +#else st_ivas->hTcBuffer->tc_fx[1], +#endif Cldfb_RealBuffer_fx[1][0], Cldfb_ImagBuffer_fx[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 ) || EQ_32( st->core_brate, SID_2k40 ) ) ) && EQ_16( st->cng_type, FD_CNG ) && st->cng_sba_flag, Q_input, &q_temp_cldfb ); Scale_sig32( Cldfb_RealBuffer_fx[1][0], CLDFB_NO_CHANNELS_MAX, sub( Q6, q_temp_cldfb ) ); // Q6 diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index b5d494eaeb4eb0d97ae3633d35e8e7675963ac72..cc78652e6eeb167061c22ef2670d7ab2e89815e4 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -894,7 +894,11 @@ void ivas_sba_dec_digest_tc_fx( Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; Scale_sig( st->hFdCngDec->hFdCngCom->A_cng, M + 1, sub( norm_s( sub( st->hFdCngDec->hFdCngCom->A_cng[0], 1 ) ), 2 ) ); /*Q12 -> Q13*/ +#ifdef NONBE_FIX_951_MCMASA_5MS_RENDERING + generate_masking_noise_lb_dirac_fx( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc_fx[1], nCldfbSlots, st_ivas->hSpatParamRendCom, st->cna_dirac_flag && st->flag_cna ); +#else generate_masking_noise_lb_dirac_fx( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc_fx[1], nCldfbSlots, st->cna_dirac_flag && st->flag_cna ); +#endif } return; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 32bcb732e538ffec57d83efb36a1a19a8b5fa9d0..408f1cb1bca306d57a57056c283c27d8947caa02 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -830,17 +830,29 @@ static void ivas_dirac_dec_binaural_internal_fx( IF( st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) { Word16 numCoreBands, b; +#ifndef NONBE_FIX_951_MCMASA_5MS_RENDERING Word16 slotInFrame; +#endif numCoreBands = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->numCoreBands; move16(); +#ifndef NONBE_FIX_951_MCMASA_5MS_RENDERING slotInFrame = add( hSpatParamRendCom->slots_rendered, slot ); +#endif generate_masking_noise_dirac_ivas_fx( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, st_ivas->cldfbAnaDec[1], +#ifdef NONBE_FIX_951_MCMASA_5MS_RENDERING + &st_ivas->hTcBuffer->tc_fx[nchan_transport][hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->slots_rendered], +#else st_ivas->hTcBuffer->tc_fx[nchan_transport], +#endif Cldfb_RealBuffer_in_fx[2][slot], Cldfb_ImagBuffer_in_fx[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, 11, &q_cldfb[2][slot] ); @@ -849,7 +861,11 @@ static void ivas_dirac_dec_binaural_internal_fx( st_ivas->cldfbAnaDec[1], /*nothing will be analyzed, just get cnst*/ NULL, Cldfb_RealBuffer_in_fx[1][slot], Cldfb_ImagBuffer_in_fx[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, 0, &q_cldfb[1][slot] ); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 4b4d5c4567eff6c4d972a662efc00d7b464e3451..c3be6c73bfc3a8cb90c114a4322e47120db81bc9 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -525,6 +525,7 @@ static void accumulate2dArrayToBuffer_fx( * In-place saturation control for multichannel buffers with adaptive release time *-------------------------------------------------------------------*/ +#ifndef DISABLE_LIMITER /*! r: number of clipped output samples */ static Word32 limitRendererOutput_fx( IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ @@ -568,6 +569,7 @@ static Word32 limitRendererOutput_fx( return numClipping; } +#endif /*-------------------------------------------------------------------* * validateOutputAudioConfig()