diff --git a/lib_com/options.h b/lib_com/options.h index 965e181727ff38eccaea67edebc1a8074b626c87..6e0851258a6a7a8daa4790c1094257c42cc2166a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -167,6 +167,7 @@ #define NONBE_FIX_943_PORT_1208_DFT_STEREO_PLC_BURST /* Ericsson: BASOP Issue 943, Float Issue 1208, fix for overflow of sample offset counter for burst error in DFT Stereo PLC. */ #define FIX_903_ZERO_OUT_IMDCT_BUFFERS_FOR_MCT_IGNORE /* FhG: zero out all relevant imdct buffers in MCT decoding of channels with mct_chan_mode == MCT_CHAN_MODE_IGNORE */ #define FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC_FP /* Nokia: Fixes ivas_decode_masaism_metadata decision logic change due to precision difference; this is the fix in floating point */ +#define NONBE_FIX_1205_TD_STEREO_MOD_CT /* VA: fix mismatch of coder_type (mod_ct) btw. TD stereo encoder and decoder */ /* #################### End FIXES switches ############################ */ #define BASOP_NOGLOB /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */ diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index 41018cae2542af3ed3962c5c59e3d61fdcb0ddfd..545d2b0697a7322cbbdf2edc69508842b938f6fc 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -251,7 +251,6 @@ void tdm_configure_dec( } #ifdef DEBUG_MODE_TD - dbgwrite( &mod_ct, 2, 1, 320, "res/mod_ct.dec" ); dbgwrite( tdm_ratio_idx, 2, 1, 320, "res/tdm_ratio_idx.dec" ); dbgwrite( &tdm_inst_ratio_idx, 2, 1, 320, "res/tdm_inst_ratio_idx.dec" ); dbgwrite( &hStereoTD->tdm_lp_reuse_flag, 2, 1, 320, "res/tdm_lp_reuse_flag.dec" ); diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index b9578423b989de2c2c30c38294222a00f018f426..6e4c4978b6ad81dece3ed0d435a1711d15708623 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -215,7 +215,16 @@ void ivas_decision_matrix_enc( if ( st->core == TCX_20_CORE && st->total_brate < STEREO_TCX_MIN_RATE ) { st->core = ACELP_CORE; +#ifdef NONBE_FIX_1205_TD_STEREO_MOD_CT + /* In TD stereo below 24.4 kbps we cannot overwrite the `coder_type` when it is set to TRANSITION, */ + /* as it is used for TD stereo bit allocation. To ensure consistent bit allocation, it must remain unchanged on the decoder side. */ + if ( st->idchan == 0 && !( element_brate < IVAS_24k4 && st->coder_type == TRANSITION && st->element_mode == IVAS_CPE_TD ) ) + { + st->coder_type = AUDIO; + } +#else st->coder_type = AUDIO; +#endif st->sp_aud_decision2 = 0; if ( st->low_rate_mode ) @@ -465,6 +474,16 @@ void ivas_signaling_enc( if ( st->core == ACELP_CORE ) { +#ifdef NONBE_FIX_1205_TD_STEREO_MOD_CT + /* write coder type */ + push_indice( hBstr, IND_ACELP_SIGNALLING, st->coder_type, 3 ); + + if ( element_brate >= FRMT_SHP_MIN_BRATE_IVAS ) + { + /* write sharpening flag */ + push_indice( hBstr, IND_SHARP_FLAG, st->sharpFlag, 1 ); + } +#else if ( element_brate < FRMT_SHP_MIN_BRATE_IVAS ) { push_indice( hBstr, IND_ACELP_SIGNALLING, st->coder_type, 3 ); @@ -477,6 +496,7 @@ void ivas_signaling_enc( /* write sharpening flag */ push_indice( hBstr, IND_SHARP_FLAG, st->sharpFlag, 1 ); } +#endif /* write extension layer flag to distinguish between TBE (0) and BWE (1) */ if ( st->extl_brate > 0 ) diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 64446f3e518407abb7d25b5e1220fc3d50659708..3778bffedd8e07f06a37a8d156ca0970d7eef943 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -449,6 +449,22 @@ void tdm_configure_enc( } mod_ct = AUDIO; +#ifdef NONBE_FIX_1205_TD_STEREO_MOD_CT + if ( hCPE->element_brate < IVAS_24k4 ) + { + /* In TD stereo, the TRANSITION mode has a specific bit allocation. All other formats share the same bit allocation. For these other formats, `mod_ct` is set to AUDIO to aid in debugging, though it does not have any functional impact. */ + if ( !( sts[0]->localVAD == 0 && sts[0]->coder_type == TRANSITION ) && + ( sts[0]->coder_type == TRANSITION || + ( ( ( sts[0]->last_L_frame >= L_FRAME16k && sts[0]->flag_ACELP16k == 0 ) || + ( sts[0]->last_L_frame == L_FRAME && sts[0]->flag_ACELP16k == 1 ) ) && + sts[0]->last_core_brate != FRAME_NO_DATA && + sts[0]->last_core_brate != SID_2k40 && + sts[0]->coder_type_raw != VOICED ) ) ) + { + mod_ct = TRANSITION; + } + } +#else if ( hCPE->element_brate < IVAS_24k4 ) { mod_ct = sts[0]->coder_type; @@ -462,6 +478,7 @@ void tdm_configure_enc( mod_ct = AUDIO; } } +#endif /* Correction of tdm_inst_ratio_idx in case of TC in the seecondary channel */ if ( hStereoTD->flag_skip_DMX == 0 && hStereoTD->tdm_LRTD_flag == 1 && sts[1]->tc_cnt > 1 /*&& abs(hStereoTD->tdm_inst_ratio_idx-LRTD_STEREO_MID_IS_PRIM) > 5*/ ) @@ -549,7 +566,6 @@ void tdm_configure_enc( #ifdef DEBUG_MODE_TD dbgwrite( &hStereoTD->tdm_low_rate_mode, 2, 1, 320, "res/tdm_low_rate_mode_c" ); dbgwrite( &hStereoTD->tdm_lp_reuse_flag, 2, 1, 320, "res/tdm_lp_reuse_flag_c" ); - dbgwrite( &mod_ct, 2, 1, 320, "res/mod_ct.enc" ); #endif /*----------------------------------------------------------------*