From 9c25f9edc0662a3bbc53dfbafdf3c5fa1b82e85f Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:15:18 +0100 Subject: [PATCH 01/17] Update copyright header in aeid_file_reader.[ch] from 2024 to 2025 --- lib_util/aeid_file_reader.c | 2 +- lib_util/aeid_file_reader.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_util/aeid_file_reader.c b/lib_util/aeid_file_reader.c index 83dd4b4e1..e569dbdc7 100644 --- a/lib_util/aeid_file_reader.c +++ b/lib_util/aeid_file_reader.c @@ -1,6 +1,6 @@ /****************************************************************************************************** - (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other diff --git a/lib_util/aeid_file_reader.h b/lib_util/aeid_file_reader.h index 2e7c32094..f72465b1f 100644 --- a/lib_util/aeid_file_reader.h +++ b/lib_util/aeid_file_reader.h @@ -1,6 +1,6 @@ /****************************************************************************************************** - (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other -- GitLab From 2d9584e5507cf1d8aece23efdffc712eb52daa83 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:24:35 +0100 Subject: [PATCH 02/17] [cleanup] accept NONBE_1246_INF_COHERENCE_IN_HIGH_LEVEL_DTX --- lib_com/options.h | 1 - lib_enc/ivas_stereo_cng_enc.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 7b047dff4..9f7ee0abe 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,7 +172,6 @@ #define FIX_1377_HANDLE_ERROR_CODE /* Eri: Add missing error code handling from IVAS_REND_SetObjectIDs */ #define FIX_1053_REVERB_RECONFIGURATION #define FIX_1179_USAN_PHASEECU /* Eri: issue 1179: better handling of 16 bit wrap around for very long(>200ms) FER-bursts */ -#define NONBE_1246_INF_COHERENCE_IN_HIGH_LEVEL_DTX /* Ericsson: Issue 1246: High level input which triggers DTX can lead to numerical overflow in coherence calculation */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ #define FIX_1113_EXTREND_ISAR /* FhG: issue 1113: fix external renderer asserts for FOA/HOA2 and CLDFB config */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ diff --git a/lib_enc/ivas_stereo_cng_enc.c b/lib_enc/ivas_stereo_cng_enc.c index 4a407d30f..b8eaf43af 100644 --- a/lib_enc/ivas_stereo_cng_enc.c +++ b/lib_enc/ivas_stereo_cng_enc.c @@ -95,11 +95,7 @@ void stereo_dft_enc_sid_calc_coh( for ( k = hStereoDft->band_limits[b]; k < hStereoDft->band_limits[b + 1]; k++ ) { coh_weight = hStereoDft->DFT[0][2 * k] * hStereoDft->DFT[0][2 * k] + hStereoDft->DFT[0][2 * k + 1] * hStereoDft->DFT[0][2 * k + 1]; -#ifdef NONBE_1246_INF_COHERENCE_IN_HIGH_LEVEL_DTX cohBand[b] += coh_weight * ( ( hStereoDft->xspec_smooth[2 * k] * hStereoDft->xspec_smooth[2 * k] + hStereoDft->xspec_smooth[2 * k + 1] * hStereoDft->xspec_smooth[2 * k + 1] ) / ( hStereoDft->Spd_L_smooth[k] * hStereoDft->Spd_R_smooth[k] + EPSILON ) ); -#else - cohBand[b] += coh_weight * ( hStereoDft->xspec_smooth[2 * k] * hStereoDft->xspec_smooth[2 * k] + hStereoDft->xspec_smooth[2 * k + 1] * hStereoDft->xspec_smooth[2 * k + 1] ) / ( hStereoDft->Spd_L_smooth[k] * hStereoDft->Spd_R_smooth[k] + EPSILON ); -#endif coh_weight_sum += coh_weight; } if ( coh_weight_sum > 0 ) -- GitLab From d36423f00f402d25b82314d8b21aa6476cd9f1a6 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:24:41 +0100 Subject: [PATCH 03/17] [cleanup] accept NONBE_1217_INIT_OBJ_EDIT --- lib_com/options.h | 1 - lib_dec/lib_dec.c | 23 ----------------------- 2 files changed, 24 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9f7ee0abe..cb4fc4891 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -199,7 +199,6 @@ #define FIX_HRTF_LOAD_API // solves API conflicts between HRTF and object-editing features #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) #define TMP_FIX_OMASA_SR_BE // temporary fix to keep OMASA split-rendering BE -#define NONBE_1217_INIT_OBJ_EDIT /* VA: issue 1217: do object editing only when objects metadata is available */ #define FIX_1217_OBJECT_EDIT_FILE_INTERFACE /* Nokia: issue #1217: add decoder functionality to read object edit instructions from a file */ #define NONBE_1217_OBJ_EDIT_FOA /* VA/Nokia: isse 1217: fix crash in object editing to FOA output in ParamISM */ #define NONBE_FIX_1255_OBJ_EDIT_JBM /* VA: issue 1255: restore object editing in JBM */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index c6db4c74b..941313c5b 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1468,16 +1468,10 @@ ivas_error IVAS_DEC_GetEditableParameters( st_ivas = hIvasDec->st_ivas; ism_mode = st_ivas->ism_mode; -#ifdef NONBE_1217_INIT_OBJ_EDIT if ( !( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT || ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_ism > 0 ) ) ) -#else - if ( !( st_ivas->ivas_format == ISM_FORMAT || - ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) || - ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) ) ) -#endif { return IVAS_ERROR( IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED, "Object editing is not supported in this operation mode." ); } @@ -1527,11 +1521,7 @@ ivas_error IVAS_DEC_GetEditableParameters( } #endif } -#ifdef NONBE_1217_INIT_OBJ_EDIT else if ( st_ivas->ivas_format == MASA_ISM_FORMAT || ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_ism > 0 ) ) -#else - else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) -#endif { /* object editing possible only in two highest OMASA modes */ if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) @@ -1550,11 +1540,7 @@ ivas_error IVAS_DEC_GetEditableParameters( hIvasEditableParameters->ism_metadata[obj].non_diegetic_flag = st_ivas->hIsmMetaData[obj]->non_diegetic_flag; } } -#ifdef NONBE_1217_INIT_OBJ_EDIT else if ( ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#else - else -#endif { /* Handle MONO output */ if ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX ) @@ -1581,7 +1567,6 @@ ivas_error IVAS_DEC_GetEditableParameters( hIvasEditableParameters->ism_metadata[obj].non_diegetic_flag = st_ivas->hIsmMetaData[obj]->non_diegetic_flag; } } -#ifdef NONBE_1217_INIT_OBJ_EDIT else if ( ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || ism_mode == ISM_MODE_NONE ) { hIvasEditableParameters->num_obj = 0; @@ -1591,7 +1576,6 @@ ivas_error IVAS_DEC_GetEditableParameters( { assert( 0 && "This should never happen!" ); } -#endif #endif } @@ -1630,17 +1614,10 @@ ivas_error IVAS_DEC_SetEditableParameters( st_ivas = hIvasDec->st_ivas; ism_mode = st_ivas->ism_mode; -#ifdef NONBE_1217_INIT_OBJ_EDIT if ( !( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT || ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_ism > 0 ) ) ) -#else - if ( !( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || - ( hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT && hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC ) || - ( hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT && ( hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) ) || - hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) -#endif { return IVAS_ERROR( IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED, "Object editing no supported in this operation mode." ); } -- GitLab From 9ef9fc2264c2d562a27086744dcd856836729c0e Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:24:46 +0100 Subject: [PATCH 04/17] [cleanup] accept FIX_1179_USAN_PHASEECU --- lib_com/options.h | 1 - lib_dec/FEC_HQ_phase_ecu.c | 27 --------------------------- 2 files changed, 28 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index cb4fc4891..25a8f32d8 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,7 +171,6 @@ #define NONBE_1377_REND_DIRATT_CONF /* Eri: Issue 1377: Error in directivity attenuation configuration for both IVAS_dec and IVAS_rend */ #define FIX_1377_HANDLE_ERROR_CODE /* Eri: Add missing error code handling from IVAS_REND_SetObjectIDs */ #define FIX_1053_REVERB_RECONFIGURATION -#define FIX_1179_USAN_PHASEECU /* Eri: issue 1179: better handling of 16 bit wrap around for very long(>200ms) FER-bursts */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ #define FIX_1113_EXTREND_ISAR /* FhG: issue 1113: fix external renderer asserts for FOA/HOA2 and CLDFB config */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ diff --git a/lib_dec/FEC_HQ_phase_ecu.c b/lib_dec/FEC_HQ_phase_ecu.c index 4470b677c..b8630de3d 100644 --- a/lib_dec/FEC_HQ_phase_ecu.c +++ b/lib_dec/FEC_HQ_phase_ecu.c @@ -2102,21 +2102,10 @@ static void hq_phase_ecu( if ( !prev_bfi || ( prev_bfi && *last_fec && ( *time_offs == output_frame ) ) ) { -#ifdef FIX_1179_USAN_PHASEECU if ( !( prev_bfi && *last_fec && ( element_mode == EVS_MONO ) ) ) { *time_offs = 0; /* IVAS reset of offset time counter, timeoffset variable later also used to calculate burst length */ } -#else - if ( prev_bfi && *last_fec && element_mode == EVS_MONO ) - { - *time_offs += 0; - } - else - { - *time_offs = 0; - } -#endif trans_ana( prevsynth + 2 * output_frame - Lprot - *time_offs + ph_ecu_lookahead, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab, *last_fec, element_mode, alpha, beta, beta_mute, Xavg ); @@ -2125,7 +2114,6 @@ static void hq_phase_ecu( if ( prev_bfi && *last_fec ) { -#ifdef FIX_1179_USAN_PHASEECU if ( element_mode != EVS_MONO ) { *time_offs = (int16_t) ( *time_offs + output_frame ); /* USAN avoid risk of internal int32_t in "+=" */ @@ -2138,26 +2126,15 @@ static void hq_phase_ecu( { *time_offs = (int16_t) ( *time_offs + output_frame ); /* EVS_MONO BE compatible, but EVS CR needed as wrap will cause burst length muting envelope instability issues */ } -#else - *time_offs += output_frame; -#endif } } else { -#ifdef FIX_1179_USAN_PHASEECU *time_offs = (int16_t) ( *time_offs + output_frame ); /* cast added for USAN, "+=" avoided as it may creat a truncation from int to int16_t */ -#else - *time_offs += output_frame; -#endif if ( *time_offs <= 0 ) { /* detect wrap around of st->time_offs */ -#ifdef FIX_1179_USAN_PHASEECU *time_offs = (int16_t) INT16_MAX; /* high value --> continued muting will ensure that the now saturated seed is not creating tones */ -#else - *time_offs = MAX16B; /* continued muting will ensure that the now fixed seeds are not creating tones */ -#endif } trans_ana( prevsynth + 2 * output_frame - Lprot, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab, 0, element_mode, alpha, beta, beta_mute, Xavg ); /* 1.0 stable-music, 0.0 speech-like */ @@ -2169,11 +2146,7 @@ static void hq_phase_ecu( seed = *time_offs; if ( *num_p > 0 ) { -#ifdef FIX_1179_USAN_PHASEECU seed = (int16_t) ( seed + plocs[*num_p - 1] ); /* explicit cast and "+=" not used, as it "+=" may create a cast from 32 bit to 16 bit, triggering USAN */ -#else - seed += plocs[*num_p - 1]; -#endif } subst_spec( plocs, plocsi, num_p, *time_offs, X, mag_chg, ph_dith, old_is_transient, output_frame, &seed, alpha, beta, *beta_mute, Xavg, element_mode, ph_ecu_lookahead, noise_fac ); -- GitLab From 13755cf75af13d5d0093ae53c24fbc6ffde8294a Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:25:03 +0100 Subject: [PATCH 05/17] [cleanup] accept NONBE_FIX_1261_MASA_EXT_META_JBM --- apps/decoder.c | 7 ------- lib_com/options.h | 1 - 2 files changed, 8 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 936a3e4f9..75b8b89e8 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -2109,7 +2109,6 @@ static ivas_error initOnFirstGoodFrame( if ( numInitialBadFrames > 0 ) { /* Duplicate good first frame metadata to fill the beginning of stream. */ -#ifdef NONBE_FIX_1261_MASA_EXT_META_JBM int16_t fullDelayNumSamplesLocal[3]; int32_t delayTimeScaleLocal; float delayMs; @@ -2122,9 +2121,6 @@ static ivas_error initOnFirstGoodFrame( fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); } delayMs = (float) ( fullDelayNumSamplesLocal[0] ) / (float) ( delayTimeScaleLocal ); -#else - IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta = NULL; -#endif if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK ) { @@ -2134,9 +2130,6 @@ static ivas_error initOnFirstGoodFrame( for ( int16_t j = 0; j < numInitialBadFrames; ++j ) { -#ifndef NONBE_FIX_1261_MASA_EXT_META_JBM - float delayMs = (float) ( pFullDelayNumSamples[0] ) / (float) ( *delayTimeScale ); -#endif if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) ); diff --git a/lib_com/options.h b/lib_com/options.h index 25a8f32d8..8722de284 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -166,7 +166,6 @@ #define FIX_1320_STACK_CPE_DECODER /* VA: issue 1320: Optimize the stack memory consumption in the CPE decoder */ #define NONBE_1302_FIX_OMASA_JBM_FLUSH /* VA: issue 1302: fix OMASA JBM bitrate switching flush in binaural output */ #define FIX_1319_STACK_SBA_DECODER /* VA: issue 1319: Optimize the definition of buffer lengths in the SBA decoder */ -#define NONBE_FIX_1261_MASA_EXT_META_JBM /* Nokia: issue #1261: MASA metadata EXT output delay buffer init in JBM */ #define NONBE_FIX_1376_MDCT_CONCEALMENT /* FhG: fix concealment artifact in MDCT Stereo with DTX, in case transition frame gets lost */ #define NONBE_1377_REND_DIRATT_CONF /* Eri: Issue 1377: Error in directivity attenuation configuration for both IVAS_dec and IVAS_rend */ #define FIX_1377_HANDLE_ERROR_CODE /* Eri: Add missing error code handling from IVAS_REND_SetObjectIDs */ -- GitLab From 2eda3ad0b68b202cfa57e7b578853aab0d07cf3b Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:25:05 +0100 Subject: [PATCH 06/17] [cleanup] accept FIX_1217_OBJECT_EDIT_FILE_INTERFACE --- apps/decoder.c | 61 --------------------------------- lib_com/ivas_error.h | 4 --- lib_com/options.h | 1 - lib_dec/ivas_init_dec.c | 2 -- lib_util/obj_edit_file_reader.c | 2 -- lib_util/obj_edit_file_reader.h | 2 -- 6 files changed, 72 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 75b8b89e8..b1d24ac98 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -32,9 +32,7 @@ #include "lib_dec.h" #include -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE #include -#endif #include "cmdl_tools.h" #include "audio_file_writer.h" #include "bitstream_reader.h" @@ -50,9 +48,7 @@ #include "aeid_file_reader.h" #endif #include "split_render_file_read_write.h" -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE #include "obj_edit_file_reader.h" -#endif #ifdef VARIABLE_SPEED_DECODING #include "tsm_scale_file_reader.h" #include @@ -148,9 +144,7 @@ typedef struct bool dpidEnabled; uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS]; bool objEditEnabled; -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE char *objEditFileName; -#endif } DecArguments; @@ -179,24 +173,15 @@ typedef struct static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); -#else -static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); -static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); -#endif static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs ); #ifdef DEBUGGING static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); static int16_t app_own_random( int16_t *seed ); static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec( char *forcedRendModeChar ); #endif -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE static void do_object_editing( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader ); -#else -static void do_object_editing( IVAS_EDITABLE_PARAMETERS *editableParameters ); -#endif /*------------------------------------------------------------------------------------------* @@ -228,9 +213,7 @@ int main( int16_t *pcmBuf = NULL; IVAS_RENDER_FRAMESIZE asked_frame_size; IVAS_DEC_HRTF_BINARY_WRAPPER hHrtfBinary; -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE ObjectEditFileReader *objectEditFileReader = NULL; -#endif #ifdef DEBUGGING int32_t noClipping; int32_t cnt_frames_limited; @@ -434,7 +417,6 @@ int main( } } -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE /*------------------------------------------------------------------------------------------* * Open object editing instruction file *------------------------------------------------------------------------------------------*/ @@ -447,7 +429,6 @@ int main( goto cleanup; } } -#endif /*------------------------------------------------------------------------------------------* * Configure the decoder @@ -780,19 +761,11 @@ int main( if ( arg.voipMode ) { -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, hIvasDec, pcmBuf ); -#else - error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec, pcmBuf ); -#endif } else { -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE error = decodeG192( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, hIvasDec, pcmBuf ); -#else - error = decodeG192( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, &splitRendBits, hIvasDec, pcmBuf ); -#endif } if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE ) @@ -857,9 +830,7 @@ cleanup: RotationFileReader_close( &refRotReader ); Vector3PairFileReader_close( &referenceVectorReader ); RenderConfigReader_close( &renderConfigReader ); -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE ObjectEditFileReader_close( &objectEditFileReader ); -#endif if ( BS_Reader_Close( &hBsReader ) != IVAS_ERR_OK ) { @@ -1062,9 +1033,7 @@ static bool parseCmdlIVAS_dec( } arg->objEditEnabled = false; -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE arg->objEditFileName = NULL; -#endif /*-----------------------------------------------------------------* * Initialization @@ -1598,7 +1567,6 @@ static bool parseCmdlIVAS_dec( { arg->objEditEnabled = true; i++; -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE if ( argc - i <= 3 || argv[i][0] == '-' ) { fprintf( stderr, "Error: Object editing instruction filename not specified!\n\n" ); @@ -1615,7 +1583,6 @@ static bool parseCmdlIVAS_dec( arg->objEditFileName = argv[i]; /* read edit instructions from this file */ } i++; -#endif } /*-----------------------------------------------------------------* @@ -1824,11 +1791,7 @@ static void usage_dec( void ) fprintf( stdout, " ID and duration pairs, where duration is specified in frames\n" ); #endif fprintf( stdout, " for BINAURAL_ROOM_REVERB output configuration.\n" ); -#ifndef FIX_1217_OBJECT_EDIT_FILE_INTERFACE - fprintf( stdout, "-obj_edit : Enable objects editing\n" ); -#else fprintf( stdout, "-obj_edit File : Object editing instructions file or NULL for built-in example\n" ); -#endif fprintf( stdout, "-level level : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" ); fprintf( stdout, " Currently, all values default to level 3 (full functionality).\n" ); fprintf( stdout, "-q : Quiet mode, no frame counter\n" ); @@ -2178,9 +2141,7 @@ static ivas_error decodeG192( RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE ObjectEditFileReader *objectEditFileReader, -#endif ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ) @@ -2589,7 +2550,6 @@ static ivas_error decodeG192( return error; } -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE if ( arg.objEditFileName != NULL ) { if ( ( error = ObjectEditFileReader_readNextFrame( objectEditFileReader ) ) != IVAS_ERR_OK ) @@ -2598,14 +2558,9 @@ static ivas_error decodeG192( return error; } } -#endif /* Do object metadata editing here ... */ -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE do_object_editing( &editableParameters, objectEditFileReader ); -#else - do_object_editing( &editableParameters ); -#endif /* set new object parameters*/ if ( ( error = IVAS_DEC_SetEditableParameters( hIvasDec, editableParameters ) ) != IVAS_ERR_OK ) @@ -3131,9 +3086,7 @@ static ivas_error decodeVoIP( RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE ObjectEditFileReader *objectEditFileReader, -#endif IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ) { @@ -3412,7 +3365,6 @@ static ivas_error decodeVoIP( } } -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE #ifdef NONBE_FIX_1255_OBJ_EDIT_JBM if ( arg.objEditEnabled && arg.objEditFileName != NULL && vec_pos_update == 0 ) #else @@ -3425,7 +3377,6 @@ static ivas_error decodeVoIP( return error; } } -#endif /* read all packets with a receive time smaller than the system time */ while ( nextPacketRcvTime_ms <= systemTime_ms ) @@ -3527,11 +3478,7 @@ static ivas_error decodeVoIP( } /* Do object metadata editing here ... */ -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE do_object_editing( &editableParameters, objectEditFileReader ); -#else - do_object_editing( &editableParameters ); -#endif /* set new object parameters */ if ( ( error = IVAS_DEC_SetEditableParameters( hIvasDec, editableParameters ) ) != IVAS_ERR_OK ) @@ -3853,12 +3800,8 @@ cleanup: *---------------------------------------------------------------------*/ static void do_object_editing( -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader ) -#else - IVAS_EDITABLE_PARAMETERS *editableParameters ) -#endif { /* put the objects equally spaced at the horizontal plane */ /* and play a little bit with the gains... */ @@ -3874,7 +3817,6 @@ static void do_object_editing( } } -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE if ( objectEditFileReader != NULL ) { ReadObjectEditInfo *readInfo; @@ -3933,7 +3875,6 @@ static void do_object_editing( } else { -#endif if ( num_nondiegetic_objects ) { float start_angle, angle_inc; @@ -3957,9 +3898,7 @@ static void do_object_editing( } editableParameters->gain_bed = 0.5f; -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE } -#endif return; diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index 0f47de161..c6d18125e 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -78,9 +78,7 @@ typedef enum IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED, IVAS_ERR_ACOUSTIC_ENVIRONMENT_NOT_SUPPORTED, IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED, -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE IVAS_ERR_OBJECTS_EDITING_AND_PANNING_NOT_SUPPORTED, -#endif IVAS_ERR_INVALID_HRTF, IVAS_ERR_INVALID_HRTF_SAMPLING_RATE, IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA, @@ -264,10 +262,8 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) return "Acoustic environment not supported"; case IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED: return "Objects editing not supported"; -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE case IVAS_ERR_OBJECTS_EDITING_AND_PANNING_NOT_SUPPORTED: return "Wrong use of both Object editing and Non-diegetic panning"; -#endif case IVAS_ERR_INVALID_HRTF: return "Unsupported HRTF filter set"; case IVAS_ERR_INVALID_HRTF_SAMPLING_RATE: diff --git a/lib_com/options.h b/lib_com/options.h index 8722de284..1a73414a4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -197,7 +197,6 @@ #define FIX_HRTF_LOAD_API // solves API conflicts between HRTF and object-editing features #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) #define TMP_FIX_OMASA_SR_BE // temporary fix to keep OMASA split-rendering BE -#define FIX_1217_OBJECT_EDIT_FILE_INTERFACE /* Nokia: issue #1217: add decoder functionality to read object edit instructions from a file */ #define NONBE_1217_OBJ_EDIT_FOA /* VA/Nokia: isse 1217: fix crash in object editing to FOA output in ParamISM */ #define NONBE_FIX_1255_OBJ_EDIT_JBM /* VA: issue 1255: restore object editing in JBM */ #define FIX_1372_OSBA_OBJECT_EDITING /* VA: issue 1372: Fix OSBA object-editing in BINAURAL_ROOM_IR */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 697eaa0c5..d6c20cb4b 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -3243,12 +3243,10 @@ static ivas_error doSanityChecks_IVAS( } } -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE if ( st_ivas->hDecoderConfig->Opt_ObjEdit_on && st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) { return IVAS_ERROR( IVAS_ERR_OBJECTS_EDITING_AND_PANNING_NOT_SUPPORTED, "Wrong set-up: Only object editing or Non-diegetic panning can be used." ); } -#endif #ifdef DEBUGGING if ( ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) && ( ( st_ivas->ivas_format != MC_FORMAT && st_ivas->ivas_format != ISM_FORMAT ) || ( output_config != IVAS_AUDIO_CONFIG_BINAURAL && output_config != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != MC_MODE_MCT ) ) ) { diff --git a/lib_util/obj_edit_file_reader.c b/lib_util/obj_edit_file_reader.c index 62c12bd3f..b00311074 100644 --- a/lib_util/obj_edit_file_reader.c +++ b/lib_util/obj_edit_file_reader.c @@ -36,7 +36,6 @@ the United Nations Convention on Contracts on the International Sales of Goods. #include "prot.h" -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE /*-----------------------------------------------------------------------* * ObjectEditFileReader_open() * @@ -275,4 +274,3 @@ void ObjectEditFileReader_close( return; } -#endif diff --git a/lib_util/obj_edit_file_reader.h b/lib_util/obj_edit_file_reader.h index 2eb6698d6..06b92a74d 100644 --- a/lib_util/obj_edit_file_reader.h +++ b/lib_util/obj_edit_file_reader.h @@ -37,7 +37,6 @@ the United Nations Convention on Contracts on the International Sales of Goods. #include "common_api_types.h" -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE /*---------------------------------------------------------------------* * Constants ans structures *---------------------------------------------------------------------*/ @@ -108,5 +107,4 @@ void ObjectEditFileReader_close( ObjectEditFileReader **objEditReader /* i/o: pointer to ObjectEditFileReader handle */ ); -#endif #endif /* OBJ_EDIT_FILE_READER_H */ -- GitLab From fa8a39a78a4305b74b36f81583c80c7f39fa381c Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:25:08 +0100 Subject: [PATCH 07/17] [cleanup] accept NONBE_1217_OBJ_EDIT_FOA --- lib_com/options.h | 1 - lib_dec/lib_dec.c | 8 -------- 2 files changed, 9 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 1a73414a4..9a98c5a80 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -197,7 +197,6 @@ #define FIX_HRTF_LOAD_API // solves API conflicts between HRTF and object-editing features #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) #define TMP_FIX_OMASA_SR_BE // temporary fix to keep OMASA split-rendering BE -#define NONBE_1217_OBJ_EDIT_FOA /* VA/Nokia: isse 1217: fix crash in object editing to FOA output in ParamISM */ #define NONBE_FIX_1255_OBJ_EDIT_JBM /* VA: issue 1255: restore object editing in JBM */ #define FIX_1372_OSBA_OBJECT_EDITING /* VA: issue 1372: Fix OSBA object-editing in BINAURAL_ROOM_IR */ #define NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT /* Nokia: issue 1305: Fix OMASA ext output in case of object editing */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 941313c5b..c71e8f348 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1655,10 +1655,8 @@ ivas_error IVAS_DEC_SetEditableParameters( st_ivas->hParamIsmDec->edited_azimuth_values[obj] = hIvasEditableParameters.ism_metadata[obj].azimuth; st_ivas->hParamIsmDec->edited_elevation_values[obj] = hIvasEditableParameters.ism_metadata[obj].elevation; -#ifdef NONBE_1217_OBJ_EDIT_FOA if ( st_ivas->hMasaIsmData != NULL ) { -#endif st_ivas->hMasaIsmData->gain_ism_edited[obj] = hIvasEditableParameters.ism_metadata[obj].gain; /* Detect direction editing in Param-ISM mode */ @@ -1681,20 +1679,14 @@ ivas_error IVAS_DEC_SetEditableParameters( { st_ivas->hMasaIsmData->ism_gain_is_edited[obj] = 0u; } -#ifdef NONBE_1217_OBJ_EDIT_FOA } -#endif } -#ifdef NONBE_1217_OBJ_EDIT_FOA if ( st_ivas->hMasaIsmData != NULL ) { -#endif /* MASA is not present with the ISM format */ st_ivas->hMasaIsmData->masa_gain_is_edited = 0u; -#ifdef NONBE_1217_OBJ_EDIT_FOA } -#endif } else if ( ism_mode == ISM_MODE_NONE ) { -- GitLab From 9b4ecff516d30e2d122819286284b71b8bca48cf Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:25:11 +0100 Subject: [PATCH 08/17] [cleanup] accept NONBE_FIX_1255_OBJ_EDIT_JBM --- apps/decoder.c | 15 --------------- lib_com/options.h | 1 - lib_dec/lib_dec.c | 9 --------- 3 files changed, 25 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index b1d24ac98..184294b96 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -3365,11 +3365,7 @@ static ivas_error decodeVoIP( } } -#ifdef NONBE_FIX_1255_OBJ_EDIT_JBM if ( arg.objEditEnabled && arg.objEditFileName != NULL && vec_pos_update == 0 ) -#else - if ( arg.objEditEnabled && ( arg.objEditFileName != NULL ) ) -#endif { if ( ( error = ObjectEditFileReader_readNextFrame( objectEditFileReader ) ) != IVAS_ERR_OK ) { @@ -3612,22 +3608,12 @@ static ivas_error decodeVoIP( } } -#ifdef NONBE_FIX_1255_OBJ_EDIT_JBM vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len; -#else - if ( !arg.quietModeEnabled ) - { - fprintf( stdout, "%-8d\b\b\b\b\b\b\b\b", frame ); - } - vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len; - frame++; -#endif if ( vec_pos_update == 0 ) { systemTime_ms += vec_pos_len * systemTimeInc_ms; } -#ifdef NONBE_FIX_1255_OBJ_EDIT_JBM if ( vec_pos_update == 0 ) { frame++; @@ -3636,7 +3622,6 @@ static ivas_error decodeVoIP( fprintf( stdout, "%-8d\b\b\b\b\b\b\b\b", frame ); } } -#endif #ifdef WMOPS update_mem(); diff --git a/lib_com/options.h b/lib_com/options.h index 9a98c5a80..954628208 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -197,7 +197,6 @@ #define FIX_HRTF_LOAD_API // solves API conflicts between HRTF and object-editing features #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) #define TMP_FIX_OMASA_SR_BE // temporary fix to keep OMASA split-rendering BE -#define NONBE_FIX_1255_OBJ_EDIT_JBM /* VA: issue 1255: restore object editing in JBM */ #define FIX_1372_OSBA_OBJECT_EDITING /* VA: issue 1372: Fix OSBA object-editing in BINAURAL_ROOM_IR */ #define NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT /* Nokia: issue 1305: Fix OMASA ext output in case of object editing */ #define NONBE_FIX_1172_OBJ_EDIT_JBM /* VA: issue 1172: fix OMASA object editing in JBM */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index c71e8f348..9eca3ae84 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -4066,13 +4066,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( hIvasDec->nSamplesRendered = 0; #endif } -#ifndef NONBE_FIX_1255_OBJ_EDIT_JBM - if ( hIvasDec->hasBeenFedFirstGoodFrame ) - { - *parametersAvailableForEditing = true; - return IVAS_ERR_OK; - } -#endif } /* decode */ @@ -4110,10 +4103,8 @@ ivas_error IVAS_DEC_VoIP_GetSamples( hIvasDec->nSamplesFlushed = nSamplesFlushed_ref; #endif *bitstreamReadDone = false; -#ifdef NONBE_FIX_1255_OBJ_EDIT_JBM *parametersAvailableForEditing = true; return IVAS_ERR_OK; -#endif } } -- GitLab From cca64c7512b5cb2d5cb1b5de8115cc5a442aba58 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:25:30 +0100 Subject: [PATCH 09/17] [cleanup] accept LIB_DEC_REVISION --- apps/decoder.c | 44 ---- lib_com/ivas_prot.h | 4 - lib_com/options.h | 1 - lib_dec/ivas_jbm_dec.c | 12 - lib_dec/lib_dec.c | 502 ----------------------------------------- lib_dec/lib_dec.h | 16 -- 6 files changed, 579 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 184294b96..f2ab20ff6 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -438,13 +438,8 @@ int main( uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535; -#ifdef LIB_DEC_REVISION if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain, arg.dpidEnabled, aeID, arg.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain, - arg.dpidEnabled, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; @@ -1060,30 +1055,18 @@ static bool parseCmdlIVAS_dec( if ( strcmp( argv_to_upper, "-VOIP" ) == 0 ) { -#ifdef LIB_DEC_REVISION arg->voipMode = true; -#else - arg->voipMode = 1; -#endif i++; } else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=0" ) == 0 ) { -#ifdef LIB_DEC_REVISION arg->voipMode = true; -#else - arg->voipMode = 1; -#endif arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP; i++; } else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=1" ) == 0 ) { -#ifdef LIB_DEC_REVISION arg->voipMode = true; -#else - arg->voipMode = 1; -#endif arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF; i++; } @@ -1233,10 +1216,8 @@ static bool parseCmdlIVAS_dec( { if ( !is_digits_only( argv[i] ) ) { -#ifdef LIB_DEC_REVISION fprintf( stderr, "Error: Render frame size is invalid or not specified!\n\n" ); usage_dec(); -#endif return false; } @@ -1884,15 +1865,6 @@ static ivas_error initOnFirstGoodFrame( return error; } -#ifndef LIB_DEC_REVISION - int32_t pcmFrameSize; - - if ( ( error = IVAS_DEC_GetPcmFrameSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_GetPcmFrameSize, error code: %d\n", error ); - return error; - } -#endif if ( isSplitRend ) { /* Open split rendering metadata writer */ @@ -1951,7 +1923,6 @@ static ivas_error initOnFirstGoodFrame( } -#ifdef LIB_DEC_REVISION int16_t pcmFrameSize; if ( ( error = IVAS_DEC_GetOutputBufferSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK ) { @@ -1959,15 +1930,12 @@ static ivas_error initOnFirstGoodFrame( return error; } -#endif int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) ); -#ifdef LIB_DEC_REVISION if ( zeroBuf == NULL ) { fprintf( stdout, "Error: Unable to allocate memory for output buffer.\n" ); return IVAS_ERR_FAILED_ALLOC; } -#endif memset( zeroBuf, 0, pcmFrameSize * sizeof( int16_t ) ); for ( int16_t i = 0; i < numInitialBadFrames; ++i ) @@ -2184,7 +2152,6 @@ static ivas_error decodeG192( RenderConfigReader *renderConfigReader = NULL; #ifdef VARIABLE_SPEED_DECODING -#ifdef LIB_DEC_REVISION if ( arg.tsmEnabled ) { if ( ( error = IVAS_DEC_EnableTsm( hIvasDec ) ) != IVAS_ERR_OK ) @@ -2194,7 +2161,6 @@ static ivas_error decodeG192( } } -#endif #endif if ( ( error = IVAS_DEC_is_split_rendering_enabled( hIvasDec, &isSplitRend ) ) != IVAS_ERR_OK ) { @@ -2590,11 +2556,7 @@ static ivas_error decodeG192( } else { -#ifdef LIB_DEC_REVISION if ( ( error = IVAS_DEC_GetSamplesRenderer( hIvasDec, nSamplesToRender, IVAS_DEC_PCM_INT16, (void *) ( pcmBuf + nOutChannels * nSamplesRendered ), &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, IVAS_DEC_PCM_INT16, (void *) ( pcmBuf + nOutChannels * nSamplesRendered ), &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError in IVAS_DEC_GetSamplesRenderer(): %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; @@ -3508,11 +3470,7 @@ static ivas_error decodeVoIP( { if ( ( error = IVAS_DEC_HasDecodedFirstGoodFrame( hIvasDec, &decodedGoodFrame ) ) != IVAS_ERR_OK ) { -#ifdef LIB_DEC_REVISION fprintf( stderr, "Error in IVAS_DEC_HasDecodedFirstGoodFrame(): %s\n", IVAS_DEC_GetErrorMessage( error ) ); -#else - fprintf( stderr, "Error in IVAS_DEC_HasDecodedFirstGoodFrame, code: %d\n", error ); -#endif goto cleanup; } @@ -3524,9 +3482,7 @@ static ivas_error decodeVoIP( if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, NULL, delayNumSamples_orig, &delayNumSamples, &delayTimeScale, &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &splitRendWriter ) ) != IVAS_ERR_OK ) { -#ifdef LIB_DEC_REVISION fprintf( stderr, "Error in initOnFirstGoodFrame(): %s\n", IVAS_DEC_GetErrorMessage( error ) ); -#endif goto cleanup; } } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 8e2b32d4d..57514bac5 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -818,10 +818,6 @@ void ivas_apply_non_diegetic_panning( ivas_error ivas_jbm_dec_tc( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -#ifndef LIB_DEC_REVISION - , - float *data /* o : output synthesis signals */ -#endif ); ivas_error ivas_jbm_dec_render( diff --git a/lib_com/options.h b/lib_com/options.h index 954628208..66c2e34c8 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -185,7 +185,6 @@ #define FIX_1384_MSAN_ivas_spar_dec_open /* VA: issue 1386: fix use-of-uninitialized value in ivas_spar_dec_open() */ #define FIX_1388_MSAN_ivas_init_decoder /* VA: issue 1388: fix use-of-uninitialized value in ivas_init_decoder() */ #define FIX_1288_SPLIT_REND_XSAN /* Dlb: Fix asan, msan and usan issues in split rendering mode*/ -#define LIB_DEC_REVISION /* VA: cleaning and simplification of lib_dec.c */ #define UNIFIED_DECODING_PATHS_LEFTOVERS /* VA: issue 880: remove leftovers after NONBE_UNIFIED_DECODING_PATHS */ #define FIX_NCHAN_BUFFERS /* VA: issue 1322: Correct the number of float buffers (channels) at the decoder */ #define FIX_RENDERER_STACK /* VA: issue 1322: reduction of renderers' buffers size */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index a168da91e..2dc6c20e7 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -68,10 +68,6 @@ static void ivas_jbm_masa_sf_to_slot_map( Decoder_Struct *st_ivas, const int16_t ivas_error ivas_jbm_dec_tc( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -#ifndef LIB_DEC_REVISION - , - float *data /* o : transport channel signals */ -#endif ) { int16_t n, output_frame, nchan_out; @@ -733,15 +729,7 @@ ivas_error ivas_jbm_dec_tc( * Write IVAS transport channels *----------------------------------------------------------------*/ -#ifdef LIB_DEC_REVISION if ( st_ivas->hDecoderConfig->Opt_tsm == 0 ) -#else - if ( st_ivas->hDecoderConfig->Opt_tsm == 1 ) - { - ivas_syn_output_f( p_output, output_frame, st_ivas->hTcBuffer->nchan_transport_jbm, data ); - } - else -#endif { /* directly copy to tc buffers */ ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, output_frame ); diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 9eca3ae84..cd1b96d04 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -55,9 +55,6 @@ struct IVAS_DEC_VOIP { -#ifndef LIB_DEC_REVISION - uint16_t nSamplesFrame; /* Total number of samples in a frame (includes number of channels) */ -#endif JB4_HANDLE hJBM; uint16_t lastDecodedWasActive; JB4_DATAUNIT_HANDLE hCurrentDataUnit; /* Points to the currently processed data unit */ @@ -94,9 +91,6 @@ struct IVAS_DEC bool hasBeenFedFrame; bool updateOrientation; uint16_t nSamplesAvailableNext; -#ifndef LIB_DEC_REVISION - int16_t nSamplesRendered; -#endif int16_t nTransportChannelsOld; int16_t amrwb_rfc4867_flag; /* MIME from rfc4867 is used */ int16_t sdp_hf_only; /* RTP payload format parameter: only Header-Full format without zero padding for size collision avoidance */ @@ -114,32 +108,15 @@ struct IVAS_DEC * Local function declarations *---------------------------------------------------------------------*/ -#ifdef LIB_DEC_REVISION static void ivas_destroy_handle_VoIP( IVAS_DEC_VOIP *hVoIP ); -#else -static void IVAS_DEC_Close_VoIP( IVAS_DEC_VOIP *hVoIP ); -#endif #ifdef SUPPORT_JBM_TRACEFILE static void store_JbmData( IVAS_DEC_VOIP *hVoIP, JB4_DATAUNIT_HANDLE dataUnit, const uint32_t systemTimestamp_ms, const uint16_t extBufferedSamples, const int32_t output_Fs ); #endif -#ifdef LIB_DEC_REVISION static ivas_error evs_dec_main( Decoder_Struct *st_ivas ); -#else -static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSamples, float *floatBuf, int16_t *pcmBuf ); -#endif static ivas_error input_format_API_to_internal( IVAS_DEC_INPUT_FORMAT input_format, int16_t *bitstream_format_internal, int16_t *sdp_hf_only, const bool is_voip_enabled ); static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig ); -#ifdef LIB_DEC_REVISION static ivas_error ivas_dec_setup_all( IVAS_DEC_HANDLE hIvasDec, uint8_t *nTransportChannels, const int16_t isSplitRend, ISAR_SPLIT_REND_BITS_DATA *splitRendBits ); static ivas_error apa_setup( IVAS_DEC_HANDLE hIvasDec, const bool isInitialized_voip, const uint16_t nTransportChannels ); -#else -static ivas_error IVAS_DEC_VoIP_reconfigure( IVAS_DEC_HANDLE hIvasDec, const uint16_t nTransportChannels, const uint16_t l_ts ); -static ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, uint16_t *nTcBufferGranularity, uint8_t *nTransportChannels ); -static ivas_error IVAS_DEC_GetTcSamples( IVAS_DEC_HANDLE hIvasDec, float *pcmBuf, int16_t *nOutSamples ); -static ivas_error IVAS_DEC_RendererFeedTcSamples( IVAS_DEC_HANDLE hIvasDec, const int16_t nSamplesForRendering, int16_t *nSamplesResidual, float *pcmBuf ); -static ivas_error IVAS_DEC_GetRenderedSamples( IVAS_DEC_HANDLE hIvasDec, const uint16_t nSamplesForRendering, uint16_t *nSamplesRendered, uint16_t *nSamplesAvailableNext, const IVAS_DEC_PCM_TYPE pcmType, void *pcmBuf ); -static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( IVAS_DEC_HANDLE hIvasDec, int16_t *nSamplesBuffered ); -#endif static PCM_RESOLUTION pcm_type_API_to_internal( const IVAS_DEC_PCM_TYPE pcmType ); static void *pcm_buffer_offset( void *buffer, const IVAS_DEC_PCM_TYPE pcmType, const int32_t offset ); static ivas_error set_pcm_buffer_to_zero( void *buffer, const IVAS_DEC_PCM_TYPE pcmType, const int16_t nZeroSamples ); @@ -190,9 +167,6 @@ ivas_error IVAS_DEC_Open( hIvasDec->needNewFrame = false; hIvasDec->nTransportChannelsOld = 0; hIvasDec->nSamplesAvailableNext = 0; -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesRendered = 0; -#endif hIvasDec->nSamplesFrame = 0; hIvasDec->hasBeenFedFrame = false; hIvasDec->hasBeenFedFirstGoodFrame = false; @@ -365,11 +339,7 @@ void IVAS_DEC_Close( if ( ( *phIvasDec )->hVoIP ) { -#ifdef LIB_DEC_REVISION ivas_destroy_handle_VoIP( ( *phIvasDec )->hVoIP ); -#else - IVAS_DEC_Close_VoIP( ( *phIvasDec )->hVoIP ); -#endif ( *phIvasDec )->hVoIP = NULL; } @@ -436,7 +406,6 @@ static IVAS_DEC_BS_FORMAT mapIvasFormat( return IVAS_DEC_BS_UNKOWN; } -#ifdef LIB_DEC_REVISION /*---------------------------------------------------------------------* * create_flush_buffer() @@ -460,7 +429,6 @@ static ivas_error create_flush_buffer( return IVAS_ERR_OK; } -#endif /*---------------------------------------------------------------------* * IVAS_DEC_Configure( ) @@ -473,9 +441,6 @@ ivas_error IVAS_DEC_Configure( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const uint32_t sampleRate, /* i : output sampling frequency */ const IVAS_AUDIO_CONFIG outputConfig, /* i : output configuration */ -#ifndef LIB_DEC_REVISION - const bool tsmEnabled, /* i : enable time scale modification */ -#endif const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */ const bool customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const bool hrtfReaderEnabled, /* i : enable HRTF binary file input */ @@ -534,9 +499,6 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->nchan_out = audioCfg2channels( hDecoderConfig->output_config ); } -#ifndef LIB_DEC_REVISION - hDecoderConfig->Opt_tsm = (int16_t) tsmEnabled; -#endif hDecoderConfig->Opt_LsCustom = (int16_t) customLsOutputEnabled; hDecoderConfig->Opt_Headrotation = (int16_t) enableHeadRotation; hDecoderConfig->orientation_tracking = orientation_tracking; @@ -584,21 +546,6 @@ ivas_error IVAS_DEC_Configure( } hIvasDec->nSamplesFrame = (uint16_t) ( hDecoderConfig->output_Fs / FRAMES_PER_SEC ); -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesAvailableNext = 0; - hIvasDec->nSamplesRendered = 0; - hIvasDec->tsm_scale = 100; - hIvasDec->tsm_max_scaling = 0; - hIvasDec->tsm_quality = 1.0f; - - /* init flush buffer if necessary (only needed for binaural)*/ - if ( tsmEnabled && ( outputConfig == IVAS_AUDIO_CONFIG_BINAURAL || outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM || outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) - { - hIvasDec->flushbuffer = (void *) malloc( CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( int16_t ) ); - hIvasDec->pcmType = IVAS_DEC_PCM_INT16; - set_s( (int16_t *) hIvasDec->flushbuffer, 0, CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ); - } -#endif return IVAS_ERR_OK; } @@ -830,9 +777,6 @@ ivas_error IVAS_DEC_EnableVoIP( hIvasDec->hVoIP->lastDecodedWasActive = 0; hIvasDec->hVoIP->hCurrentDataUnit = NULL; -#ifndef LIB_DEC_REVISION - hIvasDec->hVoIP->nSamplesFrame = (uint16_t) ( hDecoderConfig->output_Fs / FRAMES_PER_SEC ); -#endif hIvasDec->hVoIP->nSamplesRendered20ms = 0; #define WMC_TOOL_SKIP @@ -863,22 +807,12 @@ ivas_error IVAS_DEC_EnableVoIP( } #endif -#ifdef LIB_DEC_REVISION /* init flush buffer (needed for binaural outputs) */ if ( ( error = create_flush_buffer( hIvasDec ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in create_flush_buffer , code: %d\n", error ); return error; } -#else - /* init flush buffer if necessary (only needed for binaural)*/ - if ( hIvasDec->flushbuffer == NULL && ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) - { - hIvasDec->flushbuffer = (void *) malloc( CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( int16_t ) ); - hIvasDec->pcmType = IVAS_DEC_PCM_INT16; - set_s( (int16_t *) hIvasDec->flushbuffer, 0, CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ); - } -#endif return IVAS_ERR_OK; } @@ -983,9 +917,6 @@ ivas_error IVAS_DEC_FeedFrame_Serial( hIvasDec->needNewFrame = false; hIvasDec->hasBeenFedFrame = true; -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesRendered = 0; -#endif hIvasDec->nSamplesAvailableNext = hIvasDec->nSamplesFrame; return IVAS_ERR_OK; @@ -1225,12 +1156,10 @@ ivas_error IVAS_DEC_GetSamplesDecoder( { ivas_error error; Decoder_Struct *st_ivas; -#ifdef LIB_DEC_REVISION uint16_t nTimeScalerOutSamples; uint8_t nTransportChannels; int16_t nResidualSamples, nSamplesTcsScaled; bool isInitialized_voip; -#endif if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { @@ -1245,13 +1174,10 @@ ivas_error IVAS_DEC_GetSamplesDecoder( #endif st_ivas = hIvasDec->st_ivas; -#ifdef LIB_DEC_REVISION isInitialized_voip = hIvasDec->apaExecBuffer != NULL; -#endif if ( !hIvasDec->isInitialized || hIvasDec->hasBeenFedFrame ) /* wait for the first good frame */ { -#ifdef LIB_DEC_REVISION /*-----------------------------------------------------------------* * Setup all decoder parts (IVAS decoder, ISAR) *-----------------------------------------------------------------*/ @@ -1260,34 +1186,7 @@ ivas_error IVAS_DEC_GetSamplesDecoder( { return error; } -#else - uint16_t l_ts, nTimeScalerOutSamples; - uint8_t nTransportChannels; - int16_t nResidualSamples, nSamplesTcsScaled, nOutSamplesElse; - - if ( isSplitRend ) - { - if ( ( error = isar_set_split_rend_setup( hIvasDec->st_ivas->hSplitBinRend, &hIvasDec->st_ivas->hRenderConfig->split_rend_config, hIvasDec->st_ivas->hCombinedOrientationData, splitRendBits ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels ) ) != IVAS_ERR_OK ) - { - return error; - } - if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm && nTransportChannels != hIvasDec->nTransportChannelsOld ) - { - if ( ( error = IVAS_DEC_VoIP_reconfigure( hIvasDec, nTransportChannels, l_ts ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif - -#ifdef LIB_DEC_REVISION /*-----------------------------------------------------------------* * IVAS decoder: decode transport channels and metadata *-----------------------------------------------------------------*/ @@ -1313,13 +1212,6 @@ ivas_error IVAS_DEC_GetSamplesDecoder( { hIvasDec->hasDecodedFirstGoodFrame = true; } -#else - /* IVAS TC decoder */ - if ( ( error = IVAS_DEC_GetTcSamples( hIvasDec, hIvasDec->apaExecBuffer, &nOutSamplesElse ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif /*-----------------------------------------------------------------* * JBM @@ -1327,7 +1219,6 @@ ivas_error IVAS_DEC_GetSamplesDecoder( if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) { -#ifdef LIB_DEC_REVISION if ( nTransportChannels != hIvasDec->nTransportChannelsOld ) { if ( ( error = apa_setup( hIvasDec, isInitialized_voip, nTransportChannels ) ) != IVAS_ERR_OK ) @@ -1336,16 +1227,13 @@ ivas_error IVAS_DEC_GetSamplesDecoder( } } -#endif if ( apa_set_scale( hIvasDec->hTimeScaler, hIvasDec->tsm_scale ) != 0 ) { return IVAS_ERR_UNKNOWN; } -#ifdef LIB_DEC_REVISION ivas_syn_output_f( hIvasDec->st_ivas->p_output_f, hIvasDec->nSamplesFrame, nTransportChannels, hIvasDec->apaExecBuffer ); -#endif if ( apa_exec( hIvasDec->hTimeScaler, hIvasDec->apaExecBuffer, hIvasDec->nSamplesFrame * nTransportChannels, (uint16_t) hIvasDec->tsm_max_scaling, hIvasDec->apaExecBuffer, &nTimeScalerOutSamples ) != 0 ) { @@ -1365,14 +1253,7 @@ ivas_error IVAS_DEC_GetSamplesDecoder( * Feed decoded transport channels samples to the renderer *-----------------------------------------------------------------*/ -#ifdef LIB_DEC_REVISION ivas_jbm_dec_feed_tc_to_renderer( st_ivas, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer ); -#else - if ( ( error = IVAS_DEC_RendererFeedTcSamples( hIvasDec, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) { @@ -1869,11 +1750,7 @@ ivas_error IVAS_DEC_PrepareRenderer( * Main function to render the decoded data to output data *---------------------------------------------------------------------*/ -#ifdef LIB_DEC_REVISION ivas_error IVAS_DEC_GetSamplesRenderer( -#else -ivas_error IVAS_DEC_GetSamples( -#endif IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesAsked, /* i : number of samples wanted by the caller */ const IVAS_DEC_PCM_TYPE pcmType, /* i : type for the decoded PCM resolution */ @@ -1883,9 +1760,6 @@ ivas_error IVAS_DEC_GetSamples( ) { ivas_error error; -#ifndef LIB_DEC_REVISION - int16_t nSamplesToRender; -#endif uint16_t nSamplesRendered, nSamplesRendered_loop; uint8_t nOutChannels; Decoder_Struct *st_ivas; @@ -1961,42 +1835,23 @@ ivas_error IVAS_DEC_GetSamples( } else { -#ifndef LIB_DEC_REVISION - { -/* check if we need to run the setup function, tc decoding and feeding the renderer */ -#endif nOutChannels = (uint8_t) hIvasDec->st_ivas->hDecoderConfig->nchan_out; hIvasDec->hasBeenFedFrame = false; /* check for possible flushed samples from a rate switch */ if ( hIvasDec->nSamplesFlushed > 0 ) { -#ifndef LIB_DEC_REVISION - void *pPcmBuffer; -#endif #ifdef DEBUGGING assert( hIvasDec->pcmType == pcmType ); #endif -#ifdef LIB_DEC_REVISION /* note: offset (rendered samples) is always 0 */ -#else - pPcmBuffer = pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ); -#endif if ( pcmType == IVAS_DEC_PCM_INT16 ) { -#ifdef LIB_DEC_REVISION mvs2s( (int16_t *) hIvasDec->flushbuffer, pcmBuf, hIvasDec->nSamplesFlushed * nOutChannels ); -#else - mvs2s( (int16_t *) hIvasDec->flushbuffer, pPcmBuffer, hIvasDec->nSamplesFlushed * nOutChannels ); -#endif } else if ( pcmType == IVAS_DEC_PCM_FLOAT ) { -#ifdef LIB_DEC_REVISION mvr2r( (float *) hIvasDec->flushbuffer, pcmBuf, hIvasDec->nSamplesFlushed * nOutChannels ); -#else - mvr2r( (float *) hIvasDec->flushbuffer, pPcmBuffer, hIvasDec->nSamplesFlushed * nOutChannels ); -#endif } #ifdef DEBUGGING else @@ -2004,21 +1859,12 @@ ivas_error IVAS_DEC_GetSamples( assert( 0 && "wrong PCM type for the flush buffer!" ); } #endif -#ifdef LIB_DEC_REVISION nSamplesRendered = hIvasDec->nSamplesFlushed; -#else - nSamplesRendered += hIvasDec->nSamplesFlushed; -#endif hIvasDec->nSamplesFlushed = 0; } /* render IVAS frames directly to the output buffer */ -#ifdef LIB_DEC_REVISION if ( ( error = ivas_jbm_dec_render( st_ivas, nSamplesAsked - nSamplesRendered, &nSamplesRendered_loop, &hIvasDec->nSamplesAvailableNext, pcm_type_API_to_internal( pcmType ), pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ) ) ) != IVAS_ERR_OK ) -#else - nSamplesToRender = nSamplesAsked - nSamplesRendered; - if ( ( error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesRendered_loop, &hIvasDec->nSamplesAvailableNext, pcmType, pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ) ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2035,9 +1881,6 @@ ivas_error IVAS_DEC_GetSamples( { *needNewFrame = false; } -#endif -#ifndef LIB_DEC_REVISION - } #endif } @@ -2148,11 +1991,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( } /* Decode and render */ -#ifdef LIB_DEC_REVISION if ( ( error = IVAS_DEC_GetSamplesRenderer( hIvasDec, numSamplesPerChannelToDecode, IVAS_DEC_PCM_FLOAT, pcmBuf, nOutSamples, needNewFrame ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_GetSamples( hIvasDec, numSamplesPerChannelToDecode, IVAS_DEC_PCM_FLOAT, pcmBuf, nOutSamples, needNewFrame ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2269,7 +2108,6 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( } -#ifdef LIB_DEC_REVISION /*---------------------------------------------------------------------* * ivas_dec_setup_all() * @@ -2282,19 +2120,6 @@ static ivas_error ivas_dec_setup_all( const int16_t isSplitRend, /* i : split rendering enabled flag */ ISAR_SPLIT_REND_BITS_DATA *splitRendBits /* o : output split rendering bits */ ) -#else -/*---------------------------------------------------------------------* - * IVAS_DEC_Setup( ) - * - * - *---------------------------------------------------------------------*/ - -static ivas_error IVAS_DEC_Setup( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - uint16_t *nTcBufferGranularity, /* o : granularity of the TC Buffer */ - uint8_t *nTransportChannels /* o : number of decoded transport PCM channels */ -) -#endif { ivas_error error; @@ -2315,7 +2140,6 @@ static ivas_error IVAS_DEC_Setup( st_ivas = hIvasDec->st_ivas; -#ifdef LIB_DEC_REVISION /* Setup IVAS split rendering */ if ( isSplitRend ) { @@ -2325,7 +2149,6 @@ static ivas_error IVAS_DEC_Setup( } } -#endif /*----------------------------------------------------------------* * IVAS decoder setup * - read IVAS format signaling @@ -2343,9 +2166,6 @@ static ivas_error IVAS_DEC_Setup( } *nTransportChannels = (uint8_t) st_ivas->hTcBuffer->nchan_transport_jbm; -#ifndef LIB_DEC_REVISION - *nTcBufferGranularity = (uint16_t) st_ivas->hTcBuffer->n_samples_granularity; -#endif /*-----------------------------------------------------------------* * ISAR: @@ -2353,11 +2173,7 @@ static ivas_error IVAS_DEC_Setup( * - reconfigure the ISAR handle in case of bitrate switching (renderer might change) *-----------------------------------------------------------------*/ -#ifdef LIB_DEC_REVISION if ( st_ivas->ini_frame == 0 && isSplitRend ) -#else - if ( st_ivas->ini_frame == 0 && ( is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig ) ) ) -#endif { if ( ( error = ivas_dec_init_split_rend( st_ivas ) ) != IVAS_ERR_OK ) { @@ -2377,181 +2193,6 @@ static ivas_error IVAS_DEC_Setup( return IVAS_ERR_OK; } -#ifndef LIB_DEC_REVISION -/*---------------------------------------------------------------------* - * IVAS_DEC_GetTcSamples( ) - * - * Main function to decode to PCM data of the transport channels - *---------------------------------------------------------------------*/ - -static ivas_error IVAS_DEC_GetTcSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - float *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ - int16_t *nOutSamples /* o : number of samples per channel written to output buffer */ -) -{ - Decoder_Struct *st_ivas; - ivas_error error; - - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - st_ivas = hIvasDec->st_ivas; - - *nOutSamples = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); - - if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) - { - if ( ( error = evs_dec_main( st_ivas, *nOutSamples, pcmBuf, NULL ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( hIvasDec->mode == IVAS_DEC_MODE_IVAS ) - { - /* run the main IVAS decoding routine */ - if ( ( error = ivas_jbm_dec_tc( st_ivas, pcmBuf ) ) != IVAS_ERR_OK ) - { - return error; - } - - hIvasDec->isInitialized = true; /* Initialization done in ivas_dec() */ - } - - if ( hIvasDec->hasBeenFedFirstGoodFrame ) - { - hIvasDec->hasDecodedFirstGoodFrame = true; - } - - return IVAS_ERR_OK; -} - - -/*---------------------------------------------------------------------* - * IVAS_DEC_Rendered_FeedTcSamples( ) - * - * Feed decoded transport channels samples to the renderer - *---------------------------------------------------------------------*/ - -static ivas_error IVAS_DEC_RendererFeedTcSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const int16_t nSamplesForRendering, /* i : number of TC samples wanted from the renderer */ - int16_t *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call */ - float *pcmBuf /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ -) -{ - Decoder_Struct *st_ivas; - - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - st_ivas = hIvasDec->st_ivas; - - /* feed the TCs to the IVAS renderer */ - ivas_jbm_dec_feed_tc_to_renderer( st_ivas, nSamplesForRendering, nSamplesResidual, pcmBuf ); - - return IVAS_ERR_OK; -} - - -/*---------------------------------------------------------------------* - * IVAS_DEC_GetRenderedSamples( ) - * - * Main function to render the transport channels to PCM output data - *---------------------------------------------------------------------*/ - -static ivas_error IVAS_DEC_GetRenderedSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const uint16_t nSamplesForRendering, /* i : number of TC samples wanted from the renderer */ - uint16_t *nSamplesRendered, /* o : number of samples rendered */ - uint16_t *nSamplesAvailableNext, /* o : number of samples still available in the renerer pipeline */ - const IVAS_DEC_PCM_TYPE pcmType, - void *pcmBuf ) -{ - Decoder_Struct *st_ivas; - ivas_error error; - - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - st_ivas = hIvasDec->st_ivas; - - /* temp code to make HRTF changes working in the old API structure */ - uint16_t nSamplesRendered_loop; - uint8_t nOutChannels; - - nSamplesRendered_loop = 0; - nOutChannels = (uint8_t) st_ivas->hDecoderConfig->nchan_out; - - hIvasDec->hasBeenFedFrame = false; - - /* check for possible flushed samples from a rate switch */ - if ( hIvasDec->nSamplesFlushed > 0 ) - { -#ifdef DEBUGGING - assert( hIvasDec->pcmType == pcmType ); -#endif - /* note: offset (rendered samples) is always 0 */ - if ( pcmType == IVAS_DEC_PCM_INT16 ) - { - mvs2s( (int16_t *) hIvasDec->flushbuffer, pcmBuf, hIvasDec->nSamplesFlushed * nOutChannels ); - } - else if ( pcmType == IVAS_DEC_PCM_FLOAT ) - { - mvr2r( (float *) hIvasDec->flushbuffer, pcmBuf, hIvasDec->nSamplesFlushed * nOutChannels ); - } -#ifdef DEBUGGING - else - { - assert( 0 && "wrong PCM type for the flush buffer!" ); - } -#endif - *nSamplesRendered = hIvasDec->nSamplesFlushed; - hIvasDec->nSamplesFlushed = 0; - } - - /* run the main IVAS decoding routine */ - error = ivas_jbm_dec_render( st_ivas, nSamplesForRendering - *nSamplesRendered, &nSamplesRendered_loop, nSamplesAvailableNext, pcm_type_API_to_internal( pcmType ), pcm_buffer_offset( pcmBuf, pcmType, *nSamplesRendered * nOutChannels ) ); - - *nSamplesRendered += nSamplesRendered_loop; - - return error; -} - - -/*---------------------------------------------------------------------* - * IVAS_DEC_GetBufferedNumberOfSamples( ) - * - * Returns the number of objects available in the decoded bitstream - *---------------------------------------------------------------------*/ - -static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - int16_t *nSamplesBuffered /* o : number of samples still buffered */ -) -{ - *nSamplesBuffered = 0; - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - /* check if the TC buffer already exists, otherweise nothing is buffered anyway */ - if ( hIvasDec->st_ivas->hTcBuffer != NULL ) - { - *nSamplesBuffered = hIvasDec->st_ivas->hTcBuffer->n_samples_buffered - hIvasDec->st_ivas->hTcBuffer->n_samples_rendered; - *nSamplesBuffered += hIvasDec->hVoIP->nSamplesRendered20ms; - } - - return IVAS_ERR_OK; -} -#endif /*---------------------------------------------------------------------* * IVAS_DEC_GetNumObjects( ) @@ -3594,35 +3235,6 @@ ivas_error IVAS_DEC_HasDecodedFirstGoodFrame( return IVAS_ERR_OK; } -#ifndef LIB_DEC_REVISION -/*---------------------------------------------------------------------* - * IVAS_DEC_GetPcmFrameSize( ) - * - * - *---------------------------------------------------------------------*/ - -ivas_error IVAS_DEC_GetPcmFrameSize( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - int32_t *pcmFrameSize /* o : total size of the PCM output frame. This takes into account the number of output channels */ -) -{ - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || pcmFrameSize == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - if ( hIvasDec->hasDecodedFirstGoodFrame ) - { - *pcmFrameSize = hIvasDec->st_ivas->hDecoderConfig->nchan_out * hIvasDec->st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC; - } - else - { - *pcmFrameSize = 0; - } - - return IVAS_ERR_OK; -} -#endif /*---------------------------------------------------------------------* * isSidFrame( ) @@ -3804,7 +3416,6 @@ ivas_error IVAS_DEC_VoIP_SetScale( } #ifdef VARIABLE_SPEED_DECODING -#ifdef LIB_DEC_REVISION /*---------------------------------------------------------------------* * IVAS_DEC_EnableTsm( ) @@ -3839,7 +3450,6 @@ ivas_error IVAS_DEC_EnableTsm( return IVAS_ERR_OK; } -#endif /*---------------------------------------------------------------------* * IVAS_DEC_TSM_SetQuality( ) @@ -3943,19 +3553,12 @@ ivas_error IVAS_DEC_VoIP_GetSamples( nSamplesBuffered = 0; if ( hIvasDec->hasBeenFedFirstGoodFrame ) { -#ifdef LIB_DEC_REVISION /* check if the TC buffer already exists, otherweise nothing is buffered anyway */ if ( st_ivas->hTcBuffer != NULL ) { nSamplesBuffered = st_ivas->hTcBuffer->n_samples_buffered - st_ivas->hTcBuffer->n_samples_rendered; nSamplesBuffered += hVoIP->nSamplesRendered20ms; } -#else - if ( ( error = IVAS_DEC_GetBufferedNumberOfSamples( hIvasDec, &nSamplesBuffered ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } extBufferedSamples = nSamplesBuffered; @@ -4062,9 +3665,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( if ( !hIvasDec->hasBeenFedFirstGoodFrame ) { hIvasDec->nSamplesAvailableNext = hIvasDec->nSamplesFrame; -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesRendered = 0; -#endif } } @@ -4076,9 +3676,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( int16_t nSamplesToZero = min( nSamplesPerChannel, hIvasDec->nSamplesAvailableNext ); set_pcm_buffer_to_zero( pcm_buffer_offset( pcmBuf, pcmType, *nSamplesRendered * nOutChannels ), pcmType, nSamplesToZero * nOutChannels ); *nSamplesRendered += nSamplesToZero; -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesRendered += nSamplesToZero; -#endif hIvasDec->nSamplesAvailableNext -= nSamplesToZero; update_voip_rendered20ms( hIvasDec, nSamplesToZero ); } @@ -4092,16 +3689,10 @@ ivas_error IVAS_DEC_VoIP_GetSamples( { if ( hIvasDec->nSamplesAvailableNext == 0 || hIvasDec->nSamplesAvailableNext == hIvasDec->nSamplesFrame ) { -#ifndef LIB_DEC_REVISION - uint16_t nSamplesFlushed_ref = hIvasDec->nSamplesFlushed; -#endif if ( ( error = IVAS_DEC_GetSamplesDecoder( hIvasDec, 0, 0 ) ) != IVAS_ERR_OK ) { return error; } -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesFlushed = nSamplesFlushed_ref; -#endif *bitstreamReadDone = false; *parametersAvailableForEditing = true; return IVAS_ERR_OK; @@ -4121,11 +3712,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples( } /* render IVAS frames directly to the output buffer */ -#ifdef LIB_DEC_REVISION if ( ( error = IVAS_DEC_GetSamplesRenderer( hIvasDec, nSamplesToRender, pcmType, pcm_buffer_offset( pcmBuf, pcmType, *nSamplesRendered * nOutChannels ), &nSamplesRendered_loop, &tmp ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, pcmType, pcm_buffer_offset( pcmBuf, pcmType, *nSamplesRendered * nOutChannels ), &nSamplesRendered_loop, &tmp ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -4153,20 +3740,12 @@ static void update_voip_rendered20ms( nSamplesRenderedTotal = hIvasDec->hVoIP->nSamplesRendered20ms + nSamplesRendered; /* we have crossed a 20ms border, reset the time scaling done flag */ -#ifdef LIB_DEC_REVISION if ( nSamplesRenderedTotal >= hIvasDec->nSamplesFrame ) -#else - if ( nSamplesRenderedTotal >= hIvasDec->hVoIP->nSamplesFrame ) -#endif { hIvasDec->timeScalingDone = 0; } -#ifdef LIB_DEC_REVISION hIvasDec->hVoIP->nSamplesRendered20ms = nSamplesRenderedTotal % hIvasDec->nSamplesFrame; -#else - hIvasDec->hVoIP->nSamplesRendered20ms = nSamplesRenderedTotal % hIvasDec->hVoIP->nSamplesFrame; -#endif return; } @@ -4204,11 +3783,7 @@ ivas_error IVAS_DEC_Flush( error = IVAS_ERR_OK; if ( nSamplesToRender > 0 && hIvasDec->st_ivas->ivas_format != MONO_FORMAT ) { -#ifdef LIB_DEC_REVISION error = ivas_jbm_dec_render( hIvasDec->st_ivas, nSamplesToRender, &nSamplesFlushedLocal, &hIvasDec->nSamplesAvailableNext, pcm_type_API_to_internal( pcmType ), pcmBuf ); -#else - error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesFlushedLocal, &hIvasDec->nSamplesAvailableNext, pcmType, pcmBuf ); -#endif } else { @@ -4267,11 +3842,7 @@ ivas_error IVAS_DEC_VoIP_Get_CA_offset( * *---------------------------------------------------------------------*/ -#ifdef LIB_DEC_REVISION static void ivas_destroy_handle_VoIP( -#else -static void IVAS_DEC_Close_VoIP( -#endif IVAS_DEC_VOIP *hVoIP /* i/o: IVAS decoder handle */ ) { @@ -4665,31 +4236,18 @@ void IVAS_DEC_PrintDisclaimer( void ) *---------------------------------------------------------------------*/ static ivas_error evs_dec_main( -#ifdef LIB_DEC_REVISION Decoder_Struct *st_ivas /* i : IVAS decoder structure */ -#else - Decoder_Struct *st_ivas, - const int16_t nOutSamples, - float *floatBuf, - int16_t *pcmBuf -#endif ) { DEC_CORE_HANDLE *hCoreCoder; float mixer_left, mixer_rigth; float *p_output[MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN]; -#ifdef LIB_DEC_REVISION int16_t ch, nOutSamples; -#else - int16_t ch; -#endif ivas_error error; hCoreCoder = st_ivas->hSCE[0]->hCoreCoder; hCoreCoder[0]->total_brate = st_ivas->hDecoderConfig->ivas_total_brate; -#ifdef LIB_DEC_REVISION nOutSamples = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); -#endif mdct_switching_dec( hCoreCoder[0] ); @@ -4751,7 +4309,6 @@ static ivas_error evs_dec_main( v_multc( p_output[0], mixer_left, p_output[0], nOutSamples ); } -#ifdef LIB_DEC_REVISION if ( st_ivas->hDecoderConfig->Opt_tsm ) { /* BE workaround: in order to keep EVS bit-exact wrt. TS 26.443, convert 'float' output data to 'short' before the TSM */ @@ -4773,31 +4330,6 @@ static ivas_error evs_dec_main( ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, nOutSamples ); } #endif -#else - if ( !st_ivas->hDecoderConfig->Opt_tsm ) - { - ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, nOutSamples ); - } - else if ( floatBuf != NULL ) - { - /* BE workaround */ - int16_t pcm_buf_local[L_FRAME48k * MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN]; - - /* convert 'float' output data to 'short' */ -#ifdef DEBUGGING - st_ivas->noClipping += -#endif - ivas_syn_output( p_output, nOutSamples, st_ivas->hDecoderConfig->nchan_out, pcm_buf_local ); - mvs2r( pcm_buf_local, floatBuf, nOutSamples * st_ivas->hDecoderConfig->nchan_out ); - } - else - { -#ifdef DEBUGGING - st_ivas->noClipping += -#endif - ivas_syn_output( p_output, nOutSamples, st_ivas->hDecoderConfig->nchan_out, pcmBuf ); - } -#endif return IVAS_ERR_OK; } @@ -4996,7 +4528,6 @@ static ivas_error input_format_API_to_internal( return IVAS_ERR_OK; } -#ifdef LIB_DEC_REVISION /*---------------------------------------------------------------------* * apa_setup() * @@ -5007,38 +4538,16 @@ static ivas_error apa_setup( IVAS_DEC_HANDLE hIvasDec, const bool isInitialized_voip, const uint16_t nTransportChannels ) -#else -/*---------------------------------------------------------------------* - * IVAS_DEC_VoIP_reconfigure() - * - * - *---------------------------------------------------------------------*/ - -static ivas_error IVAS_DEC_VoIP_reconfigure( - IVAS_DEC_HANDLE hIvasDec, - const uint16_t nTransportChannels, - const uint16_t l_ts ) -#endif { int16_t apa_buffer_size; -#ifdef LIB_DEC_REVISION uint16_t l_ts; l_ts = (uint16_t) hIvasDec->st_ivas->hTcBuffer->n_samples_granularity; if ( !isInitialized_voip ) -#else - apa_buffer_size = hIvasDec->nSamplesFrame; - - if ( hIvasDec->apaExecBuffer == NULL ) -#endif { DECODER_CONFIG_HANDLE hDecoderConfig; -#ifndef LIB_DEC_REVISION - if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) - { -#endif uint16_t wss, css; float startQuality; @@ -5096,16 +4605,9 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( } set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); -#ifndef LIB_DEC_REVISION - } -#endif } else { -#ifndef LIB_DEC_REVISION - if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) - { -#endif if ( apa_reconfigure( hIvasDec->hTimeScaler, nTransportChannels, l_ts ) != 0 ) { return IVAS_ERR_INIT_ERROR; @@ -5117,10 +4619,6 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); } set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); -#ifndef LIB_DEC_REVISION - } - /* realloc apa_exe_buffer */ -#endif } hIvasDec->nTransportChannelsOld = nTransportChannels; diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 8a45d8670..677405b52 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -121,9 +121,6 @@ ivas_error IVAS_DEC_Configure( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const uint32_t sampleRate, /* i : output sampling frequency */ const IVAS_AUDIO_CONFIG outputConfig, /* i : output configuration */ -#ifndef LIB_DEC_REVISION - const bool tsmEnabled, /* i : enable time scale modification */ -#endif const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */ const bool customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const bool hrtfReaderEnabled, /* i : enable HRTF binary file input */ @@ -168,11 +165,7 @@ ivas_error IVAS_DEC_GetSamplesDecoder( ); /*! r: decoder error code */ -#ifdef LIB_DEC_REVISION ivas_error IVAS_DEC_GetSamplesRenderer( -#else -ivas_error IVAS_DEC_GetSamples( -#endif IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesAsked, /* i : number of samples wanted by the caller */ const IVAS_DEC_PCM_TYPE pcmType, /* i : type for the decoded PCM resolution */ @@ -298,12 +291,10 @@ ivas_error IVAS_DEC_VoIP_SetScale( ); #ifdef VARIABLE_SPEED_DECODING -#ifdef LIB_DEC_REVISION ivas_error IVAS_DEC_EnableTsm( IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */ ); -#endif #endif ivas_error IVAS_DEC_TSM_SetQuality( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ @@ -506,13 +497,6 @@ ivas_error IVAS_DEC_HasDecodedFirstGoodFrame( bool *hasDecodedFirstGoodFrame /* o : flag indicating if the decoder has decoded a good frame since it was configured */ ); -#ifndef LIB_DEC_REVISION -/*! r: error code */ -ivas_error IVAS_DEC_GetPcmFrameSize( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - int32_t *pcmFrameSize /* o : total size of the PCM output frame. This takes into account the number of output channels */ -); -#endif /*! r: true if decoder has no data in VoIP jitter buffer */ bool IVAS_DEC_VoIP_IsEmpty( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ -- GitLab From 93f9a3112c4e3cb9b624438029c83ae351df1871 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:25:33 +0100 Subject: [PATCH 10/17] [cleanup] accept NONBE_1293_CRASH_FIRST_FRAME_LOST --- apps/isar_post_rend.c | 18 ------------- lib_com/options.h | 1 - lib_dec/lib_dec.c | 36 ------------------------- lib_isar/lib_isar_post_rend.c | 2 -- lib_util/split_render_file_read_write.c | 10 ------- lib_util/split_render_file_read_write.h | 8 ------ 6 files changed, 75 deletions(-) diff --git a/apps/isar_post_rend.c b/apps/isar_post_rend.c index f7b3e479f..e6c78bfed 100644 --- a/apps/isar_post_rend.c +++ b/apps/isar_post_rend.c @@ -953,9 +953,7 @@ int main( while ( 1 ) { -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST int16_t bfi = 0; -#endif int16_t num_in_channels; num_in_channels = inBuffer.config.numChannels; @@ -964,11 +962,7 @@ int main( { ivas_error error_tmp; numSamplesRead = (int16_t) inBufferSize; -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten, &bfi ); -#else - error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten ); -#endif if ( error_tmp != IVAS_ERR_OK ) { if ( error_tmp == IVAS_ERR_END_OF_FILE ) @@ -1035,23 +1029,12 @@ int main( /* Read from split renderer bfi file if specified */ if ( splitRendBFIReader != NULL && splitBinNeedsNewFrame ) { -#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST - int16_t bfi; -#endif if ( ( error = SplitRendBFIFileReading( splitRendBFIReader, &bfi ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in SplitRendBFIFileReading(): %s\n", ivas_error_to_string( error ) ); goto cleanup; } -#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST - if ( ( error = ISAR_POST_REND_SetSplitRendBFI( hIsarPostRend, bfi ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in ISAR_POST_REND_SetSplitRendBFI(): %s\n", ivas_error_to_string( error ) ); - goto cleanup; - } -#endif } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( splitBinNeedsNewFrame ) { if ( ( error = ISAR_POST_REND_SetSplitRendBFI( hIsarPostRend, bfi ) ) != IVAS_ERR_OK ) @@ -1060,7 +1043,6 @@ int main( goto cleanup; } } -#endif for ( i = 0; i < args.inConfig.numBinBuses; ++i ) { diff --git a/lib_com/options.h b/lib_com/options.h index 66c2e34c8..1ad76038b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -179,7 +179,6 @@ #define FIX_1387_INIT_PRM_SQQ /* FhG: initialize pointer prm_sqQ, which might be uninitialized in case of bfi == 1 */ #define FIX_1349_TNS_CRASH /* FhG: Fix crash in TNS entropy coding, in case order of joint TNS coding is reduced to 0 */ #define NONBE_1300_TDREND_LARGE_ITD /* Eri: issue 1300: There was a bug feeding 1.25 ms frames to the TD renderer, causing out-of-buffer access. This was resolved. However, it is still possible that modeled HRTF with large ITDs could trigger out-of-buffer access. This adds a check to prevent this.*/ -#define NONBE_1293_CRASH_FIRST_FRAME_LOST /* VA: issue 1293: fix G.192 decoder crash when first frame is lost */ #define FIX_1384_MSAN_stereo_tcx_core_enc /* VA: issue 1384: fix use-of-uninitialized value in stereo_tcx_core_enc() */ #define NONBE_1303_REND_GRANULARITY /* VA: issue 1303: Renderer granularity revision */ #define FIX_1384_MSAN_ivas_spar_dec_open /* VA: issue 1386: fix use-of-uninitialized value in ivas_spar_dec_open() */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index cd1b96d04..0bfa07f48 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1166,12 +1166,10 @@ ivas_error IVAS_DEC_GetSamplesDecoder( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( !hIvasDec->hasBeenFedFirstGoodFrame && !hIvasDec->isInitialized ) /* note: 'isInitialized' is related to EVS decoder */ { return IVAS_ERR_OK; } -#endif st_ivas = hIvasDec->st_ivas; isInitialized_voip = hIvasDec->apaExecBuffer != NULL; @@ -1337,14 +1335,12 @@ ivas_error IVAS_DEC_GetEditableParameters( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( !hIvasDec->hasBeenFedFirstGoodFrame ) { hIvasEditableParameters->num_obj = 0; return IVAS_ERR_OK; } -#endif st_ivas = hIvasDec->st_ivas; ism_mode = st_ivas->ism_mode; @@ -1485,12 +1481,10 @@ ivas_error IVAS_DEC_SetEditableParameters( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( !hIvasDec->hasBeenFedFirstGoodFrame ) { return IVAS_ERR_OK; } -#endif st_ivas = hIvasDec->st_ivas; ism_mode = st_ivas->ism_mode; @@ -1731,9 +1725,7 @@ ivas_error IVAS_DEC_PrepareRenderer( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( hIvasDec->hasBeenFedFirstGoodFrame || hIvasDec->isInitialized ) /* note: 'isInitialized' is related to EVS decoder */ -#endif { ivas_dec_prepare_renderer( hIvasDec->st_ivas ); } @@ -1818,20 +1810,8 @@ ivas_error IVAS_DEC_GetSamplesRenderer( { hIvasDec->hasBeenFedFrame = false; set_s( pcmBuf, 0, hIvasDec->st_ivas->hDecoderConfig->nchan_out * nSamplesAsked ); -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST nSamplesRendered = nSamplesAsked; -#else - hIvasDec->nSamplesRendered += nSamplesAsked; - *nOutSamples = nSamplesAsked; -#endif hIvasDec->nSamplesAvailableNext -= nSamplesAsked; -#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST - if ( hIvasDec->nSamplesAvailableNext == 0 ) - { - hIvasDec->needNewFrame = true; - *needNewFrame = true; - } -#endif } else { @@ -1870,21 +1850,8 @@ ivas_error IVAS_DEC_GetSamplesRenderer( } nSamplesRendered += nSamplesRendered_loop; -#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST - nSamplesToRender -= nSamplesRendered_loop; - if ( hIvasDec->nSamplesAvailableNext == 0 ) - { - *needNewFrame = true; - hIvasDec->needNewFrame = true; - } - else - { - *needNewFrame = false; - } -#endif } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( hIvasDec->nSamplesAvailableNext == 0 ) { *needNewFrame = true; @@ -1894,7 +1861,6 @@ ivas_error IVAS_DEC_GetSamplesRenderer( { *needNewFrame = false; } -#endif *nOutSamples = nSamplesRendered; @@ -1996,12 +1962,10 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( return error; } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( !hIvasDec->hasBeenFedFirstGoodFrame ) { return IVAS_ERR_OK; } -#endif /* change buffer layout */ for ( i = 0; i < numSamplesPerChannelToDecode; ++i ) diff --git a/lib_isar/lib_isar_post_rend.c b/lib_isar/lib_isar_post_rend.c index 711be967d..0170c2b52 100644 --- a/lib_isar/lib_isar_post_rend.c +++ b/lib_isar/lib_isar_post_rend.c @@ -1541,7 +1541,6 @@ static ivas_error renderSplitBinauralWithPostRot( } else { -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( splitBinInput->numCachedSamples == 0 ) { numSamplesPerChannelCacheSize = (int16_t) ( *splitBinInput->base.ctx.pOutSampleRate * bits.isar_frame_size_ms / 1000 ) - outAudio.config.numSamplesPerChannel; @@ -1551,7 +1550,6 @@ static ivas_error renderSplitBinauralWithPostRot( { splitBinInput->numCachedSamples -= outAudio.config.numSamplesPerChannel; } -#endif if ( splitBinInput->base.inConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c index 17070a630..cc8e3c4a4 100644 --- a/lib_util/split_render_file_read_write.c +++ b/lib_util/split_render_file_read_write.c @@ -323,20 +323,12 @@ ivas_error split_rend_write_bitstream_to_file( * *-----------------------------------------------------------------------------------------*/ -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written, int16_t *bfi ) -#else -ivas_error split_rend_read_bits_from_file( - SplitFileReadWrite *hSplitRendFileReadWrite, - uint8_t *bits, - int32_t *bits_read, - int32_t *bits_written ) -#endif { char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "SPLIT_FRAME"; char header_read[SPLIT_RENDERER_FRAME_HEADER_LEN]; @@ -400,13 +392,11 @@ ivas_error split_rend_read_bits_from_file( *bits_read = 0; *bits_written = bit_len; -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST *bfi = 0; if ( bit_len == 0 ) { *bfi = 1; } -#endif return IVAS_ERR_OK; } diff --git a/lib_util/split_render_file_read_write.h b/lib_util/split_render_file_read_write.h index 294d2efa1..0ea113e89 100644 --- a/lib_util/split_render_file_read_write.h +++ b/lib_util/split_render_file_read_write.h @@ -75,20 +75,12 @@ ivas_error split_rend_write_bitstream_to_file( int32_t *bits_written ); /* read split rend coded bits from file */ -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written, int16_t *bfi ); -#else -ivas_error split_rend_read_bits_from_file( - SplitFileReadWrite *hSplitRendFileReadWrite, - uint8_t *bits, - int32_t *bits_read, - int32_t *bits_written ); -#endif /* read split pre rend delay */ ivas_error split_rend_read_pre_rend_delay_ns( -- GitLab From 968fd04e875852c257f7bc9fa87e8e7aaaa50e6c Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:25:36 +0100 Subject: [PATCH 11/17] [cleanup] accept NONBE_1303_REND_GRANULARITY --- lib_com/ivas_prot.h | 7 ---- lib_com/options.h | 1 - lib_dec/ivas_init_dec.c | 39 ------------------- lib_dec/ivas_ism_dec.c | 4 -- lib_dec/ivas_ism_param_dec.c | 14 ------- lib_dec/ivas_jbm_dec.c | 29 -------------- lib_dec/ivas_masa_dec.c | 13 ------- lib_dec/ivas_mc_param_dec.c | 6 --- lib_dec/ivas_mc_paramupmix_dec.c | 6 --- lib_dec/ivas_mct_dec.c | 4 -- lib_dec/ivas_objectRenderer_internal.c | 6 --- lib_dec/ivas_sba_dec.c | 41 -------------------- lib_dec/ivas_spar_decoder.c | 7 ---- lib_dec/lib_dec.c | 27 ------------- lib_rend/ivas_dirac_dec_binaural_functions.c | 10 ----- 15 files changed, 214 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 57514bac5..68ed4ce99 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -903,16 +903,9 @@ 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 1ad76038b..e28a80cbf 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -180,7 +180,6 @@ #define FIX_1349_TNS_CRASH /* FhG: Fix crash in TNS entropy coding, in case order of joint TNS coding is reduced to 0 */ #define NONBE_1300_TDREND_LARGE_ITD /* Eri: issue 1300: There was a bug feeding 1.25 ms frames to the TD renderer, causing out-of-buffer access. This was resolved. However, it is still possible that modeled HRTF with large ITDs could trigger out-of-buffer access. This adds a check to prevent this.*/ #define FIX_1384_MSAN_stereo_tcx_core_enc /* VA: issue 1384: fix use-of-uninitialized value in stereo_tcx_core_enc() */ -#define NONBE_1303_REND_GRANULARITY /* VA: issue 1303: Renderer granularity revision */ #define FIX_1384_MSAN_ivas_spar_dec_open /* VA: issue 1386: fix use-of-uninitialized value in ivas_spar_dec_open() */ #define FIX_1388_MSAN_ivas_init_decoder /* VA: issue 1388: fix use-of-uninitialized value in ivas_init_decoder() */ #define FIX_1288_SPLIT_REND_XSAN /* Dlb: Fix asan, msan and usan issues in split rendering mode*/ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index d6c20cb4b..9bc6c9715 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2132,15 +2132,6 @@ ivas_error ivas_init_decoder( return error; } } -#ifndef NONBE_1303_REND_GRANULARITY - granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); - 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 ) { @@ -2173,30 +2164,6 @@ ivas_error ivas_init_decoder( } st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; -#ifndef NONBE_1303_REND_GRANULARITY - if ( ( st_ivas->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) - { - granularity = NS2SA( output_Fs, CLDFB_SLOT_NS ); - - 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, MC_PARAMUPMIX_MAX_INPUT_CHANS, MC_PARAMUPMIX_MAX_INPUT_CHANS, granularity ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); - - 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 } if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) @@ -2398,16 +2365,10 @@ 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_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 ) -#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 cf77aae01..076acddec 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -124,11 +124,7 @@ 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 7aa086c94..b7b868a70 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -412,11 +412,7 @@ 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; @@ -552,9 +548,7 @@ 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 ) { @@ -594,11 +588,7 @@ 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; } @@ -611,11 +601,7 @@ 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 2dc6c20e7..e1e59def3 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -2266,7 +2266,6 @@ 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 */ @@ -2290,34 +2289,6 @@ int16_t ivas_jbm_dec_get_render_granularity( 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 */ - const int32_t output_Fs /* i : sampling rate */ -) -{ - int16_t render_granularity; - - if ( rendererType == RENDERER_BINAURAL_OBJECTS_TD || rendererType == RENDERER_BINAURAL_MIXER_CONV || rendererType == RENDERER_BINAURAL_MIXER_CONV_ROOM ) - { - if ( ( ivas_format == MC_FORMAT ) && ( mc_mode == MC_MODE_PARAMUPMIX ) ) - { - render_granularity = NS2SA( output_Fs, CLDFB_SLOT_NS ); - } - else - { - render_granularity = NS2SA( output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); - } - } - else - { - render_granularity = NS2SA( output_Fs, CLDFB_SLOT_NS ); - } - - return render_granularity; -} -#endif /*--------------------------------------------------------------------------* diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 636739017..92e61c2f6 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -696,9 +696,7 @@ 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; @@ -730,13 +728,9 @@ ivas_error ivas_masa_dec_open( nchan_to_allocate++; } -#ifdef NONBE_1303_REND_GRANULARITY 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; } @@ -1489,11 +1483,7 @@ 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 ); @@ -1519,9 +1509,6 @@ 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 b91dddb1d..fa0816cb2 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -437,9 +437,7 @@ 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 ) @@ -460,13 +458,9 @@ ivas_error ivas_param_mc_dec_open( if ( st_ivas->hTcBuffer == NULL ) { -#ifdef NONBE_1303_REND_GRANULARITY 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 2c4aebdcf..8ef994fb4 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -375,9 +375,7 @@ 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; @@ -395,13 +393,9 @@ ivas_error ivas_mc_paramupmix_dec_open( nchan_to_allocate = MC_PARAMUPMIX_MAX_INPUT_CHANS; } -#ifdef NONBE_1303_REND_GRANULARITY 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 a9cbed3a9..0094316b5 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -792,11 +792,7 @@ 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_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index 73b6ecd8c..ea04206fd 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -61,13 +61,7 @@ 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/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index a2e58a826..8b5e446f1 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -163,49 +163,8 @@ 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; - - sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); - - /* get new renderer type */ - /* copy the logic from ivas_renderer_select(), because calling this function has too many side effects that would affect the flushing */ - if ( ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) <= 2 ) - { - if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) - { - renderer_type_new = RENDERER_BINAURAL_PARAMETRIC; - } - else - { - renderer_type_new = RENDERER_BINAURAL_PARAMETRIC_ROOM; - } - } - else - { - if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) - { - renderer_type_new = RENDERER_BINAURAL_FASTCONV; - } - else - { - renderer_type_new = RENDERER_BINAURAL_FASTCONV_ROOM; - } - } -#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 ); -#else - granularity_new = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); - - /* this will change anyway only with binaural */ - if ( renderer_type_new == RENDERER_BINAURAL_FASTCONV && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) - { - 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 e5ce8503f..260ea208d 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -228,9 +228,6 @@ 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 ) ) @@ -258,13 +255,9 @@ ivas_error ivas_spar_dec_open( granularity = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ); } -#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 ( ( 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 0bfa07f48..e805939a1 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -987,11 +987,7 @@ 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, renderer_type_sec_new; -#endif if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { @@ -1006,9 +1002,7 @@ 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; @@ -1085,7 +1079,6 @@ ivas_error IVAS_DEC_ReadFormat( } } -#ifdef NONBE_1303_REND_GRANULARITY /* 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 ) || @@ -1109,26 +1102,6 @@ ivas_error IVAS_DEC_ReadFormat( } } } -#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 ) || - ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ism_mode != ISM_SBA_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 } st_ivas->ism_mode = ism_mode_old; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 83a8f6bb4..9d556dcca 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -150,11 +150,9 @@ 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++ ) { @@ -340,15 +338,7 @@ 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 ed092f2c58010bbfef3575b0f3160e09749bb848 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:25:38 +0100 Subject: [PATCH 12/17] [cleanup] accept NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT --- lib_com/ivas_prot.h | 2 -- lib_com/options.h | 1 - lib_dec/ivas_jbm_dec.c | 4 ---- lib_dec/ivas_objectRenderer_internal.c | 8 -------- lib_dec/ivas_omasa_dec.c | 2 -- lib_dec/lib_dec.c | 6 ------ 6 files changed, 23 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 68ed4ce99..a46024701 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5800,14 +5800,12 @@ void ivas_omasa_render_objects_from_mix( const int16_t output_frame /* i : output frame length per channel */ ); -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT void ivas_omasa_gain_masa_tc( float *output[], /* i/o : output synthesis signal */ const float gainMasa, /* i : gain for MASA transport channels */ const int16_t nchan_transport_ism, /* i : number of ISM TCs */ const int16_t output_frame /* i : output frame length per channel */ ); -#endif void ivas_omasa_dirac_rend_jbm( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ diff --git a/lib_com/options.h b/lib_com/options.h index e28a80cbf..294a6fafe 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -195,7 +195,6 @@ #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) #define TMP_FIX_OMASA_SR_BE // temporary fix to keep OMASA split-rendering BE #define FIX_1372_OSBA_OBJECT_EDITING /* VA: issue 1372: Fix OSBA object-editing in BINAURAL_ROOM_IR */ -#define NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT /* Nokia: issue 1305: Fix OMASA ext output in case of object editing */ #define NONBE_FIX_1172_OBJ_EDIT_JBM /* VA: issue 1172: fix OMASA object editing in JBM */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index e1e59def3..a951e6cac 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -3038,13 +3038,11 @@ void ivas_dec_prepare_renderer( { ivas_jbm_masa_sf_to_slot_map( st_ivas, n_render_timeslots ); } -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT /* MASA transport gaining for edited disc OMASA EXT. For ISMs, only metadata is modified */ if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->hMasaIsmData->masa_gain_is_edited == 1 ) { ivas_omasa_gain_masa_tc( st_ivas->hTcBuffer->tc, st_ivas->hMasaIsmData->gain_masa_edited, st_ivas->nchan_ism, st_ivas->hTcBuffer->n_samples_available ); } -#endif } else if ( st_ivas->ivas_format == STEREO_FORMAT ) { @@ -3120,7 +3118,6 @@ void ivas_dec_prepare_renderer( { ivas_jbm_masa_sf_to_slot_map( st_ivas, n_render_timeslots ); } -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT /* MASA transport gaining for edited param_one OMASA EXT. For ISMs, only metadata is modified. */ if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->hMasaIsmData->masa_gain_is_edited == 1 ) { @@ -3129,7 +3126,6 @@ void ivas_dec_prepare_renderer( v_multc( st_ivas->hTcBuffer->tc[n], st_ivas->hMasaIsmData->gain_masa_edited, st_ivas->hTcBuffer->tc[n], st_ivas->hTcBuffer->n_samples_available ); } } -#endif } else { diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index ea04206fd..530974416 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -178,11 +178,7 @@ ivas_error ivas_td_binaural_renderer_sf( } if ( subframe_idx == ism_md_subframe_update_jbm ) { -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT if ( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) -#else - if ( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) -#endif { ISM_METADATA_FRAME ismMetaData[MAX_NUM_OBJECTS]; ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS]; @@ -194,7 +190,6 @@ ivas_error ivas_td_binaural_renderer_sf( ismMetaData[nS].yaw = st_ivas->hIsmMetaData[nS]->edited_yaw; ismMetaData[nS].pitch = st_ivas->hIsmMetaData[nS]->edited_pitch; ismMetaData[nS].non_diegetic_flag = st_ivas->hIsmMetaData[nS]->non_diegetic_flag; -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { /* DISC OMASA ISM gaining with TDREND is done in ivas_dec_prepare_renderer()*/ @@ -204,9 +199,6 @@ ivas_error ivas_td_binaural_renderer_sf( { ismMetaData[nS].gain = st_ivas->hIsmMetaData[nS]->edited_gain; } -#else - ismMetaData[nS].gain = st_ivas->hIsmMetaData[nS]->edited_gain; -#endif hIsmMetaData[nS] = &ismMetaData[nS]; } diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 43f102d12..e65708926 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -1318,7 +1318,6 @@ void ivas_omasa_render_objects_from_mix( return; } -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT /*--------------------------------------------------------------------------* * ivas_omasa_gain_masa_tc() * @@ -1341,4 +1340,3 @@ void ivas_omasa_gain_masa_tc( return; } -#endif diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index e805939a1..ca90838f3 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1650,13 +1650,11 @@ ivas_error IVAS_DEC_SetEditableParameters( /* Copy edited values to hIsmMetaData struct */ if ( st_ivas->hIsmMetaData[obj] != NULL ) { -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT st_ivas->hIsmMetaData[obj]->edited_azimuth = hIvasEditableParameters.ism_metadata[obj].azimuth; st_ivas->hIsmMetaData[obj]->edited_elevation = hIvasEditableParameters.ism_metadata[obj].elevation; st_ivas->hIsmMetaData[obj]->edited_yaw = hIvasEditableParameters.ism_metadata[obj].yaw; st_ivas->hIsmMetaData[obj]->edited_pitch = hIvasEditableParameters.ism_metadata[obj].pitch; st_ivas->hIsmMetaData[obj]->edited_radius = hIvasEditableParameters.ism_metadata[obj].radius; -#endif #ifndef NONBE_FIX_1172_OBJ_EDIT_JBM st_ivas->hIsmMetaData[obj]->azimuth = hIvasEditableParameters.ism_metadata[obj].azimuth; st_ivas->hIsmMetaData[obj]->elevation = hIvasEditableParameters.ism_metadata[obj].elevation; @@ -2378,11 +2376,7 @@ ivas_error IVAS_DEC_GetObjectMetadata( metadata->gainFactor = 1.f; metadata->non_diegetic_flag = hIsmMeta->non_diegetic_flag; } -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#else - else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) -#endif { metadata->azimuth = st_ivas->hIsmMetaData[objectIdx]->edited_azimuth; metadata->elevation = st_ivas->hIsmMetaData[objectIdx]->edited_elevation; -- GitLab From 3cf9196f1f7baa6b17a3eb03d80c7364672d6e18 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:25:41 +0100 Subject: [PATCH 13/17] [cleanup] accept UNIFIED_DECODING_PATHS_LEFTOVERS --- lib_com/ivas_cnst.h | 4 - lib_com/ivas_prot.h | 15 -- lib_com/options.h | 1 - lib_dec/ivas_ism_param_dec.c | 54 ----- lib_dec/ivas_jbm_dec.c | 282 -------------------------- lib_dec/ivas_mc_param_dec.c | 34 ---- lib_dec/ivas_sba_rendering_internal.c | 4 - lib_dec/lib_dec.c | 6 - 8 files changed, 400 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index d0a2de5f3..847d0b920 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -175,11 +175,7 @@ typedef enum #define MAX_JBM_L_FRAME48k 1920 #define MAX_JBM_L_FRAME_NS 40000000L #define MAX_SPAR_INTERNAL_CHANNELS IVAS_SPAR_MAX_CH -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS #define MAX_CLDFB_DIGEST_CHANNELS 3 /* == maximum of ParamISM TCs and ParamMC TCs */ -#else -#define MAX_CLDFB_DIGEST_CHANNELS (FOA_CHANNELS + MAX_NUM_OBJECTS) -#endif typedef enum { diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index a46024701..50ddd1101 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -882,13 +882,6 @@ int16_t ivas_jbm_dec_get_num_tc_channels( Decoder_Struct *st_ivas /* i : IVAS decoder handle */ ); -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS -void ivas_jbm_dec_copy_tc_no_tsm( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float *tc[], /* i : transport channels */ - const int16_t output_frame /* i : output frame size */ -); -#endif void ivas_jbm_dec_get_md_map_even_spacing( const int16_t len, /* i : length of the modfied frames in metadata slots */ const int16_t subframe_len, /* i : default length of a subframe */ @@ -1142,14 +1135,6 @@ void ivas_param_ism_dec_prepare_renderer( const uint16_t nCldfbSlots /* i : number of CLDFB slots in transport channels */ ); -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS -void ivas_ism_param_dec_tc_gain_ajust( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint16_t nSamples, /* i : number of samples to be compensate */ - const uint16_t nFadeLength, /* i : length of the crossfade in samples */ - float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ -); -#endif void ivas_param_ism_dec_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ diff --git a/lib_com/options.h b/lib_com/options.h index 294a6fafe..6494cf5f0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -183,7 +183,6 @@ #define FIX_1384_MSAN_ivas_spar_dec_open /* VA: issue 1386: fix use-of-uninitialized value in ivas_spar_dec_open() */ #define FIX_1388_MSAN_ivas_init_decoder /* VA: issue 1388: fix use-of-uninitialized value in ivas_init_decoder() */ #define FIX_1288_SPLIT_REND_XSAN /* Dlb: Fix asan, msan and usan issues in split rendering mode*/ -#define UNIFIED_DECODING_PATHS_LEFTOVERS /* VA: issue 880: remove leftovers after NONBE_UNIFIED_DECODING_PATHS */ #define FIX_NCHAN_BUFFERS /* VA: issue 1322: Correct the number of float buffers (channels) at the decoder */ #define FIX_RENDERER_STACK /* VA: issue 1322: reduction of renderers' buffers size */ #define FIX_1370_EXTERNAL_ORIENTATION_CHECK /* Nokia: add sanity check for Euler angles for external orientations */ diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index b7b868a70..5f3fee794 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -45,14 +45,12 @@ #include "wmc_auto.h" -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS /*-----------------------------------------------------------------------* * Local function declarations *-----------------------------------------------------------------------*/ static void ivas_ism_param_dec_tc_gain_adjust( Decoder_Struct *st_ivas, const int16_t nSamples, const int16_t nFadeLength, float *p_data_f[] ); -#endif /*-----------------------------------------------------------------------* * Local function definitions @@ -805,49 +803,20 @@ void ivas_param_ism_dec_digest_tc( float *p_data_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ) { -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS int16_t ch, slot_idx, output_frame; int16_t num_freq_bands, cldfb_ch, n_ch_cldfb; float *cldfb_real_buffer, *cldfb_imag_buffer; -#else - int16_t ch, nchan_transport; - int16_t slot_idx; - int16_t output_frame; - PARAM_ISM_DEC_HANDLE hParamIsmDec; - SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; - int16_t fade_len; -#endif /* Initialization */ -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS num_freq_bands = st_ivas->hSpatParamRendCom->num_freq_bands; output_frame = nCldfbSlots * num_freq_bands; n_ch_cldfb = st_ivas->hTcBuffer->nchan_transport_jbm - st_ivas->hTcBuffer->nchan_buffer_full; cldfb_real_buffer = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc; cldfb_imag_buffer = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc; -#else - hParamIsmDec = st_ivas->hParamIsmDec; - assert( hParamIsmDec ); - hSpatParamRendCom = st_ivas->hSpatParamRendCom; - assert( hSpatParamRendCom ); - output_frame = nCldfbSlots * hSpatParamRendCom->num_freq_bands; - fade_len = output_frame / 2; - - nchan_transport = st_ivas->nchan_transport; -#endif -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS ivas_ism_param_dec_tc_gain_adjust( st_ivas, output_frame, output_frame / 2, p_data_f ); -#else - if ( st_ivas->hDecoderConfig->Opt_tsm ) - { - /*TODO : FhG to check*/ - ivas_ism_param_dec_tc_gain_ajust( st_ivas, output_frame, fade_len, p_data_f ); - } -#endif -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS /* CLDFB Analysis */ for ( ch = 0, cldfb_ch = 0; cldfb_ch < n_ch_cldfb; cldfb_ch++, ch++ ) { @@ -859,25 +828,6 @@ void ivas_param_ism_dec_digest_tc( num_freq_bands, st_ivas->cldfbAnaDec[cldfb_ch] ); } } -#else - for ( ch = 0; ch < nchan_transport; ch++ ) - { - /* CLDFB Analysis */ - for ( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ ) - { - if ( st_ivas->hDecoderConfig->Opt_tsm ) - { - - float RealBuffer[CLDFB_NO_CHANNELS_MAX]; - float ImagBuffer[CLDFB_NO_CHANNELS_MAX]; - - cldfbAnalysis_ts( &( p_data_f[ch][hSpatParamRendCom->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hSpatParamRendCom->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); - mvr2r( RealBuffer, &hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc[slot_idx * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands], hSpatParamRendCom->num_freq_bands ); - mvr2r( ImagBuffer, &hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc[slot_idx * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands], hSpatParamRendCom->num_freq_bands ); - } - } - } -#endif return; } @@ -1039,11 +989,7 @@ void ivas_param_ism_dec_prepare_renderer( * *-------------------------------------------------------------------------*/ -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS static void ivas_ism_param_dec_tc_gain_adjust( -#else -void ivas_ism_param_dec_tc_gain_ajust( -#endif Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const int16_t nSamples, /* i : number of samples to be compensate */ const int16_t nFadeLength, /* i : length of the crossfade in samples */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index a951e6cac..0d1aee270 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -50,9 +50,6 @@ * Local function prototypes *-----------------------------------------------------------------------*/ -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS -static void ivas_jbm_dec_copy_tc( Decoder_Struct *st_ivas, const int16_t nSamplesForRendering, int16_t *nSamplesResidual, float *data, float *tc_digest_f[] ); -#endif static void ivas_jbm_dec_tc_buffer_playout( Decoder_Struct *st_ivas, const uint16_t nSamplesAsked, uint16_t *nSamplesRendered, float *output[] ); static void ivas_jbm_dec_copy_masa_meta_to_buffer( Decoder_Struct *st_ivas ); @@ -208,12 +205,6 @@ ivas_error ivas_jbm_dec_tc( { return error; } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->hDecoderConfig->Opt_tsm ) - { - ivas_jbm_dec_copy_masa_meta_to_buffer( st_ivas ); - } -#endif } else if ( st_ivas->ivas_format == SBA_FORMAT ) { @@ -408,12 +399,6 @@ ivas_error ivas_jbm_dec_tc( /* Extract objects from MASA, output MASA + all objects (i.e., extracted and separated objects) */ ivas_omasa_render_objects_from_mix( st_ivas, p_output, st_ivas->nchan_ism, output_frame ); } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - if ( st_ivas->hDecoderConfig->Opt_tsm ) - { - ivas_jbm_dec_copy_masa_meta_to_buffer( st_ivas ); - } -#endif } } else if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) @@ -724,17 +709,6 @@ ivas_error ivas_jbm_dec_tc( } } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - /*----------------------------------------------------------------* - * Write IVAS transport channels - *----------------------------------------------------------------*/ - - if ( st_ivas->hDecoderConfig->Opt_tsm == 0 ) - { - /* directly copy to tc buffers */ - ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, output_frame ); - } -#endif /*----------------------------------------------------------------* * Common updates *----------------------------------------------------------------*/ @@ -771,7 +745,6 @@ ivas_error ivas_jbm_dec_tc( } -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS /*--------------------------------------------------------------------------* * ivas_dec_feed_tc_to_renderer() @@ -880,73 +853,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( return; } -#else - -/*--------------------------------------------------------------------------* - * ivas_jbm_dec_feed_tc_to_renderer() - * - * Feed decoded transport channels and metadata to the IVAS JBM renderer routine - *--------------------------------------------------------------------------*/ - -void ivas_jbm_dec_feed_tc_to_renderer( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t nSamplesForRendering, /* i : number of TC samples available for rendering */ - int16_t *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ - float *data /* i : transport channels */ -) -{ - float data_f[MAX_CLDFB_DIGEST_CHANNELS][MAX_JBM_L_FRAME48k]; /* 'float' buffer for transport channels that will be directly converted with the CLDFB */ - float *p_data_f[MAX_CLDFB_DIGEST_CHANNELS]; - int16_t n, n_render_timeslots; - - push_wmops( "ivas_jbm_dec_feed_tc_to_renderer" ); - for ( n = 0; n < MAX_CLDFB_DIGEST_CHANNELS; n++ ) - { - p_data_f[n] = &data_f[n][0]; - } - - if ( !st_ivas->hDecoderConfig->Opt_tsm ) - { - for ( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) - { - st_ivas->hTcBuffer->tc[n] = st_ivas->p_output_f[n]; /* note: buffers needed in the TD decorellator */ - } - } - - if ( st_ivas->hDecoderConfig->Opt_tsm ) - { - ivas_jbm_dec_copy_tc( st_ivas, nSamplesForRendering, nSamplesResidual, data, p_data_f ); - } - else - { - *nSamplesResidual = 0; - } - n_render_timeslots = st_ivas->hTcBuffer->n_samples_available / st_ivas->hTcBuffer->n_samples_granularity; - - if ( st_ivas->ivas_format == ISM_FORMAT ) - { - /* Rendering */ - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) - { - if ( st_ivas->renderer_type == RENDERER_PARAM_ISM || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) - { - ivas_param_ism_dec_digest_tc( st_ivas, n_render_timeslots, p_data_f ); - } - } - } - else if ( st_ivas->ivas_format == MC_FORMAT ) - { - if ( st_ivas->mc_mode == MC_MODE_PARAMMC && st_ivas->hTcBuffer->tc_buffer_mode == TC_BUFFER_MODE_RENDERER ) - { - ivas_param_mc_dec_digest_tc( st_ivas, (uint8_t) n_render_timeslots, p_data_f ); - } - } - - pop_wmops(); - return; -} - -#endif /*--------------------------------------------------------------------------* * ivas_dec_render() @@ -972,9 +878,6 @@ ivas_error ivas_jbm_dec_render( ivas_error error; float *p_output[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; float *p_tc[MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS]; -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; -#endif int16_t nchan_out_syn_output; push_wmops( "ivas_dec_render" ); @@ -982,9 +885,6 @@ ivas_error ivas_jbm_dec_render( * Initialization of local vars after struct has been set *----------------------------------------------------------------*/ -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - hSpatParamRendCom = st_ivas->hSpatParamRendCom; -#endif output_Fs = st_ivas->hDecoderConfig->output_Fs; nchan_out = st_ivas->hDecoderConfig->nchan_out; nchan_transport = st_ivas->hTcBuffer->nchan_transport_jbm; @@ -998,29 +898,15 @@ ivas_error ivas_jbm_dec_render( if ( !st_ivas->hDecoderConfig->Opt_tsm ) { -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) - { - - p_tc[n] = &p_output[n][st_ivas->hTcBuffer->n_samples_rendered]; - } -#endif for ( n = 0; n < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; n++ ) { st_ivas->hTcBuffer->tc[n] = p_output[n]; } } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - else - { -#endif for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) { p_tc[n] = &st_ivas->hTcBuffer->tc[n][st_ivas->hTcBuffer->n_samples_rendered]; } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - } -#endif /*----------------------------------------------------------------* * Update combined orientation access index @@ -1097,11 +983,7 @@ ivas_error ivas_jbm_dec_render( #endif { /* Convert to Ambisonics */ -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS ivas_ism2sba_sf( p_tc, p_output, st_ivas->hIsmRendererData, st_ivas->nchan_transport, *nSamplesRendered, st_ivas->hTcBuffer->n_samples_rendered, st_ivas->hIntSetup.ambisonics_order ); -#else - ivas_ism2sba_sf( st_ivas->hTcBuffer->tc, p_output, st_ivas->hIsmRendererData, st_ivas->nchan_transport, *nSamplesRendered, st_ivas->hTcBuffer->n_samples_rendered, st_ivas->hIntSetup.ambisonics_order ); -#endif } /* Binaural rendering */ @@ -1233,11 +1115,7 @@ ivas_error ivas_jbm_dec_render( for ( n = 0; n < st_ivas->nchan_ism; n++ ) { -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS mvr2r( p_tc[n], p_output[n], *nSamplesRendered ); -#else - mvr2r( st_ivas->hTcBuffer->tc[n] + st_ivas->hTcBuffer->n_samples_rendered, p_output[n], *nSamplesRendered ); -#endif } } else @@ -1286,12 +1164,6 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->ivas_format == MC_FORMAT ) { -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) - { - p_tc[n] = &st_ivas->hTcBuffer->tc[n][st_ivas->hTcBuffer->n_samples_rendered]; - } -#endif if ( st_ivas->mc_mode == MC_MODE_MCT ) { int16_t crendInPlaceRotation = FALSE; @@ -1386,9 +1258,6 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - int16_t offset = hSpatParamRendCom->slots_rendered * hSpatParamRendCom->slot_size; -#endif nchan_remapped = st_ivas->nchan_transport; if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { @@ -1403,11 +1272,7 @@ ivas_error ivas_jbm_dec_render( /* we still need to copy the separate channel if available */ if ( st_ivas->hOutSetup.separateChannelEnabled ) { -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS mvr2r( p_tc[LFE_CHANNEL - 1], p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); -#else - mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); -#endif } ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0.f ); @@ -1428,23 +1293,14 @@ ivas_error ivas_jbm_dec_render( output_config == IVAS_AUDIO_CONFIG_5_1_4 || output_config == IVAS_AUDIO_CONFIG_7_1_4 || output_config == IVAS_AUDIO_CONFIG_5_1_2 || ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe > 0 ) ) { -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS mvr2r( p_tc[LFE_CHANNEL], p_output[LFE_CHANNEL], *nSamplesRendered ); mvr2r( p_tc[LFE_CHANNEL - 1], p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); -#else - mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL] + offset, p_output[LFE_CHANNEL], *nSamplesRendered ); - mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); -#endif } else if ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe == 0 ) { /* Delay the separated channel to sync with the DirAC rendering */ -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS mvr2r( p_tc[LFE_CHANNEL - 1], p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); -#else - mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); -#endif } } } @@ -2196,67 +2052,6 @@ int16_t ivas_jbm_dec_get_num_tc_channels( return num_tc; } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - -/*--------------------------------------------------------------------------* - * ivas_jbm_dec_copy_tc() - * - * Copy interleaved transport chnannels to the correct buffers, update the TC - * buffer handle - *--------------------------------------------------------------------------*/ - -static void ivas_jbm_dec_copy_tc( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t nSamplesForRendering, /* i : number of samples to digest */ - int16_t *nSamplesResidual, /* o : number of samples that will be left for the next frame */ - float *data, /* i : (interleaved) transport channel samples */ - float *tc_digest_f[] /* o : samples that will be directly digested (e.g. by CLDFB) */ -) -{ - int16_t ch; - DECODER_TC_BUFFER_HANDLE hTcBuffer; - int16_t n_samples_still_available, m; - int16_t n_ch_full_copy; - int16_t n_ch_res_copy; - - hTcBuffer = st_ivas->hTcBuffer; - n_samples_still_available = hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_rendered; - hTcBuffer->n_samples_buffered = n_samples_still_available + nSamplesForRendering + hTcBuffer->n_samples_discard; - hTcBuffer->n_samples_available = hTcBuffer->n_samples_granularity * ( hTcBuffer->n_samples_buffered / hTcBuffer->n_samples_granularity ); - *nSamplesResidual = hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_available; - n_ch_full_copy = min( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); - n_ch_res_copy = hTcBuffer->nchan_transport_jbm - hTcBuffer->nchan_buffer_full; - - for ( ch = 0; ch < n_ch_full_copy; ch++ ) - { - set_zero( hTcBuffer->tc[ch], hTcBuffer->n_samples_discard ); - mvr2r( hTcBuffer->tc[ch] + hTcBuffer->n_samples_rendered, hTcBuffer->tc[ch] + hTcBuffer->n_samples_discard, n_samples_still_available ); - for ( m = 0; m < nSamplesForRendering; m++ ) - { - hTcBuffer->tc[ch][n_samples_still_available + hTcBuffer->n_samples_discard + m] = data[m * st_ivas->hTcBuffer->nchan_transport_jbm + ch]; - } - } - - if ( n_ch_res_copy > 0 ) - { - for ( ; ch < hTcBuffer->nchan_transport_jbm; ch++ ) - { - mvr2r( hTcBuffer->tc[ch], tc_digest_f[ch], n_samples_still_available ); - for ( m = 0; m < nSamplesForRendering; m++ ) - { - tc_digest_f[ch][n_samples_still_available + m] = data[m * st_ivas->hTcBuffer->nchan_transport_jbm + ch]; - } - mvr2r( tc_digest_f[ch] + hTcBuffer->n_samples_available, hTcBuffer->tc[ch], *nSamplesResidual ); - } - } - - hTcBuffer->n_samples_rendered = 0; - hTcBuffer->subframes_rendered = 0; - - return; -} - -#endif /*--------------------------------------------------------------------------* * ivas_jbm_dec_get_render_granularity() @@ -2753,81 +2548,6 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( return buffer_mode; } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - -/*--------------------------------------------------------------------------* - * ivas_jbm_dec_copy_tc_no_tsm() - * - * - *--------------------------------------------------------------------------*/ - -void ivas_jbm_dec_copy_tc_no_tsm( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float *tc[], /* i : transport channels */ - const int16_t output_frame /* i : output frame size */ -) -{ - int16_t n_ch_cldfb; - int16_t ch_idx; - DECODER_TC_BUFFER_HANDLE hTcBuffer; - - hTcBuffer = st_ivas->hTcBuffer; - hTcBuffer->n_samples_buffered = output_frame; - hTcBuffer->n_samples_available = hTcBuffer->n_samples_buffered; - n_ch_cldfb = hTcBuffer->nchan_transport_jbm - hTcBuffer->nchan_buffer_full; - -#ifdef DEBUGGING - assert( st_ivas->hDecoderConfig->Opt_tsm == 0 ); -#endif - /* CLDFB ana for ParamMC/ParamISM */ - if ( n_ch_cldfb > 0 ) - { - float *cldfb_real_buffer; - float *cldfb_imag_buffer; - int16_t cldfb_ch, slot_idx, num_freq_bands; - - cldfb_real_buffer = NULL; - cldfb_imag_buffer = NULL; - num_freq_bands = 0; - - if ( st_ivas->ivas_format == ISM_FORMAT ) - { - cldfb_real_buffer = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc; - cldfb_imag_buffer = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc; - num_freq_bands = st_ivas->hSpatParamRendCom->num_freq_bands; - ivas_ism_param_dec_tc_gain_ajust( st_ivas, output_frame, output_frame / 2, tc ); - } - else if ( st_ivas->ivas_format == MC_FORMAT ) - { - cldfb_real_buffer = st_ivas->hParamMC->Cldfb_RealBuffer_tc; - cldfb_imag_buffer = st_ivas->hParamMC->Cldfb_ImagBuffer_tc; - num_freq_bands = st_ivas->hParamMC->num_freq_bands; - } -#ifdef DEBUGGING - else - { - assert( 0 && "Residual (direct CLDFB transport channels) only possible for ParamMC/ParamISM!" ); - } -#endif - /* CLDFB Analysis*/ - for ( ch_idx = 0, cldfb_ch = 0; cldfb_ch < n_ch_cldfb; cldfb_ch++, ch_idx++ ) - { - for ( slot_idx = 0; slot_idx < DEFAULT_JBM_CLDFB_TIMESLOTS; slot_idx++ ) - { - cldfbAnalysis_ts( &( tc[ch_idx][num_freq_bands * slot_idx] ), - &cldfb_real_buffer[slot_idx * num_freq_bands * n_ch_cldfb + cldfb_ch * num_freq_bands], - &cldfb_imag_buffer[slot_idx * num_freq_bands * n_ch_cldfb + cldfb_ch * num_freq_bands], - num_freq_bands, st_ivas->cldfbAnaDec[cldfb_ch] ); - } - } - } - hTcBuffer->n_samples_rendered = 0; - hTcBuffer->subframes_rendered = 0; - - return; -} - -#endif /*--------------------------------------------------------------------------* * ivas_jbm_dec_metadata_open() @@ -2917,10 +2637,8 @@ static void ivas_jbm_masa_sf_to_slot_map( int16_t slot_idx; int16_t write_idx, sf_index; -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS ivas_jbm_dec_copy_masa_meta_to_buffer( st_ivas ); -#endif /* Set values */ hJbmMetadata = st_ivas->hJbmMetadata; num_slots_in_subfr = CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index fa0816cb2..22827d8b6 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -1329,30 +1329,16 @@ void ivas_param_mc_dec_digest_tc( float *p_data_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ) { -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS int16_t ch, num_freq_bands, slot_idx, cldfb_ch, n_ch_cldfb; float *cldfb_real_buffer, *cldfb_imag_buffer; -#else - PARAM_MC_DEC_HANDLE hParamMC; - int16_t ch, slot_idx; - int16_t nchan_transport; -#endif /* Initialization */ -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS num_freq_bands = st_ivas->hParamMC->num_freq_bands; n_ch_cldfb = st_ivas->hTcBuffer->nchan_transport_jbm - st_ivas->hTcBuffer->nchan_buffer_full; cldfb_real_buffer = st_ivas->hParamMC->Cldfb_RealBuffer_tc; cldfb_imag_buffer = st_ivas->hParamMC->Cldfb_ImagBuffer_tc; -#else - hParamMC = st_ivas->hParamMC; - assert( hParamMC ); - nchan_transport = st_ivas->nchan_transport; -#endif - -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS /* CLDFB Analysis */ for ( ch = 0, cldfb_ch = 0; cldfb_ch < n_ch_cldfb; cldfb_ch++, ch++ ) { @@ -1364,26 +1350,6 @@ void ivas_param_mc_dec_digest_tc( num_freq_bands, st_ivas->cldfbAnaDec[cldfb_ch] ); } } -#else - /* slot loop for gathering the input data */ - for ( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ ) - { - if ( st_ivas->hDecoderConfig->Opt_tsm ) - { - float RealBuffer[CLDFB_NO_CHANNELS_MAX]; - float ImagBuffer[CLDFB_NO_CHANNELS_MAX]; - - /* CLDFB Analysis*/ - for ( ch = 0; ch < nchan_transport; ch++ ) - { - cldfbAnalysis_ts( &( p_data_f[ch][hParamMC->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hParamMC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); - - mvr2r( RealBuffer, &hParamMC->Cldfb_RealBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands ); - mvr2r( ImagBuffer, &hParamMC->Cldfb_ImagBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands ); - } - } - } -#endif return; } diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 1aece93bb..853841132 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -376,11 +376,7 @@ void ivas_ism2sba_sf( for ( j = 0; j < sba_num_chans; j++ ) { g2 = hIsmRendererData->interpolator + offset; -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS tc = buffer_in[i]; -#else - tc = buffer_in[i] + offset; -#endif out = buffer_tmp[j]; gain = hIsmRendererData->gains[i][j]; prev_gain = hIsmRendererData->prev_gains[i][j]; diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index ca90838f3..0e7057d80 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -4255,12 +4255,6 @@ static ivas_error evs_dec_main( mvs2r( pcm_buf_local, p_output[ch], nOutSamples ); } } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - else // ToDo: the 'else' branch can be removed once UNIFIED_DECODING_PATHS_LEFTOVERS is merged - { - ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, nOutSamples ); - } -#endif return IVAS_ERR_OK; } -- GitLab From bca0f0f200b5ca0c062c46fc37daaae8709bb885 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:25:44 +0100 Subject: [PATCH 14/17] [cleanup] accept NONBE_1300_TDREND_LARGE_ITD --- lib_com/options.h | 1 - lib_rend/ivas_objectRenderer.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 6494cf5f0..b0fe4e94e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -178,7 +178,6 @@ #define FIX_1385_INIT_IGF_STOP_FREQ /* FhG: Initialize infoIGFStopFreq in init_igf_dec() */ #define FIX_1387_INIT_PRM_SQQ /* FhG: initialize pointer prm_sqQ, which might be uninitialized in case of bfi == 1 */ #define FIX_1349_TNS_CRASH /* FhG: Fix crash in TNS entropy coding, in case order of joint TNS coding is reduced to 0 */ -#define NONBE_1300_TDREND_LARGE_ITD /* Eri: issue 1300: There was a bug feeding 1.25 ms frames to the TD renderer, causing out-of-buffer access. This was resolved. However, it is still possible that modeled HRTF with large ITDs could trigger out-of-buffer access. This adds a check to prevent this.*/ #define FIX_1384_MSAN_stereo_tcx_core_enc /* VA: issue 1384: fix use-of-uninitialized value in stereo_tcx_core_enc() */ #define FIX_1384_MSAN_ivas_spar_dec_open /* VA: issue 1386: fix use-of-uninitialized value in ivas_spar_dec_open() */ #define FIX_1388_MSAN_ivas_init_decoder /* VA: issue 1388: fix use-of-uninitialized value in ivas_init_decoder() */ diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index e5b2210f7..b9dafaed5 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -437,9 +437,7 @@ ivas_error TDREND_GetMix( float hrf_left_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; float hrf_right_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; int16_t intp_count; -#ifdef NONBE_1300_TDREND_LARGE_ITD int16_t currShift, prevShift, transition_len, length_in2; -#endif error = IVAS_ERR_OK; @@ -465,7 +463,6 @@ ivas_error TDREND_GetMix( { TDREND_SRC_REND_UpdateFiltersFromSpatialParams( hBinRendererTd, SrcRend_p, SrcSpatial_p, Src_p->hrf_left_prev, Src_p->hrf_right_prev, hrf_left_delta, hrf_right_delta, &intp_count, &Src_p->filterlength, &Src_p->itd, &Src_p->Gain, Src_p ); -#ifdef NONBE_1300_TDREND_LARGE_ITD /* For large ITD values at lower sampling rate, check if the transition can be done */ if ( Src_p->itd * Src_p->previtd < 0 ) { @@ -479,7 +476,6 @@ ivas_error TDREND_GetMix( Src_p->itd = 0; } } -#endif } /* Render source if needed */ -- GitLab From 43d683e04ded48a4269f42330c910a09b6f2f57a Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:37:07 +0100 Subject: [PATCH 15/17] clang-format --- lib_dec/ivas_jbm_dec.c | 9 +-- lib_dec/lib_dec.c | 180 ++++++++++++++++++++--------------------- 2 files changed, 94 insertions(+), 95 deletions(-) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 0d1aee270..f944da2d8 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -745,7 +745,6 @@ ivas_error ivas_jbm_dec_tc( } - /*--------------------------------------------------------------------------* * ivas_dec_feed_tc_to_renderer() * @@ -903,10 +902,10 @@ ivas_error ivas_jbm_dec_render( st_ivas->hTcBuffer->tc[n] = p_output[n]; } } - for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) - { - p_tc[n] = &st_ivas->hTcBuffer->tc[n][st_ivas->hTcBuffer->n_samples_rendered]; - } + for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) + { + p_tc[n] = &st_ivas->hTcBuffer->tc[n][st_ivas->hTcBuffer->n_samples_rendered]; + } /*----------------------------------------------------------------* * Update combined orientation access index diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 0e7057d80..99bd11c76 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -438,9 +438,9 @@ static ivas_error create_flush_buffer( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_Configure( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const uint32_t sampleRate, /* i : output sampling frequency */ - const IVAS_AUDIO_CONFIG outputConfig, /* i : output configuration */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const uint32_t sampleRate, /* i : output sampling frequency */ + const IVAS_AUDIO_CONFIG outputConfig, /* i : output configuration */ const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */ const bool customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const bool hrtfReaderEnabled, /* i : enable HRTF binary file input */ @@ -1786,41 +1786,41 @@ ivas_error IVAS_DEC_GetSamplesRenderer( } else { - nOutChannels = (uint8_t) hIvasDec->st_ivas->hDecoderConfig->nchan_out; - hIvasDec->hasBeenFedFrame = false; + nOutChannels = (uint8_t) hIvasDec->st_ivas->hDecoderConfig->nchan_out; + hIvasDec->hasBeenFedFrame = false; - /* check for possible flushed samples from a rate switch */ - if ( hIvasDec->nSamplesFlushed > 0 ) - { -#ifdef DEBUGGING - assert( hIvasDec->pcmType == pcmType ); -#endif - /* note: offset (rendered samples) is always 0 */ - if ( pcmType == IVAS_DEC_PCM_INT16 ) - { - mvs2s( (int16_t *) hIvasDec->flushbuffer, pcmBuf, hIvasDec->nSamplesFlushed * nOutChannels ); - } - else if ( pcmType == IVAS_DEC_PCM_FLOAT ) - { - mvr2r( (float *) hIvasDec->flushbuffer, pcmBuf, hIvasDec->nSamplesFlushed * nOutChannels ); - } + /* check for possible flushed samples from a rate switch */ + if ( hIvasDec->nSamplesFlushed > 0 ) + { #ifdef DEBUGGING - else - { - assert( 0 && "wrong PCM type for the flush buffer!" ); - } + assert( hIvasDec->pcmType == pcmType ); #endif - nSamplesRendered = hIvasDec->nSamplesFlushed; - hIvasDec->nSamplesFlushed = 0; + /* note: offset (rendered samples) is always 0 */ + if ( pcmType == IVAS_DEC_PCM_INT16 ) + { + mvs2s( (int16_t *) hIvasDec->flushbuffer, pcmBuf, hIvasDec->nSamplesFlushed * nOutChannels ); } - - /* render IVAS frames directly to the output buffer */ - if ( ( error = ivas_jbm_dec_render( st_ivas, nSamplesAsked - nSamplesRendered, &nSamplesRendered_loop, &hIvasDec->nSamplesAvailableNext, pcm_type_API_to_internal( pcmType ), pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ) ) ) != IVAS_ERR_OK ) + else if ( pcmType == IVAS_DEC_PCM_FLOAT ) { - return error; + mvr2r( (float *) hIvasDec->flushbuffer, pcmBuf, hIvasDec->nSamplesFlushed * nOutChannels ); + } +#ifdef DEBUGGING + else + { + assert( 0 && "wrong PCM type for the flush buffer!" ); } +#endif + nSamplesRendered = hIvasDec->nSamplesFlushed; + hIvasDec->nSamplesFlushed = 0; + } - nSamplesRendered += nSamplesRendered_loop; + /* render IVAS frames directly to the output buffer */ + if ( ( error = ivas_jbm_dec_render( st_ivas, nSamplesAsked - nSamplesRendered, &nSamplesRendered_loop, &hIvasDec->nSamplesAvailableNext, pcm_type_API_to_internal( pcmType ), pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + nSamplesRendered += nSamplesRendered_loop; } if ( hIvasDec->nSamplesAvailableNext == 0 ) @@ -4473,77 +4473,77 @@ static ivas_error apa_setup( { DECODER_CONFIG_HANDLE hDecoderConfig; - uint16_t wss, css; - float startQuality; + uint16_t wss, css; + float startQuality; - startQuality = hIvasDec->tsm_quality; - apa_buffer_size = APA_BUF_PER_CHANNEL; + startQuality = hIvasDec->tsm_quality; + apa_buffer_size = APA_BUF_PER_CHANNEL; - /* get current renderer type*/ - hDecoderConfig = hIvasDec->st_ivas->hDecoderConfig; + /* get current renderer type*/ + hDecoderConfig = hIvasDec->st_ivas->hDecoderConfig; - if ( hDecoderConfig->output_Fs == 8000 ) - { - wss = 1; - css = 1; - } - else if ( hDecoderConfig->output_Fs == 16000 ) - { - wss = 2; - css = 1; - } - else if ( hDecoderConfig->output_Fs == 32000 ) - { - wss = 4; - css = 2; - } - else if ( hDecoderConfig->output_Fs == 48000 ) - { - wss = 6; - css = 3; - } - else - { - return IVAS_ERR_INIT_ERROR; - } + if ( hDecoderConfig->output_Fs == 8000 ) + { + wss = 1; + css = 1; + } + else if ( hDecoderConfig->output_Fs == 16000 ) + { + wss = 2; + css = 1; + } + else if ( hDecoderConfig->output_Fs == 32000 ) + { + wss = 4; + css = 2; + } + else if ( hDecoderConfig->output_Fs == 48000 ) + { + wss = 6; + css = 3; + } + else + { + return IVAS_ERR_INIT_ERROR; + } - if ( apa_init( &hIvasDec->hTimeScaler, nTransportChannels ) != IVAS_ERR_OK || - apa_set_rate( hIvasDec->hTimeScaler, hDecoderConfig->output_Fs ) != 0 || - apa_set_complexity_options( hIvasDec->hTimeScaler, wss, css ) != 0 || - apa_set_quality( hIvasDec->hTimeScaler, startQuality, 4, 4 ) != 0 || - apa_set_renderer_granularity( hIvasDec->hTimeScaler, l_ts ) != 0 ) - { - return IVAS_ERR_INIT_ERROR; - } + if ( apa_init( &hIvasDec->hTimeScaler, nTransportChannels ) != IVAS_ERR_OK || + apa_set_rate( hIvasDec->hTimeScaler, hDecoderConfig->output_Fs ) != 0 || + apa_set_complexity_options( hIvasDec->hTimeScaler, wss, css ) != 0 || + apa_set_quality( hIvasDec->hTimeScaler, startQuality, 4, 4 ) != 0 || + apa_set_renderer_granularity( hIvasDec->hTimeScaler, l_ts ) != 0 ) + { + return IVAS_ERR_INIT_ERROR; + } - if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) + if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) + { + if ( apa_set_evs_compat_mode( hIvasDec->hTimeScaler, true ) != 0 ) { - if ( apa_set_evs_compat_mode( hIvasDec->hTimeScaler, true ) != 0 ) - { - return IVAS_ERR_INIT_ERROR; - } + return IVAS_ERR_INIT_ERROR; } + } - if ( ( hIvasDec->apaExecBuffer = malloc( sizeof( float ) * apa_buffer_size * nTransportChannels ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); - } + if ( ( hIvasDec->apaExecBuffer = malloc( sizeof( float ) * apa_buffer_size * nTransportChannels ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); + } - set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); + set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); } else { - if ( apa_reconfigure( hIvasDec->hTimeScaler, nTransportChannels, l_ts ) != 0 ) - { - return IVAS_ERR_INIT_ERROR; - } - apa_buffer_size = APA_BUF_PER_CHANNEL; - free( hIvasDec->apaExecBuffer ); - if ( ( hIvasDec->apaExecBuffer = malloc( sizeof( float ) * apa_buffer_size * nTransportChannels ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); - } - set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); + if ( apa_reconfigure( hIvasDec->hTimeScaler, nTransportChannels, l_ts ) != 0 ) + { + return IVAS_ERR_INIT_ERROR; + } + apa_buffer_size = APA_BUF_PER_CHANNEL; + free( hIvasDec->apaExecBuffer ); + if ( ( hIvasDec->apaExecBuffer = malloc( sizeof( float ) * apa_buffer_size * nTransportChannels ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); + } + set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); } hIvasDec->nTransportChannelsOld = nTransportChannels; -- GitLab From 21145641d9e4c6e8cf298b128c30836b5cf4dcc9 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:37:37 +0100 Subject: [PATCH 16/17] [cleanup] accept NONBE_FIX_1197_OMASA_META_BUFFER --- lib_com/options.h | 1 - lib_dec/ivas_omasa_dec.c | 2 -- lib_rend/ivas_dirac_dec_binaural_functions.c | 6 ------ 3 files changed, 9 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index b0fe4e94e..696bcb990 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -185,7 +185,6 @@ #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 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 */ // object-editing feature porting diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index e65708926..f61762bfe 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -334,7 +334,6 @@ ivas_error ivas_omasa_dec_config( ivas_omasa_separate_object_renderer_close( st_ivas ); } -#ifdef NONBE_FIX_1197_OMASA_META_BUFFER if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->hMasaIsmData != NULL ) /* this structure is in use only in ISM_MASA_MODE_PARAM_ONE_OBJ */ { MASA_ISM_DATA_HANDLE hMasaIsmData = st_ivas->hMasaIsmData; @@ -350,7 +349,6 @@ ivas_error ivas_omasa_dec_config( set_s( hMasaIsmData->azimuth_separated_ism, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); set_s( hMasaIsmData->elevation_separated_ism, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); } -#endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) { diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 9d556dcca..11a3a16aa 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -3128,17 +3128,11 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects( totalTargetEneCh[ch] = max( totalTargetEneCh[ch], 0.0f ); } -#ifdef NONBE_FIX_1197_OMASA_META_BUFFER /* due to rounding, the sum may exceed 1.0f ever so slightly, so clip it */ ratioAccOrig = min( ratioAccOrig, 1.0f ); -#endif if ( masaGainEdited ) { -#ifdef NONBE_FIX_1197_OMASA_META_BUFFER ratioAccNew += gainMasaPow2 * ( 1.0f - ratioAccOrig ); -#else - ratioAccNew += gainMasaPow2 * ( 1 - ratioAccOrig ); -#endif } else { -- GitLab From 18eef16190af9b9bcf079d4ca954672ac9e2496c Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:37:40 +0100 Subject: [PATCH 17/17] [cleanup] accept FIX_1113_EXTREND_ISAR --- lib_com/options.h | 1 - lib_rend/ivas_rotation.c | 4 ---- lib_rend/lib_rend.c | 12 ------------ lib_rend/lib_rend.h | 8 -------- 4 files changed, 25 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 696bcb990..fe6e47b88 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,7 +171,6 @@ #define FIX_1377_HANDLE_ERROR_CODE /* Eri: Add missing error code handling from IVAS_REND_SetObjectIDs */ #define FIX_1053_REVERB_RECONFIGURATION #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ -#define FIX_1113_EXTREND_ISAR /* FhG: issue 1113: fix external renderer asserts for FOA/HOA2 and CLDFB config */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ #define FIX_938_COMPILER_WARNING /* FhG: Fix compiler warning in ivas_mdct_core_reconstruct() */ #define FIX_1376_MISSING_ISM_METADATA /* FhG: IVAS_rend: throw error if there exists an ISM input without a corresponding metadata file path */ diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 4cf401582..0a4a7c4ec 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -508,12 +508,8 @@ void rotateFrame_shd_cldfb( float realRot[2 * HEADROT_ORDER + 1], imagRot[2 * HEADROT_ORDER + 1]; float SHrotmat[HEADROT_SHMAT_DIM][HEADROT_SHMAT_DIM]; -#ifdef FIX_1113_EXTREND_ISAR assert( ( nInChannels == HOA3_CHANNELS || nInChannels == HOA2_CHANNELS || nInChannels == FOA_CHANNELS ) && "Number of channels must correspond to an ambisonics order!" ); -#else - assert( nInChannels == HEADROT_SHMAT_DIM && "Number of channels must be 16!" ); -#endif /* initialize rotation matrices with zeros */ for ( i = 0; i < HEADROT_SHMAT_DIM; i++ ) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 3de67f9fd..58265ed1f 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2532,11 +2532,7 @@ static ivas_error updateSbaPanGains( { if ( hRendCfg->split_rend_config.rendererSelection == IVAS_BIN_RENDERER_TYPE_FASTCONV ) { -#ifdef FIX_1113_EXTREND_ISAR assert( *rendCtx.pOutSampleRate == 48000 && "split binaural fast conv mode is currently supported with 48k sampling rate only" ); -#else - assert( inConfig == IVAS_AUDIO_CONFIG_HOA3 && ( *rendCtx.pOutSampleRate == 48000 ) && "split binaural fast conv mode is currently supported with HOA3 input and 48k sampling rate only" ); -#endif if ( ( error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -4216,11 +4212,7 @@ ivas_error IVAS_REND_InitConfig( * *-------------------------------------------------------------------*/ -#ifdef FIX_1113_EXTREND_ISAR ivas_error IVAS_REND_GetRenderConfig( -#else -int16_t IVAS_REND_GetRenderConfig( -#endif IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ ) @@ -4284,11 +4276,7 @@ int16_t IVAS_REND_GetRenderConfig( * *-------------------------------------------------------------------*/ -#ifdef FIX_1113_EXTREND_ISAR ivas_error IVAS_REND_FeedRenderConfig( -#else -int16_t IVAS_REND_FeedRenderConfig( -#endif IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ ) diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index f7c5d3674..61c7d0094 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -252,21 +252,13 @@ ivas_error IVAS_REND_InitConfig( const IVAS_AUDIO_CONFIG outAudioConfig /* i : output audioConfig */ ); -#ifdef FIX_1113_EXTREND_ISAR ivas_error IVAS_REND_GetRenderConfig( -#else -int16_t IVAS_REND_GetRenderConfig( -#endif IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ ); -#ifdef FIX_1113_EXTREND_ISAR ivas_error IVAS_REND_FeedRenderConfig( -#else -int16_t IVAS_REND_FeedRenderConfig( -#endif IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ ); -- GitLab