diff --git a/lib_com/options.h b/lib_com/options.h index 31ece548c65344582f04e83e319a50f6ef84fa06..3c714b64e0669a84329647c9b2e1948fe6f8783d 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -201,6 +201,8 @@ #define FIX_487_LOWRATE_SBA_TUNING_FIX /* Dlb: TUning fix for low bitrate cases to match theoretical longest SPAR MD bitstream */ #define FIX_490_MASA_2TC_LBR_DTX /* Nokia: Fixes issue 490 by correcting condition. */ +#define FIX_163_SBA_TD_DECORR_OPT /* Dlb : Issue 163 : TD decorr state optimization in SBA for certain output formats */ + #define FIX_HBR_MASAMETA /* Nokia: Fixes to HBR MASA metadata at 384 and 512 kbps. Addresses issues 438 and 477 as well. */ #define FIX_482_DUMMYDEC_INIT /* Nokia: fix issue #428: missing inits for dummyDec in IVAS_rend */ #define FIX_468_16KHZ_PUPMIX /* Dlb: Fix issue 468 for Param Upmix at 16kHz sampling rate */ diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 9918a80b8291e964bfa7809b095dd02558b3e332..dd7174eae04d07205f89132babdab6b69c5be182 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -460,7 +460,14 @@ ivas_error ivas_sba_dec_digest_tc( while ( nSamplesLeftForTD ) { int16_t nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); - ivas_td_decorr_process( st_ivas->hDiracDecBin->hTdDecorr, p_tc, decorr_signal, nSamplesToDecorr ); +#ifdef FIX_163_SBA_TD_DECORR_OPT + if ( st_ivas->hDiracDecBin->hTdDecorr ) + { +#endif + ivas_td_decorr_process( st_ivas->hDiracDecBin->hTdDecorr, p_tc, decorr_signal, nSamplesToDecorr ); +#ifdef FIX_163_SBA_TD_DECORR_OPT + } +#endif for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) { decorr_signal[ch_idx] += nSamplesToDecorr; diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 7609099b5f5862091f692fbf2a214087afe6c74a..a2cdfe1562a92d543332a6bc2953830e10bdf751 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -101,10 +101,21 @@ ivas_error ivas_spar_dec_open( } /* TD decorr. */ - if ( ( error = ivas_td_decorr_dec_open( &hSpar->hTdDecorr, output_Fs, num_decor_chs + 1, 1 ) ) != IVAS_ERR_OK ) +#ifdef FIX_163_SBA_TD_DECORR_OPT + if ( ( st_ivas->ivas_format == SBA_FORMAT ) && ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) || ( st_ivas->hDecoderConfig->ivas_total_brate >= IVAS_256k && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_FOA ) ) ) { - return error; + hSpar->hTdDecorr = NULL; + } + else + { +#endif + if ( ( error = ivas_td_decorr_dec_open( &hSpar->hTdDecorr, output_Fs, num_decor_chs + 1, 1 ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef FIX_163_SBA_TD_DECORR_OPT } +#endif /* MD handle */ if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, num_channels_internal, sba_order_internal, st_ivas->sid_format ) ) != IVAS_ERR_OK ) @@ -731,8 +742,15 @@ static void ivas_spar_dec_MD( if ( hSpar->hMdDec->table_idx != table_idx ) { hSpar->hMdDec->table_idx = table_idx; - hSpar->hTdDecorr->ducking_flag = ivas_spar_br_table_consts[table_idx].td_ducking; +#ifdef FIX_163_SBA_TD_DECORR_OPT + if ( hSpar->hTdDecorr ) + { +#endif + hSpar->hTdDecorr->ducking_flag = ivas_spar_br_table_consts[table_idx].td_ducking; +#ifdef FIX_163_SBA_TD_DECORR_OPT + } +#endif ivas_spar_md_dec_init( hSpar->hMdDec, hDecoderConfig, num_channels, sba_order ); } } @@ -1231,25 +1249,32 @@ void ivas_spar_dec_digest_tc( { int16_t nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); - ivas_td_decorr_process( hSpar->hTdDecorr, p_tc, pPcm_tmp, nSamplesToDecorr ); - if ( hSpar->hTdDecorr->num_apd_outputs >= ( nchan_internal - nchan_transport ) ) - { - for ( ch = 0; ch < nchan_internal - nchan_transport; ch++ ) - { - mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - ch], p_tc[nchan_internal - 1 - ch], nSamplesToDecorr ); - } - } - else +#ifdef FIX_163_SBA_TD_DECORR_OPT + if ( hSpar->hTdDecorr ) { - for ( ch = 0; ch < nchan_internal - nchan_transport; ch++ ) +#endif + ivas_td_decorr_process( hSpar->hTdDecorr, p_tc, pPcm_tmp, nSamplesToDecorr ); + if ( hSpar->hTdDecorr->num_apd_outputs >= ( nchan_internal - nchan_transport ) ) { - set_zero( p_tc[nchan_internal - 1 - ch], nSamplesToDecorr ); + for ( ch = 0; ch < nchan_internal - nchan_transport; ch++ ) + { + mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - ch], p_tc[nchan_internal - 1 - ch], nSamplesToDecorr ); + } } - for ( ch = 0; ch < hSpar->hTdDecorr->num_apd_outputs; ch++ ) + else { - mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - ch], p_tc[nchan_internal - 1 - ch], nSamplesToDecorr ); + for ( ch = 0; ch < nchan_internal - nchan_transport; ch++ ) + { + set_zero( p_tc[nchan_internal - 1 - ch], nSamplesToDecorr ); + } + for ( ch = 0; ch < hSpar->hTdDecorr->num_apd_outputs; ch++ ) + { + mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - ch], p_tc[nchan_internal - 1 - ch], nSamplesToDecorr ); + } } +#ifdef FIX_163_SBA_TD_DECORR_OPT } +#endif for ( ch = 0; ch < nchan_internal; ch++ ) { p_tc[ch] += nSamplesToDecorr; @@ -1312,25 +1337,32 @@ void ivas_spar_dec_upmixer( if ( hSpar->hMdDec->td_decorr_flag ) { - ivas_td_decorr_process( hSpar->hTdDecorr, st_ivas->hTcBuffer->tc, pPcm_tmp, output_frame ); - if ( hSpar->hTdDecorr->num_apd_outputs >= ( nchan_internal - nchan_transport ) ) - { - for ( i = 0; i < nchan_internal - nchan_transport; i++ ) - { - mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - i], st_ivas->hTcBuffer->tc[nchan_internal - 1 - i], output_frame ); - } - } - else +#ifdef FIX_163_SBA_TD_DECORR_OPT + if ( hSpar->hTdDecorr ) { - for ( i = 0; i < nchan_internal - nchan_transport; i++ ) +#endif + ivas_td_decorr_process( hSpar->hTdDecorr, st_ivas->hTcBuffer->tc, pPcm_tmp, output_frame ); + if ( hSpar->hTdDecorr->num_apd_outputs >= ( nchan_internal - nchan_transport ) ) { - set_zero( st_ivas->hTcBuffer->tc[nchan_internal - 1 - i], output_frame ); + for ( i = 0; i < nchan_internal - nchan_transport; i++ ) + { + mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - i], st_ivas->hTcBuffer->tc[nchan_internal - 1 - i], output_frame ); + } } - for ( i = 0; i < hSpar->hTdDecorr->num_apd_outputs; i++ ) + else { - mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - i], st_ivas->hTcBuffer->tc[nchan_internal - 1 - i], output_frame ); + for ( i = 0; i < nchan_internal - nchan_transport; i++ ) + { + set_zero( st_ivas->hTcBuffer->tc[nchan_internal - 1 - i], output_frame ); + } + for ( i = 0; i < hSpar->hTdDecorr->num_apd_outputs; i++ ) + { + mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - i], st_ivas->hTcBuffer->tc[nchan_internal - 1 - i], output_frame ); + } } +#ifdef FIX_163_SBA_TD_DECORR_OPT } +#endif } ivas_spar_dec_set_render_params( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c old mode 100644 new mode 100755