From 0215b9e1a8d90afe859acd8eefa7a25d6417dd7c Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 23 Oct 2025 21:20:21 +0200 Subject: [PATCH 1/2] port NONBE_1324_TC_BUFFER_MEMOERY_KEEP --- lib_com/options.h | 1 + lib_dec/ivas_jbm_dec.c | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9d09bd5fc..46b68c254 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -193,6 +193,7 @@ #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 */ #define JBM_MEMORY_OPT /* VA: issue 916: optimization of RAM in the JBM decoder */ +#define NONBE_1324_TC_BUFFER_MEMOERY_KEEP /* VA: issue 1324: do not reset TSM memory in JBM bitrate switching */ #define FIX_1370_EXTERNAL_ORIENTATION_CHECK /* Nokia: add sanity check for Euler angles for external orientations */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 7049d8b59..2c1c06d9d 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -2669,7 +2669,10 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( const int16_t n_samples_granularity /* i : new granularity of the renderer/buffer */ ) { - +#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP + int16_t ch_idx, num_tc_buffer_mem, n_samples_still_available; + float tc_buffer_mem[MAX_INTERN_CHANNELS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES - 1]; +#endif #ifdef JBM_MEMORY_OPT ivas_error error; #else @@ -2680,6 +2683,26 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( hTcBuffer = st_ivas->hTcBuffer; +#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP + num_tc_buffer_mem = 0; + n_samples_still_available = 0; + + if ( st_ivas->hDecoderConfig->Opt_tsm ) + { + /* save samples of the TC buffer from the previous frame */ + num_tc_buffer_mem = min( hTcBuffer->nchan_transport_internal, nchan_transport_internal ); + n_samples_still_available = hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_rendered; + + /* what is remaining from last frame needs always be smaller than the new granularity */ + assert( n_samples_still_available < n_samples_granularity ); + + for ( ch_idx = 0; ch_idx < num_tc_buffer_mem; ch_idx++ ) + { + mvr2r( hTcBuffer->tc_buffer_old[ch_idx] + hTcBuffer->n_samples_flushed, tc_buffer_mem[ch_idx], n_samples_still_available ); + } + } + +#endif /* if granularity changes, adapt subframe_nb_slots */ if ( n_samples_granularity != hTcBuffer->n_samples_granularity ) { @@ -2797,6 +2820,14 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( } #endif +#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP + /* propagate samples of the TC buffer from the previous frame */ + for ( ch_idx = 0; ch_idx < num_tc_buffer_mem; ch_idx++ ) + { + mvr2r( tc_buffer_mem[ch_idx], hTcBuffer->tc_buffer_old[ch_idx], n_samples_still_available ); + } + +#endif return IVAS_ERR_OK; } -- GitLab From 5a831d127716e239564b83bb27cb216d100d6c63 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Thu, 30 Oct 2025 10:51:11 +0200 Subject: [PATCH 2/2] Disable switch NONBE_1324_TC_BUFFER_MEMOERY_KEEP to align with float. --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index ab5ca948c..13e6a8696 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -185,7 +185,7 @@ #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 */ #define JBM_MEMORY_OPT /* VA: issue 916: optimization of RAM in the JBM decoder */ -#define NONBE_1324_TC_BUFFER_MEMOERY_KEEP /* VA: issue 1324: do not reset TSM memory in JBM bitrate switching */ +/*#define NONBE_1324_TC_BUFFER_MEMOERY_KEEP*/ /* VA: issue 1324: do not reset TSM memory in JBM bitrate switching */ #define FIX_1370_EXTERNAL_ORIENTATION_CHECK /* Nokia: add sanity check for Euler angles for external orientations */ #define FIX_1413_IGF_INIT_PRINTOUT /* FhG: use correct variable for IGF initiliazation */ #define CODE_IMPROVEMENTS -- GitLab