From 9443b718f0639fd96e88f178916705d64af0db39 Mon Sep 17 00:00:00 2001 From: vaclav Date: Sat, 22 Mar 2025 17:28:01 +0100 Subject: [PATCH 01/11] issue 1303: Renderer granularity revision; under NONBE_1303_REND_GRANULARITY --- lib_com/ivas_prot.h | 13 ++++++++ lib_com/options.h | 1 + lib_dec/ivas_init_dec.c | 25 +++++++++++++-- lib_dec/ivas_ism_dec.c | 4 +++ lib_dec/ivas_ism_param_dec.c | 15 +++++++++ lib_dec/ivas_jbm_dec.c | 26 +++++++++++++++ lib_dec/ivas_masa_dec.c | 12 +++++++ lib_dec/ivas_mc_param_dec.c | 6 ++++ lib_dec/ivas_mc_paramupmix_dec.c | 6 ++++ lib_dec/ivas_mct_dec.c | 5 +++ lib_dec/ivas_output_config.c | 33 ++++++++++++++++++++ lib_dec/ivas_sba_dec.c | 4 +++ lib_dec/ivas_spar_decoder.c | 8 +++++ lib_dec/lib_dec.c | 27 ++++++++++++++++ lib_rend/ivas_dirac_dec_binaural_functions.c | 13 +++++++- 15 files changed, 195 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index ad871926d0..4722f322d2 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -656,6 +656,13 @@ void ivas_renderer_select( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); +#ifdef NONBE_1303_REND_GRANULARITY +/*! r: secondary binaural renderer type */ +RENDERER_TYPE ivas_renderer_secondary_select( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +#endif ivas_error ivas_mc_enc_config( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); @@ -885,10 +892,16 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( /*! r: render granularity */ int16_t ivas_jbm_dec_get_render_granularity( +#ifdef NONBE_1303_REND_GRANULARITY + const RENDERER_TYPE renderer_type, /* i : renderer type */ + const RENDERER_TYPE renderer_type_sec, /* i : secondary renderer type */ + const int32_t output_Fs /* i : sampling rate */ +#else const RENDERER_TYPE rendererType, /* i : renderer type */ const IVAS_FORMAT ivas_format, /* i : ivas format */ const MC_MODE mc_mode, /* i : MC mode */ const int32_t output_Fs /* i : sampling rate */ +#endif ); ivas_error ivas_jbm_dec_tc_buffer_open( diff --git a/lib_com/options.h b/lib_com/options.h index 84ce770c97..c28d4b16e8 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -174,6 +174,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_FIX_1180_HQMDCT_PHECU_LT_MUTING /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms in PhECU-PLC */ #define NONBE_1289_STEREO_SW_TO_MONO /* VA: issue 1289: Fix glitch when stereo signal is decoded to mono n TD->DFT switching */ +#define NONBE_1303_REND_GRANULARITY /* VA: issue 1303: Renderer granularity revision */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 74ea4a34b8..95a32865d2 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2127,7 +2127,11 @@ ivas_error ivas_init_decoder( } } +#ifdef NONBE_1303_REND_GRANULARITY + granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs ); +#else granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); +#endif n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) @@ -2167,6 +2171,16 @@ ivas_error ivas_init_decoder( st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; +#ifdef NONBE_1303_REND_GRANULARITY + granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs ); + n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) + { + return error; + } +#else + if ( ( st_ivas->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) { granularity = NS2SA( output_Fs, CLDFB_SLOT_NS ); @@ -2189,6 +2203,7 @@ ivas_error ivas_init_decoder( return error; } } +#endif } if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) @@ -2203,7 +2218,7 @@ ivas_error ivas_init_decoder( if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, output_Fs ) ) != IVAS_ERR_OK ) { return error; } @@ -2382,12 +2397,18 @@ ivas_error ivas_init_decoder( *-----------------------------------------------------------------*/ if ( st_ivas->hTcBuffer == NULL ) - { /* no module has yet open the TC buffer, open a default one */ +#ifdef NONBE_1303_REND_GRANULARITY + granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, ivas_jbm_dec_get_tc_buffer_mode( st_ivas ), output_Fs ); + n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) +#else n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, ivas_jbm_dec_get_tc_buffer_mode( st_ivas ), n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 0438755a31..15f2b72392 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -124,7 +124,11 @@ static ivas_error ivas_ism_bitrate_switching_dec( /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv render what still fits in the new granularity */ +#ifdef NONBE_1303_REND_GRANULARITY + tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs ); +#else tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); +#endif if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) { diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index df1be1d5b1..93202b94cf 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -403,7 +403,11 @@ ivas_error ivas_param_ism_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { +#ifdef NONBE_1303_REND_GRANULARITY + int16_t i, granularity; +#else int16_t i; +#endif PARAM_ISM_DEC_HANDLE hParamIsmDec; IVAS_OUTPUT_SETUP hOutSetup; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; @@ -539,6 +543,9 @@ ivas_error ivas_param_ism_dec_open( st_ivas->hParamIsmDec = hParamIsmDec; st_ivas->hSpatParamRendCom = hSpatParamRendCom; +#ifdef NONBE_1303_REND_GRANULARITY + granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs ); +#endif if ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) { @@ -578,7 +585,11 @@ ivas_error ivas_param_ism_dec_open( if ( st_ivas->hTcBuffer == NULL ) { +#ifdef NONBE_1303_REND_GRANULARITY + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, nchan_full, granularity ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, nchan_full, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -591,7 +602,11 @@ ivas_error ivas_param_ism_dec_open( if ( st_ivas->hTcBuffer == NULL ) { int16_t nchan_to_allocate = st_ivas->hDecoderConfig->nchan_out; +#ifdef NONBE_1303_REND_GRANULARITY + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_BUFFER, nchan_to_allocate, nchan_to_allocate, nchan_to_allocate, granularity ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_BUFFER, nchan_to_allocate, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 2376de298a..cdef1d6677 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -2060,6 +2060,31 @@ static void ivas_jbm_dec_copy_tc( /*! r: render granularity */ int16_t ivas_jbm_dec_get_render_granularity( +#ifdef NONBE_1303_REND_GRANULARITY + const RENDERER_TYPE renderer_type, /* i : renderer type */ + const RENDERER_TYPE renderer_type_sec, /* i : secondary renderer type */ + const int32_t output_Fs /* i : sampling rate */ +) +{ + int16_t render_granularity; + + if ( renderer_type == RENDERER_BINAURAL_OBJECTS_TD || /* TD renderer */ + renderer_type == RENDERER_BINAURAL_MIXER_CONV || renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM || /* Crend */ + renderer_type_sec == RENDERER_BINAURAL_OBJECTS_TD /* TD rend as a secondary renderer -> set the common granularity for both renderers */ + ) + { + /* 5 ms granularity */ + render_granularity = NS2SA( output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); + } + else + { + /* 1.25 ms granularity */ + render_granularity = NS2SA( output_Fs, CLDFB_SLOT_NS ); + } + + return render_granularity; +} +#else const RENDERER_TYPE rendererType, /* i : renderer type */ const IVAS_FORMAT ivas_format, /* i : ivas format */ const MC_MODE mc_mode, /* i : MC mode */ @@ -2086,6 +2111,7 @@ int16_t ivas_jbm_dec_get_render_granularity( return render_granularity; } +#endif /*--------------------------------------------------------------------------* diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 48c6f45571..d4b301408c 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -727,7 +727,13 @@ ivas_error ivas_masa_dec_open( nchan_to_allocate++; } +#ifdef NONBE_1303_REND_GRANULARITY + int16_t granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs ); + + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_transport, nchan_to_allocate, nchan_to_allocate, granularity ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_transport, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -1474,7 +1480,11 @@ ivas_error ivas_masa_dec_reconfigure( TC_BUFFER_MODE buffer_mode_new; int16_t n_samples_granularity; +#ifdef NONBE_1303_REND_GRANULARITY + n_samples_granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, ivas_renderer_secondary_select( st_ivas ), st_ivas->hDecoderConfig->output_Fs ); +#else n_samples_granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); +#endif buffer_mode_new = ivas_jbm_dec_get_tc_buffer_mode( st_ivas ); tc_nchan_transport = ivas_jbm_dec_get_num_tc_channels( st_ivas ); @@ -1491,7 +1501,9 @@ ivas_error ivas_masa_dec_reconfigure( } if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { +#ifndef NONBE_1303_REND_GRANULARITY n_samples_granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); /* Use the same granularity as tdrend */ +#endif if ( n_samples_granularity > st_ivas->hTcBuffer->n_samples_granularity ) { if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index e97adc27d1..98e2cdf5d4 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -457,7 +457,13 @@ ivas_error ivas_param_mc_dec_open( if ( st_ivas->hTcBuffer == NULL ) { +#ifdef NONBE_1303_REND_GRANULARITY + int16_t granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs ); + + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, 0, granularity ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, 0, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 26a5124783..a6ecd68b2f 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -391,7 +391,13 @@ ivas_error ivas_mc_paramupmix_dec_open( nchan_to_allocate = MC_PARAMUPMIX_MAX_INPUT_CHANS; } +#ifdef NONBE_1303_REND_GRANULARITY + int16_t granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs ); + + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, granularity ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 164a245eaa..2a6970e227 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -795,7 +795,12 @@ static ivas_error ivas_mc_dec_reconfig( /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv render what still fits in the new granularity */ +#ifdef NONBE_1303_REND_GRANULARITY + tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs ); +#else tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); +#endif + if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) { /* flush already done in IVAS_DEC_ReadFormat() */ diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index ac06064065..0476796816 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -479,3 +479,36 @@ void ivas_renderer_select( return; } + + +#ifdef NONBE_1303_REND_GRANULARITY +/*-------------------------------------------------------------------------* + * ivas_renderer_secondary_select() + * + * Select and configure IVAS secondary binaural renderer (used in combine formats) + *-------------------------------------------------------------------------*/ + +/*! r: secondary binaural renderer type */ +RENDERER_TYPE ivas_renderer_secondary_select( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + RENDERER_TYPE renderer_type; + AUDIO_CONFIG output_config; + + /* disabled by default */ + renderer_type = RENDERER_DISABLE; + output_config = st_ivas->hDecoderConfig->output_config; + + if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && output_config == IVAS_AUDIO_CONFIG_BINAURAL ) + { + renderer_type = RENDERER_BINAURAL_OBJECTS_TD; + } + else if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) + { + renderer_type = RENDERER_BINAURAL_OBJECTS_TD; + } + + return renderer_type; +} +#endif diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index df7b021c9f..5b8ffbde8a 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -194,6 +194,9 @@ ivas_error ivas_sba_dec_reconfigure( } /* determine new granularity */ +#ifdef NONBE_1303_REND_GRANULARITY + granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, ivas_renderer_secondary_select( st_ivas ), st_ivas->hDecoderConfig->output_Fs ); +#else granularity_new = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); /* this will change anyway only with binaural */ @@ -201,6 +204,7 @@ ivas_error ivas_sba_dec_reconfigure( { granularity_new *= JBM_CLDFB_SLOTS_IN_SUBFRAME; } +#endif /* flush renderer on granularity change form 5ms to 1.25ms, again only possible for binaural rendering */ if ( granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index e984b9251c..b256ae2af8 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -228,8 +228,10 @@ ivas_error ivas_spar_dec_open( nchan_to_allocate += st_ivas->nchan_ism; } +#ifndef NONBE_1303_REND_GRANULARITY granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); +#endif if ( ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_MONO ) ) { if ( ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO ) ) @@ -249,6 +251,11 @@ ivas_error ivas_spar_dec_open( nchan_to_allocate = 2 * BINAURAL_CHANNELS; } +#ifdef NONBE_1303_REND_GRANULARITY + granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, ivas_renderer_secondary_select( st_ivas ), output_Fs ); + + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, granularity ) ) != IVAS_ERR_OK ) +#else if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) @@ -258,6 +265,7 @@ ivas_error ivas_spar_dec_open( } if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, granularity ) ) != IVAS_ERR_OK ) +#endif ` { return error; } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 7640228d3b..75356605a6 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -919,7 +919,11 @@ ivas_error IVAS_DEC_ReadFormat( MC_MODE mc_mode_old; int16_t nchan_transport_old; AUDIO_CONFIG intern_config_old, transport_config_old, output_config; +#ifdef NONBE_1303_REND_GRANULARITY + RENDERER_TYPE renderer_type_old, renderer_type_sec_new, renderer_type_sec_old; +#else RENDERER_TYPE renderer_type_old; +#endif if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { @@ -934,6 +938,9 @@ ivas_error IVAS_DEC_ReadFormat( intern_config_old = st_ivas->intern_config; transport_config_old = st_ivas->transport_config; renderer_type_old = st_ivas->renderer_type; +#ifdef NONBE_1303_REND_GRANULARITY + renderer_type_sec_old = ivas_renderer_secondary_select( st_ivas ); +#endif output_config = st_ivas->hDecoderConfig->output_config; @@ -956,6 +963,9 @@ ivas_error IVAS_DEC_ReadFormat( } ivas_renderer_select( st_ivas ); +#ifdef NONBE_1303_REND_GRANULARITY + renderer_type_sec_new = ivas_renderer_secondary_select( st_ivas ); +#endif switch ( st_ivas->renderer_type ) { @@ -982,10 +992,17 @@ ivas_error IVAS_DEC_ReadFormat( } *binaural_renderer_sec = IVAS_BIN_RENDERER_TYPE_NONE; +#ifdef NONBE_1303_REND_GRANULARITY + if ( renderer_type_sec_new == RENDERER_BINAURAL_OBJECTS_TD ) + { + *binaural_renderer_sec = IVAS_BIN_RENDERER_TYPE_TDREND; + } +#else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && output_config == IVAS_AUDIO_CONFIG_BINAURAL ) { *binaural_renderer_sec = IVAS_BIN_RENDERER_TYPE_TDREND; } +#endif *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_INVALID; if ( *binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV ) @@ -1034,13 +1051,23 @@ ivas_error IVAS_DEC_ReadFormat( } } +#ifdef NONBE_1303_REND_GRANULARITY + if ( ( renderer_type_old != st_ivas->renderer_type && renderer_type_old != RENDERER_DISABLE ) || + ( renderer_type_sec_old != renderer_type_sec_new && renderer_type_sec_old != RENDERER_DISABLE ) ) +#else if ( ( renderer_type_old != st_ivas->renderer_type && renderer_type_old != RENDERER_DISABLE ) || ( st_ivas->ini_active_frame > 0 && ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) ) +#endif { /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv render what still fits in the new granularity */ +#ifdef NONBE_1303_REND_GRANULARITY + int16_t tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, renderer_type_sec_new, st_ivas->hDecoderConfig->output_Fs ); +#else int16_t tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); +#endif st_ivas->nchan_transport = nchan_transport_old; + if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) { if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &st_ivas->hIntSetup, mc_mode_old, ism_mode_old, &hIvasDec->nSamplesFlushed, pcm_type_API_to_internal( hIvasDec->pcmType ), hIvasDec->flushbuffer ) ) != IVAS_ERR_OK ) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index c5810cb6d3..50d62a7594 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -151,6 +151,12 @@ ivas_error ivas_dirac_dec_init_binaural_data( num_poses = st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses; } +#ifdef NONBE_1303_REND_GRANULARITY + output_Fs = st_ivas->hDecoderConfig->output_Fs; + nBins = st_ivas->hSpatParamRendCom->num_freq_bands; + renderer_type = st_ivas->renderer_type; + +#endif for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { hDiracDecBin = st_ivas->hDiracDecBin[pos_idx]; @@ -169,10 +175,11 @@ ivas_error ivas_dirac_dec_init_binaural_data( hDiracDecBin->phHrtfParambin = NULL; } +#ifndef NONBE_1303_REND_GRANULARITY output_Fs = st_ivas->hDecoderConfig->output_Fs; nBins = st_ivas->hSpatParamRendCom->num_freq_bands; renderer_type = st_ivas->renderer_type; - +#endif for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { for ( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) @@ -324,11 +331,15 @@ ivas_error ivas_dirac_dec_init_binaural_data( nchan_to_allocate = BINAURAL_CHANNELS + st_ivas->nchan_ism; } +#ifdef NONBE_1303_REND_GRANULARITY + n_samples_granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, ivas_renderer_secondary_select( st_ivas ), output_Fs ); +#else ` n_samples_granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { n_samples_granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); /* Use the same granularity as tdrend */ } +#endif if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, ivas_jbm_dec_get_num_tc_channels( st_ivas ), nchan_to_allocate, nchan_to_allocate, n_samples_granularity ) ) != IVAS_ERR_OK ) { -- GitLab From b1f36ecaaab589407e3ba8ee48ed3766fa8d0dac Mon Sep 17 00:00:00 2001 From: vaclav Date: Sat, 22 Mar 2025 17:54:57 +0100 Subject: [PATCH 02/11] fix --- lib_dec/ivas_init_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 95a32865d2..c51a7c4c46 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2403,7 +2403,7 @@ ivas_error ivas_init_decoder( granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, ivas_jbm_dec_get_tc_buffer_mode( st_ivas ), output_Fs ); n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, ivas_jbm_dec_get_tc_buffer_mode( st_ivas ), n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) #else n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); -- GitLab From 1f6221c0e7cace329ca1ec90ddad5a8024f459a6 Mon Sep 17 00:00:00 2001 From: vaclav Date: Sat, 22 Mar 2025 18:12:03 +0100 Subject: [PATCH 03/11] fix warnings --- lib_dec/ivas_masa_dec.c | 5 ++++- lib_dec/ivas_mc_param_dec.c | 5 ++++- lib_dec/ivas_mc_paramupmix_dec.c | 5 ++++- lib_dec/ivas_sba_dec.c | 2 ++ lib_dec/ivas_spar_decoder.c | 2 +- 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index d4b301408c..395cd39596 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -696,6 +696,9 @@ ivas_error ivas_masa_dec_open( if ( st_ivas->hTcBuffer == NULL && st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { int16_t nchan_to_allocate, nchan_transport; +#ifdef NONBE_1303_REND_GRANULARITY + int16_t granularity; +#endif TC_BUFFER_MODE buffer_mode; buffer_mode = TC_BUFFER_MODE_RENDERER; @@ -728,7 +731,7 @@ ivas_error ivas_masa_dec_open( } #ifdef NONBE_1303_REND_GRANULARITY - int16_t granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs ); + granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs ); if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_transport, nchan_to_allocate, nchan_to_allocate, granularity ) ) != IVAS_ERR_OK ) #else diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 98e2cdf5d4..048f26e379 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -437,6 +437,9 @@ ivas_error ivas_param_mc_dec_open( if ( hParamMC->synthesis_conf != PARAM_MC_SYNTH_MONO_STEREO ) { int16_t n_cldfb_slots; +#ifdef NONBE_1303_REND_GRANULARITY + int16_t granularity; +#endif n_cldfb_slots = DEFAULT_JBM_CLDFB_TIMESLOTS; if ( st_ivas->hDecoderConfig->Opt_tsm ) @@ -458,7 +461,7 @@ ivas_error ivas_param_mc_dec_open( if ( st_ivas->hTcBuffer == NULL ) { #ifdef NONBE_1303_REND_GRANULARITY - int16_t granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs ); + granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs ); if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, 0, granularity ) ) != IVAS_ERR_OK ) #else diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index a6ecd68b2f..81bd4023a4 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -374,6 +374,9 @@ ivas_error ivas_mc_paramupmix_dec_open( { int16_t nchan_to_allocate; int16_t nchan_tc; +#ifdef NONBE_1303_REND_GRANULARITY + int16_t granularity; +#endif TC_BUFFER_MODE buffer_mode; buffer_mode = TC_BUFFER_MODE_RENDERER; @@ -392,7 +395,7 @@ ivas_error ivas_mc_paramupmix_dec_open( } #ifdef NONBE_1303_REND_GRANULARITY - int16_t granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs ); + granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs ); if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, granularity ) ) != IVAS_ERR_OK ) #else diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 5b8ffbde8a..6f0b4e3c43 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -163,6 +163,7 @@ ivas_error ivas_sba_dec_reconfigure( /* we may need to flush only for binaural and OSBA and TSM */ if ( st_ivas->ivas_format == SBA_ISM_FORMAT && ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { +#ifndef NONBE_1303_REND_GRANULARITY RENDERER_TYPE renderer_type_new; int16_t sba_order_internal; @@ -193,6 +194,7 @@ ivas_error ivas_sba_dec_reconfigure( } } +#endif /* determine new granularity */ #ifdef NONBE_1303_REND_GRANULARITY granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, ivas_renderer_secondary_select( st_ivas ), st_ivas->hDecoderConfig->output_Fs ); diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index b256ae2af8..205bc77859 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -265,7 +265,7 @@ ivas_error ivas_spar_dec_open( } if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, granularity ) ) != IVAS_ERR_OK ) -#endif ` +#endif { return error; } -- GitLab From 452c31553b28f1465221a1b2afb6ba0e183fa203 Mon Sep 17 00:00:00 2001 From: vaclav Date: Sat, 22 Mar 2025 18:17:37 +0100 Subject: [PATCH 04/11] fix --- lib_dec/ivas_init_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index c51a7c4c46..28a1554ff0 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2400,7 +2400,7 @@ ivas_error ivas_init_decoder( { /* no module has yet open the TC buffer, open a default one */ #ifdef NONBE_1303_REND_GRANULARITY - granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, ivas_jbm_dec_get_tc_buffer_mode( st_ivas ), output_Fs ); + granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, ivas_renderer_secondary_select( st_ivas ), output_Fs ); n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, ivas_jbm_dec_get_tc_buffer_mode( st_ivas ), n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) -- GitLab From 183958b62ce325d041ac00e8e42140a82c50cbf3 Mon Sep 17 00:00:00 2001 From: vaclav Date: Sat, 22 Mar 2025 18:22:10 +0100 Subject: [PATCH 05/11] cleaning --- lib_rend/ivas_dirac_dec_binaural_functions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 50d62a7594..3be1a116d7 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -333,7 +333,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( #ifdef NONBE_1303_REND_GRANULARITY n_samples_granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, ivas_renderer_secondary_select( st_ivas ), output_Fs ); -#else ` +#else n_samples_granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { -- GitLab From c582f3082ad178b6d729c315a3078a9390b5268e Mon Sep 17 00:00:00 2001 From: vaclav Date: Sat, 22 Mar 2025 19:05:46 +0100 Subject: [PATCH 06/11] simplification --- lib_dec/ivas_init_dec.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 28a1554ff0..aac6720870 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2126,18 +2126,16 @@ ivas_error ivas_init_decoder( return error; } } +#ifndef NONBE_1303_REND_GRANULARITY -#ifdef NONBE_1303_REND_GRANULARITY - granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs ); -#else granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); -#endif n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) { return error; } +#endif } else if ( st_ivas->renderer_type == RENDERER_MC ) { @@ -2170,16 +2168,7 @@ ivas_error ivas_init_decoder( } st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; - -#ifdef NONBE_1303_REND_GRANULARITY - granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs ); - n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); - - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) - { - return error; - } -#else +#ifndef NONBE_1303_REND_GRANULARITY if ( ( st_ivas->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) { -- GitLab From 134ce55e68724c8ee3e9c867f3181cb07859ef96 Mon Sep 17 00:00:00 2001 From: vaclav Date: Sat, 22 Mar 2025 19:35:07 +0100 Subject: [PATCH 07/11] call ivas_jbm_dec_set_discard_samples() at one common place --- lib_dec/ivas_ism_dec.c | 7 +++++-- lib_dec/ivas_masa_dec.c | 2 ++ lib_dec/ivas_mct_dec.c | 6 +++++- lib_dec/ivas_sba_dec.c | 12 ++++++++++++ lib_dec/lib_dec.c | 12 +++++++++++- 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 15f2b72392..7752b2f96e 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -122,6 +122,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } +#ifndef NONBE_1303_REND_GRANULARITY /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv render what still fits in the new granularity */ #ifdef NONBE_1303_REND_GRANULARITY @@ -142,7 +143,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( return error; } } - +#endif if ( st_ivas->ism_mode != last_ism_mode ) { /* EFAP handle */ @@ -310,7 +311,9 @@ static ivas_error ivas_ism_bitrate_switching_dec( tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels( st_ivas ); tc_nchan_allocate_new = tc_nchan_tc_new; tc_nchan_full_new = tc_nchan_tc_new; - +#ifdef NONBE_1303_REND_GRANULARITY + tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs ); +#endif if ( st_ivas->ism_mode == ISM_MODE_PARAM && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 395cd39596..2ab0291e73 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1502,6 +1502,7 @@ ivas_error ivas_masa_dec_reconfigure( { tc_nchan_to_allocate = 2 * BINAURAL_CHANNELS; } +#ifndef NONBE_1303_REND_GRANULARITY if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { #ifndef NONBE_1303_REND_GRANULARITY @@ -1522,6 +1523,7 @@ ivas_error ivas_masa_dec_reconfigure( /* flush already done in IVAS_DEC_ReadFormat() */ } } +#endif } else if ( st_ivas->nchan_transport == 1 && ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) ) { diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 2a6970e227..c1aa1870f4 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -793,6 +793,7 @@ static ivas_error ivas_mc_dec_reconfig( } } +#ifndef NONBE_1303_REND_GRANULARITY /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv render what still fits in the new granularity */ #ifdef NONBE_1303_REND_GRANULARITY @@ -813,7 +814,7 @@ static ivas_error ivas_mc_dec_reconfig( return error; } } - +#endif if ( st_ivas->mc_mode == MC_MODE_MCT ) { st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ) ); @@ -1300,6 +1301,9 @@ static ivas_error ivas_mc_dec_reconfig( tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels( st_ivas ); tc_nchan_allocate_new = tc_nchan_tc_new; tc_nchan_full_new = tc_nchan_tc_new; +#ifdef NONBE_1303_REND_GRANULARITY + tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs ); +#endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 6f0b4e3c43..2eb2ee17f2 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -208,6 +208,17 @@ ivas_error ivas_sba_dec_reconfigure( } #endif +#ifdef NONBE_1303_REND_GRANULARITY + if ( granularity_new > st_ivas->hTcBuffer->n_samples_granularity ) + { + /* make sure the changed number of slots in the last subframe is not lost in the following steps */ + if ( st_ivas->hSpatParamRendCom != NULL ) + { + st_ivas->hSpatParamRendCom->subframe_nbslots[st_ivas->hSpatParamRendCom->nb_subframes - 1] = st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->nb_subframes - 1]; + } + st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->nb_subframes - 1] = st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->nb_subframes - 1]; + } +#else /* flush renderer on granularity change form 5ms to 1.25ms, again only possible for binaural rendering */ if ( granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) { @@ -227,6 +238,7 @@ ivas_error ivas_sba_dec_reconfigure( } st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->nb_subframes - 1] = st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->nb_subframes - 1]; } +#endif } /* save old */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 75356605a6..4485ff6b72 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1053,7 +1053,7 @@ ivas_error IVAS_DEC_ReadFormat( #ifdef NONBE_1303_REND_GRANULARITY if ( ( renderer_type_old != st_ivas->renderer_type && renderer_type_old != RENDERER_DISABLE ) || - ( renderer_type_sec_old != renderer_type_sec_new && renderer_type_sec_old != RENDERER_DISABLE ) ) + ( renderer_type_sec_old != renderer_type_sec_new ) ) #else if ( ( renderer_type_old != st_ivas->renderer_type && renderer_type_old != RENDERER_DISABLE ) || ( st_ivas->ini_active_frame > 0 && ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) ) @@ -1075,6 +1075,16 @@ ivas_error IVAS_DEC_ReadFormat( return error; } } +#ifdef NONBE_1303_REND_GRANULARITY + /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ + else if ( tc_granularity_new > st_ivas->hTcBuffer->n_samples_granularity ) + { + if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif } } -- GitLab From aa7f453906bc7b868c2b7e124132622e533fd1b1 Mon Sep 17 00:00:00 2001 From: vaclav Date: Sat, 22 Mar 2025 20:10:38 +0100 Subject: [PATCH 08/11] fix (avoid the adjustment in the very first frame) --- lib_dec/lib_dec.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 4485ff6b72..831a65b101 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1053,21 +1053,17 @@ ivas_error IVAS_DEC_ReadFormat( #ifdef NONBE_1303_REND_GRANULARITY if ( ( renderer_type_old != st_ivas->renderer_type && renderer_type_old != RENDERER_DISABLE ) || - ( renderer_type_sec_old != renderer_type_sec_new ) ) -#else - if ( ( renderer_type_old != st_ivas->renderer_type && renderer_type_old != RENDERER_DISABLE ) || - ( st_ivas->ini_active_frame > 0 && ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) ) -#endif + ( renderer_type_sec_old != renderer_type_sec_new && st_ivas->ini_active_frame > 0 ) ) { - /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv - render what still fits in the new granularity */ -#ifdef NONBE_1303_REND_GRANULARITY int16_t tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, renderer_type_sec_new, st_ivas->hDecoderConfig->output_Fs ); -#else - int16_t tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); -#endif st_ivas->nchan_transport = nchan_transport_old; + if ( st_ivas->hTcBuffer == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + /* JBM: when granularity goes down, render what still fits in the new granularity */ if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) { if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &st_ivas->hIntSetup, mc_mode_old, ism_mode_old, &hIvasDec->nSamplesFlushed, pcm_type_API_to_internal( hIvasDec->pcmType ), hIvasDec->flushbuffer ) ) != IVAS_ERR_OK ) @@ -1075,8 +1071,7 @@ ivas_error IVAS_DEC_ReadFormat( return error; } } -#ifdef NONBE_1303_REND_GRANULARITY - /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ + /* JBM: when granularity goes up, discard samples at the beginning of the frame */ else if ( tc_granularity_new > st_ivas->hTcBuffer->n_samples_granularity ) { if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) @@ -1084,6 +1079,22 @@ ivas_error IVAS_DEC_ReadFormat( return error; } } +#else + if ( ( renderer_type_old != st_ivas->renderer_type && renderer_type_old != RENDERER_DISABLE ) || + ( st_ivas->ini_active_frame > 0 && ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) ) + { + /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv + render what still fits in the new granularity */ + int16_t tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); + st_ivas->nchan_transport = nchan_transport_old; + + if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) + { + if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &st_ivas->hIntSetup, mc_mode_old, ism_mode_old, &hIvasDec->nSamplesFlushed, pcm_type_API_to_internal( hIvasDec->pcmType ), hIvasDec->flushbuffer ) ) != IVAS_ERR_OK ) + { + return error; + } + } #endif } } -- GitLab From efa4d76523bc00c4f1df432fad122e074d2ff46e Mon Sep 17 00:00:00 2001 From: vaclav Date: Sun, 23 Mar 2025 10:06:48 +0100 Subject: [PATCH 09/11] add comments --- lib_dec/ivas_output_config.c | 2 +- lib_dec/lib_dec.c | 64 ++++++++++++++++++++++++++++++++---- 2 files changed, 59 insertions(+), 7 deletions(-) diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 0476796816..305d99ef99 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -485,7 +485,7 @@ void ivas_renderer_select( /*-------------------------------------------------------------------------* * ivas_renderer_secondary_select() * - * Select and configure IVAS secondary binaural renderer (used in combine formats) + * Select IVAS secondary binaural renderer (used in combine formats) *-------------------------------------------------------------------------*/ /*! r: secondary binaural renderer type */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 831a65b101..e3e9176e7d 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -896,6 +896,49 @@ ivas_error IVAS_DEC_FeedFrame_Serial( return IVAS_ERR_OK; } +#ifdef NONBE_1303_REND_GRANULARITY + +/*---------------------------------------------------------------------* + * renderer_type_to_mode() + * + * Convert (codec library) renderer type to (API public) binaural renderer mode + *---------------------------------------------------------------------*/ + +/*! r: binaural renderer mode (API type) */ +static IVAS_BIN_RENDERER_TYPE renderer_type_to_mode( + const RENDERER_TYPE renderer_type /* i : renderer type (codec library type) */ +) +{ + IVAS_BIN_RENDERER_TYPE binaural_renderer; + + switch ( renderer_type ) + { + case RENDERER_BINAURAL_OBJECTS_TD: + binaural_renderer = IVAS_BIN_RENDERER_TYPE_TDREND; + break; + case RENDERER_BINAURAL_MIXER_CONV: + case RENDERER_BINAURAL_MIXER_CONV_ROOM: + binaural_renderer = IVAS_BIN_RENDERER_TYPE_CREND; + break; + case RENDERER_BINAURAL_FASTCONV: + binaural_renderer = IVAS_BIN_RENDERER_TYPE_FASTCONV; + break; + case RENDERER_BINAURAL_FASTCONV_ROOM: + binaural_renderer = IVAS_BIN_RENDERER_TYPE_FASTCONV; + break; + case RENDERER_BINAURAL_PARAMETRIC: + case RENDERER_BINAURAL_PARAMETRIC_ROOM: + binaural_renderer = IVAS_BIN_RENDERER_TYPE_PARAMBIN; + break; + default: + binaural_renderer = IVAS_BIN_RENDERER_TYPE_NONE; + break; + } + + return binaural_renderer; +} + +#endif /*---------------------------------------------------------------------* * IVAS_DEC_ReadFormat( ) @@ -962,11 +1005,15 @@ ivas_error IVAS_DEC_ReadFormat( return ( IVAS_ERROR( IVAS_ERR_INVALID_INPUT_FORMAT, "IVAS format switching is not allowed." ) ); } + /* Select binaural renderer */ ivas_renderer_select( st_ivas ); #ifdef NONBE_1303_REND_GRANULARITY - renderer_type_sec_new = ivas_renderer_secondary_select( st_ivas ); -#endif + *binaural_renderer = renderer_type_to_mode( st_ivas->renderer_type ); + /* Select secondary binaural renderer (used in combine formats) */ + renderer_type_sec_new = ivas_renderer_secondary_select( st_ivas ); + *binaural_renderer_sec = renderer_type_to_mode( renderer_type_sec_new ); +#else switch ( st_ivas->renderer_type ) { case RENDERER_BINAURAL_OBJECTS_TD: @@ -1002,8 +1049,10 @@ ivas_error IVAS_DEC_ReadFormat( { *binaural_renderer_sec = IVAS_BIN_RENDERER_TYPE_TDREND; } +#endif #endif + /* select HRTF audio configuration to load the right HRTF set for the external binary file */ *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_INVALID; if ( *binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV ) { @@ -1052,10 +1101,13 @@ ivas_error IVAS_DEC_ReadFormat( } #ifdef NONBE_1303_REND_GRANULARITY - if ( ( renderer_type_old != st_ivas->renderer_type && renderer_type_old != RENDERER_DISABLE ) || - ( renderer_type_sec_old != renderer_type_sec_new && st_ivas->ini_active_frame > 0 ) ) + /* JBM: handle cases when binaural renderer granularity changes (happens in bitrate switching) */ + if ( st_ivas->ini_active_frame > 0 && st_ivas->hDecoderConfig->Opt_tsm && + ( ( renderer_type_old != st_ivas->renderer_type ) || + ( renderer_type_sec_old != renderer_type_sec_new ) ) ) { int16_t tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, renderer_type_sec_new, st_ivas->hDecoderConfig->output_Fs ); + st_ivas->nchan_transport = nchan_transport_old; if ( st_ivas->hTcBuffer == NULL ) @@ -1063,7 +1115,7 @@ ivas_error IVAS_DEC_ReadFormat( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - /* JBM: when granularity goes down, render what still fits in the new granularity */ + /* when granularity goes down, render what still fits in the new granularity */ if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) { if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &st_ivas->hIntSetup, mc_mode_old, ism_mode_old, &hIvasDec->nSamplesFlushed, pcm_type_API_to_internal( hIvasDec->pcmType ), hIvasDec->flushbuffer ) ) != IVAS_ERR_OK ) @@ -1071,7 +1123,7 @@ ivas_error IVAS_DEC_ReadFormat( return error; } } - /* JBM: when granularity goes up, discard samples at the beginning of the frame */ + /* when granularity goes up, discard samples at the beginning of the frame */ else if ( tc_granularity_new > st_ivas->hTcBuffer->n_samples_granularity ) { if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) -- GitLab From becf4c0d7b2fde8dea52f614ecd9cb628a8d296a Mon Sep 17 00:00:00 2001 From: vaclav Date: Sun, 23 Mar 2025 12:25:23 +0100 Subject: [PATCH 10/11] cleaning --- lib_dec/ivas_ism_dec.c | 4 ---- lib_dec/ivas_masa_dec.c | 3 +-- lib_dec/ivas_mct_dec.c | 4 ---- lib_dec/lib_dec.c | 9 +-------- 4 files changed, 2 insertions(+), 18 deletions(-) diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 7752b2f96e..e7c793caf3 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -125,11 +125,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( #ifndef NONBE_1303_REND_GRANULARITY /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv render what still fits in the new granularity */ -#ifdef NONBE_1303_REND_GRANULARITY - tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs ); -#else tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); -#endif if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) { diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 2ab0291e73..62e711718a 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1505,9 +1505,8 @@ ivas_error ivas_masa_dec_reconfigure( #ifndef NONBE_1303_REND_GRANULARITY if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { -#ifndef NONBE_1303_REND_GRANULARITY n_samples_granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); /* Use the same granularity as tdrend */ -#endif + if ( n_samples_granularity > st_ivas->hTcBuffer->n_samples_granularity ) { if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index c1aa1870f4..0ec1514eaa 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -796,11 +796,7 @@ static ivas_error ivas_mc_dec_reconfig( #ifndef NONBE_1303_REND_GRANULARITY /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv render what still fits in the new granularity */ -#ifdef NONBE_1303_REND_GRANULARITY - tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs ); -#else tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); -#endif if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) { diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index e3e9176e7d..5bc5993ea2 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1039,17 +1039,10 @@ ivas_error IVAS_DEC_ReadFormat( } *binaural_renderer_sec = IVAS_BIN_RENDERER_TYPE_NONE; -#ifdef NONBE_1303_REND_GRANULARITY - if ( renderer_type_sec_new == RENDERER_BINAURAL_OBJECTS_TD ) - { - *binaural_renderer_sec = IVAS_BIN_RENDERER_TYPE_TDREND; - } -#else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && output_config == IVAS_AUDIO_CONFIG_BINAURAL ) { *binaural_renderer_sec = IVAS_BIN_RENDERER_TYPE_TDREND; } -#endif #endif /* select HRTF audio configuration to load the right HRTF set for the external binary file */ @@ -1101,7 +1094,7 @@ ivas_error IVAS_DEC_ReadFormat( } #ifdef NONBE_1303_REND_GRANULARITY - /* JBM: handle cases when binaural renderer granularity changes (happens in bitrate switching) */ + /* JBM: compensate when binaural renderer granularity changes (happens in bitrate switching) */ if ( st_ivas->ini_active_frame > 0 && st_ivas->hDecoderConfig->Opt_tsm && ( ( renderer_type_old != st_ivas->renderer_type ) || ( renderer_type_sec_old != renderer_type_sec_new ) ) ) -- GitLab From ba12394a2263bf8fe4bbba6a32f5991b0f6cedb9 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 27 Mar 2025 13:51:35 +0100 Subject: [PATCH 11/11] remove ToDo commented temporary code; under NONBE_1303_REND_GRANULARITY --- lib_dec/ivas_objectRenderer_internal.c | 4 ++++ lib_dec/lib_dec.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index d20c793304..d64720c44a 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -61,9 +61,13 @@ ivas_error ivas_td_binaural_open( num_src = st_ivas->nchan_ism; } +#ifdef NONBE_1303_REND_GRANULARITY + if ( st_ivas->hHrtfTD == NULL && st_ivas->hDecoderConfig->Opt_HRTF_binary ) +#else if ( st_ivas->hHrtfTD == NULL && st_ivas->hDecoderConfig->Opt_HRTF_binary && ( st_ivas->ivas_format != SBA_ISM_FORMAT ) // ToDo: temporary hack to avoid ASAN errors -> see issue #1202 ) +#endif { return IVAS_ERROR( IVAS_ERR_INTERNAL, "HRTF binary file present but not used in TD renderer" ); } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 5bc5993ea2..ddb88420cc 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2968,9 +2968,13 @@ ivas_error IVAS_DEC_HRTF_binary_close( if ( st_ivas->hDecoderConfig->Opt_HRTF_binary && st_ivas->ini_frame > 0 ) { +#ifdef NONBE_1303_REND_GRANULARITY + if ( !( binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_DEFAULT ) ) +#else if ( !( binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_DEFAULT ) && ( hIvasDec->st_ivas->ivas_format != SBA_ISM_FORMAT ) // ToDo: temporary hack to avoid ASAN errors -> see issue #1202 ) +#endif { ivas_HRTF_binary_close( &st_ivas->hHrtfTD ); } -- GitLab