From 0477b0c6a5fa92b74e7559b5a93da3a47381cdf4 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 11 Apr 2025 11:11:57 +0200 Subject: [PATCH 01/19] issue 1314: set RENDERER_DISABLE for stereo to EXT output; under FIX_1314_STEREO_TO_EXT --- lib_com/options.h | 2 +- lib_dec/ivas_output_config.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index ebfc3519ab..c308940dba 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,7 +160,7 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ - +#define FIX_1314_STEREO_TO_EXT /* VA: issue 1314: set RENDERER_DISABLE for stereo to EXT output */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 305d99ef99..c58d761723 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -262,7 +262,11 @@ void ivas_renderer_select( } else if ( st_ivas->ivas_format == STEREO_FORMAT ) { +#ifdef FIX_1314_STEREO_TO_EXT + if ( output_config != IVAS_AUDIO_CONFIG_STEREO && output_config != IVAS_AUDIO_CONFIG_MONO && output_config != IVAS_AUDIO_CONFIG_EXTERNAL ) +#else if ( output_config != IVAS_AUDIO_CONFIG_STEREO && output_config != IVAS_AUDIO_CONFIG_MONO ) +#endif { *renderer_type = RENDERER_MC; } -- GitLab From 5fc3a112f1ede3391d8e4c3509c218dd7e5f91bf Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 11 Apr 2025 13:47:12 +0200 Subject: [PATCH 02/19] add error exit code --- lib_dec/ivas_out_setup_conversion.c | 47 +++++++++++++++++++---------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/lib_dec/ivas_out_setup_conversion.c b/lib_dec/ivas_out_setup_conversion.c index 699343c1da..90473903d9 100644 --- a/lib_dec/ivas_out_setup_conversion.c +++ b/lib_dec/ivas_out_setup_conversion.c @@ -223,9 +223,6 @@ static ivas_error get_ls_conversion_matrix( int16_t index; float value; const LS_CONVERSION_MATRIX *conversion_matrix; - ivas_error error; - - error = IVAS_ERR_OK; conversion_matrix = NULL; @@ -260,7 +257,7 @@ static ivas_error get_ls_conversion_matrix( } } } - return error; + return IVAS_ERR_OK; } else { @@ -273,7 +270,7 @@ static ivas_error get_ls_conversion_matrix( { hLsSetUpConversion->dmxMtx[k][k] = 1.0f; } - return error; + return IVAS_ERR_OK; } else { @@ -288,7 +285,7 @@ static ivas_error get_ls_conversion_matrix( hLsSetUpConversion->dmxMtx[ch_in][ch_out] = value; } } - return error; + return IVAS_ERR_OK; } } } @@ -311,8 +308,10 @@ ivas_error ivas_ls_setup_conversion_open( int16_t chIdx, inChannels, outChannels; int16_t output_frame; int32_t output_Fs; - int16_t nchan_out; int16_t paramUpmixMonoStereo; +#ifdef FIX_1314_STEREO_TO_EXT + ivas_error error; +#endif if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMUPMIX && ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO ) ) { @@ -323,7 +322,7 @@ ivas_error ivas_ls_setup_conversion_open( paramUpmixMonoStereo = FALSE; } output_Fs = st_ivas->hDecoderConfig->output_Fs; - nchan_out = st_ivas->hDecoderConfig->nchan_out; + outChannels = st_ivas->hDecoderConfig->nchan_out; output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); /* Allocate memory to the handle */ @@ -332,9 +331,8 @@ ivas_error ivas_ls_setup_conversion_open( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LS configuration Conversion Handle \n" ) ); } - assert( nchan_out <= MAX_OUTPUT_CHANNELS ); + assert( outChannels <= MAX_OUTPUT_CHANNELS ); - outChannels = nchan_out; if ( st_ivas->renderer_type == RENDERER_MC_PARAMMC ) { inChannels = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; @@ -423,16 +421,37 @@ ivas_error ivas_ls_setup_conversion_open( { if ( paramUpmixMonoStereo == TRUE ) { +#ifdef FIX_1314_STEREO_TO_EXT + if ( ( error = get_ls_conversion_matrix( hLsSetUpConversion, IVAS_AUDIO_CONFIG_5_1_2, st_ivas->hDecoderConfig->output_config ) ) != IVAS_ERR_OK ) + { + return error; + } +#else get_ls_conversion_matrix( hLsSetUpConversion, IVAS_AUDIO_CONFIG_5_1_2, st_ivas->hDecoderConfig->output_config ); +#endif } else { +#ifdef FIX_1314_STEREO_TO_EXT + if ( ( error = get_ls_conversion_matrix( hLsSetUpConversion, st_ivas->transport_config, st_ivas->hDecoderConfig->output_config ) ) != IVAS_ERR_OK ) + { + return error; + } +#else get_ls_conversion_matrix( hLsSetUpConversion, st_ivas->transport_config, st_ivas->hDecoderConfig->output_config ); +#endif } } else { +#ifdef FIX_1314_STEREO_TO_EXT + if ( ( error = get_ls_conversion_matrix( hLsSetUpConversion, st_ivas->intern_config, st_ivas->hDecoderConfig->output_config ) ) != IVAS_ERR_OK ) + { + return error; + } +#else get_ls_conversion_matrix( hLsSetUpConversion, st_ivas->intern_config, st_ivas->hDecoderConfig->output_config ); +#endif } } @@ -633,9 +652,7 @@ void ivas_ls_setup_conversion_process_mdct( { dmxCoeff = hLsSetUpConversion->dmxMtx[chInIdx][chOutIdx]; - if ( - chInIdx != LFE_CHANNEL && - mct_chan_mode[chInIdx] != MCT_CHAN_MODE_IGNORE ) + if ( chInIdx != LFE_CHANNEL && mct_chan_mode[chInIdx] != MCT_CHAN_MODE_IGNORE ) { /* Step 1: Compute the target energy and DMX signal (possible since we have all signals in TCX20 resolution) */ if ( dmxCoeff ) @@ -728,9 +745,7 @@ void ivas_ls_setup_conversion_process_mdct( /* Step 4: Perform equalization */ for ( chInIdx = 0; chInIdx < inChannels; chInIdx++ ) { - if ( - chInIdx != LFE_CHANNEL && - mct_chan_mode[chInIdx] != MCT_CHAN_MODE_IGNORE ) + if ( chInIdx != LFE_CHANNEL && mct_chan_mode[chInIdx] != MCT_CHAN_MODE_IGNORE ) { if ( transform_type[chInIdx][0] == TCX_20 ) { -- GitLab From 82fdad6dfa960410f9aa7702e807026df1286f7c Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 1 May 2025 08:39:13 +0200 Subject: [PATCH 03/19] issue 1320: Optimize the stack memory consumption in the CPE decoder; under FIX_1320_STACK_CPE_DECODER --- lib_com/options.h | 1 + lib_dec/ivas_core_dec.c | 32 +++++++++++++-- lib_dec/ivas_cpe_dec.c | 87 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 904e462921..a7ea44edba 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -161,6 +161,7 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ #define UNIFIED_DECODING_PATHS_LEFTOVERS /* VA: issue 880: remove leftovers after NONBE_UNIFIED_DECODING_PATHS */ +#define FIX_1320_STACK_CPE_DECODER /* VA: issue 1320: Optimize the stack memory consumption in the CPE decoder */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index eb961c38dc..7b6e5770e1 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -75,7 +75,12 @@ ivas_error ivas_core_dec( float synth[CPE_CHANNELS][L_FRAME48k]; float tmp_buffer[L_FRAME48k]; int16_t tmps, incr; +#ifdef FIX_1320_STACK_CPE_DECODER + float *bwe_exc_extended[CPE_CHANNELS] = { NULL, NULL }; + int16_t flag_bwe_bws; +#else float bwe_exc_extended[CPE_CHANNELS][L_FRAME32k + NL_BUFF_OFFSET]; +#endif float voice_factors[CPE_CHANNELS][NB_SUBFR16k]; int16_t core_switching_flag[CPE_CHANNELS]; float old_syn_12k8_16k[CPE_CHANNELS][L_FRAME16k]; @@ -200,6 +205,9 @@ ivas_error ivas_core_dec( set_f( voice_factors[n], 0.f, NB_SUBFR16k ); set_f( hb_synth[n], 0.0f, L_FRAME48k ); +#ifdef FIX_1320_STACK_CPE_DECODER + bwe_exc_extended[n] = hb_synth[n]; /* note: reuse the buffer */ +#endif /*------------------------------------------------------------------* * Decision matrix (selection of technologies) @@ -510,6 +518,10 @@ ivas_error ivas_core_dec( * SWB(FB) BWE decoding *---------------------------------------------------------------------*/ +#ifdef FIX_1320_STACK_CPE_DECODER + flag_bwe_bws = ( output_Fs >= 32000 && st->core == ACELP_CORE && st->bwidth > NB && st->bws_cnt > 0 && st->bfi == 0 ); + +#endif if ( st->extl == SWB_TBE || st->extl == FB_TBE || ( st->coder_type != AUDIO && st->coder_type != INACTIVE && st->core_brate >= SID_2k40 && st->core == ACELP_CORE && !st->con_tcx && output_Fs >= 32000 && st->bwidth > NB && st->bws_cnt > 0 ) ) { /* SWB TBE decoder */ @@ -521,12 +533,23 @@ ivas_error ivas_core_dec( fb_tbe_dec( st, tmp_buffer /*fb_exc*/, hb_synth[n], tmp_buffer /*fb_synth_ref*/, output_frame ); } } +#ifdef FIX_1320_STACK_CPE_DECODER + else if ( st->extl == SWB_BWE || st->extl == FB_BWE || flag_bwe_bws ) +#else else if ( st->extl == SWB_BWE || st->extl == FB_BWE || ( output_Fs >= 32000 && st->core == ACELP_CORE && st->bwidth > NB && st->bws_cnt > 0 && !st->ppp_mode_dec && !( st->nelp_mode_dec == 1 && st->bfi == 1 ) ) ) +#endif { /* SWB BWE decoder */ swb_bwe_dec( st, output[n], synth[n], hb_synth[n], use_cldfb_for_dft, output_frame ); } +#ifdef FIX_1320_STACK_CPE_DECODER + if ( ( st->core == ACELP_CORE && ( st->extl == -1 || st->extl == SWB_CNG ) ) && flag_bwe_bws == 0 ) + { + set_f( hb_synth[n], 0.0f, L_FRAME48k ); + } + +#endif /*---------------------------------------------------------------------* * FEC - recovery after lost HQ core (smoothing of the BWE component) *---------------------------------------------------------------------*/ @@ -560,6 +583,7 @@ ivas_error ivas_core_dec( stereo_icBWE_dec( hCPE, hb_synth[0], hb_synth[1], tmp_buffer /*fb_synth_ref*/, voice_factors[0], output_frame ); } +#ifndef FIX_1320_STACK_CPE_DECODER if ( st->element_mode == EVS_MONO ) { /*----------------------------------------------------------------* @@ -575,7 +599,7 @@ ivas_error ivas_core_dec( st->hPlcInfo->Pitch = 0; } } - +#endif /*----------------------------------------------------------------* * Transition and synchronization of BWE components *----------------------------------------------------------------*/ @@ -590,6 +614,7 @@ ivas_error ivas_core_dec( } else { +#ifndef FIX_1320_STACK_CPE_DECODER if ( st->extl == SWB_BWE_HIGHRATE || st->extl == FB_BWE_HIGHRATE ) { /* HR SWB BWE on top of ACELP@16kHz */ @@ -597,9 +622,12 @@ ivas_error ivas_core_dec( } else { +#endif /* TBE on top of ACELP@16kHz */ tmps = NS2SA( output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_16k_NS ); +#ifndef FIX_1320_STACK_CPE_DECODER } +#endif } /* Smooth transitions when switching between different technologies */ @@ -733,11 +761,9 @@ ivas_error ivas_core_dec( } /* n_channels loop */ - #ifdef DEBUG_MODE_INFO output_debug_mode_info_dec( sts, n_channels, output_frame, pitch_buf ); #endif - pop_wmops(); return error; } diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index dea4a37211..e9d9a62384 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -54,6 +54,10 @@ static void read_stereo_mode_and_bwidth( CPE_DEC_HANDLE hCPE, const Decoder_Stru static void stereo_mode_combined_format_dec( const Decoder_Struct *st_ivas, CPE_DEC_HANDLE hCPE ); +#ifdef FIX_1320_STACK_CPE_DECODER +static ivas_error stereo_dft_dec_main( CPE_DEC_HANDLE hCPE, const int32_t ivas_total_brate, const int16_t n_channels, float res_buf[STEREO_DFT_N_8k], float *output[], float outputHB[][L_FRAME48k], const int16_t output_frame ); + +#endif /*--------------------------------------------------------------------------* * ivas_cpe_dec() @@ -74,7 +78,11 @@ ivas_error ivas_cpe_dec( int16_t last_bwidth; int16_t tdm_ratio_idx; float outputHB[CPE_CHANNELS][L_FRAME48k]; /* 'float' buffer for output HB synthesis, both channels */ +#ifdef FIX_1320_STACK_CPE_DECODER + float *res_buf = NULL; +#else float res_buf[STEREO_DFT_N_8k]; +#endif CPE_DEC_HANDLE hCPE; Decoder_State **sts; STEREO_DFT_CONFIG_DATA_HANDLE hConfigDft; @@ -265,6 +273,10 @@ ivas_error ivas_cpe_dec( } else { +#ifdef FIX_1320_STACK_CPE_DECODER + res_buf = outputHB[0]; /* note: temporarily reused buffer */ + +#endif if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) { nb_bits -= nb_bits_metadata; @@ -443,6 +455,12 @@ ivas_error ivas_cpe_dec( if ( hCPE->element_mode == IVAS_CPE_DFT && !( hCPE->nchan_out == 1 && hConfigDft->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) { +#ifdef FIX_1320_STACK_CPE_DECODER + if ( ( error = stereo_dft_dec_main( hCPE, ivas_total_brate, n_channels, res_buf, output, outputHB, output_frame ) ) != IVAS_ERR_OK ) + { + return error; + } +#else float DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX]; /* core decoder */ @@ -477,6 +495,7 @@ ivas_error ivas_cpe_dec( { stereo_dft_dec_synthesize( hCPE, DFT, n, output[n], output_frame ); } +#endif } else if ( hCPE->element_mode == IVAS_CPE_TD ) { @@ -601,6 +620,74 @@ ivas_error ivas_cpe_dec( return error; } +#ifdef FIX_1320_STACK_CPE_DECODER + +/*------------------------------------------------------------------------- + * stereo_dft_dec_main() + * + * DFT decoder main function + *-------------------------------------------------------------------------*/ + +static ivas_error stereo_dft_dec_main( + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int16_t n_channels, /* i : number of channels to be decoded */ + float *p_res_buf, /* i : DFT stereo residual S signal */ + float *output[], /* o : output synthesis signal */ + float outputHB[][L_FRAME48k], /* o : output HB synthesis signal */ + const int16_t output_frame /* i : output frame length per channel */ +) +{ + float DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX]; + int16_t n; + Decoder_State *st0; + ivas_error error; + + st0 = hCPE->hCoreCoder[0]; + + /* copy from temporary buffer */ + if ( hCPE->hStereoDft->res_cod_band_max > 0 && !st0->bfi ) + { + mvr2r( p_res_buf, DFT[1], STEREO_DFT_N_8k ); + } + + /* core decoder */ + if ( ( error = ivas_core_dec( NULL, NULL, hCPE, NULL, n_channels, output, outputHB, DFT, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* DFT Stereo residual decoding */ + if ( hCPE->hStereoDft->res_cod_band_max > 0 && !st0->bfi ) + { + stereo_dft_dec_res( hCPE, DFT[1] /*res_buf*/, output[1] ); + + stereo_dft_dec_analyze( hCPE, output[1], DFT, 1, L_FRAME8k, output_frame, DFT_STEREO_DEC_ANA_LB, 0, 0 ); + } + + /* DFT stereo CNG */ + stereo_dtf_cng( hCPE, ivas_total_brate, DFT, output_frame ); + + /* decoding */ + if ( hCPE->nchan_out == 1 ) + { + stereo_dft_unify_dmx( hCPE->hStereoDft, st0, DFT, hCPE->input_mem[1], hCPE->hStereoCng->prev_sid_nodata ); + } + else + { + stereo_dft_dec( hCPE->hStereoDft, st0, DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); + } + + /* synthesis iFFT */ + for ( n = 0; n < hCPE->nchan_out; n++ ) + { + stereo_dft_dec_synthesize( hCPE, DFT, n, output[n], output_frame ); + } + + return IVAS_ERR_OK; +} + +#endif /*------------------------------------------------------------------------- * create_cpe_dec() -- GitLab From f79d86a2c03a8cdac6f4c26e0ea92e4f21ffaac8 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 1 May 2025 09:47:23 +0200 Subject: [PATCH 04/19] FIX_1320_STACK_CPE_DECODER in mdct_core --- lib_dec/ivas_mdct_core_dec.c | 8 ++++++++ lib_dec/ivas_stereo_mdct_core_dec.c | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index dd0bfac76d..581374ac74 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -804,7 +804,11 @@ void ivas_mdct_core_reconstruct( int16_t L_frame[CPE_CHANNELS], L_frameTCX[CPE_CHANNELS], nSubframes[CPE_CHANNELS]; int16_t L_frame_global[CPE_CHANNELS], L_frame_globalTCX[CPE_CHANNELS]; /* Synth */ +#ifdef FIX_1320_STACK_CPE_DECODER + float synth_buf[OLD_SYNTH_INTERNAL_DEC + L_FRAME32k + L_FRAME32k / 4 + M]; +#else float synth_buf[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M]; +#endif float *synth; float synth_bufFB[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M]; float *synthFB; @@ -841,7 +845,11 @@ void ivas_mdct_core_reconstruct( synthFB = synth_bufFB + st->hTcxDec->old_synth_lenFB; mvr2r( st->hTcxDec->old_synth, synth_buf, st->hTcxDec->old_synth_len ); mvr2r( st->hTcxDec->old_synthFB, synth_bufFB, st->hTcxDec->old_synth_lenFB ); +#ifdef FIX_1320_STACK_CPE_DECODER + set_zero( synth, L_FRAME32k + L_FRAME32k / 4 + M ); +#else set_zero( synth, L_FRAME_PLUS + M ); +#endif set_zero( synthFB, L_FRAME_PLUS + M ); if ( st->core != ACELP_CORE ) diff --git a/lib_dec/ivas_stereo_mdct_core_dec.c b/lib_dec/ivas_stereo_mdct_core_dec.c index d569640669..a70e62ea2e 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec.c +++ b/lib_dec/ivas_stereo_mdct_core_dec.c @@ -156,7 +156,9 @@ void stereo_mdct_core_dec( float *x[CPE_CHANNELS][NB_DIV]; /*needed to allocate N_MAX to prevent stereo switching crash */ +#ifndef FIX_1320_STACK_CPE_DECODER float x_0_buf[CPE_CHANNELS][N_MAX]; +#endif float *x_0[CPE_CHANNELS][NB_DIV]; /* Concealment */ @@ -178,6 +180,7 @@ void stereo_mdct_core_dec( int16_t p_param[CPE_CHANNELS][NB_DIV]; int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV]; + float signal_outFB_tmp[CPE_CHANNELS][L_FRAME_PLUS]; float signal_out_tmp[CPE_CHANNELS][L_FRAME_PLUS]; push_wmops( "stereo_mdct_core_dec" ); @@ -202,9 +205,15 @@ void stereo_mdct_core_dec( x[ch][0] = &signal_out_tmp[ch][0]; x[ch][1] = &signal_out_tmp[ch][0] + L_FRAME_PLUS / 2; +#ifdef FIX_1320_STACK_CPE_DECODER + set_zero( signal_outFB_tmp[ch], N_MAX ); /* length of N_MAX is needed to prevent stereo switching crash -> reuse buffer signal_outFB_tmp[][] */ + x_0[ch][0] = &signal_outFB_tmp[ch][0]; + x_0[ch][1] = &signal_outFB_tmp[ch][0] + L_FRAME48k / 2; +#else set_zero( x_0_buf[ch], N_MAX ); x_0[ch][0] = &x_0_buf[ch][0]; x_0[ch][1] = &x_0_buf[ch][0] + L_FRAME48k / 2; +#endif nTnsBitsTCX10[ch][0] = 0; nTnsBitsTCX10[ch][1] = 0; @@ -355,6 +364,15 @@ void stereo_mdct_core_dec( apply_dmx_weights( hCPE, x, sts[0]->transform_type, sts[1]->transform_type ); } +#ifdef FIX_1320_STACK_CPE_DECODERaa + mvr2r( signal_out_tmp[0], signal_out[0], L_FRAME48k ); + mvr2r( signal_out_tmp[1], signal_out[1], L_FRAME48k ); + + ivas_mdct_core_reconstruct( hCPE, x, signal_outFB_tmp, fUseTns, 0 ); + + mvr2r( signal_outFB_tmp[0], signal_outFB[0], hCPE->hCoreCoder[0]->hTcxDec->L_frameTCX ); + mvr2r( signal_outFB_tmp[1], signal_outFB[1], hCPE->hCoreCoder[1]->hTcxDec->L_frameTCX ); +#else ivas_mdct_core_reconstruct( hCPE, x, signal_outFB_tmp, fUseTns, 0 ); mvr2r( signal_out_tmp[0], signal_out[0], L_FRAME48k ); @@ -362,6 +380,7 @@ void stereo_mdct_core_dec( mvr2r( signal_outFB_tmp[0], signal_outFB[0], hCPE->hCoreCoder[0]->hTcxDec->L_frameTCX ); mvr2r( signal_outFB_tmp[1], signal_outFB[1], hCPE->hCoreCoder[1]->hTcxDec->L_frameTCX ); +#endif pop_wmops(); return; -- GitLab From 7cd84ef1fefebe4163c57edaddda65b54d6de3ce Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 1 May 2025 10:34:01 +0200 Subject: [PATCH 05/19] fix also to stereo TCX decoder --- lib_com/cnst.h | 3 +++ lib_dec/dec_LPD.c | 8 ++++++++ lib_dec/ivas_mdct_core_dec.c | 4 ++-- lib_dec/ivas_stereo_mdct_core_dec.c | 10 ---------- lib_dec/ivas_tcx_core_dec.c | 8 ++++++++ 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 2108ab81c6..ebb363e692 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -524,6 +524,9 @@ enum #define ACELP_TCX_TRANS_NS 1250000 /* Duration of the ACELP->TCX overlap - 1.25 ms */ #define L_FRAME_MAX L_FRAME48k /* Max 20ms frame size @48kHz */ #define L_FRAME_PLUS 1200 /* Max frame size (long TCX frame) */ +#ifdef FIX_1320_STACK_CPE_DECODER +#define L_FRAME_PLUS_INTERNAL 800 /* Max frame size (long TCX frame) at maximum internal sampling rate */ +#endif #define L_MDCT_OVLP_MAX NS2SA( 48000, ACELP_LOOK_NS ) /* = Max mdct overlap */ #define N_TCX10_MAX 480 /* Max size of TCX10 MDCT spectrum */ #define BITS_TEC 1 /* number of bits for TEC */ diff --git a/lib_dec/dec_LPD.c b/lib_dec/dec_LPD.c index 89597cae4a..bf4aab5e31 100644 --- a/lib_dec/dec_LPD.c +++ b/lib_dec/dec_LPD.c @@ -71,7 +71,11 @@ void decoder_LPD( { int16_t *prm; int16_t param_lpc[NPRM_LPC_NEW]; +#ifdef FIX_1320_STACK_CPE_DECODER + float synth_buf[OLD_SYNTH_INTERNAL_DEC + L_FRAME_PLUS_INTERNAL + M]; +#else float synth_buf[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M]; +#endif float *synth; float synth_bufFB[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M]; float *synthFB; @@ -124,7 +128,11 @@ void decoder_LPD( synthFB = synth_bufFB + st->hTcxDec->old_synth_lenFB; mvr2r( st->hTcxDec->old_synth, synth_buf, st->hTcxDec->old_synth_len ); mvr2r( st->hTcxDec->old_synthFB, synth_bufFB, st->hTcxDec->old_synth_lenFB ); +#ifdef FIX_1320_STACK_CPE_DECODER + set_zero( synth, L_FRAME_PLUS_INTERNAL + M ); +#else set_zero( synth, L_FRAME_PLUS + M ); +#endif set_zero( synthFB, L_FRAME_PLUS + M ); diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index 581374ac74..29ca975ee0 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -805,7 +805,7 @@ void ivas_mdct_core_reconstruct( int16_t L_frame_global[CPE_CHANNELS], L_frame_globalTCX[CPE_CHANNELS]; /* Synth */ #ifdef FIX_1320_STACK_CPE_DECODER - float synth_buf[OLD_SYNTH_INTERNAL_DEC + L_FRAME32k + L_FRAME32k / 4 + M]; + float synth_buf[OLD_SYNTH_INTERNAL_DEC + L_FRAME_PLUS_INTERNAL + M]; #else float synth_buf[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M]; #endif @@ -846,7 +846,7 @@ void ivas_mdct_core_reconstruct( mvr2r( st->hTcxDec->old_synth, synth_buf, st->hTcxDec->old_synth_len ); mvr2r( st->hTcxDec->old_synthFB, synth_bufFB, st->hTcxDec->old_synth_lenFB ); #ifdef FIX_1320_STACK_CPE_DECODER - set_zero( synth, L_FRAME32k + L_FRAME32k / 4 + M ); + set_zero( synth, L_FRAME_PLUS_INTERNAL + M ); #else set_zero( synth, L_FRAME_PLUS + M ); #endif diff --git a/lib_dec/ivas_stereo_mdct_core_dec.c b/lib_dec/ivas_stereo_mdct_core_dec.c index a70e62ea2e..5a3c4f8a7c 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec.c +++ b/lib_dec/ivas_stereo_mdct_core_dec.c @@ -364,15 +364,6 @@ void stereo_mdct_core_dec( apply_dmx_weights( hCPE, x, sts[0]->transform_type, sts[1]->transform_type ); } -#ifdef FIX_1320_STACK_CPE_DECODERaa - mvr2r( signal_out_tmp[0], signal_out[0], L_FRAME48k ); - mvr2r( signal_out_tmp[1], signal_out[1], L_FRAME48k ); - - ivas_mdct_core_reconstruct( hCPE, x, signal_outFB_tmp, fUseTns, 0 ); - - mvr2r( signal_outFB_tmp[0], signal_outFB[0], hCPE->hCoreCoder[0]->hTcxDec->L_frameTCX ); - mvr2r( signal_outFB_tmp[1], signal_outFB[1], hCPE->hCoreCoder[1]->hTcxDec->L_frameTCX ); -#else ivas_mdct_core_reconstruct( hCPE, x, signal_outFB_tmp, fUseTns, 0 ); mvr2r( signal_out_tmp[0], signal_out[0], L_FRAME48k ); @@ -380,7 +371,6 @@ void stereo_mdct_core_dec( mvr2r( signal_outFB_tmp[0], signal_outFB[0], hCPE->hCoreCoder[0]->hTcxDec->L_frameTCX ); mvr2r( signal_outFB_tmp[1], signal_outFB[1], hCPE->hCoreCoder[1]->hTcxDec->L_frameTCX ); -#endif pop_wmops(); return; diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 85e79e8b7d..4133af03ea 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -179,7 +179,11 @@ void stereo_tcx_core_dec( Word16 Aind[M + 1], lspind[M]; /*Synth*/ +#ifdef FIX_1320_STACK_CPE_DECODER + float synth_buf[OLD_SYNTH_INTERNAL_DEC + L_FRAME_PLUS_INTERNAL + M]; +#else float synth_buf[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M]; +#endif float *synth; float synth_bufFB[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M]; float *synthFB; @@ -246,7 +250,11 @@ void stereo_tcx_core_dec( synthFB = synth_bufFB + hTcxDec->old_synth_lenFB; mvr2r( hTcxDec->old_synth, synth_buf, hTcxDec->old_synth_len ); mvr2r( hTcxDec->old_synthFB, synth_bufFB, hTcxDec->old_synth_lenFB ); +#ifdef FIX_1320_STACK_CPE_DECODER + set_zero( synth, L_FRAME_PLUS_INTERNAL + M ); +#else set_zero( synth, L_FRAME_PLUS + M ); +#endif set_zero( synthFB, L_FRAME_PLUS + M ); #ifdef DEBUG_MODE_INFO_PLC -- GitLab From 6f627602f034ae93377ced5290e633f405f79dae Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 5 May 2025 16:00:44 +0200 Subject: [PATCH 06/19] issue 1322: Correct the number of float buffers (channels) at the decoder; under FIX_NCHAN_BUFFERS --- lib_com/options.h | 1 + lib_dec/ivas_dirac_dec.c | 24 +++++- lib_dec/ivas_init_dec.c | 7 +- lib_dec/ivas_jbm_dec.c | 18 +++++ lib_dec/ivas_masa_dec.c | 30 +++++++ lib_dec/ivas_mct_dec.c | 12 +++ lib_dec/ivas_sba_dec.c | 14 ++++ lib_rend/ivas_crend.c | 28 ++++++- lib_rend/ivas_dirac_dec_binaural_functions.c | 24 ++++++ lib_rend/ivas_output_init.c | 84 +++++++++++++++++++- 10 files changed, 238 insertions(+), 4 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 904e462921..96168a1b4c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -161,6 +161,7 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ #define UNIFIED_DECODING_PATHS_LEFTOVERS /* VA: issue 880: remove leftovers after NONBE_UNIFIED_DECODING_PATHS */ +#define FIX_NCHAN_BUFFERS /* VA: issue 1322: Correct the number of float buffers (channels) at the decoder */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index cfc4b0bc30..ade39c535b 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -1554,7 +1554,12 @@ void ivas_dirac_dec_render( uint16_t slot_size, n_samples_sf, ch, nchan_intern; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; float *output_f_local[MAX_OUTPUT_CHANNELS]; +#ifdef FIX_NCHAN_BUFFERS + float *p_output_f[MAX_OUTPUT_CHANNELS]; + float output_f_local_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; +#else float output_f_local_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; +#endif hSpatParamRendCom = st_ivas->hSpatParamRendCom; @@ -1565,7 +1570,11 @@ void ivas_dirac_dec_render( for ( ch = 0; ch < nchan_intern; ch++ ) { output_f_local[ch] = output_f_local_buff[ch]; +#ifdef FIX_NCHAN_BUFFERS + p_output_f[ch] = output_f[ch]; +#else set_zero( output_f_local_buff[ch], nSamplesAsked ); +#endif } slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); @@ -1587,16 +1596,29 @@ void ivas_dirac_dec_render( for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { ivas_dirac_dec_render_sf( st_ivas, output_f_local, nchan_transport, NULL, NULL ); + n_samples_sf = hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->slot_size; + for ( ch = 0; ch < nchan_intern; ch++ ) { +#ifdef FIX_NCHAN_BUFFERS + /* move to output */ + if ( !( ( st_ivas->hDirACRend->hOutSetup.separateChannelEnabled ) && ( st_ivas->hDirACRend->hOutSetup.separateChannelIndex == ch || st_ivas->hDirACRend->hOutSetup.separateChannelIndex + 1 == ch ) ) ) + { + mvr2r( output_f_local_buff[ch], p_output_f[ch], n_samples_sf ); + } + + p_output_f[ch] += n_samples_sf; +#else output_f_local[ch] += n_samples_sf; +#endif } /* update combined orientation access index */ ivas_combined_orientation_update_index( st_ivas->hCombinedOrientationData, n_samples_sf ); } +#ifndef FIX_NCHAN_BUFFERS for ( ch = 0; ch < nchan_intern; ch++ ) { if ( !( ( st_ivas->hDirACRend->hOutSetup.separateChannelEnabled ) && ( st_ivas->hDirACRend->hOutSetup.separateChannelIndex == ch || st_ivas->hDirACRend->hOutSetup.separateChannelIndex + 1 == ch ) ) ) @@ -1604,7 +1626,7 @@ void ivas_dirac_dec_render( mvr2r( output_f_local_buff[ch], output_f[ch], *nSamplesRendered ); } } - +#endif if ( hSpatParamRendCom->slots_rendered == hSpatParamRendCom->num_slots ) { if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 0d3610065b..f59064bbb8 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -487,7 +487,7 @@ ivas_error ivas_dec_setup( } /*-------------------------------------------------------------------* - * Read other signling (ISM/MC mode, number of channels, etc.) + * Read other signaling (ISM/MC mode, number of channels, etc.) *-------------------------------------------------------------------*/ if ( is_DTXrate( ivas_total_brate ) == 0 ) @@ -2378,7 +2378,12 @@ ivas_error ivas_init_decoder( * Allocate floating-point output audio buffers *-----------------------------------------------------------------*/ +#ifdef FIX_NCHAN_BUFFERS + k = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + for ( n = 0; n < k; n++ ) +#else for ( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) +#endif { /* note: these are intra-frame heap memories */ if ( ( st_ivas->p_output_f[n] = (float *) malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( float ) ) ) == NULL ) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 68e9099896..596a9edd74 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -849,7 +849,12 @@ void ivas_jbm_dec_feed_tc_to_renderer( p_data_f[n] = &st_ivas->p_output_f[n][0]; } +#ifdef FIX_NCHAN_BUFFERS + ch = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + for ( n = 0; n < ch; n++ ) +#else for ( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) +#endif { hTcBuffer->tc[n] = st_ivas->p_output_f[n]; /* note: buffers needed in the TD decorellator */ } @@ -2379,11 +2384,20 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( { int16_t nsamp_to_allocate, n_samp_full, n_samp_residual, offset, nchan_residual; int16_t ch_idx; +#ifdef FIX_NCHAN_BUFFERS + float tc_buffer_mem[CPE_CHANNELS * MAX_JBM_L_FRAME48k]; + int16_t num_tc_buffer_mem; +#endif DECODER_TC_BUFFER_HANDLE hTcBuffer; hTcBuffer = st_ivas->hTcBuffer; +#ifdef FIX_NCHAN_BUFFERS + /* 2 channels of the TC buffer for smooth transition in bitrate swithing within 1 CPE and TD decorr. on and off */ + num_tc_buffer_mem = min( hTcBuffer->nchan_buffer_full, CPE_CHANNELS ); + mvr2r( hTcBuffer->tc_buffer, tc_buffer_mem, num_tc_buffer_mem * NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) ); +#endif /* if granularity changes, adapt subframe_nb_slots */ if ( n_samples_granularity != hTcBuffer->n_samples_granularity ) { @@ -2488,6 +2502,10 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( } } +#ifdef FIX_NCHAN_BUFFERS + mvr2r( tc_buffer_mem, hTcBuffer->tc_buffer, num_tc_buffer_mem * NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) ); + +#endif return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 34d528b0e3..560cb474b4 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1320,6 +1320,9 @@ ivas_error ivas_masa_dec_reconfigure( Decoder_State **sts; int32_t ivas_total_brate, last_ivas_total_brate; int16_t numCldfbAnalyses_old, numCldfbSyntheses_old; +#ifdef FIX_NCHAN_BUFFERS + int16_t nchan_out_buff_old, nchan_out_buff; +#endif ivas_error error; int16_t pos_idx; int32_t ism_total_brate; @@ -1327,6 +1330,10 @@ ivas_error ivas_masa_dec_reconfigure( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate; +#ifdef FIX_NCHAN_BUFFERS + nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); + +#endif /* Copy state to TC buffer if granularity matches and we are not in OMASA EXT rendering mode */ if ( st_ivas->hSpatParamRendCom != NULL && st_ivas->hSpatParamRendCom->slot_size == st_ivas->hTcBuffer->n_samples_granularity && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_EXTERNAL ) { @@ -1490,7 +1497,15 @@ ivas_error ivas_masa_dec_reconfigure( } else { +#ifdef FIX_NCHAN_BUFFERS + tc_nchan_to_allocate = BINAURAL_CHANNELS; + if ( st_ivas->hDiracDecBin[0] != NULL && st_ivas->hDiracDecBin[0]->useTdDecorr ) + { + tc_nchan_to_allocate = 2 * BINAURAL_CHANNELS; + } +#else tc_nchan_to_allocate = 2 * BINAURAL_CHANNELS; +#endif } } else if ( st_ivas->nchan_transport == 1 && ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) ) @@ -1530,6 +1545,21 @@ ivas_error ivas_masa_dec_reconfigure( } } +#ifdef FIX_NCHAN_BUFFERS + /*-----------------------------------------------------------------* + * floating-point output audio buffers + *-----------------------------------------------------------------*/ + + if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->last_ivas_format == MASA_FORMAT ) /* note: switching with OMASA is addressed in ivas_omasa_dec_config() */ + { + nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); + if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) + { + return error; + } + } + +#endif return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 3300eb7965..4097c4d71d 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1279,7 +1279,19 @@ static ivas_error ivas_mc_dec_reconfig( if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { +#ifdef FIX_NCHAN_BUFFERS + tc_nchan_allocate_new = BINAURAL_CHANNELS; + if ( st_ivas->hDiracDecBin[0] != NULL && st_ivas->hDiracDecBin[0]->useTdDecorr ) + { + tc_nchan_allocate_new = 2 * BINAURAL_CHANNELS; + } + else if ( st_ivas->hOutSetup.separateChannelEnabled ) + { + tc_nchan_allocate_new++; + } +#else tc_nchan_allocate_new = 2 * BINAURAL_CHANNELS; +#endif tc_nchan_full_new = tc_nchan_allocate_new; } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index ade8e11b02..de0e9444c6 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -704,6 +704,20 @@ ivas_error ivas_sba_dec_render( nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); nchan_out = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; +#ifdef FIX_NCHAN_BUFFERS + if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + { + nchan_out = max( nchan_internal, st_ivas->hDecoderConfig->nchan_out ); + + if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) + { + nchan_out = max( nchan_internal, st_ivas->hDecoderConfig->nchan_out - st_ivas->nchan_ism ); + } + } + + nchan_out = min( nchan_out, ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) ); + +#endif #ifdef DEBUGGING assert( hSpar ); #endif diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index fde8148951..b0c9631bdc 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1501,8 +1501,13 @@ static ivas_error ivas_rend_crendConvolver( const float *pFreq_filt_re, *pFreq_filt_im; float *pFreq_buf_re = NULL, *pFreq_buf_im = NULL; float *pFreq_buf2_re = NULL, *pFreq_buf2_im = NULL; +#ifdef FIX_NCHAN_BUFFERS + float pOut[2 /*Re,Im*/ * L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; + float tmp_out_re[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES], tmp_out_im[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; +#else float pOut[L_FRAME48k * 2]; float tmp_out_re[L_FRAME48k], tmp_out_im[L_FRAME48k]; +#endif CREND_HANDLE hCrend; ivas_error error; @@ -1708,7 +1713,12 @@ ivas_error ivas_rend_crendProcessSubframe( int16_t subframe_idx, subframe_len; int16_t nchan_out, nchan_in, ch, first_sf, last_sf, slot_size, slots_to_render; float *tc_local[MAX_OUTPUT_CHANNELS]; +#ifdef FIX_NCHAN_BUFFERS + float *p_output[BINAURAL_CHANNELS]; + float pcm_tmp[BINAURAL_CHANNELS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; +#else float pcm_tmp[BINAURAL_CHANNELS][L_FRAME48k]; +#endif float *p_pcm_tmp[BINAURAL_CHANNELS]; IVAS_REND_AudioConfigType inConfigType; ivas_error error; @@ -1747,6 +1757,9 @@ ivas_error ivas_rend_crendProcessSubframe( for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { p_pcm_tmp[ch] = pcm_tmp[ch]; +#ifdef FIX_NCHAN_BUFFERS + p_output[ch] = output[ch]; +#endif } if ( hTcBuffer != NULL ) @@ -1827,10 +1840,12 @@ ivas_error ivas_rend_crendProcessSubframe( { tc_local[ch] += subframe_len; } +#ifndef FIX_NCHAN_BUFFERS for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { p_pcm_tmp[ch] += subframe_len; } +#endif if ( hTcBuffer != NULL ) { @@ -1842,16 +1857,27 @@ ivas_error ivas_rend_crendProcessSubframe( return IVAS_ERR_INVALID_INPUT_FORMAT; } +#ifdef FIX_NCHAN_BUFFERS + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + /* move to output */ + mvr2r( pcm_tmp[ch], p_output[ch], subframe_len ); + + p_output[ch] += subframe_len; + } + +#endif /* update combined orientation access index */ ivas_combined_orientation_update_index( hCombinedOrientationData, subframe_len ); } +#ifndef FIX_NCHAN_BUFFERS /* move to output */ for ( ch = 0; ch < nchan_out; ch++ ) { mvr2r( pcm_tmp[ch], output[ch], n_samples_to_render ); } - +#endif if ( hTcBuffer != NULL ) { hTcBuffer->subframes_rendered = last_sf; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index cc1bccb131..8aa7b94d58 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -318,7 +318,19 @@ ivas_error ivas_dirac_dec_init_binaural_data( int16_t nchan_to_allocate; int16_t n_samples_granularity; +#ifdef FIX_NCHAN_BUFFERS + nchan_to_allocate = BINAURAL_CHANNELS; + if ( st_ivas->hDiracDecBin[0] != NULL && st_ivas->hDiracDecBin[0]->useTdDecorr ) + { + nchan_to_allocate = 2 * BINAURAL_CHANNELS; + } + else if ( st_ivas->hOutSetup.separateChannelEnabled ) + { + nchan_to_allocate++; + } +#else nchan_to_allocate = 2 * BINAURAL_CHANNELS; +#endif if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { nchan_to_allocate = BINAURAL_CHANNELS + st_ivas->nchan_ism; @@ -444,8 +456,10 @@ void ivas_dirac_dec_binaural_render( uint16_t nchan_out; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; float *output_f_local[MAX_OUTPUT_CHANNELS]; +#ifndef FIX_NCHAN_BUFFERS float output_f_local_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; int16_t output_length; +#endif hSpatParamRendCom = st_ivas->hSpatParamRendCom; nchan_out = BINAURAL_CHANNELS; @@ -454,7 +468,11 @@ void ivas_dirac_dec_binaural_render( #endif for ( ch = 0; ch < nchan_out; ch++ ) { +#ifdef FIX_NCHAN_BUFFERS + output_f_local[ch] = output_f[ch]; +#else output_f_local[ch] = output_f_local_buff[ch]; +#endif } slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); @@ -473,7 +491,9 @@ void ivas_dirac_dec_binaural_render( #ifdef DEBUGGING assert( slots_to_render == 0 ); #endif +#ifndef FIX_NCHAN_BUFFERS output_length = 0; +#endif for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { int16_t n_samples_sf = slot_size * hSpatParamRendCom->subframe_nbslots[subframe_idx]; @@ -484,17 +504,21 @@ void ivas_dirac_dec_binaural_render( output_f_local[ch] += n_samples_sf; } +#ifndef FIX_NCHAN_BUFFERS output_length += n_samples_sf; +#endif /* update combined orientation access index */ ivas_combined_orientation_update_index( st_ivas->hCombinedOrientationData, n_samples_sf ); } +#ifndef FIX_NCHAN_BUFFERS for ( ch = 0; ch < nchan_out; ch++ ) { mvr2r( output_f_local_buff[ch], output_f[ch], output_length ); } +#endif if ( hSpatParamRendCom->slots_rendered == hSpatParamRendCom->num_slots ) { hSpatParamRendCom->dirac_read_idx = ( hSpatParamRendCom->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % hSpatParamRendCom->dirac_md_buffer_length; diff --git a/lib_rend/ivas_output_init.c b/lib_rend/ivas_output_init.c index 1487181715..4458e9ea84 100644 --- a/lib_rend/ivas_output_init.c +++ b/lib_rend/ivas_output_init.c @@ -271,7 +271,11 @@ int16_t ivas_get_nchan_buffers_dec( output_config = st_ivas->hDecoderConfig->output_config; +#ifdef FIX_NCHAN_BUFFERS + nchan_out_buff = st_ivas->nchan_transport; +#else nchan_out_buff = MAX_OUTPUT_CHANNELS; +#endif if ( st_ivas->ivas_format == MONO_FORMAT ) { @@ -283,6 +287,14 @@ int16_t ivas_get_nchan_buffers_dec( } else if ( st_ivas->ivas_format == ISM_FORMAT ) { +#ifdef FIX_NCHAN_BUFFERS + nchan_out_buff = max( st_ivas->hDecoderConfig->nchan_out, st_ivas->nchan_ism ); + + if ( st_ivas->ism_mode == ISM_MODE_PARAM || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + { + nchan_out_buff = max( nchan_out_buff, audioCfg2channels( st_ivas->intern_config ) ); + } +#else nchan_out_buff = st_ivas->nchan_ism; if ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) @@ -294,9 +306,16 @@ int16_t ivas_get_nchan_buffers_dec( nchan_out_buff = max( audioCfg2channels( st_ivas->transport_config ), audioCfg2channels( st_ivas->intern_config ) ); nchan_out_buff = max( nchan_out_buff, audioCfg2channels( output_config ) ); } +#endif } else if ( st_ivas->ivas_format == SBA_FORMAT ) { +#ifdef FIX_NCHAN_BUFFERS + int16_t nchan_internal; + nchan_internal = ivas_sba_get_nchan_metadata( sba_analysis_order, ivas_total_brate ); + + nchan_out_buff = max( nchan_internal, st_ivas->hDecoderConfig->nchan_out ); +#else int16_t nchan_internal; nchan_internal = ivas_sba_get_nchan_metadata( sba_analysis_order, ivas_total_brate ); nchan_out_buff = st_ivas->hDecoderConfig->nchan_out; @@ -311,9 +330,18 @@ int16_t ivas_get_nchan_buffers_dec( nchan_out_buff = max( nchan_out_buff, audioCfg2channels( output_config ) ); } nchan_out_buff = max( nchan_out_buff, nchan_internal ); +#endif } else if ( st_ivas->ivas_format == MASA_FORMAT ) { +#ifdef FIX_NCHAN_BUFFERS + nchan_out_buff = max( st_ivas->hDecoderConfig->nchan_out, st_ivas->nchan_transport ); + + if ( st_ivas->hDiracDecBin[0] != NULL && st_ivas->hDiracDecBin[0]->useTdDecorr ) + { + nchan_out_buff = 2 * BINAURAL_CHANNELS; + } +#else nchan_out_buff = CPE_CHANNELS; if ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) @@ -334,9 +362,13 @@ int16_t ivas_get_nchan_buffers_dec( { nchan_out_buff = st_ivas->nchan_ism + CPE_CHANNELS; } +#endif } else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { +#ifdef FIX_NCHAN_BUFFERS + nchan_out_buff = max( st_ivas->hDecoderConfig->nchan_out, st_ivas->nchan_transport + st_ivas->nchan_ism ); +#else nchan_out_buff = st_ivas->nchan_ism + CPE_CHANNELS; if ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) @@ -352,9 +384,32 @@ int16_t ivas_get_nchan_buffers_dec( nchan_out_buff = max( nchan_out_buff, audioCfg2channels( st_ivas->intern_config ) ); nchan_out_buff = max( nchan_out_buff, audioCfg2channels( output_config ) ); } +#endif } else if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) { +#ifdef FIX_NCHAN_BUFFERS + int16_t nchan_internal; + + nchan_internal = ivas_sba_get_nchan_metadata( sba_analysis_order, ivas_total_brate ); + + if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + { + nchan_internal += st_ivas->nchan_ism; + } + + if ( st_ivas->hMCT != NULL ) + { + nchan_internal = ( ( nchan_internal + 1 ) >> 1 ) << 1; /* ensure odd number of channels in MCT */ + } + + nchan_out_buff = max( nchan_internal, st_ivas->hDecoderConfig->nchan_out ); + + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + { + nchan_out_buff = max( nchan_out_buff, audioCfg2channels( st_ivas->intern_config ) ); + } +#else int16_t nchan_internal; nchan_internal = ivas_sba_get_nchan_metadata( sba_analysis_order, ivas_total_brate ); nchan_out_buff = st_ivas->nchan_ism + st_ivas->nchan_transport; @@ -392,9 +447,27 @@ int16_t ivas_get_nchan_buffers_dec( nchan_out_buff = max( nchan_out_buff, nchan_internal + st_ivas->nchan_ism ); } nchan_out_buff = min( nchan_out_buff, MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS ); +#endif } else if ( st_ivas->ivas_format == MC_FORMAT ) { +#ifdef FIX_NCHAN_BUFFERS + nchan_out_buff = max( st_ivas->hDecoderConfig->nchan_out, st_ivas->nchan_transport ); + + if ( st_ivas->hOutSetup.separateChannelEnabled ) + { + nchan_out_buff = max( nchan_out_buff, st_ivas->nchan_transport + 1 ); + } + + if ( st_ivas->hDiracDecBin[0] != NULL && st_ivas->hDiracDecBin[0]->useTdDecorr ) + { + nchan_out_buff = 2 * BINAURAL_CHANNELS; + } + else + { + nchan_out_buff = max( nchan_out_buff, audioCfg2channels( st_ivas->intern_config ) ); + } +#else nchan_out_buff = st_ivas->hDecoderConfig->nchan_out; if ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) @@ -406,6 +479,7 @@ int16_t ivas_get_nchan_buffers_dec( nchan_out_buff = max( audioCfg2channels( st_ivas->transport_config ), audioCfg2channels( st_ivas->intern_config ) ); nchan_out_buff = max( nchan_out_buff, audioCfg2channels( output_config ) ); } +#endif } if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) @@ -435,8 +509,16 @@ ivas_error ivas_output_buff_dec( { for ( ch = nchan_out_buff_old; ch < nchan_out_buff; ch++ ) { +#ifdef FIX_NCHAN_BUFFERS +#ifdef DEBUGGING + if ( p_output_f[ch] != NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Memory for floating-point output audio buffer is already allocated!\n" ) ); + } +#endif +#endif /* note: these are intra-frame heap memories */ - if ( ( p_output_f[ch] = (float *) malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( float ) ) ) == NULL ) /* note: 32000 == max internal sampling rate */ + if ( ( p_output_f[ch] = (float *) malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for floating-point output audio buffer!\n" ) ); } -- GitLab From d817b428cd68b85254ff06b115d0ae0c221780e8 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 5 May 2025 16:47:29 +0200 Subject: [PATCH 07/19] fix non-JBM BR switching crash --- lib_dec/ivas_jbm_dec.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 596a9edd74..6a02f16c8d 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -2395,7 +2395,10 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( #ifdef FIX_NCHAN_BUFFERS /* 2 channels of the TC buffer for smooth transition in bitrate swithing within 1 CPE and TD decorr. on and off */ num_tc_buffer_mem = min( hTcBuffer->nchan_buffer_full, CPE_CHANNELS ); - mvr2r( hTcBuffer->tc_buffer, tc_buffer_mem, num_tc_buffer_mem * NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) ); + if ( st_ivas->hDecoderConfig->Opt_tsm ) + { + mvr2r( hTcBuffer->tc_buffer, tc_buffer_mem, num_tc_buffer_mem * NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) ); + } #endif /* if granularity changes, adapt subframe_nb_slots */ @@ -2503,7 +2506,10 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( } #ifdef FIX_NCHAN_BUFFERS - mvr2r( tc_buffer_mem, hTcBuffer->tc_buffer, num_tc_buffer_mem * NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) ); + if ( st_ivas->hDecoderConfig->Opt_tsm ) + { + mvr2r( tc_buffer_mem, hTcBuffer->tc_buffer, num_tc_buffer_mem * NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) ); + } #endif return IVAS_ERR_OK; -- GitLab From 7b562139e9c49b75d49488619030d3ed4d411054 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 5 May 2025 17:43:38 +0200 Subject: [PATCH 08/19] fix MASA non-JBM BR switching crash --- lib_dec/ivas_jbm_dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 6a02f16c8d..281c42344a 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -2395,7 +2395,7 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( #ifdef FIX_NCHAN_BUFFERS /* 2 channels of the TC buffer for smooth transition in bitrate swithing within 1 CPE and TD decorr. on and off */ num_tc_buffer_mem = min( hTcBuffer->nchan_buffer_full, CPE_CHANNELS ); - if ( st_ivas->hDecoderConfig->Opt_tsm ) + if ( st_ivas->hDecoderConfig->Opt_tsm && num_tc_buffer_mem == CPE_CHANNELS ) { mvr2r( hTcBuffer->tc_buffer, tc_buffer_mem, num_tc_buffer_mem * NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) ); } @@ -2506,7 +2506,7 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( } #ifdef FIX_NCHAN_BUFFERS - if ( st_ivas->hDecoderConfig->Opt_tsm ) + if ( st_ivas->hDecoderConfig->Opt_tsm && num_tc_buffer_mem == CPE_CHANNELS && hTcBuffer->nchan_buffer_full == CPE_CHANNELS ) { mvr2r( tc_buffer_mem, hTcBuffer->tc_buffer, num_tc_buffer_mem * NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) ); } -- GitLab From e0cdbf2fece164a5232cedba1fb01c82b3a5f63a Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 5 May 2025 18:28:27 +0200 Subject: [PATCH 09/19] deactivate update under FIX_NCHAN_BUFFERS --- lib_dec/ivas_jbm_dec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 281c42344a..6abc131289 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -2508,7 +2508,8 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( #ifdef FIX_NCHAN_BUFFERS if ( st_ivas->hDecoderConfig->Opt_tsm && num_tc_buffer_mem == CPE_CHANNELS && hTcBuffer->nchan_buffer_full == CPE_CHANNELS ) { - mvr2r( tc_buffer_mem, hTcBuffer->tc_buffer, num_tc_buffer_mem * NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) ); + // Note: keep deactivated for the moment to ensure BE results for 'stv' + // mvr2r( tc_buffer_mem, hTcBuffer->tc_buffer, num_tc_buffer_mem * NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) ); } #endif -- GitLab From 8a0b0bea984a9ec0bb13c7bb6b9c911fb5ca9c29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Tue, 6 May 2025 12:06:59 +0200 Subject: [PATCH 10/19] Increase LTV pipeline schedules' timeouts Should fix build problems which recently surfaced on some runners (cf. https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/pipelines/52295). --- .gitlab-ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index eead0d128e..fada31d271 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1585,7 +1585,7 @@ ltv-msan: - .sanitizer-selftest-anchor rules: - if: $SANITIZER_SCHEDULE_E - timeout: 4 hours + timeout: 5 hours tags: - ivas-linux-fast before_script: @@ -1603,10 +1603,10 @@ ltv-asan: rules: - if: $SANITIZER_SCHEDULE_E when: delayed - start_in: 4 hours + start_in: 5 hours tags: - ivas-linux-fast - timeout: 4 hours + timeout: 5 hours before_script: - !reference [.job-linux, before_script] - CLANG_NUM=2 @@ -1622,10 +1622,10 @@ ltv-usan: rules: - if: $SANITIZER_SCHEDULE_E when: delayed - start_in: 7 hours + start_in: 8 hours tags: - ivas-linux-fast - timeout: 4 hours + timeout: 5 hours before_script: - !reference [.job-linux, before_script] - CLANG_NUM=3 -- GitLab From 99a7a9fd488cf95db7ec03018be76262384f5dd7 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 8 May 2025 19:50:15 +0200 Subject: [PATCH 11/19] revert the MASA discontinuity fix --- lib_dec/ivas_jbm_dec.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 6abc131289..76bd1eb61f 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -2384,23 +2384,10 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( { int16_t nsamp_to_allocate, n_samp_full, n_samp_residual, offset, nchan_residual; int16_t ch_idx; -#ifdef FIX_NCHAN_BUFFERS - float tc_buffer_mem[CPE_CHANNELS * MAX_JBM_L_FRAME48k]; - int16_t num_tc_buffer_mem; -#endif DECODER_TC_BUFFER_HANDLE hTcBuffer; hTcBuffer = st_ivas->hTcBuffer; -#ifdef FIX_NCHAN_BUFFERS - /* 2 channels of the TC buffer for smooth transition in bitrate swithing within 1 CPE and TD decorr. on and off */ - num_tc_buffer_mem = min( hTcBuffer->nchan_buffer_full, CPE_CHANNELS ); - if ( st_ivas->hDecoderConfig->Opt_tsm && num_tc_buffer_mem == CPE_CHANNELS ) - { - mvr2r( hTcBuffer->tc_buffer, tc_buffer_mem, num_tc_buffer_mem * NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) ); - } - -#endif /* if granularity changes, adapt subframe_nb_slots */ if ( n_samples_granularity != hTcBuffer->n_samples_granularity ) { @@ -2505,14 +2492,6 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( } } -#ifdef FIX_NCHAN_BUFFERS - if ( st_ivas->hDecoderConfig->Opt_tsm && num_tc_buffer_mem == CPE_CHANNELS && hTcBuffer->nchan_buffer_full == CPE_CHANNELS ) - { - // Note: keep deactivated for the moment to ensure BE results for 'stv' - // mvr2r( tc_buffer_mem, hTcBuffer->tc_buffer, num_tc_buffer_mem * NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) ); - } - -#endif return IVAS_ERR_OK; } -- GitLab From fdb264b75ab41ecb2678dea8478095250be3ebaa Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 13 May 2025 10:48:45 +0200 Subject: [PATCH 12/19] accept UNIFIED_DECODING_PATHS_LEFTOVERS --- lib_com/ivas_cnst.h | 4 - lib_com/ivas_prot.h | 15 -- lib_com/options.h | 1 - lib_dec/ivas_ism_param_dec.c | 62 +----- lib_dec/ivas_jbm_dec.c | 287 +------------------------- lib_dec/ivas_mc_param_dec.c | 34 --- lib_dec/ivas_sba_rendering_internal.c | 4 - lib_dec/lib_dec.c | 6 - 8 files changed, 5 insertions(+), 408 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index d42da1b422..e2d40e74df 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -175,11 +175,7 @@ typedef enum #define MAX_JBM_L_FRAME48k 1920 #define MAX_JBM_L_FRAME_NS 40000000L #define MAX_SPAR_INTERNAL_CHANNELS IVAS_SPAR_MAX_CH -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS #define MAX_CLDFB_DIGEST_CHANNELS 3 /* == maximum of ParamISM TCs and ParamMC TCs */ -#else -#define MAX_CLDFB_DIGEST_CHANNELS (FOA_CHANNELS + MAX_NUM_OBJECTS) -#endif typedef enum { diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index e0dbc245d7..f3366e08a8 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -868,13 +868,6 @@ void ivas_jbm_dec_get_md_map( int16_t ivas_jbm_dec_get_num_tc_channels( Decoder_Struct *st_ivas /* i : IVAS decoder handle */ ); -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS -void ivas_jbm_dec_copy_tc_no_tsm( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float *tc[], /* i : transport channels */ - const int16_t output_frame /* i : output frame size */ -); -#endif void ivas_jbm_dec_get_md_map_even_spacing( const int16_t len, /* i : length of the modfied frames in metadata slots */ @@ -1129,14 +1122,6 @@ void ivas_param_ism_dec_prepare_renderer( const uint16_t nCldfbSlots /* i : number of CLDFB slots in transport channels */ ); -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS -void ivas_ism_param_dec_tc_gain_ajust( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint16_t nSamples, /* i : number of samples to be compensate */ - const uint16_t nFadeLength, /* i : length of the crossfade in samples */ - float *p_data_f[] /* i : synthesized core-coder transport channels/DirAC output */ -); -#endif void ivas_param_ism_dec_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ diff --git a/lib_com/options.h b/lib_com/options.h index e237e1f1ef..85314bece4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,7 +160,6 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ -#define UNIFIED_DECODING_PATHS_LEFTOVERS /* VA: issue 880: remove leftovers after NONBE_UNIFIED_DECODING_PATHS */ #define FIX_1314_STEREO_TO_EXT /* VA: issue 1314: set RENDERER_DISABLE for stereo to EXT output */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index a5a6f90f02..ba29576848 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -45,14 +45,12 @@ #include "wmc_auto.h" -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS /*-----------------------------------------------------------------------* * Local function declarations *-----------------------------------------------------------------------*/ static void ivas_ism_param_dec_tc_gain_adjust( Decoder_Struct *st_ivas, const int16_t nSamples, const int16_t nFadeLength, float *p_data_f[] ); -#endif /*-----------------------------------------------------------------------* * Local function definitions *-----------------------------------------------------------------------*/ @@ -804,49 +802,20 @@ void ivas_param_ism_dec_digest_tc( float *p_data_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ) { -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS int16_t ch, slot_idx, output_frame; int16_t num_freq_bands, cldfb_ch, n_ch_cldfb; float *cldfb_real_buffer, *cldfb_imag_buffer; -#else - int16_t ch, nchan_transport; - int16_t slot_idx; - int16_t output_frame; - PARAM_ISM_DEC_HANDLE hParamIsmDec; - SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; - int16_t fade_len; -#endif /* Initialization */ -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS num_freq_bands = st_ivas->hSpatParamRendCom->num_freq_bands; output_frame = nCldfbSlots * num_freq_bands; n_ch_cldfb = st_ivas->hTcBuffer->nchan_transport_jbm - st_ivas->hTcBuffer->nchan_buffer_full; cldfb_real_buffer = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc; cldfb_imag_buffer = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc; -#else - hParamIsmDec = st_ivas->hParamIsmDec; - assert( hParamIsmDec ); - hSpatParamRendCom = st_ivas->hSpatParamRendCom; - assert( hSpatParamRendCom ); - output_frame = nCldfbSlots * hSpatParamRendCom->num_freq_bands; - fade_len = output_frame / 2; - - nchan_transport = st_ivas->nchan_transport; -#endif -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS ivas_ism_param_dec_tc_gain_adjust( st_ivas, output_frame, output_frame / 2, p_data_f ); -#else - if ( st_ivas->hDecoderConfig->Opt_tsm ) - { - /*TODO : FhG to check*/ - ivas_ism_param_dec_tc_gain_ajust( st_ivas, output_frame, fade_len, p_data_f ); - } -#endif -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS /* CLDFB Analysis */ for ( ch = 0, cldfb_ch = 0; cldfb_ch < n_ch_cldfb; cldfb_ch++, ch++ ) { @@ -858,24 +827,6 @@ void ivas_param_ism_dec_digest_tc( num_freq_bands, st_ivas->cldfbAnaDec[cldfb_ch] ); } } -#else - for ( ch = 0; ch < nchan_transport; ch++ ) - { - /* CLDFB Analysis */ - for ( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ ) - { - if ( st_ivas->hDecoderConfig->Opt_tsm ) - { - float RealBuffer[CLDFB_NO_CHANNELS_MAX]; - float ImagBuffer[CLDFB_NO_CHANNELS_MAX]; - - cldfbAnalysis_ts( &( p_data_f[ch][hSpatParamRendCom->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hSpatParamRendCom->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); - mvr2r( RealBuffer, &hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc[slot_idx * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands], hSpatParamRendCom->num_freq_bands ); - mvr2r( ImagBuffer, &hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc[slot_idx * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands], hSpatParamRendCom->num_freq_bands ); - } - } - } -#endif return; } @@ -1037,20 +988,11 @@ void ivas_param_ism_dec_prepare_renderer( * *-------------------------------------------------------------------------*/ -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS static void ivas_ism_param_dec_tc_gain_adjust( -#else -void ivas_ism_param_dec_tc_gain_ajust( -#endif - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const int16_t nSamples, /* i : number of samples to be compensate */ const int16_t nFadeLength, /* i : length of the crossfade in samples */ -#else - const uint16_t nSamples, /* i : number of samples to be compensate */ - const uint16_t nFadeLength, /* i : length of the crossfade in samples */ -#endif - float *p_data_f[] /* i : synthesized core-coder transport channels/DirAC output*/ + float *p_data_f[] /* i : synthesized core-coder transport channels/DirAC output*/ ) { diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 68e9099896..e752c91c40 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -50,9 +50,6 @@ * Local function prototypes *-----------------------------------------------------------------------*/ -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS -static void ivas_jbm_dec_copy_tc( Decoder_Struct *st_ivas, const int16_t nSamplesForRendering, int16_t *nSamplesResidual, float *data, float *tc_digest_f[] ); -#endif static void ivas_jbm_dec_tc_buffer_playout( Decoder_Struct *st_ivas, const uint16_t nSamplesAsked, uint16_t *nSamplesRendered, float *output[] ); static void ivas_jbm_dec_copy_masa_meta_to_buffer( Decoder_Struct *st_ivas ); @@ -210,12 +207,6 @@ ivas_error ivas_jbm_dec_tc( { return error; } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->hDecoderConfig->Opt_tsm ) - { - ivas_jbm_dec_copy_masa_meta_to_buffer( st_ivas ); - } -#endif } else if ( st_ivas->ivas_format == SBA_FORMAT ) { @@ -410,12 +401,6 @@ ivas_error ivas_jbm_dec_tc( /* Extract objects from MASA, output MASA + all objects (i.e., extracted and separated objects) */ ivas_omasa_render_objects_from_mix( st_ivas, p_output, st_ivas->nchan_ism, output_frame ); } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - if ( st_ivas->hDecoderConfig->Opt_tsm ) - { - ivas_jbm_dec_copy_masa_meta_to_buffer( st_ivas ); - } -#endif } } else if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) @@ -726,18 +711,6 @@ ivas_error ivas_jbm_dec_tc( } } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - /*----------------------------------------------------------------* - * Write IVAS transport channels - *----------------------------------------------------------------*/ - - if ( st_ivas->hDecoderConfig->Opt_tsm == 0 ) - { - /* directly copy to tc buffers */ - ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, output_frame ); - } - -#endif /*----------------------------------------------------------------* * Common updates *----------------------------------------------------------------*/ @@ -773,7 +746,6 @@ ivas_error ivas_jbm_dec_tc( return IVAS_ERR_OK; } -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS /*--------------------------------------------------------------------------* * ivas_dec_feed_tc_to_renderer() @@ -877,73 +849,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( return; } -#else - -/*--------------------------------------------------------------------------* - * ivas_jbm_dec_feed_tc_to_renderer() - * - * Feed decoded transport channels and metadata to the IVAS JBM renderer routine - *--------------------------------------------------------------------------*/ - -void ivas_jbm_dec_feed_tc_to_renderer( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t nSamplesForRendering, /* i : number of TC samples available for rendering */ - int16_t *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ - float *data /* i : transport channels */ -) -{ - float data_f[MAX_CLDFB_DIGEST_CHANNELS][MAX_JBM_L_FRAME48k]; /* 'float' buffer for transport channels that will be directly converted with the CLDFB */ - float *p_data_f[MAX_CLDFB_DIGEST_CHANNELS]; - int16_t n, n_render_timeslots; - - push_wmops( "ivas_jbm_dec_feed_tc_to_renderer" ); - for ( n = 0; n < MAX_CLDFB_DIGEST_CHANNELS; n++ ) - { - p_data_f[n] = &data_f[n][0]; - } - - if ( !st_ivas->hDecoderConfig->Opt_tsm ) - { - for ( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) - { - st_ivas->hTcBuffer->tc[n] = st_ivas->p_output_f[n]; /* note: buffers needed in the TD decorellator */ - } - } - - if ( st_ivas->hDecoderConfig->Opt_tsm ) - { - ivas_jbm_dec_copy_tc( st_ivas, nSamplesForRendering, nSamplesResidual, data, p_data_f ); - } - else - { - *nSamplesResidual = 0; - } - n_render_timeslots = st_ivas->hTcBuffer->n_samples_available / st_ivas->hTcBuffer->n_samples_granularity; - - if ( st_ivas->ivas_format == ISM_FORMAT ) - { - /* Rendering */ - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) - { - if ( st_ivas->renderer_type == RENDERER_PARAM_ISM || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) - { - ivas_param_ism_dec_digest_tc( st_ivas, n_render_timeslots, p_data_f ); - } - } - } - else if ( st_ivas->ivas_format == MC_FORMAT ) - { - if ( st_ivas->mc_mode == MC_MODE_PARAMMC && st_ivas->hTcBuffer->tc_buffer_mode == TC_BUFFER_MODE_RENDERER ) - { - ivas_param_mc_dec_digest_tc( st_ivas, (uint8_t) n_render_timeslots, p_data_f ); - } - } - - pop_wmops(); - return; -} - -#endif /*--------------------------------------------------------------------------* * ivas_dec_render() @@ -969,9 +874,6 @@ ivas_error ivas_jbm_dec_render( ivas_error error; float *p_output[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; float *p_tc[MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS]; -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; -#endif int16_t nchan_out_syn_output; push_wmops( "ivas_dec_render" ); @@ -979,9 +881,6 @@ ivas_error ivas_jbm_dec_render( * Initialization of local vars after struct has been set *----------------------------------------------------------------*/ -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - hSpatParamRendCom = st_ivas->hSpatParamRendCom; -#endif output_Fs = st_ivas->hDecoderConfig->output_Fs; nchan_out = st_ivas->hDecoderConfig->nchan_out; nchan_transport = st_ivas->hTcBuffer->nchan_transport_jbm; @@ -995,30 +894,16 @@ ivas_error ivas_jbm_dec_render( if ( !st_ivas->hDecoderConfig->Opt_tsm ) { -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) - { - p_tc[n] = &p_output[n][st_ivas->hTcBuffer->n_samples_rendered]; - } - -#endif for ( n = 0; n < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; n++ ) { st_ivas->hTcBuffer->tc[n] = p_output[n]; } } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - else - { -#endif - for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) - { - p_tc[n] = &st_ivas->hTcBuffer->tc[n][st_ivas->hTcBuffer->n_samples_rendered]; - } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS + for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) + { + p_tc[n] = &st_ivas->hTcBuffer->tc[n][st_ivas->hTcBuffer->n_samples_rendered]; } -#endif /*----------------------------------------------------------------* * Update combined orientation access index @@ -1094,11 +979,7 @@ ivas_error ivas_jbm_dec_render( #endif { /* Convert to Ambisonics */ -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS ivas_ism2sba_sf( p_tc, p_output, st_ivas->hIsmRendererData, st_ivas->nchan_transport, *nSamplesRendered, st_ivas->hTcBuffer->n_samples_rendered, st_ivas->hIntSetup.ambisonics_order ); -#else - ivas_ism2sba_sf( st_ivas->hTcBuffer->tc, p_output, st_ivas->hIsmRendererData, st_ivas->nchan_transport, *nSamplesRendered, st_ivas->hTcBuffer->n_samples_rendered, st_ivas->hIntSetup.ambisonics_order ); -#endif } /* Binaural rendering */ @@ -1236,11 +1117,7 @@ ivas_error ivas_jbm_dec_render( for ( n = 0; n < st_ivas->nchan_ism; n++ ) { -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS mvr2r( p_tc[n], p_output[n], *nSamplesRendered ); -#else - mvr2r( st_ivas->hTcBuffer->tc[n] + st_ivas->hTcBuffer->n_samples_rendered, p_output[n], *nSamplesRendered ); -#endif } } else @@ -1280,12 +1157,6 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->ivas_format == MC_FORMAT ) { -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) - { - p_tc[n] = &st_ivas->hTcBuffer->tc[n][st_ivas->hTcBuffer->n_samples_rendered]; - } -#endif if ( st_ivas->mc_mode == MC_MODE_MCT ) { int16_t crendInPlaceRotation = FALSE; @@ -1379,9 +1250,6 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - int16_t offset = hSpatParamRendCom->slots_rendered * hSpatParamRendCom->slot_size; -#endif 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 ) { @@ -1396,11 +1264,7 @@ ivas_error ivas_jbm_dec_render( /* we still need to copy the separate channel if available */ if ( st_ivas->hOutSetup.separateChannelEnabled ) { -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS mvr2r( p_tc[LFE_CHANNEL - 1], p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); -#else - mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); -#endif } ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0.f ); @@ -1421,22 +1285,12 @@ ivas_error ivas_jbm_dec_render( output_config == IVAS_AUDIO_CONFIG_5_1_4 || output_config == IVAS_AUDIO_CONFIG_7_1_4 || output_config == IVAS_AUDIO_CONFIG_5_1_2 || ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe > 0 ) ) { -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS mvr2r( p_tc[LFE_CHANNEL], p_output[LFE_CHANNEL], *nSamplesRendered ); mvr2r( p_tc[LFE_CHANNEL - 1], p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); -#else - mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL] + offset, p_output[LFE_CHANNEL], *nSamplesRendered ); - mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); -#endif } else if ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe == 0 ) { -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS mvr2r( p_tc[LFE_CHANNEL - 1], p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); -#else - /* Delay the separated channel to sync with the DirAC rendering */ - mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); -#endif } } } @@ -2153,65 +2007,6 @@ int16_t ivas_jbm_dec_get_num_tc_channels( return num_tc; } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS -/*--------------------------------------------------------------------------* - * ivas_jbm_dec_copy_tc() - * - * Copy interleaved transport chnannels to the correct buffers, update the TC - * buffer handle - *--------------------------------------------------------------------------*/ - -static void ivas_jbm_dec_copy_tc( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t nSamplesForRendering, /* i : number of samples to digest */ - int16_t *nSamplesResidual, /* o : number of samples that will be left for the next frame */ - float *data, /* i : (interleaved) transport channel samples */ - float *tc_digest_f[] /* o : samples that will be directly digested (e.g. by CLDFB) */ -) -{ - int16_t ch; - DECODER_TC_BUFFER_HANDLE hTcBuffer; - int16_t n_samples_still_available, m; - int16_t n_ch_full_copy; - int16_t n_ch_res_copy; - - hTcBuffer = st_ivas->hTcBuffer; - n_samples_still_available = hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_rendered; - hTcBuffer->n_samples_buffered = n_samples_still_available + nSamplesForRendering + hTcBuffer->n_samples_discard; - hTcBuffer->n_samples_available = hTcBuffer->n_samples_granularity * ( hTcBuffer->n_samples_buffered / hTcBuffer->n_samples_granularity ); - *nSamplesResidual = hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_available; - n_ch_full_copy = min( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); - n_ch_res_copy = hTcBuffer->nchan_transport_jbm - hTcBuffer->nchan_buffer_full; - - for ( ch = 0; ch < n_ch_full_copy; ch++ ) - { - set_zero( hTcBuffer->tc[ch], hTcBuffer->n_samples_discard ); - mvr2r( hTcBuffer->tc[ch] + hTcBuffer->n_samples_rendered, hTcBuffer->tc[ch] + hTcBuffer->n_samples_discard, n_samples_still_available ); - for ( m = 0; m < nSamplesForRendering; m++ ) - { - hTcBuffer->tc[ch][n_samples_still_available + hTcBuffer->n_samples_discard + m] = data[m * st_ivas->hTcBuffer->nchan_transport_jbm + ch]; - } - } - - if ( n_ch_res_copy > 0 ) - { - for ( ; ch < hTcBuffer->nchan_transport_jbm; ch++ ) - { - mvr2r( hTcBuffer->tc[ch], tc_digest_f[ch], n_samples_still_available ); - for ( m = 0; m < nSamplesForRendering; m++ ) - { - tc_digest_f[ch][n_samples_still_available + m] = data[m * st_ivas->hTcBuffer->nchan_transport_jbm + ch]; - } - mvr2r( tc_digest_f[ch] + hTcBuffer->n_samples_available, hTcBuffer->tc[ch], *nSamplesResidual ); - } - } - - hTcBuffer->n_samples_rendered = 0; - hTcBuffer->subframes_rendered = 0; - - return; -} -#endif /*--------------------------------------------------------------------------* * ivas_jbm_dec_get_render_granularity() @@ -2709,80 +2504,6 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( return buffer_mode; } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS -/*--------------------------------------------------------------------------* - * ivas_jbm_dec_copy_tc_no_tsm() - * - * - *--------------------------------------------------------------------------*/ - -void ivas_jbm_dec_copy_tc_no_tsm( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float *tc[], /* i : transport channels */ - const int16_t output_frame /* i : output frame size */ -) -{ - int16_t n_ch_cldfb; - int16_t ch_idx; - DECODER_TC_BUFFER_HANDLE hTcBuffer; - - hTcBuffer = st_ivas->hTcBuffer; - hTcBuffer->n_samples_buffered = output_frame; - hTcBuffer->n_samples_available = hTcBuffer->n_samples_buffered; - n_ch_cldfb = hTcBuffer->nchan_transport_jbm - hTcBuffer->nchan_buffer_full; - -#ifdef DEBUGGING - assert( st_ivas->hDecoderConfig->Opt_tsm == 0 ); -#endif - /* CLDFB ana for ParamMC/ParamISM */ - if ( n_ch_cldfb > 0 ) - { - float *cldfb_real_buffer; - float *cldfb_imag_buffer; - int16_t cldfb_ch, slot_idx, num_freq_bands; - - cldfb_real_buffer = NULL; - cldfb_imag_buffer = NULL; - num_freq_bands = 0; - - if ( st_ivas->ivas_format == ISM_FORMAT ) - { - cldfb_real_buffer = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc; - cldfb_imag_buffer = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc; - num_freq_bands = st_ivas->hSpatParamRendCom->num_freq_bands; - ivas_ism_param_dec_tc_gain_ajust( st_ivas, output_frame, output_frame / 2, tc ); - } - else if ( st_ivas->ivas_format == MC_FORMAT ) - { - cldfb_real_buffer = st_ivas->hParamMC->Cldfb_RealBuffer_tc; - cldfb_imag_buffer = st_ivas->hParamMC->Cldfb_ImagBuffer_tc; - num_freq_bands = st_ivas->hParamMC->num_freq_bands; - } -#ifdef DEBUGGING - else - { - assert( 0 && "Residual (direct CLDFB transport channels) only possible for ParamMC/ParamISM!" ); - } -#endif - - /* CLDFB Analysis*/ - for ( ch_idx = 0, cldfb_ch = 0; cldfb_ch < n_ch_cldfb; cldfb_ch++, ch_idx++ ) - { - for ( slot_idx = 0; slot_idx < DEFAULT_JBM_CLDFB_TIMESLOTS; slot_idx++ ) - { - cldfbAnalysis_ts( &( tc[ch_idx][num_freq_bands * slot_idx] ), - &cldfb_real_buffer[slot_idx * num_freq_bands * n_ch_cldfb + cldfb_ch * num_freq_bands], - &cldfb_imag_buffer[slot_idx * num_freq_bands * n_ch_cldfb + cldfb_ch * num_freq_bands], - num_freq_bands, st_ivas->cldfbAnaDec[cldfb_ch] ); - } - } - } - hTcBuffer->n_samples_rendered = 0; - hTcBuffer->subframes_rendered = 0; - - return; -} -#endif /*--------------------------------------------------------------------------* * ivas_jbm_dec_metadata_open() @@ -2872,10 +2593,8 @@ static void ivas_jbm_masa_sf_to_slot_map( int16_t slot_idx; int16_t write_idx, sf_index; -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS ivas_jbm_dec_copy_masa_meta_to_buffer( st_ivas ); -#endif /* Set values */ hJbmMetadata = st_ivas->hJbmMetadata; num_slots_in_subfr = CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 643781bfcc..2bf96ca034 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -1330,30 +1330,16 @@ void ivas_param_mc_dec_digest_tc( float *p_data_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ) { -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS int16_t ch, num_freq_bands, slot_idx, cldfb_ch, n_ch_cldfb; float *cldfb_real_buffer, *cldfb_imag_buffer; -#else - PARAM_MC_DEC_HANDLE hParamMC; - int16_t ch, slot_idx; - int16_t nchan_transport; -#endif /* Initialization */ -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS num_freq_bands = st_ivas->hParamMC->num_freq_bands; n_ch_cldfb = st_ivas->hTcBuffer->nchan_transport_jbm - st_ivas->hTcBuffer->nchan_buffer_full; cldfb_real_buffer = st_ivas->hParamMC->Cldfb_RealBuffer_tc; cldfb_imag_buffer = st_ivas->hParamMC->Cldfb_ImagBuffer_tc; -#else - hParamMC = st_ivas->hParamMC; - assert( hParamMC ); - nchan_transport = st_ivas->nchan_transport; -#endif - -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS /* CLDFB Analysis */ for ( ch = 0, cldfb_ch = 0; cldfb_ch < n_ch_cldfb; cldfb_ch++, ch++ ) { @@ -1365,26 +1351,6 @@ void ivas_param_mc_dec_digest_tc( num_freq_bands, st_ivas->cldfbAnaDec[cldfb_ch] ); } } -#else - /* slot loop for gathering the input data */ - for ( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ ) - { - if ( st_ivas->hDecoderConfig->Opt_tsm ) - { - float RealBuffer[CLDFB_NO_CHANNELS_MAX]; - float ImagBuffer[CLDFB_NO_CHANNELS_MAX]; - - /* CLDFB Analysis*/ - for ( ch = 0; ch < nchan_transport; ch++ ) - { - cldfbAnalysis_ts( &( p_data_f[ch][hParamMC->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hParamMC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); - - mvr2r( RealBuffer, &hParamMC->Cldfb_RealBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands ); - mvr2r( ImagBuffer, &hParamMC->Cldfb_ImagBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands ); - } - } - } -#endif return; } diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 1aece93bb9..8538411328 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -376,11 +376,7 @@ void ivas_ism2sba_sf( for ( j = 0; j < sba_num_chans; j++ ) { g2 = hIsmRendererData->interpolator + offset; -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS tc = buffer_in[i]; -#else - tc = buffer_in[i] + offset; -#endif out = buffer_tmp[j]; gain = hIsmRendererData->gains[i][j]; prev_gain = hIsmRendererData->prev_gains[i][j]; diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index ae919c2184..3c9ffad205 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -4271,12 +4271,6 @@ static ivas_error evs_dec_main( mvs2r( pcm_buf_local, p_output[ch], nOutSamples ); } } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - else // ToDo: the 'else' branch can be removed once UNIFIED_DECODING_PATHS_LEFTOVERS is merged - { - ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, nOutSamples ); - } -#endif return IVAS_ERR_OK; } -- GitLab From 6faa1109f599265ac4e49204f3d3fd6ebd2f7714 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 13 May 2025 10:52:48 +0200 Subject: [PATCH 13/19] accept NONBE_1300_TDREND_LARGE_ITD and NONBE_1293_SR_HRTF --- apps/decoder.c | 4 ---- lib_com/options.h | 2 -- lib_rend/ivas_objectRenderer.c | 5 +---- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 50c8b043e9..6a1d823f76 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -298,11 +298,7 @@ int main( if ( arg.hrtfReaderEnabled ) { /* sanity check */ -#ifdef NONBE_1293_SR_HRTF if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) -#else - if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) -#endif { arg.hrtfReaderEnabled = false; fprintf( stderr, "\nError: HRTF binary file cannot be used in this output configuration.\n\n" ); diff --git a/lib_com/options.h b/lib_com/options.h index 85314bece4..3783d86426 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,8 +171,6 @@ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ -#define NONBE_1300_TDREND_LARGE_ITD /* Eri: issue 1300: There was a bug feeding 1.25 ms frames to the TD renderer, causing out-of-buffer access. This was resolved. However, it is still possible that modeled HRTF with large ITDs could trigger out-of-buffer access. This adds a check to prevent this.*/ -#define NONBE_1293_SR_HRTF /* VA: issue 1293: add support of external HRTFs in split rendering */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index df7c0d7a63..ed4fb71c42 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -437,9 +437,7 @@ ivas_error TDREND_GetMix( float hrf_left_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; float hrf_right_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; int16_t intp_count; -#ifdef NONBE_1300_TDREND_LARGE_ITD int16_t currShift, prevShift, transition_len, length_in2; -#endif error = IVAS_ERR_OK; @@ -465,7 +463,7 @@ ivas_error TDREND_GetMix( { TDREND_SRC_REND_UpdateFiltersFromSpatialParams( hBinRendererTd, SrcRend_p, SrcSpatial_p, Src_p->hrf_left_prev, Src_p->hrf_right_prev, hrf_left_delta, hrf_right_delta, &intp_count, &Src_p->filterlength, &Src_p->itd, &Src_p->Gain, Src_p ); -#ifdef NONBE_1300_TDREND_LARGE_ITD + /* For large ITD values at lower sampling rate, check if the transition can be done */ if ( Src_p->itd * Src_p->previtd < 0 ) { @@ -479,7 +477,6 @@ ivas_error TDREND_GetMix( Src_p->itd = 0; } } -#endif } /* Render source if needed */ -- GitLab From 3fc29e9da9bcb49c63d33fad19af8654b0fd9051 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 21 May 2025 10:04:36 +0200 Subject: [PATCH 14/19] [tests] update input formats for custom LS renderer tests --- tests/renderer/test_renderer.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/renderer/test_renderer.py b/tests/renderer/test_renderer.py index ff2145a474..78bf7e39ff 100644 --- a/tests/renderer/test_renderer.py +++ b/tests/renderer/test_renderer.py @@ -658,7 +658,10 @@ def test_custom_ls_input( @pytest.mark.parametrize("out_fmt", CUSTOM_LS_TO_TEST) -@pytest.mark.parametrize("in_fmt", OUTPUT_FORMATS) +@pytest.mark.parametrize( + "in_fmt", + [*INPUT_FORMATS_AMBI, *INPUT_FORMATS_MC, *INPUT_FORMATS_ISM, *INPUT_FORMATS_MASA], +) def test_custom_ls_output( record_property, props_to_record, @@ -1255,7 +1258,7 @@ def test_ism_binaural_headrotation_refvec_rotating( ): if test_info.config.option.create_ref or test_info.config.option.create_cut: pytest.skip("OTR tests only run for smoke test") - + compare_renderer_args( record_property, props_to_record, -- GitLab From 9ff058c3fc18159ad55b5f3e1c72b4004fa5d905 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 21 May 2025 10:00:41 +0200 Subject: [PATCH 15/19] [fix] MASA number of output channels not set correctly for Custom LS output --- lib_com/options.h | 1 + lib_rend/lib_rend.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 3783d86426..c8a7c40e4b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,6 +171,7 @@ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ +#define NONBE_FIX_1326_MASA_EXTREND_CUSTOMLS_OUT /* FhG: Fix crash for external renderer MASA to custom LS rendering, number of output channels not set correctly */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 2d77b66ed6..98b3177a15 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8503,7 +8503,14 @@ static ivas_error initMasaExtRenderer( return error; } - if ( ( error = getAudioConfigNumChannels( outConfig, &hMasaExtRend->nchan_output ) ) != IVAS_ERR_OK ) +#ifdef NONBE_FIX_1326_MASA_EXTREND_CUSTOMLS_OUT + if ( outConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + hMasaExtRend->nchan_output = inputMasa->base.ctx.pCustomLsOut->num_spk + inputMasa->base.ctx.pCustomLsOut->num_lfe; + } + else +#endif + if ( ( error = getAudioConfigNumChannels( outConfig, &hMasaExtRend->nchan_output ) ) != IVAS_ERR_OK ) { return error; } -- GitLab From c33eac652d289426e3b83c1b3ab9b4ad6de10054 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 21 May 2025 11:36:55 +0200 Subject: [PATCH 16/19] separate renderers' buffer sizes fixes under FIX_RENDERER_STACK --- lib_com/options.h | 2 +- lib_dec/ivas_dirac_dec.c | 8 ++++---- lib_rend/ivas_crend.c | 12 ++++++------ lib_rend/ivas_dirac_dec_binaural_functions.c | 10 +++++----- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 6e8e3ef693..79d397dc52 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -162,7 +162,7 @@ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ #define UNIFIED_DECODING_PATHS_LEFTOVERS /* VA: issue 880: remove leftovers after NONBE_UNIFIED_DECODING_PATHS */ #define FIX_NCHAN_BUFFERS /* VA: issue 1322: Correct the number of float buffers (channels) at the decoder */ - +#define FIX_RENDERER_STACK /* VA: issue 1322: reduction of renderers' buffers size */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index ade39c535b..d7ee741ca9 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -1554,7 +1554,7 @@ void ivas_dirac_dec_render( uint16_t slot_size, n_samples_sf, ch, nchan_intern; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; float *output_f_local[MAX_OUTPUT_CHANNELS]; -#ifdef FIX_NCHAN_BUFFERS +#ifdef FIX_RENDERER_STACK float *p_output_f[MAX_OUTPUT_CHANNELS]; float output_f_local_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; #else @@ -1570,7 +1570,7 @@ void ivas_dirac_dec_render( for ( ch = 0; ch < nchan_intern; ch++ ) { output_f_local[ch] = output_f_local_buff[ch]; -#ifdef FIX_NCHAN_BUFFERS +#ifdef FIX_RENDERER_STACK p_output_f[ch] = output_f[ch]; #else set_zero( output_f_local_buff[ch], nSamplesAsked ); @@ -1601,7 +1601,7 @@ void ivas_dirac_dec_render( for ( ch = 0; ch < nchan_intern; ch++ ) { -#ifdef FIX_NCHAN_BUFFERS +#ifdef FIX_RENDERER_STACK /* move to output */ if ( !( ( st_ivas->hDirACRend->hOutSetup.separateChannelEnabled ) && ( st_ivas->hDirACRend->hOutSetup.separateChannelIndex == ch || st_ivas->hDirACRend->hOutSetup.separateChannelIndex + 1 == ch ) ) ) { @@ -1618,7 +1618,7 @@ void ivas_dirac_dec_render( ivas_combined_orientation_update_index( st_ivas->hCombinedOrientationData, n_samples_sf ); } -#ifndef FIX_NCHAN_BUFFERS +#ifndef FIX_RENDERER_STACK for ( ch = 0; ch < nchan_intern; ch++ ) { if ( !( ( st_ivas->hDirACRend->hOutSetup.separateChannelEnabled ) && ( st_ivas->hDirACRend->hOutSetup.separateChannelIndex == ch || st_ivas->hDirACRend->hOutSetup.separateChannelIndex + 1 == ch ) ) ) diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index b0c9631bdc..6872f4d945 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1501,7 +1501,7 @@ static ivas_error ivas_rend_crendConvolver( const float *pFreq_filt_re, *pFreq_filt_im; float *pFreq_buf_re = NULL, *pFreq_buf_im = NULL; float *pFreq_buf2_re = NULL, *pFreq_buf2_im = NULL; -#ifdef FIX_NCHAN_BUFFERS +#ifdef FIX_RENDERER_STACK float pOut[2 /*Re,Im*/ * L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; float tmp_out_re[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES], tmp_out_im[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; #else @@ -1713,7 +1713,7 @@ ivas_error ivas_rend_crendProcessSubframe( int16_t subframe_idx, subframe_len; int16_t nchan_out, nchan_in, ch, first_sf, last_sf, slot_size, slots_to_render; float *tc_local[MAX_OUTPUT_CHANNELS]; -#ifdef FIX_NCHAN_BUFFERS +#ifdef FIX_RENDERER_STACK float *p_output[BINAURAL_CHANNELS]; float pcm_tmp[BINAURAL_CHANNELS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; #else @@ -1757,7 +1757,7 @@ ivas_error ivas_rend_crendProcessSubframe( for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { p_pcm_tmp[ch] = pcm_tmp[ch]; -#ifdef FIX_NCHAN_BUFFERS +#ifdef FIX_RENDERER_STACK p_output[ch] = output[ch]; #endif } @@ -1840,7 +1840,7 @@ ivas_error ivas_rend_crendProcessSubframe( { tc_local[ch] += subframe_len; } -#ifndef FIX_NCHAN_BUFFERS +#ifndef FIX_RENDERER_STACK for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { p_pcm_tmp[ch] += subframe_len; @@ -1857,7 +1857,7 @@ ivas_error ivas_rend_crendProcessSubframe( return IVAS_ERR_INVALID_INPUT_FORMAT; } -#ifdef FIX_NCHAN_BUFFERS +#ifdef FIX_RENDERER_STACK for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { /* move to output */ @@ -1871,7 +1871,7 @@ ivas_error ivas_rend_crendProcessSubframe( ivas_combined_orientation_update_index( hCombinedOrientationData, subframe_len ); } -#ifndef FIX_NCHAN_BUFFERS +#ifndef FIX_RENDERER_STACK /* move to output */ for ( ch = 0; ch < nchan_out; ch++ ) { diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 8aa7b94d58..6e25b6888d 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -456,7 +456,7 @@ void ivas_dirac_dec_binaural_render( uint16_t nchan_out; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; float *output_f_local[MAX_OUTPUT_CHANNELS]; -#ifndef FIX_NCHAN_BUFFERS +#ifndef FIX_RENDERER_STACK float output_f_local_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; int16_t output_length; #endif @@ -468,7 +468,7 @@ void ivas_dirac_dec_binaural_render( #endif for ( ch = 0; ch < nchan_out; ch++ ) { -#ifdef FIX_NCHAN_BUFFERS +#ifdef FIX_RENDERER_STACK output_f_local[ch] = output_f[ch]; #else output_f_local[ch] = output_f_local_buff[ch]; @@ -491,7 +491,7 @@ void ivas_dirac_dec_binaural_render( #ifdef DEBUGGING assert( slots_to_render == 0 ); #endif -#ifndef FIX_NCHAN_BUFFERS +#ifndef FIX_RENDERER_STACK output_length = 0; #endif for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) @@ -504,7 +504,7 @@ void ivas_dirac_dec_binaural_render( output_f_local[ch] += n_samples_sf; } -#ifndef FIX_NCHAN_BUFFERS +#ifndef FIX_RENDERER_STACK output_length += n_samples_sf; #endif @@ -512,7 +512,7 @@ void ivas_dirac_dec_binaural_render( ivas_combined_orientation_update_index( st_ivas->hCombinedOrientationData, n_samples_sf ); } -#ifndef FIX_NCHAN_BUFFERS +#ifndef FIX_RENDERER_STACK for ( ch = 0; ch < nchan_out; ch++ ) { mvr2r( output_f_local_buff[ch], output_f[ch], output_length ); -- GitLab From e063ce0d5c1e15bf21d44b78812ee90cf16b8985 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 22 May 2025 09:10:53 +0200 Subject: [PATCH 17/19] update ci ref version --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fada31d271..9fc90d8c2c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ variables: # note: GitLab cannot reference variables defined by users in the include ref:, we need to use a YAML anchor for this # see https://docs.gitlab.com/ci/yaml/includes/#use-variables-with-include for more information - IVAS_CODEC_CI_REF: &IVAS_CODEC_CI_REF 4eb4c0dfbdc845280a9994b5f7540f69c737537b + IVAS_CODEC_CI_REF: &IVAS_CODEC_CI_REF 44cb5638949b874ce0f5c3bf4359f9db860d88bc include: - local: .gitlab-ci/variables.yml -- GitLab From 745a46b6db35f5f9331613a8345c0176dcf65a15 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 2 Jun 2025 11:25:49 +0200 Subject: [PATCH 18/19] remove -v arg from git branch call this avoids matching the branch name on a commit message --- ci/get_float_ref_branch_name.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/get_float_ref_branch_name.sh b/ci/get_float_ref_branch_name.sh index fe160da023..407a22a7a0 100755 --- a/ci/get_float_ref_branch_name.sh +++ b/ci/get_float_ref_branch_name.sh @@ -53,7 +53,7 @@ fi # Replace only the first occurrence, as "basop" may be present in the later description # If the format is correct, then before "_basop", only numbers can occur float_ref_branchname="${branchname/basop/ref}" -git_result=$(git branch -av) +git_result=$(git branch -a) # If the branch does not exist, default to "float-pc" if [[ "$git_result" =~ "$float_ref_branchname" ]]; then -- GitLab From c08138bb39327e3d2f80527e30b136470abdc1a9 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 2 Jun 2025 14:05:50 +0200 Subject: [PATCH 19/19] skip unsupported tests --- tests/renderer/test_renderer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/renderer/test_renderer.py b/tests/renderer/test_renderer.py index 78bf7e39ff..aa20324064 100644 --- a/tests/renderer/test_renderer.py +++ b/tests/renderer/test_renderer.py @@ -419,7 +419,6 @@ def test_ism_binaural_static( get_odg_bin, split_comparison, ): - run_renderer( record_property, props_to_record, @@ -456,7 +455,6 @@ def test_ism_binaural_headrotation( get_odg_bin, split_comparison, ): - run_renderer( record_property, props_to_record, @@ -495,7 +493,6 @@ def test_masa( get_odg_bin, split_comparison, ): - run_renderer( record_property, props_to_record, @@ -675,6 +672,9 @@ def test_custom_ls_output( get_odg_bin, split_comparison, ): + # TODO: revert once BASOP is brought up-to-date + if in_fmt in INPUT_FORMATS_MASA: + pytest.skip("MASA to custom LS not supported on ivas-float-update yet") run_renderer( record_property, props_to_record, -- GitLab