From 37809ee34e1ee17b7239fdcae6501eaab88e39c1 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Oct 2025 15:43:35 +0100 Subject: [PATCH 1/4] port FIX_1330_JBM_MEMORY --- lib_com/ivas_prot_fx.h | 10 +++++ lib_com/ivas_tools_fx.c | 13 ++++++ lib_com/options.h | 2 +- lib_dec/ivas_init_dec_fx.c | 17 +++++++- lib_dec/ivas_ism_dec_fx.c | 21 +++++++++- lib_dec/ivas_ism_renderer_fx.c | 19 +++++++-- lib_dec/ivas_jbm_dec_fx.c | 41 +++++++++++++++++++ lib_dec/ivas_masa_dec_fx.c | 13 ++++++ lib_dec/ivas_mct_dec_fx.c | 11 +++++- lib_dec/ivas_omasa_dec_fx.c | 38 ++++++++++++++++-- lib_dec/ivas_osba_dec_fx.c | 30 +++++++++++++- lib_dec/ivas_sba_dec_fx.c | 14 ++++++- lib_dec/ivas_stat_dec.h | 4 ++ lib_rend/ivas_output_init_fx.c | 72 +++++++++++++++++++++++++++++++++- 14 files changed, 290 insertions(+), 15 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 652f8ccd0..02088e1e6 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1072,8 +1072,12 @@ void ivas_omasa_separate_object_render_jbm_fx( const UWord16 nSamplesRendered, /* i : number of samples rendered */ Word32 input_fx_in[][L_FRAME48k], /* i : separated object signal */ Word32 *output_fx[], /* o : rendered time signal */ +#ifdef FIX_1330_JBM_MEMORY + const Word16 subframes_rendered /* i : number of subframes rendered */ +#else const Word16 subframes_rendered, /* i : number of subframes rendered */ const Word16 slots_rendered /* i : number of CLDFB slots rendered */ +#endif ); void get_panning_gain_fx( @@ -4041,8 +4045,14 @@ ivas_error ivas_init_encoder_fx( ivas_error ivas_output_buff_dec_fx( Word32 *p_output_fx[], /* i/o: output audio buffers */ +#ifdef FIX_1330_JBM_MEMORY + const Word16 nchan_out_buff, /* i : number of output channels */ + const Word16 Opt_tsm, /* i : TSM option flag */ + DECODER_TC_BUFFER_HANDLE hTcBuffer /* i : TSM buffer handle */ +#else const Word16 nchan_out_buff_old, /* i : previous frame number of output channels */ const Word16 nchan_out_buff /* i : number of output channels */ + #endif ); ivas_error ivas_dec_get_format_fx( diff --git a/lib_com/ivas_tools_fx.c b/lib_com/ivas_tools_fx.c index dc5c3b4e2..515a10cdb 100644 --- a/lib_com/ivas_tools_fx.c +++ b/lib_com/ivas_tools_fx.c @@ -202,12 +202,25 @@ void ivas_buffer_deinterleaved_to_interleaved_fx( ) { Word16 ch, m; +#ifdef FIX_1330_JBM_MEMORY + Word32 buffer[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][L_FRAME48k]; /* temp buffer needed when "*audio[]" and "*audio_out[]" are the same */ + + FOR( ch = 0; ch < n_channels; ch++ ) + { + Copy32( audio[ch], buffer[ch], frame_length ); + } +#endif + FOR( ch = 0; ch < n_channels; ch++ ) { FOR( m = 0; m < frame_length; m++ ) { +#ifdef FIX_1330_JBM_MEMORY + audio_out[m * n_channels + ch] = buffer[ch][m]; +#else audio_out[m * n_channels + ch] = audio[ch][m]; +#endif move32(); } } diff --git a/lib_com/options.h b/lib_com/options.h index f62881bb8..b0d91c86c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -119,7 +119,7 @@ #define FIX_1370_EXTERNAL_ORIENTATION_CHECK /* Nokia: add sanity check for Euler angles for external orientations */ #define NONBE_FIX_1197_OMASA_META_BUFFER /* Nokia: OMASA ISM_MASA_MODE_PARAM_ONE_OBJ history zero in rateswitching - port 251 */ #define FIX_1413_IGF_INIT_PRINTOUT /* FhG: use correct variable for IGF initiliazation */ - +#define FIX_1330_JBM_MEMORY /* VA: issue 1330: memory savings in the JBM decoder */ // object-editing feature porting #define TMP_FIX_SPLIT_REND // temporary fix to split-rendering (it follows the later state of the framework but it is needed now because of current test-conditions) diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index 33ea403fe..0ff615a41 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -1494,6 +1494,9 @@ ivas_error ivas_init_decoder_fx( Word16 sce_id, cpe_id; Word16 numCldfbAnalyses, numCldfbSyntheses; Word16 granularity, n_channels_transport_jbm; +#ifdef FIX_1330_JBM_MEMORY + Word16 nchan_out_buff; +#endif Word32 output_Fs, ivas_total_brate, tmp_br, tmp32; Word32 delay_ns; AUDIO_CONFIG output_config; @@ -2938,7 +2941,7 @@ ivas_error ivas_init_decoder_fx( test(); test(); - IF( ( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) && st_ivas->hDecoderConfig->Opt_tsm ) + IF( ( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) && hDecoderConfig->Opt_tsm ) { IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { @@ -2953,6 +2956,13 @@ ivas_error ivas_init_decoder_fx( * Allocate output audio buffers *-----------------------------------------------------------------*/ +#ifdef FIX_1330_JBM_MEMORY + nchan_out_buff = ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, ivas_total_brate ); + IF( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff, hDecoderConfig->Opt_tsm, st_ivas->hTcBuffer ) ) != IVAS_ERR_OK ) + { + return error; + } +#else #ifdef FIX_NCHAN_BUFFERS k = ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, ivas_total_brate ); FOR( n = 0; n < k; n++ ) @@ -2971,6 +2981,7 @@ ivas_error ivas_init_decoder_fx( { st_ivas->p_output_fx[n] = NULL; } +#endif return error; } @@ -3453,11 +3464,15 @@ void ivas_destroy_dec_fx( /* output audio buffers */ FOR( i = 0; i < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; i++ ) { +#ifdef FIX_1330_JBM_MEMORY + st_ivas->p_output_fx[i] = NULL; +#else IF( st_ivas->p_output_fx[i] != NULL ) { free( st_ivas->p_output_fx[i] ); st_ivas->p_output_fx[i] = NULL; } +#endif } /* main IVAS handle */ diff --git a/lib_dec/ivas_ism_dec_fx.c b/lib_dec/ivas_ism_dec_fx.c index f225b793f..18de8307b 100644 --- a/lib_dec/ivas_ism_dec_fx.c +++ b/lib_dec/ivas_ism_dec_fx.c @@ -59,7 +59,11 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( Word16 tc_nchan_tc_new; Word16 tc_nchan_allocate_new; Word16 tc_granularity_new; +#ifdef FIX_1330_JBM_MEMORY + Word16 nchan_out_buff; +#else Word16 nchan_out_buff, nchan_out_buff_old; +#endif nCPE_old = st_ivas->nCPE; move16(); @@ -74,7 +78,9 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); st_ivas->ism_mode = ism_mode; move16(); +#ifndef FIX_1330_JBM_MEMORY nchan_out_buff_old = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); +#endif IF( NE_32( ( error = ivas_ism_config_fx( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL, 0 ) ), IVAS_ERR_OK ) ) { @@ -307,6 +313,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( return error; } +#ifndef FIX_1330_JBM_MEMORY /*-----------------------------------------------------------------* * output audio buffers *-----------------------------------------------------------------*/ @@ -317,7 +324,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( { return error; } - +#endif /*-----------------------------------------------------------------* * JBM TC buffers *-----------------------------------------------------------------*/ @@ -370,6 +377,18 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( Copy( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } +#ifdef FIX_1330_JBM_MEMORY + + /*-----------------------------------------------------------------* + * output audio buffers + *-----------------------------------------------------------------*/ + + nchan_out_buff = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); + IF( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff, st_ivas->hDecoderConfig->Opt_tsm, st_ivas->hTcBuffer ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_ism_renderer_fx.c b/lib_dec/ivas_ism_renderer_fx.c index 64c7f7b08..85d333c94 100644 --- a/lib_dec/ivas_ism_renderer_fx.c +++ b/lib_dec/ivas_ism_renderer_fx.c @@ -218,6 +218,7 @@ void ivas_ism_render_sf_fx( ism_md_subframe_update_jbm = sub( st_ivas->hTcBuffer->nb_subframes, 2 ); } +#ifndef FIX_1330_JBM_MEMORY IF( st_ivas->hDecoderConfig->Opt_tsm ) { FOR( i = 0; i < num_objects; i++ ) @@ -227,12 +228,15 @@ void ivas_ism_render_sf_fx( } ELSE { +#endif FOR( i = 0; i < num_objects; i++ ) { Copy32( &output_fx[i][tc_offset], tc_local_fx[i], n_samples_to_render ); p_tc_fx[i] = tc_local_fx[i]; } +#ifndef FIX_1330_JBM_MEMORY } +#endif FOR( i = 0; i < nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; i++ ) { @@ -507,8 +511,12 @@ void ivas_omasa_separate_object_render_jbm_fx( const UWord16 nSamplesRendered, /* i : number of samples rendered */ Word32 input_fx_in[][L_FRAME48k], /* i : separated object signal Q11*/ Word32 *output_fx[], /* o : rendered time signal Q11*/ - const Word16 subframes_rendered, /* i : number of subframes rendered */ - const Word16 slots_rendered /* i : number of CLDFB slots rendered */ +#ifdef FIX_1330_JBM_MEMORY + const Word16 subframes_rendered /* i : number of subframes rendered */ +#else + const Word16 subframes_rendered, /* i : number of subframes rendered */ + const Word16 slots_rendered /* i : number of CLDFB slots rendered */ +#endif ) { VBAP_HANDLE hVBAPdata; @@ -557,13 +565,15 @@ void ivas_omasa_separate_object_render_jbm_fx( move16(); } +#ifndef FIX_1330_JBM_MEMORY offsetSamples = i_mult( slots_rendered, hSpatParamRendCom->slot_size ); - +#endif FOR( j = 0; j < nchan_out_woLFE + num_lfe; j++ ) { output_fx_local[j] = output_fx[j]; } +#ifndef FIX_1330_JBM_MEMORY IF( st_ivas->hDecoderConfig->Opt_tsm ) { FOR( obj = 0; obj < num_objects; obj++ ) @@ -574,12 +584,15 @@ void ivas_omasa_separate_object_render_jbm_fx( } ELSE { +#endif FOR( obj = 0; obj < num_objects; obj++ ) { input_fx[obj] = input_fx_in[obj]; move32(); } +#ifndef FIX_1330_JBM_MEMORY } +#endif slots_to_render = idiv1616( nSamplesRendered, hSpatParamRendCom->slot_size ); first_sf = subframes_rendered; diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index ba7c429bf..5e5c2f262 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -1573,7 +1573,11 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx( Word32 *p_data_fx[MAX_CLDFB_DIGEST_CHANNELS]; #endif Word16 n, n_render_timeslots, n_ch_cldfb; +#ifdef FIX_1330_JBM_MEMORY + Word16 ch, offset, len_offset; +#else Word16 ch; +#endif DECODER_TC_BUFFER_HANDLE hTcBuffer; hTcBuffer = st_ivas->hTcBuffer; @@ -1599,6 +1603,23 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx( n_ch_full_copy = s_min( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); n_ch_res_copy = sub( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); +#ifdef FIX_1330_JBM_MEMORY + /* buffers are shared between 'hTcBuffer->tc[]' and 'p_output_f[]': + in case of 'length(hTcBuffer->tc[]) < length(p_output_f[])', reset of TC buffers + pointers is needed after ivas_buffer_interleaved_to_deinterleaved() */ + len_offset = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ); + IF( LT_16( len_offset, L_FRAME48k ) ) + { + offset = 0; + move16(); + FOR( ch = 0; ch < s_max( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); ch++ ) + { + hTcBuffer->tc_fx[ch] = &hTcBuffer->tc_buffer_fx[offset]; + offset = add( offset, len_offset ); + } + } + +#endif FOR( ch = 0; ch < n_ch_full_copy; ch++ ) { Copy32( hTcBuffer->tc_fx[ch], tmp_buf_fx, nSamplesForRendering ); @@ -3633,6 +3654,9 @@ static ivas_error ivas_jbm_dec_tc_audio_allocate_fx( IF( Opt_tsm ) { n_samp_full = NS2SA_FX2( output_Fs, MAX_JBM_L_FRAME_NS ); +#ifdef FIX_1330_JBM_MEMORY + n_samp_full = s_max( n_samp_full, L_FRAME48k ); /* buffers are shared between 'hTcBuffer->tc[]' and 'p_output_f[]': ensure minimal length */ +#endif n_samp_residual = add( hTcBuffer->n_samples_granularity, 1 ); } ELSE @@ -3693,6 +3717,10 @@ static ivas_error ivas_jbm_dec_tc_audio_allocate_fx( } } +#ifdef FIX_1330_JBM_MEMORY + hTcBuffer->tc_buffer2_fx = NULL; + +#endif return IVAS_ERR_OK; } @@ -3730,6 +3758,14 @@ static void ivas_jbm_dec_tc_audio_deallocate_fx( hTcBuffer->tc_buffer_old_fx[ch_idx] = NULL; } } +#ifdef FIX_1330_JBM_MEMORY + + IF( hTcBuffer->tc_buffer2_fx != NULL ) + { + free( hTcBuffer->tc_buffer2_fx ); + hTcBuffer->tc_buffer2_fx = NULL; + } +#endif } return; @@ -4077,7 +4113,12 @@ static void ivas_jbm_dec_tc_buffer_playout_fx( FOR( ch_idx = 0; ch_idx < st_ivas->hTcBuffer->nchan_transport_jbm; ch_idx++ ) { +#ifdef FIX_1330_JBM_MEMORY + output_fx[ch_idx] = st_ivas->hTcBuffer->tc_fx[ch_idx] + st_ivas->hTcBuffer->n_samples_rendered; + move32(); +#else Copy32( st_ivas->hTcBuffer->tc_fx[ch_idx] + st_ivas->hTcBuffer->n_samples_rendered, output_fx[ch_idx], *nSamplesRendered ); +#endif } st_ivas->hTcBuffer->subframes_rendered = last_sf; diff --git a/lib_dec/ivas_masa_dec_fx.c b/lib_dec/ivas_masa_dec_fx.c index fe3f7fee9..fd12b1fca 100644 --- a/lib_dec/ivas_masa_dec_fx.c +++ b/lib_dec/ivas_masa_dec_fx.c @@ -1696,7 +1696,11 @@ ivas_error ivas_masa_dec_reconfigure_fx( UWord32 ivas_total_brate, last_ivas_total_brate; Word16 numCldfbAnalyses_old, numCldfbSyntheses_old; #ifdef FIX_NCHAN_BUFFERS +#ifdef FIX_1330_JBM_MEMORY + Word16 nchan_out_buff; +#else Word16 nchan_out_buff_old, nchan_out_buff; +#endif #endif ivas_error error; Word32 ism_total_brate; @@ -1707,7 +1711,9 @@ ivas_error ivas_masa_dec_reconfigure_fx( last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate; move32(); #ifdef FIX_NCHAN_BUFFERS +#ifndef FIX_1330_JBM_MEMORY nchan_out_buff_old = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); +#endif #endif test(); @@ -1946,6 +1952,9 @@ ivas_error ivas_masa_dec_reconfigure_fx( ivas_masa_set_elements_fx( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &tmp, &tmp, &tmp, st_ivas->ivas_format, st_ivas->ism_mode, ism_total_brate ); + /*-----------------------------------------------------------------* + * JBM TC buffers + *-----------------------------------------------------------------*/ { Word16 tc_nchan_to_allocate; Word16 tc_nchan_transport; @@ -2068,7 +2077,11 @@ ivas_error ivas_masa_dec_reconfigure_fx( IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) && EQ_32( 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_fx( st_ivas, -1, -1 ); +#ifdef FIX_1330_JBM_MEMORY + IF( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff, st_ivas->hDecoderConfig->Opt_tsm, st_ivas->hTcBuffer ) ) != IVAS_ERR_OK ) +#else IF( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index 027299b99..5494118c7 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -902,13 +902,19 @@ static ivas_error ivas_mc_dec_reconfig_fx( Word16 tc_nchan_tc_new; Word16 tc_nchan_allocate_new; Word16 tc_granularity_new; +#ifdef FIX_1330_JBM_MEMORY + Word16 nchan_out_buff; +#else Word16 nchan_out_buff_old, nchan_out_buff; +#endif ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; move32(); nchan_transport_old = st_ivas->nchan_transport; move16(); +#ifndef FIX_1330_JBM_MEMORY nchan_out_buff_old = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); +#endif last_mc_mode = ivas_mc_mode_select_fx( ivas_mc_map_output_config_to_mc_ls_setup_fx( st_ivas->transport_config ), st_ivas->hDecoderConfig->last_ivas_total_brate ); /* NB: this assumes that LS config remains the same between frames */ /* temporally set the current mc_mode back to the previous one to make sure the following call to @@ -1643,8 +1649,11 @@ static ivas_error ivas_mc_dec_reconfig_fx( *-----------------------------------------------------------------*/ nchan_out_buff = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); - +#ifdef FIX_1330_JBM_MEMORY + IF( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff, st_ivas->hDecoderConfig->Opt_tsm, st_ivas->hTcBuffer ) ) != IVAS_ERR_OK ) +#else IF( NE_32( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ), IVAS_ERR_OK ) ) +#endif { return error; } diff --git a/lib_dec/ivas_omasa_dec_fx.c b/lib_dec/ivas_omasa_dec_fx.c index 4749fc22d..959554acf 100644 --- a/lib_dec/ivas_omasa_dec_fx.c +++ b/lib_dec/ivas_omasa_dec_fx.c @@ -491,7 +491,11 @@ ivas_error ivas_omasa_dec_config_fx( Word32 brate_SCE, brate_CPE; ISM_MODE ism_mode_old; IVAS_FORMAT ivas_format_orig; +#ifdef FIX_1330_JBM_MEMORY + Word16 nchan_out_buff; +#else Word16 nchan_out_buff, nchan_out_buff_old; +#endif ivas_error error; RENDERER_TYPE old_renderer_type; @@ -512,9 +516,10 @@ ivas_error ivas_omasa_dec_config_fx( st_ivas->ivas_format = st_ivas->last_ivas_format; move16(); ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); +#ifndef FIX_1330_JBM_MEMORY nchan_out_buff_old = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); move16(); - +#endif st_ivas->ivas_format = ivas_format_orig; move16(); @@ -812,7 +817,11 @@ ivas_error ivas_omasa_dec_config_fx( *-----------------------------------------------------------------*/ nchan_out_buff = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); +#ifdef FIX_1330_JBM_MEMORY + IF( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff, st_ivas->hDecoderConfig->Opt_tsm, st_ivas->hTcBuffer ) ) != IVAS_ERR_OK ) +#else IF( NE_32( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ), IVAS_ERR_OK ) ) +#endif { return error; } @@ -1089,20 +1098,29 @@ void ivas_omasa_dirac_rend_jbm_fx( ) { Word16 subframes_rendered; +#ifndef FIX_1330_JBM_MEMORY Word16 slots_rendered; +#endif Word16 n; Word32 data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; +#ifndef FIX_1330_JBM_MEMORY test(); IF( !st_ivas->hDecoderConfig->Opt_tsm ) { - *nSamplesRendered = min( nSamplesAsked, st_ivas->hTcBuffer->n_samples_available ); +#endif + *nSamplesRendered = s_min( nSamplesAsked, st_ivas->hTcBuffer->n_samples_available ); test(); IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) { Copy32( &output_fx[CPE_CHANNELS][st_ivas->hTcBuffer->n_samples_rendered], data_separated_objects[0], *nSamplesRendered ); - IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) + +#ifdef FIX_1330_JBM_MEMORY + IF( !st_ivas->hDecoderConfig->Opt_tsm && EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) +#else + IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) +#endif { /* Gain separated object, if edited */ FOR( n = 0; n < st_ivas->nchan_ism; n++ ) @@ -1123,7 +1141,11 @@ void ivas_omasa_dirac_rend_jbm_fx( Copy32( &output_fx[n + CPE_CHANNELS][st_ivas->hTcBuffer->n_samples_rendered], data_separated_objects[n], *nSamplesRendered ); /* Gain discrete objects, if edited */ - IF( st_ivas->hMasaIsmData->ism_gain_is_edited[n] ) +#ifdef FIX_1330_JBM_MEMORY + IF( !st_ivas->hDecoderConfig->Opt_tsm && st_ivas->hMasaIsmData->ism_gain_is_edited[n] ) +#else + IF( st_ivas->hMasaIsmData->ism_gain_is_edited[n] ) +#endif { v_multc_fx_16( data_separated_objects[n], st_ivas->hMasaIsmData->gain_ism_edited_fx[n], data_separated_objects[n], *nSamplesRendered ); // Q = 8 Scale_sig32( data_separated_objects[n], *nSamplesRendered, Q3 ); // Q = 11 @@ -1140,12 +1162,16 @@ void ivas_omasa_dirac_rend_jbm_fx( } } } +#ifndef FIX_1330_JBM_MEMORY } +#endif subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; move16(); +#ifndef FIX_1330_JBM_MEMORY slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered; move16(); +#endif ivas_dirac_dec_render_fx( st_ivas, nchan_transport, nSamplesAsked, nSamplesRendered, nSamplesAvailable, output_fx ); @@ -1154,7 +1180,11 @@ void ivas_omasa_dirac_rend_jbm_fx( scale_sig32( st_ivas->hIsmRendererData->prev_gains_fx[ind1], MAX_OUTPUT_CHANNELS, -1 ); // Q30 -> Q29 } +#ifdef FIX_1330_JBM_MEMORY + ivas_omasa_separate_object_render_jbm_fx( st_ivas, *nSamplesRendered, data_separated_objects, output_fx, subframes_rendered ); +#else ivas_omasa_separate_object_render_jbm_fx( st_ivas, *nSamplesRendered, data_separated_objects, output_fx, subframes_rendered, slots_rendered ); +#endif FOR( Word16 ind1 = 0; ind1 < MAX_NUM_OBJECTS; ind1++ ) { diff --git a/lib_dec/ivas_osba_dec_fx.c b/lib_dec/ivas_osba_dec_fx.c index 67908e996..68ac3ea88 100644 --- a/lib_dec/ivas_osba_dec_fx.c +++ b/lib_dec/ivas_osba_dec_fx.c @@ -282,15 +282,25 @@ ivas_error ivas_osba_render_sf_fx( ) { Word16 n; +#ifdef FIX_1330_JBM_MEMORY + Word32 output_sba[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + Word32 *p_output_sba[MAX_OUTPUT_CHANNELS]; +#else Word32 output_ism[MAX_OUTPUT_CHANNELS][L_FRAME48k]; Word32 *p_output_ism[MAX_OUTPUT_CHANNELS]; +#endif ivas_error error; FOR( n = 0; n < MAX_OUTPUT_CHANNELS; n++ ) { +#ifdef FIX_1330_JBM_MEMORY + p_output_sba[n] = output_sba[n]; +#else p_output_ism[n] = &output_ism[n][0]; +#endif } +#ifndef FIX_1330_JBM_MEMORY if ( !st_ivas->hDecoderConfig->Opt_tsm ) { Word16 tc_offset; @@ -300,23 +310,41 @@ ivas_error ivas_osba_render_sf_fx( v_shr( &p_output[n][tc_offset], Q11 - Q11, &output_ism[n][tc_offset], nSamplesAsked ); // Q11 } } - +#endif +#ifdef FIX_1330_JBM_MEMORY + IF( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailableNext, p_output_sba ) ) != IVAS_ERR_OK ) +#else IF( NE_32( ( error = ivas_sba_dec_render_fx( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailableNext, p_output ) ), IVAS_ERR_OK ) ) +#endif { return error; } IF( NE_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) { +#ifdef FIX_1330_JBM_MEMORY + ivas_ism_render_sf_fx( st_ivas, st_ivas->renderer_type, p_output, *nSamplesRendered ); +#else ivas_ism_render_sf_fx( st_ivas, st_ivas->renderer_type, p_output_ism, *nSamplesRendered ); +#endif } FOR( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) { IF( NE_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) { +#ifdef FIX_1330_JBM_MEMORY + v_add_fx_no_hdrm( p_output[n], p_output_sba[n], p_output[n], *nSamplesRendered ); +#else v_add_fx_no_hdrm( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered ); +#endif + } +#ifdef FIX_1330_JBM_MEMORY + ELSE + { + Copy32( p_output_sba[n], p_output[n], *nSamplesRendered ); } +#endif } return IVAS_ERR_OK; diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index ea7e100a1..ca44eff33 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -117,8 +117,12 @@ ivas_error ivas_sba_dec_reconfigure_fx( Word32 ivas_total_brate; Word32 last_ivas_total_brate; Word16 num_channels, num_md_sub_frames; +#ifdef FIX_1330_JBM_MEMORY + Word16 nchan_out_buff; +#else Word16 nchan_out_buff, nchan_out_buff_old; Word16 sba_analysis_order_old_flush; +#endif DECODER_CONFIG_HANDLE hDecoderConfig; ivas_error error; ISM_MODE ism_mode_old; @@ -131,16 +135,19 @@ ivas_error ivas_sba_dec_reconfigure_fx( move32(); last_ivas_total_brate = st_ivas->last_active_ivas_total_brate; move32(); +#ifndef FIX_1330_JBM_MEMORY sba_analysis_order_old_flush = st_ivas->sba_analysis_order; move16(); +#endif /*-----------------------------------------------------------------* * Set SBA high-level parameters * Save old SBA high-level parameters *-----------------------------------------------------------------*/ +#ifndef FIX_1330_JBM_MEMORY nchan_out_buff_old = ivas_get_nchan_buffers_dec_fx( st_ivas, sba_analysis_order_old_flush, last_ivas_total_brate ); - +#endif ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); nchan_hp20_old = getNumChanSynthesis( st_ivas ); @@ -749,8 +756,11 @@ ivas_error ivas_sba_dec_reconfigure_fx( *-----------------------------------------------------------------*/ nchan_out_buff = ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); /*Q0*/ - +#ifdef FIX_1330_JBM_MEMORY + IF( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff, hDecoderConfig->Opt_tsm, st_ivas->hTcBuffer ) ) != IVAS_ERR_OK ) +#else IF( NE_32( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ), IVAS_ERR_OK ) ) +#endif { return error; } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index cf8017fb5..e02105fd8 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1032,6 +1032,10 @@ typedef struct decoder_tc_buffer_structure Word16 num_slots; Word16 n_samples_discard; /* number of samples to discard from the beginning of the output */ +#ifdef FIX_1330_JBM_MEMORY + Word32 *tc_buffer2_fx; /* non-scaled buffer of output audio - needed only when '*tc_buffer* is not long enough */ + +#endif } DECODER_TC_BUFFER, *DECODER_TC_BUFFER_HANDLE; typedef struct jbm_metadata_structure diff --git a/lib_rend/ivas_output_init_fx.c b/lib_rend/ivas_output_init_fx.c index 0e2b264a8..5969fac17 100644 --- a/lib_rend/ivas_output_init_fx.c +++ b/lib_rend/ivas_output_init_fx.c @@ -566,11 +566,80 @@ Word16 ivas_get_nchan_buffers_dec_fx( *-------------------------------------------------------------------*/ ivas_error ivas_output_buff_dec_fx( - Word32 *p_output_fx[], /* i/o: output audio buffers */ + Word32 *p_output_fx[], /* i/o: output audio buffers */ +#ifdef FIX_1330_JBM_MEMORY + const Word16 nchan_out_buff, /* i : number of output channels */ + const Word16 Opt_tsm, /* i : TSM option flag */ + DECODER_TC_BUFFER_HANDLE hTcBuffer /* i : TSM buffer handle */ +#else const Word16 nchan_out_buff_old, /* i : previous frame number of output channels */ const Word16 nchan_out_buff /* i : number of output channels */ +#endif ) { +#ifdef FIX_1330_JBM_MEMORY + Word16 ch, nchan_tc_jbm, nsamp_to_allocate, n_samp_full, offset; + + FOR( ch = 0; ch < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; ch++ ) + { + p_output_fx[ch] = NULL; + } + + IF( hTcBuffer->tc_buffer2_fx != NULL ) + { + free( hTcBuffer->tc_buffer2_fx ); + hTcBuffer->tc_buffer2_fx = NULL; + } + + nchan_tc_jbm = 0; + move16(); + if ( Opt_tsm ) + { + /* JBM decoding: output audio buffers are shared with audio buffers from 'hTcBuffer->tc[]' */ + nchan_tc_jbm = s_max( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); + } + + test(); + IF( LE_16( nchan_out_buff, nchan_tc_jbm ) && !Opt_tsm ) + { + FOR( ch = 0; ch < nchan_out_buff; ch++ ) + { + p_output_fx[ch] = hTcBuffer->tc_fx[ch]; + } + } + ELSE + { + FOR( ch = 0; ch < nchan_tc_jbm; ch++ ) + { + p_output_fx[ch] = hTcBuffer->tc_fx[ch]; + } + + /* non-JBM decoding: allocate output audio buffers */ + /* JBM decoding: when not enough audio buffers 'hTcBuffer->tc[]', allocate additional buffers */ + n_samp_full = ( 48000 / FRAMES_PER_SEC ); + move16(); + nsamp_to_allocate = imult1616( sub( nchan_out_buff, nchan_tc_jbm ), n_samp_full ); + + IF( GT_16( nsamp_to_allocate, 0 ) ) + { + /* note: these are intra-frame heap memories */ + IF( ( hTcBuffer->tc_buffer2_fx = (Word32 *) malloc( nsamp_to_allocate * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for output audio buffer!\n" ) ); + } + + set_zero_fx( hTcBuffer->tc_buffer2_fx, nsamp_to_allocate ); + } + + offset = 0; + move16(); + FOR( ; ch < nchan_out_buff; ch++ ) + { + p_output_fx[ch] = &hTcBuffer->tc_buffer2_fx[offset]; + offset = add( offset, n_samp_full ); + } + } +#else Word16 ch; IF( GT_16( nchan_out_buff, nchan_out_buff_old ) ) @@ -600,6 +669,7 @@ ivas_error ivas_output_buff_dec_fx( p_output_fx[ch] = NULL; } } +#endif return IVAS_ERR_OK; } -- GitLab From b8da0931b106f96c8b95f9932356158c53140db3 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Oct 2025 21:11:37 +0100 Subject: [PATCH 2/4] fix --- lib_dec/ivas_cpe_dec_fx.c | 100 ++++++++++++++++++++------------------ 1 file changed, 54 insertions(+), 46 deletions(-) diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index 743add272..fadd84415 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -1068,7 +1068,11 @@ static ivas_error stereo_dft_dec_main( FOR( n = 0; n < hCPE->nchan_out; n++ ) { - Scale_sig32( output[n], L_FRAME48k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft +#ifdef FIX_1330_JBM_MEMORY + Scale_sig32( output[n], output_frame, sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft +#else + Scale_sig32( output[n], L_FRAME48k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft +#endif scale_sig32( hCPE->output_mem_fx[n], NS2SA_FX2( output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft hCPE->q_output_mem_fx[n] = hCPE->hStereoDft->q_dft; move16(); @@ -1082,7 +1086,11 @@ static ivas_error stereo_dft_dec_main( FOR( n = 0; n < hCPE->nchan_out; n++ ) { - Scale_sig32( output[n], L_FRAME48k, sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 +#ifdef FIX_1330_JBM_MEMORY + Scale_sig32( output[n], output_frame, sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 +#else + Scale_sig32( output[n], L_FRAME48k, sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 +#endif scale_sig32( hCPE->output_mem_fx[n], NS2SA_FX2( output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 hCPE->q_output_mem_fx[n] = Q11; move16(); @@ -1094,10 +1102,10 @@ static ivas_error stereo_dft_dec_main( #endif /*------------------------------------------------------------------------- - * create_cpe_dec_fx() - * - * Create, allocate and initialize IVAS decoder CPE handle - *-------------------------------------------------------------------------*/ + * create_cpe_dec_fx() + * + * Create, allocate and initialize IVAS decoder CPE handle + *-------------------------------------------------------------------------*/ ivas_error create_cpe_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -1116,8 +1124,8 @@ ivas_error create_cpe_dec( move32(); /*-----------------------------------------------------------------* - * Allocate CPE handle - *-----------------------------------------------------------------*/ + * Allocate CPE handle + *-----------------------------------------------------------------*/ IF( ( hCPE = (CPE_DEC_HANDLE) malloc( sizeof( CPE_DEC_DATA ) ) ) == NULL ) { @@ -1125,8 +1133,8 @@ ivas_error create_cpe_dec( } /*-----------------------------------------------------------------* - * Initialization - general parameters - *-----------------------------------------------------------------*/ + * Initialization - general parameters + *-----------------------------------------------------------------*/ output_Fs = st_ivas->hDecoderConfig->output_Fs; move32(); @@ -1208,8 +1216,8 @@ ivas_error create_cpe_dec( move32(); /*-----------------------------------------------------------------* - * DFT stereo I/O Buffers: allocate and initialize - *-----------------------------------------------------------------*/ + * DFT stereo I/O Buffers: allocate and initialize + *-----------------------------------------------------------------*/ FOR( i = 0; i < CPE_CHANNELS; i++ ) { @@ -1278,8 +1286,8 @@ ivas_error create_cpe_dec( } /*-----------------------------------------------------------------* - * CoreCoder, 2 instances: allocate and initialize - *-----------------------------------------------------------------*/ + * CoreCoder, 2 instances: allocate and initialize + *-----------------------------------------------------------------*/ FOR( n = 0; n < CPE_CHANNELS; n++ ) { @@ -1313,8 +1321,8 @@ ivas_error create_cpe_dec( } /*-----------------------------------------------------------------* - * DFT stereo initialization - *-----------------------------------------------------------------*/ + * DFT stereo initialization + *-----------------------------------------------------------------*/ test(); @@ -1327,8 +1335,8 @@ ivas_error create_cpe_dec( } /*-----------------------------------------------------------------* - * DFT stereo mono DMX initialization - *-----------------------------------------------------------------*/ + * DFT stereo mono DMX initialization + *-----------------------------------------------------------------*/ test(); IF( NE_16( hCPE->element_mode, IVAS_CPE_MDCT ) && EQ_16( hCPE->nchan_out, 1 ) ) @@ -1342,8 +1350,8 @@ ivas_error create_cpe_dec( } /*-----------------------------------------------------------------* - * Temporal inter-channel alignment initialization - *-----------------------------------------------------------------*/ + * Temporal inter-channel alignment initialization + *-----------------------------------------------------------------*/ test(); test(); @@ -1359,8 +1367,8 @@ ivas_error create_cpe_dec( } /*-----------------------------------------------------------------* - * Stereo IC BWE initialization - *-----------------------------------------------------------------*/ + * Stereo IC BWE initialization + *-----------------------------------------------------------------*/ test(); test(); @@ -1375,8 +1383,8 @@ ivas_error create_cpe_dec( } /*-----------------------------------------------------------------* - * TD stereo initialization - *-----------------------------------------------------------------*/ + * TD stereo initialization + *-----------------------------------------------------------------*/ IF( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) ) { @@ -1389,8 +1397,8 @@ ivas_error create_cpe_dec( } /*-----------------------------------------------------------------* - * MDCT stereo initialization - *-----------------------------------------------------------------*/ + * MDCT stereo initialization + *-----------------------------------------------------------------*/ test(); IF( EQ_16( hCPE->element_mode, IVAS_CPE_MDCT ) && EQ_16( st_ivas->nCPE, 1 ) ) @@ -1431,8 +1439,8 @@ ivas_error create_cpe_dec( } /*-----------------------------------------------------------------* - * Stereo CNG initialization - *-----------------------------------------------------------------*/ + * Stereo CNG initialization + *-----------------------------------------------------------------*/ test(); IF( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) || EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) @@ -1451,10 +1459,10 @@ ivas_error create_cpe_dec( /*------------------------------------------------------------------------- - * destroy_cpe_dec_fx() - * - * Destroy and deallocate IVAS decoder CPE handle - *-------------------------------------------------------------------------*/ + * destroy_cpe_dec_fx() + * + * Destroy and deallocate IVAS decoder CPE handle + *-------------------------------------------------------------------------*/ void destroy_cpe_dec( CPE_DEC_HANDLE hCPE /* i/o: CPE decoder structure */ @@ -1546,10 +1554,10 @@ void destroy_cpe_dec( /*------------------------------------------------------------------------- - * read_stereo_mode_and_bwidth_fx() - * - * Read stereo technology info & audio bandwidth - *-------------------------------------------------------------------------*/ + * read_stereo_mode_and_bwidth_fx() + * + * Read stereo technology info & audio bandwidth + *-------------------------------------------------------------------------*/ static void read_stereo_mode_and_bwidth_fx( CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ @@ -1559,8 +1567,8 @@ static void read_stereo_mode_and_bwidth_fx( Decoder_State **sts; /*-----------------------------------------------------------------* - * BFI or NO_DATA frame: Use stereo parameters from last (active) frame - *-----------------------------------------------------------------*/ + * BFI or NO_DATA frame: Use stereo parameters from last (active) frame + *-----------------------------------------------------------------*/ test(); if ( st_ivas->bfi || LT_32( st_ivas->hDecoderConfig->ivas_total_brate, IVAS_SID_5k2 ) ) @@ -1570,8 +1578,8 @@ static void read_stereo_mode_and_bwidth_fx( } /*-----------------------------------------------------------------* - * SID frame: get element mode from SID side info - *-----------------------------------------------------------------*/ + * SID frame: get element mode from SID side info + *-----------------------------------------------------------------*/ ELSE IF( EQ_32( st_ivas->hDecoderConfig->ivas_total_brate, IVAS_SID_5k2 ) ) { @@ -1629,8 +1637,8 @@ static void read_stereo_mode_and_bwidth_fx( } /*-----------------------------------------------------------------* - * active frame: read element mode and audio bandwidth info - *-----------------------------------------------------------------*/ + * active frame: read element mode and audio bandwidth info + *-----------------------------------------------------------------*/ ELSE { @@ -1683,10 +1691,10 @@ static void read_stereo_mode_and_bwidth_fx( /*------------------------------------------------------------------------- - * stereo_mode_combined_format_dec_fx() - * - * Set stereo format in a combined format - *-------------------------------------------------------------------------*/ + * stereo_mode_combined_format_dec_fx() + * + * Set stereo format in a combined format + *-------------------------------------------------------------------------*/ static void stereo_mode_combined_format_dec_fx( const Decoder_Struct *st_ivas, /* i : decoder main structure */ -- GitLab From cddb1368fbfc88f93512794f21a7ca1c9ffbc66b Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Oct 2025 21:38:34 +0100 Subject: [PATCH 3/4] clang-format --- lib_dec/ivas_cpe_dec_fx.c | 88 +++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index fadd84415..cfb6c615b 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -1102,10 +1102,10 @@ static ivas_error stereo_dft_dec_main( #endif /*------------------------------------------------------------------------- - * create_cpe_dec_fx() - * - * Create, allocate and initialize IVAS decoder CPE handle - *-------------------------------------------------------------------------*/ + * create_cpe_dec_fx() + * + * Create, allocate and initialize IVAS decoder CPE handle + *-------------------------------------------------------------------------*/ ivas_error create_cpe_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -1124,8 +1124,8 @@ ivas_error create_cpe_dec( move32(); /*-----------------------------------------------------------------* - * Allocate CPE handle - *-----------------------------------------------------------------*/ + * Allocate CPE handle + *-----------------------------------------------------------------*/ IF( ( hCPE = (CPE_DEC_HANDLE) malloc( sizeof( CPE_DEC_DATA ) ) ) == NULL ) { @@ -1133,8 +1133,8 @@ ivas_error create_cpe_dec( } /*-----------------------------------------------------------------* - * Initialization - general parameters - *-----------------------------------------------------------------*/ + * Initialization - general parameters + *-----------------------------------------------------------------*/ output_Fs = st_ivas->hDecoderConfig->output_Fs; move32(); @@ -1216,8 +1216,8 @@ ivas_error create_cpe_dec( move32(); /*-----------------------------------------------------------------* - * DFT stereo I/O Buffers: allocate and initialize - *-----------------------------------------------------------------*/ + * DFT stereo I/O Buffers: allocate and initialize + *-----------------------------------------------------------------*/ FOR( i = 0; i < CPE_CHANNELS; i++ ) { @@ -1286,8 +1286,8 @@ ivas_error create_cpe_dec( } /*-----------------------------------------------------------------* - * CoreCoder, 2 instances: allocate and initialize - *-----------------------------------------------------------------*/ + * CoreCoder, 2 instances: allocate and initialize + *-----------------------------------------------------------------*/ FOR( n = 0; n < CPE_CHANNELS; n++ ) { @@ -1321,8 +1321,8 @@ ivas_error create_cpe_dec( } /*-----------------------------------------------------------------* - * DFT stereo initialization - *-----------------------------------------------------------------*/ + * DFT stereo initialization + *-----------------------------------------------------------------*/ test(); @@ -1335,8 +1335,8 @@ ivas_error create_cpe_dec( } /*-----------------------------------------------------------------* - * DFT stereo mono DMX initialization - *-----------------------------------------------------------------*/ + * DFT stereo mono DMX initialization + *-----------------------------------------------------------------*/ test(); IF( NE_16( hCPE->element_mode, IVAS_CPE_MDCT ) && EQ_16( hCPE->nchan_out, 1 ) ) @@ -1350,8 +1350,8 @@ ivas_error create_cpe_dec( } /*-----------------------------------------------------------------* - * Temporal inter-channel alignment initialization - *-----------------------------------------------------------------*/ + * Temporal inter-channel alignment initialization + *-----------------------------------------------------------------*/ test(); test(); @@ -1367,8 +1367,8 @@ ivas_error create_cpe_dec( } /*-----------------------------------------------------------------* - * Stereo IC BWE initialization - *-----------------------------------------------------------------*/ + * Stereo IC BWE initialization + *-----------------------------------------------------------------*/ test(); test(); @@ -1383,8 +1383,8 @@ ivas_error create_cpe_dec( } /*-----------------------------------------------------------------* - * TD stereo initialization - *-----------------------------------------------------------------*/ + * TD stereo initialization + *-----------------------------------------------------------------*/ IF( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) ) { @@ -1397,8 +1397,8 @@ ivas_error create_cpe_dec( } /*-----------------------------------------------------------------* - * MDCT stereo initialization - *-----------------------------------------------------------------*/ + * MDCT stereo initialization + *-----------------------------------------------------------------*/ test(); IF( EQ_16( hCPE->element_mode, IVAS_CPE_MDCT ) && EQ_16( st_ivas->nCPE, 1 ) ) @@ -1439,8 +1439,8 @@ ivas_error create_cpe_dec( } /*-----------------------------------------------------------------* - * Stereo CNG initialization - *-----------------------------------------------------------------*/ + * Stereo CNG initialization + *-----------------------------------------------------------------*/ test(); IF( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) || EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) @@ -1459,10 +1459,10 @@ ivas_error create_cpe_dec( /*------------------------------------------------------------------------- - * destroy_cpe_dec_fx() - * - * Destroy and deallocate IVAS decoder CPE handle - *-------------------------------------------------------------------------*/ + * destroy_cpe_dec_fx() + * + * Destroy and deallocate IVAS decoder CPE handle + *-------------------------------------------------------------------------*/ void destroy_cpe_dec( CPE_DEC_HANDLE hCPE /* i/o: CPE decoder structure */ @@ -1554,10 +1554,10 @@ void destroy_cpe_dec( /*------------------------------------------------------------------------- - * read_stereo_mode_and_bwidth_fx() - * - * Read stereo technology info & audio bandwidth - *-------------------------------------------------------------------------*/ + * read_stereo_mode_and_bwidth_fx() + * + * Read stereo technology info & audio bandwidth + *-------------------------------------------------------------------------*/ static void read_stereo_mode_and_bwidth_fx( CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ @@ -1567,8 +1567,8 @@ static void read_stereo_mode_and_bwidth_fx( Decoder_State **sts; /*-----------------------------------------------------------------* - * BFI or NO_DATA frame: Use stereo parameters from last (active) frame - *-----------------------------------------------------------------*/ + * BFI or NO_DATA frame: Use stereo parameters from last (active) frame + *-----------------------------------------------------------------*/ test(); if ( st_ivas->bfi || LT_32( st_ivas->hDecoderConfig->ivas_total_brate, IVAS_SID_5k2 ) ) @@ -1578,8 +1578,8 @@ static void read_stereo_mode_and_bwidth_fx( } /*-----------------------------------------------------------------* - * SID frame: get element mode from SID side info - *-----------------------------------------------------------------*/ + * SID frame: get element mode from SID side info + *-----------------------------------------------------------------*/ ELSE IF( EQ_32( st_ivas->hDecoderConfig->ivas_total_brate, IVAS_SID_5k2 ) ) { @@ -1637,8 +1637,8 @@ static void read_stereo_mode_and_bwidth_fx( } /*-----------------------------------------------------------------* - * active frame: read element mode and audio bandwidth info - *-----------------------------------------------------------------*/ + * active frame: read element mode and audio bandwidth info + *-----------------------------------------------------------------*/ ELSE { @@ -1691,10 +1691,10 @@ static void read_stereo_mode_and_bwidth_fx( /*------------------------------------------------------------------------- - * stereo_mode_combined_format_dec_fx() - * - * Set stereo format in a combined format - *-------------------------------------------------------------------------*/ + * stereo_mode_combined_format_dec_fx() + * + * Set stereo format in a combined format + *-------------------------------------------------------------------------*/ static void stereo_mode_combined_format_dec_fx( const Decoder_Struct *st_ivas, /* i : decoder main structure */ -- GitLab From 3d9077858ba6abad1d82de695378bd067b7fb336 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Oct 2025 22:34:11 +0100 Subject: [PATCH 4/4] fix porting --- lib_dec/ivas_omasa_dec_fx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_omasa_dec_fx.c b/lib_dec/ivas_omasa_dec_fx.c index 959554acf..80eadc072 100644 --- a/lib_dec/ivas_omasa_dec_fx.c +++ b/lib_dec/ivas_omasa_dec_fx.c @@ -1153,7 +1153,11 @@ void ivas_omasa_dirac_rend_jbm_fx( } /* Gain MASA part, if edited */ - IF( st_ivas->hMasaIsmData->masa_gain_is_edited ) +#ifdef FIX_1330_JBM_MEMORY + IF( !st_ivas->hDecoderConfig->Opt_tsm && st_ivas->hMasaIsmData->masa_gain_is_edited ) +#else + IF( st_ivas->hMasaIsmData->masa_gain_is_edited ) +#endif { FOR( n = 0; n < 2; n++ ) { -- GitLab