From b4b793f1ae9bd6636f5f9e6dfa05a6f0229b58ce Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:14:47 +0100 Subject: [PATCH 01/16] 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 737c71f0c..4f44feb5d 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 abd246e59..6049ecc6b 100644 --- a/lib_util/aeid_file_reader.h +++ b/lib_util/aeid_file_reader.h @@ -1,7 +1,7 @@ #pragma once /****************************************************************************************************** - (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 f2750d3d5b861a565b6c7554f06580dce6b66d21 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:21:31 +0100 Subject: [PATCH 02/16] [cleanup] accept NONBE_1217_INIT_OBJ_EDIT --- lib_com/options.h | 1 - lib_dec/lib_dec_fx.c | 30 ------------------------------ 2 files changed, 31 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index f9fec417b..bc194bf4f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -124,7 +124,6 @@ #define TMP_FIX_OMASA_SR_BE // temporary fix to keep OMASA split-rendering BE #define NONBE_1399_1400_FIX_OBJ_EDIT_ISSUES // Nokia: Fix 1399_1400 issue in float, this is essential for the BASOP porting #define OBJ_EDIT_BASOP -#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_fx.c b/lib_dec/lib_dec_fx.c index be60b0580..dcf150c4b 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -4145,19 +4145,10 @@ ivas_error IVAS_DEC_GetEditableParameters( test(); test(); test(); -#ifdef NONBE_1217_INIT_OBJ_EDIT IF( !( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) || ( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) && GT_16( st_ivas->nchan_ism, 0 ) ) ) ) -#else - IF( !( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) || - ( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( ism_mode, ISM_SBA_MODE_DISC ) ) || - ( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && ( EQ_32( ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_32( ism_mode, ISM_MASA_MODE_DISC ) ) ) ) ) - { - return IVAS_ERROR( IVAS_ERR_WRONG_MODE, "Object editing no supported in this operation mode." ); - } -#endif hIvasEditableParameters->gain_bed_fx = ONE_IN_Q29; move32(); @@ -4228,16 +4219,10 @@ ivas_error IVAS_DEC_GetEditableParameters( } #endif } -#ifdef NONBE_1217_INIT_OBJ_EDIT ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) || ( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) && GT_16( st_ivas->nchan_ism, 0 ) ) ) -#else - ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && ( EQ_32( ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_32( ism_mode, ISM_MASA_MODE_DISC ) ) ) -#endif { /* object editing possible only in two highest OMASA modes */ -#ifdef NONBE_1217_INIT_OBJ_EDIT test(); -#endif IF( EQ_32( ism_mode, ISM_MASA_MODE_DISC ) ) { FOR( obj = 0; obj < hIvasEditableParameters->num_obj; obj++ ) @@ -4262,11 +4247,7 @@ ivas_error IVAS_DEC_GetEditableParameters( move16(); } } -#ifdef NONBE_1217_INIT_OBJ_EDIT ELSE IF( EQ_32( ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) -#else - ELSE -#endif { /* Handle MONO output */ IF( NE_32( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) ) @@ -4302,7 +4283,6 @@ ivas_error IVAS_DEC_GetEditableParameters( move16(); } } -#ifdef NONBE_1217_INIT_OBJ_EDIT ELSE IF( EQ_32( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( ism_mode, ISM_MODE_NONE ) ) { hIvasEditableParameters->num_obj = 0; @@ -4313,7 +4293,6 @@ ivas_error IVAS_DEC_GetEditableParameters( { assert( 0 && "This should never happen!" ); } -#endif #endif } @@ -4355,19 +4334,10 @@ ivas_error IVAS_DEC_SetEditableParameters( test(); test(); test(); -#ifdef NONBE_1217_INIT_OBJ_EDIT IF( !( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) || ( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) && GT_16( st_ivas->nchan_ism, 0 ) ) ) ) -#else - test(); - test(); - IF( !( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) || - ( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( ism_mode, ISM_SBA_MODE_DISC ) ) || - ( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && ( EQ_32( ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_32( ism_mode, ISM_MASA_MODE_DISC ) ) ) ) || - EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) -#endif { return IVAS_ERROR( IVAS_ERR_WRONG_MODE, "Object editing no supported in this operation mode." ); } -- GitLab From 84731c7101665ddf50d2fe9e9e399b3f15d1926e Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:21:37 +0100 Subject: [PATCH 03/16] [cleanup] accept FIX_1179_USAN_PHASEECU --- lib_com/options.h | 1 - lib_dec/FEC_HQ_phase_ecu_fx.c | 32 -------------------------------- 2 files changed, 33 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index bc194bf4f..d005cdbf1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -103,7 +103,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 FIX_1179_USAN_PHASEECU /* Eri: issue 1179: better handling of 16 bit wrap around for very long(>200ms) FER-bursts */ #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 */ diff --git a/lib_dec/FEC_HQ_phase_ecu_fx.c b/lib_dec/FEC_HQ_phase_ecu_fx.c index de3f39799..dd44f50b9 100644 --- a/lib_dec/FEC_HQ_phase_ecu_fx.c +++ b/lib_dec/FEC_HQ_phase_ecu_fx.c @@ -2317,11 +2317,7 @@ static void subst_spec_fx( move16(); tmp = add( tmp, sub( Lecu, shr( sub( Lecu, Lprot ), 1 ) ) ); tmp = sub( tmp, shr( output_frame, 1 ) ); -#ifdef FIX_1179_USAN_PHASEECU tmp = add_sat( tmp, time_offs ); -#else - tmp = add( tmp, time_offs ); -#endif tmp = round_fx( L_shl( L_mult0( tmp, Lprot_inv ), 4 ) ); /* 0+22+4-16=10 */ pPlocsi = plocsi; @@ -4516,20 +4512,11 @@ static void ivas_hq_phase_ecu_fx( { test(); test(); -#ifdef FIX_1179_USAN_PHASEECU if ( !( prev_bfi != 0 && *last_fec != 0 && element_mode == EVS_MONO ) ) { *time_offs = 0; /* IVAS reset of offset time counter, timeoffset variable later also used to calculate burst length */ move16(); } -#else - // PMT("verify condition compared to float") - if ( !( prev_bfi != 0 && *last_fec != 0 && element_mode == EVS_MONO ) ) - { - *time_offs = 0; - move16(); - } -#endif offset = add( sub( sub( shl( output_frame, 1 ), lprot ), *time_offs ), ph_ecu_lookahead ); @@ -4541,11 +4528,7 @@ static void ivas_hq_phase_ecu_fx( test(); IF( prev_bfi != 0 && *last_fec != 0 ) { -#ifdef FIX_1179_USAN_PHASEECU *time_offs = add_sat( *time_offs, output_frame ); /* when saturation is reached, this keeps the long term muting on */ -#else - *time_offs = add( *time_offs, output_frame ); -#endif move16(); } } @@ -4635,9 +4618,6 @@ static void hq_phase_ecu_fx( IF( prev_bfi == 0 || ( prev_bfi != 0 && *last_fec != 0 && ( EQ_16( *time_offs, output_frame ) ) ) ) { test(); -#ifndef FIX_1179_USAN_PHASEECU - // PMT("verify condition compared to float") -#endif if ( !( prev_bfi != 0 && *last_fec != 0 ) ) { *time_offs = 0; @@ -4654,21 +4634,13 @@ static void hq_phase_ecu_fx( test(); IF( prev_bfi != 0 && *last_fec != 0 ) { -#ifdef FIX_1179_USAN_PHASEECU *time_offs = add_sat( *time_offs, output_frame ); -#else - *time_offs = add( *time_offs, output_frame ); -#endif move16(); } } ELSE { -#ifdef FIX_1179_USAN_PHASEECU *time_offs = add_sat( *time_offs, output_frame ); -#else - *time_offs = add( *time_offs, output_frame ); -#endif move16(); offset = sub( shl( output_frame, 1 ), lprot ); @@ -4684,11 +4656,7 @@ static void hq_phase_ecu_fx( move16(); IF( *num_p > 0 ) { -#ifdef FIX_1179_USAN_PHASEECU seed = add_sat( seed, plocs[*num_p - 1] ); -#else - seed = add( seed, plocs[*num_p - 1] ); -#endif } subst_spec_fx( plocs, plocsi, num_p, *time_offs, X, mag_chg, ph_dith, old_is_transient, output_frame, &seed, -- GitLab From 59eeff865b29589f44f2bbe2779d7844bdb60ce2 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:21:55 +0100 Subject: [PATCH 04/16] [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 dfebd7392..ace58f5ec 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1854,7 +1854,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; @@ -1867,9 +1866,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 ) { @@ -1879,9 +1875,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 d005cdbf1..a8daaf75e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -90,7 +90,6 @@ #define NONBE_1328_FIX_NON_LINEARITY /* VA: Fix possible issue when computing bwe_exc_extended and previous frame were almost 0, float issue 1328 */ #define FIX_1319_STACK_SBA_DECODER /* VA: issue 1319: Optimize the definition of buffer lengths in the SBA decoder */ #define FIX_1320_STACK_CPE_DECODER /* VA: issue 1320: Optimize the stack memory consumption in the CPE 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 c720eecb917bc7b574bffe72a81531cf7fbf041b Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:21:58 +0100 Subject: [PATCH 05/16] [cleanup] accept FIX_1217_OBJECT_EDIT_FILE_INTERFACE --- apps/decoder.c | 59 --------------------------------- lib_com/ivas_error.h | 4 --- lib_com/options.h | 1 - lib_dec/ivas_init_dec_fx.c | 2 -- lib_util/obj_edit_file_reader.c | 2 -- lib_util/obj_edit_file_reader.h | 2 -- 6 files changed, 70 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index ace58f5ec..b0a5d6b0a 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -47,9 +47,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 #include "vector3_pair_file_reader.h" #include "wmc_auto.h" #include "options.h" @@ -130,9 +128,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; @@ -161,19 +157,10 @@ 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 FIX_1217_OBJECT_EDIT_FILE_INTERFACE static void do_object_editing_fx( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader ); -#else -static void do_object_editing_fx( IVAS_EDITABLE_PARAMETERS *editableParameters ); -#endif /*------------------------------------------------------------------------------------------* @@ -205,9 +192,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 WMOPS reset_wmops(); @@ -401,7 +386,6 @@ int main( } } -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE /*------------------------------------------------------------------------------------------* * Open object editing instruction file *------------------------------------------------------------------------------------------*/ @@ -414,7 +398,6 @@ int main( goto cleanup; } } -#endif /*------------------------------------------------------------------------------------------* * Configure the decoder @@ -654,19 +637,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 ) @@ -724,9 +699,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 ) { @@ -908,9 +881,7 @@ static bool parseCmdlIVAS_dec( arg->directivityPatternId[i] = 65535; } arg->objEditEnabled = false; -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE arg->objEditFileName = NULL; -#endif /*-----------------------------------------------------------------* * Initialization @@ -1383,7 +1354,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" ); @@ -1400,7 +1370,6 @@ static bool parseCmdlIVAS_dec( arg->objEditFileName = argv[i]; /* read edit instructions from this file */ } i++; -#endif } /*-----------------------------------------------------------------* @@ -1590,11 +1559,7 @@ static void usage_dec( void ) fprintf( stdout, " without braces and spaces, with ':' character separating ID from duration and ',' separating\n" ); fprintf( stdout, " ID and duration pairs, where duration is specified in frames\n" ); 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" ); @@ -1923,9 +1888,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 ) @@ -2254,7 +2217,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 ) @@ -2263,14 +2225,9 @@ static ivas_error decodeG192( return error; } } -#endif /* Do object metadata editing here ... */ -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE do_object_editing_fx( &editableParameters, objectEditFileReader ); -#else - do_object_editing_fx( &editableParameters ); -#endif /* set new object parameters*/ if ( ( error = IVAS_DEC_SetEditableParameters( hIvasDec, editableParameters ) ) != IVAS_ERR_OK ) @@ -2691,9 +2648,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 ) { @@ -2972,7 +2927,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 @@ -2985,7 +2939,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 ) @@ -3087,11 +3040,7 @@ static ivas_error decodeVoIP( } /* Do object metadata editing here ... */ -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE do_object_editing_fx( &editableParameters, objectEditFileReader ); -#else - do_object_editing_fx( &editableParameters ); -#endif /* set new object parameters */ if ( ( error = IVAS_DEC_SetEditableParameters( hIvasDec, editableParameters ) ) != IVAS_ERR_OK ) @@ -3411,12 +3360,8 @@ cleanup: *---------------------------------------------------------------------*/ static void do_object_editing_fx( -#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... */ @@ -3432,7 +3377,6 @@ static void do_object_editing_fx( } } -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE if ( objectEditFileReader != NULL ) { ReadObjectEditInfo *readInfo; @@ -3495,7 +3439,6 @@ static void do_object_editing_fx( } else { -#endif if ( num_nondiegetic_objects ) { float start_angle, angle_inc; @@ -3519,9 +3462,7 @@ static void do_object_editing_fx( } editableParameters->gain_bed_fx = ( 1 << 28 ); // 0.5 in Q29 -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE } -#endif return; } diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index 267b6ad7a..1ba3b52ae 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, @@ -258,10 +256,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 a8daaf75e..9c8ab1622 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -122,7 +122,6 @@ #define TMP_FIX_OMASA_SR_BE // temporary fix to keep OMASA split-rendering BE #define NONBE_1399_1400_FIX_OBJ_EDIT_ISSUES // Nokia: Fix 1399_1400 issue in float, this is essential for the BASOP porting #define OBJ_EDIT_BASOP -#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_fx.c b/lib_dec/ivas_init_dec_fx.c index 00179537e..d71a43691 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -3872,13 +3872,11 @@ static ivas_error doSanityChecks_IVAS( } } -#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE test(); 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 return IVAS_ERR_OK; } diff --git a/lib_util/obj_edit_file_reader.c b/lib_util/obj_edit_file_reader.c index 6ae9e4cc9..76de8908c 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_fx.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 d3aeb929b..4c3e4435f 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 *---------------------------------------------------------------------*/ @@ -110,5 +109,4 @@ void ObjectEditFileReader_close( ObjectEditFileReader **objEditReader /* i/o: pointer to ObjectEditFileReader handle */ ); -#endif #endif /* OBJ_EDIT_FILE_READER_H */ -- GitLab From 7be2f3f43bd1d97238e363ecc26e58e28a4aa87f Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:22:01 +0100 Subject: [PATCH 06/16] [cleanup] accept NONBE_1217_OBJ_EDIT_FOA --- lib_com/options.h | 1 - lib_dec/lib_dec_fx.c | 8 -------- 2 files changed, 9 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9c8ab1622..55f017451 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -122,7 +122,6 @@ #define TMP_FIX_OMASA_SR_BE // temporary fix to keep OMASA split-rendering BE #define NONBE_1399_1400_FIX_OBJ_EDIT_ISSUES // Nokia: Fix 1399_1400 issue in float, this is essential for the BASOP porting #define OBJ_EDIT_BASOP -#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 FIX_2140_OBJECT_EDITING_SANITIZER_ISSUES /* Nokia: Issue 2140, fixes three different sanitizer issues persisting in object editing code. */ diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index dcf150c4b..9390ae815 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -4388,10 +4388,8 @@ ivas_error IVAS_DEC_SetEditableParameters( move32(); st_ivas->hParamIsmDec->edited_elevation_values_fx[obj] = hIvasEditableParameters.ism_metadata[obj].elevation_fx; move32(); -#ifdef NONBE_1217_OBJ_EDIT_FOA IF( st_ivas->hMasaIsmData != NULL ) { -#endif st_ivas->hMasaIsmData->gain_ism_edited_fx[obj] = shr( extract_h( hIvasEditableParameters.ism_metadata[obj].gain_fx ), Q1 ); // Q29 -> Q12 move32(); @@ -4417,21 +4415,15 @@ ivas_error IVAS_DEC_SetEditableParameters( st_ivas->hMasaIsmData->ism_gain_is_edited[obj] = 0; } move16(); -#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 = 0; move16(); -#ifdef NONBE_1217_OBJ_EDIT_FOA } -#endif } ELSE IF( EQ_32( ism_mode, ISM_MODE_NONE ) ) { -- GitLab From 5eca250cd21535cb8e101359f7b7a3f254d61eed Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:22:04 +0100 Subject: [PATCH 07/16] [cleanup] accept NONBE_FIX_1255_OBJ_EDIT_JBM --- apps/decoder.c | 16 ---------------- lib_com/options.h | 1 - lib_dec/lib_dec_fx.c | 11 ----------- 3 files changed, 28 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index b0a5d6b0a..428524b8e 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -2927,11 +2927,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 ) { @@ -3172,23 +3168,12 @@ static ivas_error decodeVoIP( } } -#ifdef NONBE_FIX_1255_OBJ_EDIT_JBM vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len; -#else - // frame++; - 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++; @@ -3197,7 +3182,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 55f017451..63bbba84a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -122,7 +122,6 @@ #define TMP_FIX_OMASA_SR_BE // temporary fix to keep OMASA split-rendering BE #define NONBE_1399_1400_FIX_OBJ_EDIT_ISSUES // Nokia: Fix 1399_1400 issue in float, this is essential for the BASOP porting #define OBJ_EDIT_BASOP -#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 FIX_2140_OBJECT_EDITING_SANITIZER_ISSUES /* Nokia: Issue 2140, fixes three different sanitizer issues persisting in object editing code. */ #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_fx.c b/lib_dec/lib_dec_fx.c index 9390ae815..4aa75e28b 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -4842,15 +4842,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( #endif move16(); } -#ifndef NONBE_FIX_1255_OBJ_EDIT_JBM - IF( hIvasDec->hasBeenFedFirstGoodFrame ) - { - *parametersAvailableForEditing = true; - move16(); - - return IVAS_ERR_OK; - } -#endif } /* decode */ @@ -4895,11 +4886,9 @@ ivas_error IVAS_DEC_VoIP_GetSamples( #endif *bitstreamReadDone = false; move16(); -#ifdef NONBE_FIX_1255_OBJ_EDIT_JBM *parametersAvailableForEditing = true; move16(); return IVAS_ERR_OK; -#endif } } -- GitLab From 2977d4d7a7a989ada876fb228940b0e3e99a8d42 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:22:25 +0100 Subject: [PATCH 08/16] [cleanup] accept LIB_DEC_REVISION --- apps/decoder.c | 44 --- lib_com/ivas_prot_fx.h | 4 - lib_com/options.h | 1 - lib_dec/ivas_jbm_dec_fx.c | 12 - lib_dec/lib_dec.h | 16 - lib_dec/lib_dec_fx.c | 595 -------------------------------------- 6 files changed, 672 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 428524b8e..410d0c502 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -406,14 +406,9 @@ int main( asked_frame_size = arg.renderFramesize; 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_fx, 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_fx, - arg.dpidEnabled, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; @@ -908,30 +903,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++; } @@ -1012,10 +995,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; } @@ -1633,15 +1614,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 */ @@ -1699,7 +1671,6 @@ static ivas_error initOnFirstGoodFrame( } } -#ifdef LIB_DEC_REVISION int16_t pcmFrameSize; if ( ( error = IVAS_DEC_GetOutputBufferSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK ) { @@ -1707,15 +1678,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 ) @@ -1922,7 +1890,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 ) @@ -1932,7 +1899,6 @@ static ivas_error decodeG192( } } -#endif #endif if ( ( error = IVAS_DEC_is_split_rendering_enabled( hIvasDec, &isSplitRend ) ) != IVAS_ERR_OK ) { @@ -2258,11 +2224,7 @@ static ivas_error decodeG192( } else { -#ifdef LIB_DEC_REVISION if ( ( error = IVAS_DEC_GetSamplesRenderer( hIvasDec, nSamplesToRender, ( pcmBuf + nOutChannels * nSamplesRendered ), &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, ( 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; @@ -2301,9 +2263,7 @@ static ivas_error decodeG192( { if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, &vec_pos_len, 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; } } @@ -3070,11 +3030,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; } diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 08e5694d6..417bb540a 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -4222,10 +4222,6 @@ Word64 var_32_fx( ivas_error ivas_jbm_dec_tc_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -#ifndef LIB_DEC_REVISION - , - Word32 *data_fx -#endif ); ivas_error ivas_jbm_dec_flush_renderer_fx( diff --git a/lib_com/options.h b/lib_com/options.h index 63bbba84a..643988648 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -109,7 +109,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_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 62a5b5490..cd0146586 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -82,10 +82,6 @@ static Word16 ceil_fx16( ivas_error ivas_jbm_dec_tc_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -#ifndef LIB_DEC_REVISION - , - Word32 *data_fx /*Q11*/ -#endif ) { Word16 ch, n, output_frame, nchan_out, i, ii; @@ -1487,15 +1483,7 @@ ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) ) * Write IVAS transport channels *----------------------------------------------------------------*/ -#ifdef LIB_DEC_REVISION IF( st_ivas->hDecoderConfig->Opt_tsm == 0 ) -#else -IF( EQ_16( st_ivas->hDecoderConfig->Opt_tsm, 1 ) ) -{ - ivas_syn_output_f_fx( p_output_fx, output_frame, st_ivas->hTcBuffer->nchan_transport_jbm, data_fx ); -} -ELSE -#endif { /* directly copy to tc buffers */ /*note : the q of cldfb buffers (imag/real) are needed to be Q_p_output - 5 here 6 is taken for that*/ diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 51c359227..cf23f0e64 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -111,9 +111,6 @@ ivas_error IVAS_DEC_Configure( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const UWord32 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 */ @@ -158,11 +155,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 Word16 nSamplesAsked, /* i : number of samples wanted by the caller */ Word16 *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 Q0 */ @@ -287,11 +280,9 @@ 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 ivas_error IVAS_DEC_TSM_SetQuality( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ @@ -465,13 +456,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 */ - Word32 *pcmFrameSize /* o : total size of the PCM output frame. This takes into account the number of output channels Q0 */ -); -#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 */ diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 4aa75e28b..7ebdf41e4 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -55,9 +55,6 @@ struct IVAS_DEC_VOIP { -#ifndef LIB_DEC_REVISION - UWord16 nSamplesFrame; /* Total number of samples in a frame (includes number of channels) */ -#endif JB4_HANDLE hJBM; UWord16 lastDecodedWasActive; JB4_DATAUNIT_HANDLE hCurrentDataUnit; /* Points to the currently processed data unit */ @@ -94,9 +91,6 @@ struct IVAS_DEC bool hasBeenFedFrame; bool updateOrientation; UWord16 nSamplesAvailableNext; -#ifndef LIB_DEC_REVISION - Word16 nSamplesRendered; -#endif Word16 nTransportChannelsOld; Word16 amrwb_rfc4867_flag; /* MIME from rfc4867 is used */ Word16 sdp_hf_only; /* RTP payload format parameter: only Header-Full format without zero padding for size collision avoidance */ @@ -113,32 +107,15 @@ struct IVAS_DEC * Local function declarations *---------------------------------------------------------------------*/ -#ifdef LIB_DEC_REVISION static void ivas_destroy_handle_VoIP_fx( 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 UWord32 systemTimestamp_ms, const UWord16 extBufferedSamples, const Word32 output_Fs ); #endif -#ifdef LIB_DEC_REVISION static ivas_error evs_dec_main_fx( Decoder_Struct *st_ivas ); -#else -static ivas_error evs_dec_main_fx( Decoder_Struct *st_ivas, const Word16 nOutSamples, Word32 *floatBuf, Word16 *pcmBuf ); -#endif static ivas_error input_format_API_to_internal( IVAS_DEC_INPUT_FORMAT input_format, Word16 *bitstream_format_internal, Word16 *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, UWord8 *nTransportChannels, const Word16 isSplitRend, ISAR_SPLIT_REND_BITS_DATA *splitRendBits ); static ivas_error apa_setup( IVAS_DEC_HANDLE hIvasDec, const bool isInitialized_voip, const UWord16 nTransportChannels ); -#else -static ivas_error IVAS_DEC_VoIP_reconfigure( IVAS_DEC_HANDLE hIvasDec, const UWord16 nTransportChannels, const UWord16 l_ts ); -static ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, UWord16 *nTcBufferGranularity, UWord8 *nTransportChannels ); -static ivas_error IVAS_DEC_GetTcSamples( IVAS_DEC_HANDLE hIvasDec, Word32 *pcmBuf_fx, Word16 *nOutSamples ); -static ivas_error IVAS_DEC_RendererFeedTcSamples( IVAS_DEC_HANDLE hIvasDec, const Word16 nSamplesForRendering, Word16 *nSamplesResidual, Word32 *pcmBuf ); -static ivas_error IVAS_DEC_GetRenderedSamples( IVAS_DEC_HANDLE hIvasDec, const UWord16 nSamplesForRendering, UWord16 *nSamplesRendered, UWord16 *nSamplesAvailableNext, Word16 *pcmBuf ); -static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( IVAS_DEC_HANDLE hIvasDec, Word16 *nSamplesBuffered ); -#endif static Word16 get_render_frame_size_ms( IVAS_RENDER_FRAMESIZE render_framesize ); static void update_voip_rendered20ms( IVAS_DEC_HANDLE hIvasDec, const Word16 nSamplesRendered ); static ivas_error isar_set_split_rend_setup( ISAR_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, const ISAR_SPLIT_REND_CONFIG_DATA *hSplitBinConfig, const COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, ISAR_SPLIT_REND_BITS_DATA *splitRendBits ); @@ -188,9 +165,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; @@ -422,11 +396,7 @@ void IVAS_DEC_Close( IF( ( *phIvasDec )->hVoIP ) { -#ifdef LIB_DEC_REVISION ivas_destroy_handle_VoIP_fx( ( *phIvasDec )->hVoIP ); -#else - IVAS_DEC_Close_VoIP( ( *phIvasDec )->hVoIP ); -#endif ( *phIvasDec )->hVoIP = NULL; } @@ -493,7 +463,6 @@ static IVAS_DEC_BS_FORMAT mapIvasFormat( return IVAS_DEC_BS_UNKOWN; } -#ifdef LIB_DEC_REVISION /*---------------------------------------------------------------------* * create_flush_buffer() @@ -516,7 +485,6 @@ static ivas_error create_flush_buffer_fx( return IVAS_ERR_OK; } -#endif /*---------------------------------------------------------------------* * IVAS_DEC_Configure( ) @@ -529,9 +497,6 @@ ivas_error IVAS_DEC_Configure( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const UWord32 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 */ @@ -602,9 +567,6 @@ ivas_error IVAS_DEC_Configure( move16(); } -#ifndef LIB_DEC_REVISION - hDecoderConfig->Opt_tsm = (Word16) tsmEnabled; -#endif hDecoderConfig->Opt_LsCustom = (Word16) customLsOutputEnabled; hDecoderConfig->Opt_Headrotation = (Word16) enableHeadRotation; hDecoderConfig->orientation_tracking = orientation_tracking; @@ -674,30 +636,6 @@ ivas_error IVAS_DEC_Configure( } hIvasDec->nSamplesFrame = (UWord16) Mpy_32_16_1( hDecoderConfig->output_Fs, INV_FRAME_PER_SEC_Q15 ); -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesAvailableNext = 0; - hIvasDec->nSamplesRendered = 0; - hIvasDec->tsm_scale = 100; - hIvasDec->tsm_max_scaling = 0; - hIvasDec->tsm_quality = ONE_IN_Q14 /*1.0f Q14*/; - move16(); - move16(); - move16(); - move16(); - move16(); - - /* init flush buffer if necessary (only needed for binaural)*/ - test(); - test(); - test(); - test(); - test(); - IF( tsmEnabled && ( EQ_32( outputConfig, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || EQ_32( outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_32( outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) ) - { - hIvasDec->flushbuffer = (void *) malloc( CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( Word16 ) ); - set16_fx( (Word16 *) hIvasDec->flushbuffer, 0, CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ); - } -#endif return IVAS_ERR_OK; } @@ -998,10 +936,6 @@ ivas_error IVAS_DEC_EnableVoIP( hIvasDec->hVoIP->lastDecodedWasActive = 0; move16(); hIvasDec->hVoIP->hCurrentDataUnit = NULL; -#ifndef LIB_DEC_REVISION - hIvasDec->hVoIP->nSamplesFrame = (UWord16) Mpy_32_16_1( hDecoderConfig->output_Fs, INV_FRAME_PER_SEC_Q15 ); - move16(); -#endif hIvasDec->hVoIP->nSamplesRendered20ms = 0; move16(); @@ -1033,20 +967,12 @@ ivas_error IVAS_DEC_EnableVoIP( } #endif -#ifdef LIB_DEC_REVISION /* init flush buffer (needed for binaural outputs) */ IF( ( error = create_flush_buffer_fx( hIvasDec ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in create_flush_buffer , code: %d\n", error ); return error; } -#else - IF( hIvasDec->flushbuffer == NULL && ( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) ) - { - hIvasDec->flushbuffer = (void *) malloc( CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( Word16 ) ); - set16_fx( (Word16 *) hIvasDec->flushbuffer, 0, CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ); - } -#endif return IVAS_ERR_OK; } @@ -1179,13 +1105,7 @@ ivas_error IVAS_DEC_FeedFrame_Serial( hIvasDec->needNewFrame = false; hIvasDec->hasBeenFedFrame = true; -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesRendered = 0; -#endif hIvasDec->nSamplesAvailableNext = hIvasDec->nSamplesFrame; -#ifndef LIB_DEC_REVISION - move16(); -#endif move16(); move16(); move16(); @@ -1200,11 +1120,7 @@ ivas_error IVAS_DEC_FeedFrame_Serial( * 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 Word16 nSamplesAsked, /* i : number of samples wanted by the caller */ Word16 *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 Q0 */ @@ -1213,9 +1129,6 @@ ivas_error IVAS_DEC_GetSamples( ) { ivas_error error; -#ifndef LIB_DEC_REVISION - Word16 nSamplesToRender; -#endif UWord16 nSamplesRendered, nSamplesRendered_loop; UWord16 nOutChannels; Decoder_Struct *st_ivas; @@ -1311,9 +1224,6 @@ ivas_error IVAS_DEC_GetSamples( } ELSE { -#ifndef LIB_DEC_REVISION - { -#endif nOutChannels = (UWord8) st_ivas->hDecoderConfig->nchan_out; hIvasDec->hasBeenFedFrame = false; @@ -1323,23 +1233,14 @@ ivas_error IVAS_DEC_GetSamples( /* note: offset (rendered samples) is always 0 */ Copy( hIvasDec->flushbuffer, pcmBuf, imult1616( hIvasDec->nSamplesFlushed, nOutChannels ) ); -#ifdef LIB_DEC_REVISION nSamplesRendered = hIvasDec->nSamplesFlushed; -#else - nSamplesRendered = add( nSamplesRendered, hIvasDec->nSamplesFlushed ); -#endif hIvasDec->nSamplesFlushed = 0; move16(); move16(); } /* render IVAS frames directly to the output buffer */ -#ifdef LIB_DEC_REVISION IF( ( error = ivas_jbm_dec_render_fx( st_ivas, sub( nSamplesAsked, nSamplesRendered ), &nSamplesRendered_loop, &hIvasDec->nSamplesAvailableNext, pcmBuf + imult3216( nSamplesRendered, nOutChannels ) ) ) != IVAS_ERR_OK ) -#else - nSamplesToRender = sub( nSamplesAsked, nSamplesRendered ); - IF( NE_32( ( error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesRendered_loop, &hIvasDec->nSamplesAvailableNext, pcmBuf + imult3216( nSamplesRendered, nOutChannels ) ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -1359,9 +1260,6 @@ ivas_error IVAS_DEC_GetSamples( *needNewFrame = false; move16(); } -#endif -#ifndef LIB_DEC_REVISION - } #endif } @@ -1502,11 +1400,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( } /* Decode and render */ -#ifdef LIB_DEC_REVISION IF( ( error = IVAS_DEC_GetSamplesRenderer( hIvasDec, numSamplesPerChannelToDecode, pcmBuf_out, nOutSamples, needNewFrame ) ) != IVAS_ERR_OK ) -#else - IF( ( error = IVAS_DEC_GetSamples( hIvasDec, numSamplesPerChannelToDecode, pcmBuf_out, nOutSamples, needNewFrame ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1665,7 +1559,6 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( } -#ifdef LIB_DEC_REVISION /*---------------------------------------------------------------------* * ivas_dec_setup_all() * @@ -1678,19 +1571,6 @@ static ivas_error ivas_dec_setup_all( const Word16 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 */ - UWord16 *nTcBufferGranularity, /* o : granularity of the TC Buffer */ - UWord8 *nTransportChannels /* o : number of decoded transport PCM channels */ -) -#endif { ivas_error error; @@ -1712,7 +1592,6 @@ static ivas_error IVAS_DEC_Setup( st_ivas = hIvasDec->st_ivas; -#ifdef LIB_DEC_REVISION /* Setup IVAS split rendering */ IF( isSplitRend ) { @@ -1722,7 +1601,6 @@ static ivas_error IVAS_DEC_Setup( } } -#endif /*----------------------------------------------------------------* * IVAS decoder setup * - read IVAS format signaling @@ -1741,10 +1619,6 @@ static ivas_error IVAS_DEC_Setup( } *nTransportChannels = (UWord8) st_ivas->hTcBuffer->nchan_transport_jbm; -#ifndef LIB_DEC_REVISION - *nTcBufferGranularity = (UWord16) st_ivas->hTcBuffer->n_samples_granularity; - move16(); -#endif move16(); /*-----------------------------------------------------------------* @@ -1754,11 +1628,7 @@ static ivas_error IVAS_DEC_Setup( *-----------------------------------------------------------------*/ test(); -#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 ) { @@ -1779,261 +1649,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 */ - Word32 *pcmBuf_fx, /* 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 Q11 */ - Word16 *nOutSamples /* o : number of samples per channel written to output buffer */ -) -{ - Decoder_Struct *st_ivas; - ivas_error error; - - test(); - IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - st_ivas = hIvasDec->st_ivas; - - *nOutSamples = (Word16) Mpy_32_16_1( st_ivas->hDecoderConfig->output_Fs, INV_FRAME_PER_SEC_Q15 ); - move16(); - - IF( EQ_16( (Word16) hIvasDec->mode, IVAS_DEC_MODE_EVS ) ) - { -#ifdef LIB_DEC_REVISION - pcmBuf_fx[0] = 0; // TODO !!! - IF( NE_32( ( error = evs_dec_main_fx( st_ivas ) ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( error = evs_dec_main_fx( st_ivas, *nOutSamples, pcmBuf_fx, NULL ) ), IVAS_ERR_OK ) ) -#endif - { - return error; - } - } - ELSE IF( EQ_16( (Word16) hIvasDec->mode, IVAS_DEC_MODE_IVAS ) ) - { - /* run the main IVAS decoding routine */ - /*------------------------flt 2 fix----------------------*/ - Word16 n; - Decoder_State *st, **sts; /* used for bitstream handling */ - Word16 nCPE, cpe_id; - nCPE = st_ivas->nCPE; - - IF( st_ivas->hDecoderConfig->Opt_tsm == 0 ) - { - FOR( n = 0; n < ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) - { - set32_fx( st_ivas->p_output_fx[n], 0, L_FRAME48k ); - st_ivas->hTcBuffer->tc_fx[n] = st_ivas->p_output_fx[n]; // Q11 - } - } - - - CPE_DEC_HANDLE hCPE; - test(); - test(); - test(); - test(); - test(); - IF( ( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) || EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) || ( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_FORMAT ) ) || EQ_32( st_ivas->mc_mode, MC_MODE_PARAMMC ) ) && ( GT_16( st_ivas->nCPE, 1 ) ) ) - { - - nCPE = st_ivas->nCPE; - move16(); - FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - hCPE = st_ivas->hCPE[cpe_id]; - sts = hCPE->hCoreCoder; - - - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - st = hCPE->hCoreCoder[n]; - IF( st->hTcxDec ) - st->hTcxDec->conNoiseLevelIndex = st->hTcxDec->NoiseLevelIndex_bfi; - IF( st->hTcxDec ) - st->hTcxDec->conCurrLevelIndex = st->hTcxDec->CurrLevelIndex_bfi; - } - } - } - - /* Function call: ivas_jbm_dec_tc function */ -#ifdef LIB_DEC_REVISION - IF( NE_32( ( error = ivas_jbm_dec_tc_fx( st_ivas ) ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( error = ivas_jbm_dec_tc_fx( st_ivas, pcmBuf_fx ) ), IVAS_ERR_OK ) ) -#endif - { - return error; - } - - hIvasDec->isInitialized = true; /* Initialization done in ivas_dec() */ - - test(); - test(); - test(); - test(); - test(); - test(); - IF( ( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) || EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) || ( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_FORMAT ) ) || EQ_32( st_ivas->mc_mode, MC_MODE_PARAMMC ) ) && ( GT_16( st_ivas->nCPE, 1 ) ) ) - { - FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) - { - hCPE = st_ivas->hCPE[cpe_id]; - sts = hCPE->hCoreCoder; - FOR( n = 0; n < 2; n++ ) - { - - /*-------------------cldfb-start-------------------------*/ - /*note : cldfb_size here signifies the original size which was assigned to cldfb_state_fx buffer not its current size*/ - IF( sts[n]->cldfbAna != NULL ) - { - scale_sig32( sts[n]->cldfbAna->cldfb_state_fx, sts[n]->cldfbAna->cldfb_size, sub( Q11, Q10 ) ); // Q11 - sts[n]->cldfbAna->Q_cldfb_state = Q11; - move16(); - } - IF( sts[n]->cldfbSyn != NULL ) - { - scale_sig32( sts[n]->cldfbSyn->cldfb_state_fx, sts[n]->cldfbSyn->cldfb_size, sub( Q11, Q4 ) ); // Q11 - sts[n]->cldfbSyn->Q_cldfb_state = Q11; - move16(); - } - /*-------------------cldfb-end---------------------------*/ - } - } - } - } - - if ( hIvasDec->hasBeenFedFirstGoodFrame ) - { - hIvasDec->hasDecodedFirstGoodFrame = true; - move16(); - } - - 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 Word16 nSamplesForRendering, /* i : number of TC samples wanted from the renderer */ - Word16 *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call */ - Word32 *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 Q11*/ -) -{ - Decoder_Struct *st_ivas; - - test(); - 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_fx( 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 UWord16 nSamplesForRendering, /* i : number of TC samples wanted from the renderer */ - UWord16 *nSamplesRendered, /* o : number of samples rendered */ - UWord16 *nSamplesAvailableNext, /* o : number of samples still available in the renerer pipeline */ - Word16 *pcmBuf /* o : output synthesis signal Q0 */ -) -{ - Decoder_Struct *st_ivas; - ivas_error error; - - test(); - 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 - UWord16 nSamplesRendered_loop = 0; - Word16 nOutChannels = st_ivas->hDecoderConfig->nchan_out; - move16(); - hIvasDec->hasBeenFedFrame = false; - - /* check for possible flushed samples from a rate switch */ - IF( hIvasDec->nSamplesFlushed > 0 ) - { - /* note: offset (rendered samples) is always 0 */ - Copy( hIvasDec->flushbuffer, pcmBuf, hIvasDec->nSamplesFlushed * nOutChannels ); - - *nSamplesRendered = hIvasDec->nSamplesFlushed; - hIvasDec->nSamplesFlushed = 0; - move16(); - move16(); - } - - /* run the main IVAS decoding routine */ - error = ivas_jbm_dec_render_fx( st_ivas, nSamplesForRendering - *nSamplesRendered, &nSamplesRendered_loop, nSamplesAvailableNext, pcmBuf + ( *nSamplesRendered * nOutChannels ) ); - - *nSamplesRendered = add( *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 */ - Word16 *nSamplesBuffered /* o : number of samples still buffered */ -) -{ - *nSamplesBuffered = 0; - move16(); - - test(); - 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 = sub( hIvasDec->st_ivas->hTcBuffer->n_samples_buffered, hIvasDec->st_ivas->hTcBuffer->n_samples_rendered ); - *nSamplesBuffered = add( *nSamplesBuffered, hIvasDec->hVoIP->nSamplesRendered20ms ); - move16(); - } - - return IVAS_ERR_OK; -} -#endif /*---------------------------------------------------------------------* * IVAS_DEC_GetNumObjects( ) @@ -3234,40 +2849,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 */ - Word32 *pcmFrameSize /* o : total size of the PCM output frame. This takes into account the number of output channels Q0 */ -) -{ - test(); - test(); - IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL || pcmFrameSize == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - IF( hIvasDec->hasDecodedFirstGoodFrame ) - { - *pcmFrameSize = Mult_32_16( imult3216( hIvasDec->st_ivas->hDecoderConfig->output_Fs, hIvasDec->st_ivas->hDecoderConfig->nchan_out ), INV_FRAME_PER_SEC_Q15 ); - } - ELSE - { - *pcmFrameSize = 0; - } - move32(); - - return IVAS_ERR_OK; -} - -#endif /*---------------------------------------------------------------------* @@ -3490,7 +3071,6 @@ ivas_error IVAS_DEC_VoIP_SetScale( } #ifdef VARIABLE_SPEED_DECODING -#ifdef LIB_DEC_REVISION /*---------------------------------------------------------------------* * IVAS_DEC_EnableTsm( ) @@ -3533,7 +3113,6 @@ ivas_error IVAS_DEC_EnableTsm( return IVAS_ERR_OK; } -#endif /*---------------------------------------------------------------------* * IVAS_DEC_TSM_SetQuality( ) @@ -3855,12 +3434,10 @@ ivas_error IVAS_DEC_GetSamplesDecoder( { ivas_error error; Decoder_Struct *st_ivas; -#ifdef LIB_DEC_REVISION UWord16 nTimeScalerOutSamples; UWord8 nTransportChannels; Word16 nResidualSamples, nSamplesTcsScaled; bool isInitialized_voip; -#endif IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { @@ -3877,14 +3454,11 @@ ivas_error IVAS_DEC_GetSamplesDecoder( st_ivas = hIvasDec->st_ivas; -#ifdef LIB_DEC_REVISION isInitialized_voip = hIvasDec->apaExecBuffer_fx != NULL; -#endif test(); IF( !hIvasDec->isInitialized || hIvasDec->hasBeenFedFrame ) /* wait for the first good frame */ { -#ifdef LIB_DEC_REVISION /*-----------------------------------------------------------------* * Setup all decoder parts (IVAS decoder, ISAR) *-----------------------------------------------------------------*/ @@ -3893,34 +3467,7 @@ ivas_error IVAS_DEC_GetSamplesDecoder( { return error; } -#else - UWord16 l_ts, nTimeScalerOutSamples; - UWord8 nTransportChannels; - Word16 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 && NE_16( 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 *-----------------------------------------------------------------*/ @@ -3948,13 +3495,6 @@ ivas_error IVAS_DEC_GetSamplesDecoder( hIvasDec->hasDecodedFirstGoodFrame = true; move16(); } -#else - /* IVAS TC decoder */ - IF( ( error = IVAS_DEC_GetTcSamples( hIvasDec, hIvasDec->apaExecBuffer_fx, &nOutSamplesElse ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif /*-----------------------------------------------------------------* * JBM @@ -3962,7 +3502,6 @@ ivas_error IVAS_DEC_GetSamplesDecoder( IF( st_ivas->hDecoderConfig->Opt_tsm ) { -#ifdef LIB_DEC_REVISION IF( NE_16( nTransportChannels, hIvasDec->nTransportChannelsOld ) ) { IF( ( error = apa_setup( hIvasDec, isInitialized_voip, nTransportChannels ) ) != IVAS_ERR_OK ) @@ -3971,16 +3510,13 @@ ivas_error IVAS_DEC_GetSamplesDecoder( } } -#endif IF( apa_set_scale_fx( hIvasDec->hTimeScaler, hIvasDec->tsm_scale ) != 0 ) { return IVAS_ERR_UNKNOWN; } -#ifdef LIB_DEC_REVISION ivas_syn_output_f_fx( st_ivas->p_output_fx, hIvasDec->nSamplesFrame, nTransportChannels, hIvasDec->apaExecBuffer_fx ); -#endif // tmp apaExecBuffer IF( EQ_16( (Word16) hIvasDec->mode, IVAS_DEC_MODE_EVS ) ) @@ -4023,14 +3559,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_fx( st_ivas, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer_fx ); -#else - IF( ( error = IVAS_DEC_RendererFeedTcSamples( hIvasDec, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer_fx ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif IF( st_ivas->hDecoderConfig->Opt_tsm ) { @@ -4693,7 +4222,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( nSamplesBuffered = 0; move16(); -#ifdef LIB_DEC_REVISION IF( hIvasDec->hasBeenFedFirstGoodFrame ) { /* check if the TC buffer already exists, otherweise nothing is buffered anyway */ @@ -4704,15 +4232,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( nSamplesBuffered = add( nSamplesBuffered, hVoIP->nSamplesRendered20ms ); } } -#else - IF( hIvasDec->hasBeenFedFirstGoodFrame ) - { - IF( NE_32( ( error = IVAS_DEC_GetBufferedNumberOfSamples( hIvasDec, &nSamplesBuffered ) ), IVAS_ERR_OK ) ) - { - return error; - } - } -#endif extBufferedSamples = nSamplesBuffered; move16(); @@ -4836,10 +4355,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( IF( !hIvasDec->hasBeenFedFirstGoodFrame ) { hIvasDec->nSamplesAvailableNext = hIvasDec->nSamplesFrame; -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesRendered = 0; - move16(); -#endif move16(); } } @@ -4852,9 +4367,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( Word16 nSamplesToZero = s_min( nSamplesPerChannel, hIvasDec->nSamplesAvailableNext ); set16_fx( pcmBuf + imult1616( *nSamplesRendered, nOutChannels ), 0, imult1616( nSamplesToZero, nOutChannels ) ); *nSamplesRendered = add( *nSamplesRendered, nSamplesToZero ); -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesRendered = add( hIvasDec->nSamplesRendered, nSamplesToZero ); -#endif hIvasDec->nSamplesAvailableNext = sub( hIvasDec->nSamplesAvailableNext, nSamplesToZero ); move16(); move16(); @@ -4872,18 +4384,11 @@ ivas_error IVAS_DEC_VoIP_GetSamples( test(); IF( hIvasDec->nSamplesAvailableNext == 0 || EQ_16( 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; - move16(); -#endif *bitstreamReadDone = false; move16(); *parametersAvailableForEditing = true; @@ -4904,11 +4409,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples( } /* render IVAS frames directly to the output buffer */ -#ifdef LIB_DEC_REVISION IF( NE_32( ( error = IVAS_DEC_GetSamplesRenderer( hIvasDec, nSamplesToRender, pcmBuf + imult1616( *nSamplesRendered, nOutChannels ), &nSamplesRendered_loop, &tmp ) ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, pcmBuf + imult1616( *nSamplesRendered, nOutChannels ), &nSamplesRendered_loop, &tmp ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -4937,11 +4438,7 @@ static void update_voip_rendered20ms( nSamplesRenderedTotal = add( hIvasDec->hVoIP->nSamplesRendered20ms, nSamplesRendered ); /* we have crossed a 20ms border, reset the time scaling done flag */ -#ifdef LIB_DEC_REVISION IF( GE_16( nSamplesRenderedTotal, hIvasDec->nSamplesFrame ) ) -#else - IF( GE_16( nSamplesRenderedTotal, hIvasDec->hVoIP->nSamplesFrame ) ) -#endif { hIvasDec->timeScalingDone = 0; move16(); @@ -4950,17 +4447,9 @@ static void update_voip_rendered20ms( /* float code was: hIvasDec->hVoIP->nSamplesRendered20ms = nSamplesRenderedTotal % hIvasDec->hVoIP->nSamplesFrame; */ hIvasDec->hVoIP->nSamplesRendered20ms = nSamplesRenderedTotal; move16(); -#ifdef LIB_DEC_REVISION WHILE( GE_16( hIvasDec->hVoIP->nSamplesRendered20ms, hIvasDec->nSamplesFrame ) ) -#else - WHILE( GE_16( hIvasDec->hVoIP->nSamplesRendered20ms, hIvasDec->hVoIP->nSamplesFrame ) ) -#endif { -#ifdef LIB_DEC_REVISION hIvasDec->hVoIP->nSamplesRendered20ms = sub( hIvasDec->hVoIP->nSamplesRendered20ms, hIvasDec->nSamplesFrame ); -#else - hIvasDec->hVoIP->nSamplesRendered20ms = sub( hIvasDec->hVoIP->nSamplesRendered20ms, hIvasDec->hVoIP->nSamplesFrame ); -#endif } return; @@ -5004,11 +4493,7 @@ ivas_error IVAS_DEC_Flush( test(); IF( GT_16( nSamplesToRender, 0 ) && NE_16( (Word16) hIvasDec->st_ivas->ivas_format, (Word16) MONO_FORMAT ) ) { -#ifdef LIB_DEC_REVISION error = ivas_jbm_dec_render_fx( hIvasDec->st_ivas, nSamplesToRender, &nSamplesFlushedLocal, &hIvasDec->nSamplesAvailableNext, pcmBuf ); -#else - error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesFlushedLocal, &hIvasDec->nSamplesAvailableNext, pcmBuf ); -#endif } ELSE { @@ -5074,11 +4559,7 @@ ivas_error IVAS_DEC_VoIP_Get_CA_offset( * Deallocate VoIP handle *---------------------------------------------------------------------*/ -#ifdef LIB_DEC_REVISION static void ivas_destroy_handle_VoIP_fx( -#else -static void IVAS_DEC_Close_VoIP( -#endif IVAS_DEC_VOIP *hVoIP /* i/o: IVAS decoder handle */ ) { @@ -5437,22 +4918,12 @@ void IVAS_DEC_PrintDisclaimer( void ) static ivas_error evs_dec_main_fx( Decoder_Struct *st_ivas -#ifndef LIB_DEC_REVISION - , - const Word16 nOutSamples, - Word32 *Buf_fx, // Q11 - Word16 *pcmBuf // Q0 -#endif ) { DEC_CORE_HANDLE *hCoreCoder; Word16 mixer_left_fx, mixer_right_fx; Word32 *p_output_fx[MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN]; -#ifdef LIB_DEC_REVISION Word16 ch, i, nOutSamples; -#else - Word16 ch, n, i; -#endif Word16 output_16[L_FRAME48k]; ivas_error error; @@ -5461,10 +4932,8 @@ static ivas_error evs_dec_main_fx( move32(); hCoreCoder[0]->output_frame_fx = extract_l( Mult_32_16( hCoreCoder[0]->output_Fs, INV_FRAME_PER_SEC_Q15 ) ); // Q0 move16(); -#ifdef LIB_DEC_REVISION nOutSamples = hCoreCoder[0]->output_frame_fx; move16(); -#endif mdct_switching_dec_fx( hCoreCoder[0] ); @@ -5532,7 +5001,6 @@ static ivas_error evs_dec_main_fx( v_multc_fx_16( p_output_fx[0], mixer_left_fx, p_output_fx[0], nOutSamples ); /* Q11 */ } -#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 */ @@ -5551,35 +5019,6 @@ static ivas_error evs_dec_main_fx( ivas_jbm_dec_copy_tc_no_tsm_fx( st_ivas, p_output_fx, nOutSamples ); } #endif -#else - IF( !st_ivas->hDecoderConfig->Opt_tsm ) - { - ivas_jbm_dec_copy_tc_no_tsm_fx( st_ivas, p_output_fx, nOutSamples ); - } - ELSE IF( Buf_fx != NULL ) - { - FOR( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) - { - FOR( i = 0; i < nOutSamples; i++ ) - { - Buf_fx[i * st_ivas->hDecoderConfig->nchan_out + n] = p_output_fx[n][i]; /* Does the same as above */ /* Q11 */ - move32(); - } - } - } - ELSE - { - /* ivas_syn_output( p_output, nOutSamples, st_ivas->hDecoderConfig->nchan_out, pcmBuf ); */ - FOR( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) - { - FOR( i = 0; i < nOutSamples; i++ ) - { - pcmBuf[i * st_ivas->hDecoderConfig->nchan_out + n] = extract_l( L_shr( p_output_fx[n][i], Q11 ) ); /* Does the same as above */ /* Q0 */ - move16(); - } - } - } -#endif return IVAS_ERR_OK; } @@ -5634,7 +5073,6 @@ static ivas_error input_format_API_to_internal( } -#ifdef LIB_DEC_REVISION /*---------------------------------------------------------------------* * apa_setup() * @@ -5645,40 +5083,17 @@ static ivas_error apa_setup( IVAS_DEC_HANDLE hIvasDec, const bool isInitialized_voip, const UWord16 nTransportChannels ) -#else -/*---------------------------------------------------------------------* - * IVAS_DEC_VoIP_reconfigure() - * - * - *---------------------------------------------------------------------*/ - -static ivas_error IVAS_DEC_VoIP_reconfigure( - IVAS_DEC_HANDLE hIvasDec, - const UWord16 nTransportChannels, - const UWord16 l_ts ) -#endif { Word16 apa_buffer_size; -#ifdef LIB_DEC_REVISION UWord16 l_ts; l_ts = (UWord16) hIvasDec->st_ivas->hTcBuffer->n_samples_granularity; move16(); IF( !isInitialized_voip ) -#else - apa_buffer_size = hIvasDec->nSamplesFrame; - move16(); - - IF( hIvasDec->apaExecBuffer_fx == NULL ) -#endif { DECODER_CONFIG_HANDLE hDecoderConfig; -#ifndef LIB_DEC_REVISION - IF( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) - { -#endif UWord16 wss, css; Word32 startQuality; @@ -5743,14 +5158,8 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( } set_zero2_fx( hIvasDec->apaExecBuffer_fx, L_mult0( apa_buffer_size, (Word16) 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; } @@ -5762,10 +5171,6 @@ IF( ( hIvasDec->apaExecBuffer_fx = malloc( sizeof( Word32 ) * L_mult0( apa_buffe return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); } set_zero2_fx( hIvasDec->apaExecBuffer_fx, L_mult0( apa_buffer_size, (Word16) nTransportChannels ) ); -#ifndef LIB_DEC_REVISION -} -/* realloc apa_exe_buffer */ -#endif } hIvasDec->nTransportChannelsOld = nTransportChannels; -- GitLab From 660f44434e6e5cbd0bde914ecfbef4a388e7bd6d Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:22:28 +0100 Subject: [PATCH 09/16] [cleanup] accept NONBE_1293_CRASH_FIRST_FRAME_LOST --- apps/isar_post_rend.c | 18 ----------- lib_com/options.h | 1 - lib_dec/lib_dec_fx.c | 43 ------------------------- 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, 82 deletions(-) diff --git a/apps/isar_post_rend.c b/apps/isar_post_rend.c index 53417cf15..aa799c3f2 100644 --- a/apps/isar_post_rend.c +++ b/apps/isar_post_rend.c @@ -992,9 +992,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; @@ -1003,11 +1001,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 ) @@ -1074,24 +1068,13 @@ 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 ) @@ -1100,7 +1083,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 643988648..34995cf1b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -102,7 +102,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_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 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.*/ diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 7ebdf41e4..1e2516534 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1201,26 +1201,10 @@ ivas_error IVAS_DEC_GetSamplesRenderer( hIvasDec->hasBeenFedFrame = false; move16(); set16_fx( pcmBuf, 0, imult1616( st_ivas->hDecoderConfig->nchan_out, nSamplesAsked ) ); -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST nSamplesRendered = nSamplesAsked; move16(); -#else - hIvasDec->nSamplesRendered = add( hIvasDec->nSamplesRendered, nSamplesAsked ); - move16(); - *nOutSamples = nSamplesAsked; - move16(); -#endif hIvasDec->nSamplesAvailableNext = sub( hIvasDec->nSamplesAvailableNext, nSamplesAsked ); move16(); -#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST - IF( hIvasDec->nSamplesAvailableNext == 0 ) - { - hIvasDec->needNewFrame = true; - *needNewFrame = true; - move16(); - move16(); - } -#endif } ELSE { @@ -1246,24 +1230,8 @@ ivas_error IVAS_DEC_GetSamplesRenderer( } nSamplesRendered = add( nSamplesRendered, nSamplesRendered_loop ); -#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST - nSamplesToRender = sub( nSamplesToRender, nSamplesRendered_loop ); - IF( hIvasDec->nSamplesAvailableNext == 0 ) - { - *needNewFrame = true; - hIvasDec->needNewFrame = true; - move16(); - move16(); - } - ELSE - { - *needNewFrame = false; - move16(); - } -#endif } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST IF( hIvasDec->nSamplesAvailableNext == 0 ) { *needNewFrame = true; @@ -1276,7 +1244,6 @@ ivas_error IVAS_DEC_GetSamplesRenderer( *needNewFrame = false; move16(); } -#endif *nOutSamples = nSamplesRendered; move16(); @@ -1405,12 +1372,10 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( return error; } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST IF( !hIvasDec->hasBeenFedFirstGoodFrame ) { return IVAS_ERR_OK; } -#endif FOR( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i ) { @@ -3444,13 +3409,11 @@ ivas_error IVAS_DEC_GetSamplesDecoder( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST test(); IF( !hIvasDec->hasBeenFedFirstGoodFrame && !hIvasDec->isInitialized ) /* note: 'isInitialized' is related to EVS decoder */ { return IVAS_ERR_OK; } -#endif st_ivas = hIvasDec->st_ivas; @@ -3657,7 +3620,6 @@ 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; @@ -3665,7 +3627,6 @@ ivas_error IVAS_DEC_GetEditableParameters( return IVAS_ERR_OK; } -#endif st_ivas = hIvasDec->st_ivas; ism_mode = st_ivas->ism_mode; @@ -3849,12 +3810,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; @@ -4138,10 +4097,8 @@ ivas_error IVAS_DEC_PrepareRenderer( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST test(); IF( hIvasDec->hasBeenFedFirstGoodFrame || hIvasDec->isInitialized ) /* note: 'isInitialized' is related to EVS decoder */ -#endif { ivas_dec_prepare_renderer_fx( hIvasDec->st_ivas ); } diff --git a/lib_isar/lib_isar_post_rend.c b/lib_isar/lib_isar_post_rend.c index 8178663ce..6b6388261 100644 --- a/lib_isar/lib_isar_post_rend.c +++ b/lib_isar/lib_isar_post_rend.c @@ -1575,7 +1575,6 @@ static ivas_error renderSplitBinauralWithPostRot( ELSE { -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST IF( splitBinInput->numCachedSamples == 0 ) { numSamplesPerChannelCacheSize = (Word16) ( *splitBinInput->base.ctx.pOutSampleRate * bits.isar_frame_size_ms / 1000 ) - outAudio.config.numSamplesPerChannel; @@ -1586,7 +1585,6 @@ static ivas_error renderSplitBinauralWithPostRot( { splitBinInput->numCachedSamples = sub( 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 871411616..75fd30d88 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]; @@ -399,13 +391,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 6b36c7e6c8d024b1d3cbed4446b82108d8a8f61a Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:22:31 +0100 Subject: [PATCH 10/16] [cleanup] accept NONBE_1303_REND_GRANULARITY --- lib_com/ivas_prot_fx.h | 9 ---- lib_com/options.h | 1 - lib_dec/ivas_init_dec_fx.c | 39 --------------- lib_dec/ivas_ism_dec_fx.c | 4 -- lib_dec/ivas_ism_param_dec_fx.c | 15 ------ lib_dec/ivas_jbm_dec_fx.c | 33 ------------ lib_dec/ivas_masa_dec_fx.c | 14 ------ lib_dec/ivas_mc_param_dec_fx.c | 6 --- lib_dec/ivas_mc_paramupmix_dec_fx.c | 6 --- lib_dec/ivas_mct_dec_fx.c | 5 -- lib_dec/ivas_objectRenderer_internal_fx.c | 6 --- lib_dec/ivas_sba_dec_fx.c | 50 ------------------- lib_dec/ivas_spar_decoder_fx.c | 14 ------ lib_dec/lib_dec_fx.c | 37 -------------- .../ivas_dirac_dec_binaural_functions_fx.c | 20 -------- 15 files changed, 259 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 417bb540a..e75cb9805 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1008,20 +1008,11 @@ Word16 IGF_MapBitRateToIndex( const Word16 rf_mode /* i : flag to signal the RF mode */ ); -#ifdef NONBE_1303_REND_GRANULARITY Word16 ivas_jbm_dec_get_render_granularity_fx( 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 -Word16 ivas_jbm_dec_get_render_granularity( - const RENDERER_TYPE rendererType, /* i : renderer type */ - const IVAS_FORMAT ivas_format, /* i : ivas format */ - const MC_MODE mc_mode, /* i : MC mode */ - const Word32 output_Fs /* i : sampling rate */ -); -#endif void stereo_dft_config_fx( STEREO_DFT_CONFIG_DATA_HANDLE hConfig, /* o : DFT stereo configuration */ diff --git a/lib_com/options.h b/lib_com/options.h index 34995cf1b..088191275 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -103,7 +103,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 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 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_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_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index d71a43691..39b41c199 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -2559,15 +2559,6 @@ ivas_error ivas_init_decoder_fx( return error; } } -#ifndef NONBE_1303_REND_GRANULARITY - granularity = NS2SA_FX2( output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); - n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas ); - - IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( 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( EQ_32( st_ivas->renderer_type, RENDERER_MC ) ) { @@ -2611,30 +2602,6 @@ ivas_error ivas_init_decoder_fx( st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; move32(); -#ifndef NONBE_1303_REND_GRANULARITY - test(); - IF( ( EQ_32( st_ivas->ivas_format, MC_FORMAT ) ) && ( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) ) - { - granularity = NS2SA_FX2( output_Fs, CLDFB_SLOT_NS ); - n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas ); - - IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( 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_FX2( output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); - - n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas ); - - IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( 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( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) @@ -2921,16 +2888,10 @@ ivas_error ivas_init_decoder_fx( 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_fx( st_ivas->renderer_type, ivas_renderer_secondary_select_fx( st_ivas ), output_Fs ); n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas ); IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, ivas_jbm_dec_get_tc_buffer_mode_fx( 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_fx( st_ivas ); - - IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, ivas_jbm_dec_get_tc_buffer_mode_fx( st_ivas ), n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, NS2SA_FX2( output_Fs, CLDFB_SLOT_NS ) ) ), IVAS_ERR_OK ) ) -#endif { return error; } diff --git a/lib_dec/ivas_ism_dec_fx.c b/lib_dec/ivas_ism_dec_fx.c index f225b793f..bfdd03873 100644 --- a/lib_dec/ivas_ism_dec_fx.c +++ b/lib_dec/ivas_ism_dec_fx.c @@ -142,11 +142,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( /* 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_fx( 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( LT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) ) { diff --git a/lib_dec/ivas_ism_param_dec_fx.c b/lib_dec/ivas_ism_param_dec_fx.c index 4821d5cdd..835e35fee 100644 --- a/lib_dec/ivas_ism_param_dec_fx.c +++ b/lib_dec/ivas_ism_param_dec_fx.c @@ -599,11 +599,7 @@ ivas_error ivas_param_ism_dec_open_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { -#ifdef NONBE_1303_REND_GRANULARITY Word16 i, granularity; -#else - Word16 i; -#endif PARAM_ISM_DEC_HANDLE hParamIsmDec; IVAS_OUTPUT_SETUP hOutSetup; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; @@ -767,9 +763,7 @@ ivas_error ivas_param_ism_dec_open_fx( st_ivas->hParamIsmDec = hParamIsmDec; st_ivas->hSpatParamRendCom = hSpatParamRendCom; -#ifdef NONBE_1303_REND_GRANULARITY granularity = ivas_jbm_dec_get_render_granularity_fx( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs ); -#endif test(); IF( NE_32( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) && NE_32( st_ivas->renderer_type, RENDERER_DISABLE ) ) @@ -816,11 +810,7 @@ ivas_error ivas_param_ism_dec_open_fx( IF( st_ivas->hTcBuffer == NULL ) { -#ifdef NONBE_1303_REND_GRANULARITY IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, nchan_full, granularity ) ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, nchan_full, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -833,12 +823,7 @@ ivas_error ivas_param_ism_dec_open_fx( IF( st_ivas->hTcBuffer == NULL ) { Word16 nchan_to_allocate = st_ivas->hDecoderConfig->nchan_out; -#ifdef NONBE_1303_REND_GRANULARITY IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_BUFFER, nchan_to_allocate, nchan_to_allocate, nchan_to_allocate, granularity ) ), IVAS_ERR_OK ) ) -#else - move16(); // NS2SA - IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_BUFFER, nchan_to_allocate, nchan_to_allocate, nchan_to_allocate, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ), IVAS_ERR_OK ) ) -#endif { return error; } diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index cd0146586..55d683344 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -3475,7 +3475,6 @@ static void ivas_jbm_dec_copy_tc( *--------------------------------------------------------------------------*/ /*! r: render granularity */ -#ifdef NONBE_1303_REND_GRANULARITY Word16 ivas_jbm_dec_get_render_granularity_fx( const RENDERER_TYPE renderer_type, /* i : renderer type */ const RENDERER_TYPE renderer_type_sec, /* i : secondary renderer type */ @@ -3505,38 +3504,6 @@ Word16 ivas_jbm_dec_get_render_granularity_fx( return render_granularity; } -#else -Word16 ivas_jbm_dec_get_render_granularity( - const RENDERER_TYPE rendererType, /* i : renderer type */ - const IVAS_FORMAT ivas_format, /* i : ivas format */ - const MC_MODE mc_mode, /* i : MC mode */ - const Word32 output_Fs /* i : sampling rate Q0*/ -) -{ - Word16 render_granularity; - - test(); - test(); - IF( EQ_32( rendererType, RENDERER_BINAURAL_OBJECTS_TD ) || EQ_32( rendererType, RENDERER_BINAURAL_MIXER_CONV ) || EQ_32( rendererType, RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) - { - test(); - IF( ( EQ_32( ivas_format, MC_FORMAT ) ) && ( EQ_32( mc_mode, MC_MODE_PARAMUPMIX ) ) ) - { - render_granularity = NS2SA_FX2( output_Fs, CLDFB_SLOT_NS ); - } - ELSE - { - render_granularity = NS2SA_FX2( output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); - } - } - ELSE - { - render_granularity = NS2SA_FX2( output_Fs, CLDFB_SLOT_NS ); - } - - return render_granularity; -} -#endif /*--------------------------------------------------------------------------* diff --git a/lib_dec/ivas_masa_dec_fx.c b/lib_dec/ivas_masa_dec_fx.c index fe3f7fee9..a26f64c8e 100644 --- a/lib_dec/ivas_masa_dec_fx.c +++ b/lib_dec/ivas_masa_dec_fx.c @@ -905,9 +905,7 @@ ivas_error ivas_masa_dec_open_fx( IF( st_ivas->hTcBuffer == NULL && NE_16( st_ivas->renderer_type, RENDERER_DISABLE ) && NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) && NE_16( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) { Word16 nchan_to_allocate, nchan_transport; -#ifdef NONBE_1303_REND_GRANULARITY Word16 granularity; -#endif TC_BUFFER_MODE buffer_mode; buffer_mode = TC_BUFFER_MODE_RENDERER; @@ -952,13 +950,9 @@ ivas_error ivas_masa_dec_open_fx( nchan_to_allocate = add( nchan_to_allocate, 1 ); } -#ifdef NONBE_1303_REND_GRANULARITY granularity = ivas_jbm_dec_get_render_granularity_fx( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs ); IF( ( error = ivas_jbm_dec_tc_buffer_open_fx( 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_fx( st_ivas, buffer_mode, nchan_transport, nchan_to_allocate, nchan_to_allocate, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1952,12 +1946,7 @@ ivas_error ivas_masa_dec_reconfigure_fx( TC_BUFFER_MODE buffer_mode_new; Word16 n_samples_granularity; -#ifdef NONBE_1303_REND_GRANULARITY n_samples_granularity = ivas_jbm_dec_get_render_granularity_fx( st_ivas->renderer_type, ivas_renderer_secondary_select_fx( st_ivas ), st_ivas->hDecoderConfig->output_Fs ); -#else - n_samples_granularity = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); - move16(); -#endif buffer_mode_new = ivas_jbm_dec_get_tc_buffer_mode_fx( st_ivas ); tc_nchan_transport = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas ); @@ -1997,9 +1986,6 @@ ivas_error ivas_masa_dec_reconfigure_fx( test(); IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) { -#ifndef NONBE_1303_REND_GRANULARITY - n_samples_granularity = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); /* Use the same granularity as tdrend */ -#endif IF( GT_16( n_samples_granularity, st_ivas->hTcBuffer->n_samples_granularity ) ) { IF( NE_32( ( error = ivas_jbm_dec_set_discard_samples_fx( st_ivas ) ), IVAS_ERR_OK ) ) diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index 2a5b0020e..f289ec05a 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -496,9 +496,7 @@ ivas_error ivas_param_mc_dec_open_fx( IF( NE_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_MONO_STEREO ) ) { Word16 n_cldfb_slots; -#ifdef NONBE_1303_REND_GRANULARITY Word16 granularity; -#endif n_cldfb_slots = DEFAULT_JBM_CLDFB_TIMESLOTS; move16(); @@ -529,13 +527,9 @@ ivas_error ivas_param_mc_dec_open_fx( IF( st_ivas->hTcBuffer == NULL ) { -#ifdef NONBE_1303_REND_GRANULARITY granularity = ivas_jbm_dec_get_render_granularity_fx( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs ); IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, 0, granularity ) ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, 0, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ), IVAS_ERR_OK ) ) -#endif { return error; } diff --git a/lib_dec/ivas_mc_paramupmix_dec_fx.c b/lib_dec/ivas_mc_paramupmix_dec_fx.c index d28ba8328..75b9de19e 100644 --- a/lib_dec/ivas_mc_paramupmix_dec_fx.c +++ b/lib_dec/ivas_mc_paramupmix_dec_fx.c @@ -408,9 +408,7 @@ ivas_error ivas_mc_paramupmix_dec_open( { Word16 nchan_to_allocate; Word16 nchan_tc; -#ifdef NONBE_1303_REND_GRANULARITY Word16 granularity; -#endif TC_BUFFER_MODE buffer_mode; buffer_mode = TC_BUFFER_MODE_RENDERER; @@ -437,13 +435,9 @@ ivas_error ivas_mc_paramupmix_dec_open( move16(); } -#ifdef NONBE_1303_REND_GRANULARITY granularity = ivas_jbm_dec_get_render_granularity_fx( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs ); IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, granularity ) ), IVAS_ERR_OK ) ) -#else - IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ), IVAS_ERR_OK ) ) -#endif { return error; } diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index 027299b99..7881c2976 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -982,12 +982,7 @@ static ivas_error ivas_mc_dec_reconfig_fx( /* 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_fx( 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 ); - move16(); -#endif IF( LT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) ) { /* flush already done in IVAS_DEC_ReadFormat() */ diff --git a/lib_dec/ivas_objectRenderer_internal_fx.c b/lib_dec/ivas_objectRenderer_internal_fx.c index 0e30c9323..23d8ce17e 100644 --- a/lib_dec/ivas_objectRenderer_internal_fx.c +++ b/lib_dec/ivas_objectRenderer_internal_fx.c @@ -62,14 +62,8 @@ ivas_error ivas_td_binaural_open_fx( move16(); } -#ifdef NONBE_1303_REND_GRANULARITY test(); 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_fx.c b/lib_dec/ivas_sba_dec_fx.c index ea7e100a1..ebaadb47c 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -183,58 +183,8 @@ ivas_error ivas_sba_dec_reconfigure_fx( test(); IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) && ( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) ) { -#ifndef NONBE_1303_REND_GRANULARITY - RENDERER_TYPE renderer_type_new; - Word16 sba_order_internal; - - sba_order_internal = s_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( LE_16( ivas_get_sba_num_TCs_fx( ivas_total_brate, sba_order_internal ), 2 ) ) - { - IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) - { - renderer_type_new = RENDERER_BINAURAL_PARAMETRIC; - move16(); - } - ELSE - { - renderer_type_new = RENDERER_BINAURAL_PARAMETRIC_ROOM; - move16(); - } - } - ELSE - { - test(); - test(); - test(); - IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) - { - renderer_type_new = RENDERER_BINAURAL_FASTCONV; - move16(); - } - ELSE - { - renderer_type_new = RENDERER_BINAURAL_FASTCONV_ROOM; - move16(); - } - } -#endif /* determine new granularity */ -#ifdef NONBE_1303_REND_GRANULARITY granularity_new = ivas_jbm_dec_get_render_granularity_fx( st_ivas->renderer_type, ivas_renderer_secondary_select_fx( st_ivas ), st_ivas->hDecoderConfig->output_Fs ); -#else - granularity_new = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); /*Q0*/ - move16(); - - /* this will change anyway only with binaural */ - test(); - IF( EQ_16( renderer_type_new, RENDERER_BINAURAL_FASTCONV ) && EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) - { - granularity_new = i_mult( granularity_new, JBM_CLDFB_SLOTS_IN_SUBFRAME ); /*Q0*/ - } -#endif /* flush renderer on granularity change form 5ms to 1.25ms, again only possible for binaural rendering */ IF( LT_16( granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) ) diff --git a/lib_dec/ivas_spar_decoder_fx.c b/lib_dec/ivas_spar_decoder_fx.c index 12a916fbe..4161c57fa 100644 --- a/lib_dec/ivas_spar_decoder_fx.c +++ b/lib_dec/ivas_spar_decoder_fx.c @@ -292,23 +292,9 @@ ivas_error ivas_spar_dec_open_fx( move16(); } -#ifdef NONBE_1303_REND_GRANULARITY granularity = ivas_jbm_dec_get_render_granularity_fx( st_ivas->renderer_type, ivas_renderer_secondary_select_fx( st_ivas ), output_Fs ); IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, granularity ) ), IVAS_ERR_OK ) ) -#else - test(); - test(); - - IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL ) && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) - { - /* get correct granularity in case of binaural rendering of the discrete objects with the td obj renderer */ - /* granularity = NS2SA( output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ) */ - granularity = shr( extract_l( Mpy_32_32_r( st_ivas->hDecoderConfig->output_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), 2 ); /*Q0*/ - } - - IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( 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_fx.c b/lib_dec/lib_dec_fx.c index 1e2516534..3e64dd38c 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -3185,11 +3185,7 @@ ivas_error IVAS_DEC_ReadFormat( MC_MODE mc_mode_old; Word16 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 test(); IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) @@ -3205,9 +3201,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_fx( st_ivas ); -#endif move32(); move32(); move32(); @@ -3215,9 +3209,7 @@ ivas_error IVAS_DEC_ReadFormat( move32(); move32(); move32(); -#ifdef NONBE_1303_REND_GRANULARITY move32(); -#endif output_config = st_ivas->hDecoderConfig->output_config; move32(); @@ -3309,7 +3301,6 @@ ivas_error IVAS_DEC_ReadFormat( } } -#ifdef NONBE_1303_REND_GRANULARITY test(); test(); test(); @@ -3338,34 +3329,6 @@ ivas_error IVAS_DEC_ReadFormat( } } } -#else - test(); - test(); - test(); - test(); - test(); - test(); - IF( ( NE_32( renderer_type_old, st_ivas->renderer_type ) && NE_32( renderer_type_old, RENDERER_DISABLE ) ) || - ( st_ivas->ini_active_frame > 0 && - ( ( ( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) && EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && NE_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) || - ( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) && NE_32( 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 */ - Word16 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; - move16(); - - IF( LT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) ) - { - IF( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &st_ivas->hIntSetup, mc_mode_old, ism_mode_old, &hIvasDec->nSamplesFlushed, 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_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 0539b7b85..ace5d9d1d 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -156,14 +156,12 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( move16(); } -#ifdef NONBE_1303_REND_GRANULARITY output_Fs = st_ivas->hDecoderConfig->output_Fs; move32(); nBins = st_ivas->hSpatParamRendCom->num_freq_bands; move16(); renderer_type = st_ivas->renderer_type; move32(); -#endif FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { @@ -184,14 +182,6 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( hDiracDecBin->phHrtfParambin = NULL; } -#ifndef NONBE_1303_REND_GRANULARITY - output_Fs = st_ivas->hDecoderConfig->output_Fs; - move32(); - nBins = st_ivas->hSpatParamRendCom->num_freq_bands; - move16(); - renderer_type = st_ivas->renderer_type; - move32(); -#endif FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { FOR( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) @@ -402,17 +392,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( nchan_to_allocate = add( BINAURAL_CHANNELS, st_ivas->nchan_ism ); } -#ifdef NONBE_1303_REND_GRANULARITY n_samples_granularity = ivas_jbm_dec_get_render_granularity_fx( st_ivas->renderer_type, ivas_renderer_secondary_select_fx( st_ivas ), output_Fs ); -#else - n_samples_granularity = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); - test(); - test(); - IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) - { - n_samples_granularity = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); /* Use the same granularity as tdrend */ - } -#endif IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, ivas_jbm_dec_get_num_tc_channels_fx( st_ivas ), nchan_to_allocate, nchan_to_allocate, n_samples_granularity ) ), IVAS_ERR_OK ) ) { -- GitLab From 46d0e20cb3751cc531290a4fb8407c07ca9ce78f Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:22:33 +0100 Subject: [PATCH 11/16] [cleanup] accept NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT --- lib_com/ivas_prot_fx.h | 2 -- lib_com/options.h | 1 - lib_dec/ivas_jbm_dec_fx.c | 4 ---- lib_dec/ivas_objectRenderer_internal_fx.c | 9 --------- lib_dec/ivas_omasa_dec_fx.c | 2 -- lib_dec/lib_dec_fx.c | 6 ------ 6 files changed, 24 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index e75cb9805..8631fcdb2 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -178,14 +178,12 @@ void ivas_omasa_render_objects_from_mix_fx( Word16 *output_q /* i/o: output Q value */ ); -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT void ivas_omasa_gain_masa_tc_fx( Word32 *output_fx[], /* i/o: output synthesis signal */ const Word16 gainMasa_fx, /* i : gain for MASA transport channels */ const Word16 nchan_transport_ism, /* i : number of ISM TCs */ const Word16 output_frame /* i : output frame length per channel */ ); -#endif ivas_error ivas_omasa_ism_metadata_dec_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ diff --git a/lib_com/options.h b/lib_com/options.h index 088191275..9c0345668 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -121,7 +121,6 @@ #define OBJ_EDIT_BASOP #define FIX_1372_OSBA_OBJECT_EDITING /* VA: issue 1372: Fix OSBA object-editing in BINAURAL_ROOM_IR */ #define FIX_2140_OBJECT_EDITING_SANITIZER_ISSUES /* Nokia: Issue 2140, fixes three different sanitizer issues persisting in object editing code. */ -#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_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 55d683344..4fca73a01 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -4379,7 +4379,6 @@ void ivas_dec_prepare_renderer_fx( { 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 */ test(); test(); @@ -4388,7 +4387,6 @@ void ivas_dec_prepare_renderer_fx( { ivas_omasa_gain_masa_tc_fx( st_ivas->hTcBuffer->tc_fx, st_ivas->hMasaIsmData->gain_masa_edited_fx, st_ivas->nchan_ism, st_ivas->hTcBuffer->n_samples_available ); } -#endif } ELSE IF( EQ_16( st_ivas->ivas_format, STEREO_FORMAT ) ) { @@ -4512,7 +4510,6 @@ void ivas_dec_prepare_renderer_fx( { 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. */ test(); IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) && EQ_16( st_ivas->hMasaIsmData->masa_gain_is_edited, 1 ) ) @@ -4523,7 +4520,6 @@ void ivas_dec_prepare_renderer_fx( Scale_sig32( st_ivas->hTcBuffer->tc_fx[n], st_ivas->hTcBuffer->n_samples_available, Q3 ); // Q8 -> Q11 } } -#endif } ELSE { diff --git a/lib_dec/ivas_objectRenderer_internal_fx.c b/lib_dec/ivas_objectRenderer_internal_fx.c index 23d8ce17e..069e2c0eb 100644 --- a/lib_dec/ivas_objectRenderer_internal_fx.c +++ b/lib_dec/ivas_objectRenderer_internal_fx.c @@ -208,12 +208,8 @@ ivas_error ivas_td_binaural_renderer_sf_fx( IF( EQ_16( subframe_idx, ism_md_subframe_update_jbm ) ) { test(); -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT test(); IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) -#else - IF( EQ_16( st_ivas->ivas_format, ISM_FORMAT ) || EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) -#endif { ISM_METADATA_FRAME ismMetaData[MAX_NUM_OBJECTS]; ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS]; @@ -231,7 +227,6 @@ ivas_error ivas_td_binaural_renderer_sf_fx( move32(); ismMetaData[nS].non_diegetic_flag = st_ivas->hIsmMetaData[nS]->non_diegetic_flag; move16(); -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) { /* DISC OMASA ISM gaining with TDREND is done in ivas_dec_prepare_renderer()*/ @@ -243,10 +238,6 @@ ivas_error ivas_td_binaural_renderer_sf_fx( ismMetaData[nS].gain_fx = st_ivas->hIsmMetaData[nS]->edited_gain_fx; move32(); } -#else - ismMetaData[nS].gain_fx = st_ivas->hIsmMetaData[nS]->edited_gain_fx; - move32(); -#endif hIsmMetaData[nS] = &ismMetaData[nS]; } diff --git a/lib_dec/ivas_omasa_dec_fx.c b/lib_dec/ivas_omasa_dec_fx.c index 4749fc22d..c977395c4 100644 --- a/lib_dec/ivas_omasa_dec_fx.c +++ b/lib_dec/ivas_omasa_dec_fx.c @@ -2159,7 +2159,6 @@ void ivas_omasa_render_objects_from_mix_fx( return; } -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT /*--------------------------------------------------------------------------* * ivas_omasa_gain_masa_tc_fx() * @@ -2183,4 +2182,3 @@ void ivas_omasa_gain_masa_tc_fx( return; } -#endif diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 3e64dd38c..b8958309e 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1898,11 +1898,7 @@ ivas_error IVAS_DEC_GetObjectMetadata( metadata->gainFactor_fx = ONE_IN_Q29; metadata->non_diegetic_flag = hIsmMeta->non_diegetic_flag; } -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT ELSE IF( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) -#else - ELSE IF( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) -#endif { metadata->azimuth_fx = st_ivas->hIsmMetaData[objectIdx]->edited_azimuth_fx; metadata->elevation_fx = st_ivas->hIsmMetaData[objectIdx]->edited_elevation_fx; @@ -3996,7 +3992,6 @@ 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_fx = hIvasEditableParameters.ism_metadata[obj].azimuth_fx; move32(); st_ivas->hIsmMetaData[obj]->edited_elevation_fx = hIvasEditableParameters.ism_metadata[obj].elevation_fx; @@ -4007,7 +4002,6 @@ ivas_error IVAS_DEC_SetEditableParameters( move32(); st_ivas->hIsmMetaData[obj]->edited_radius_fx = hIvasEditableParameters.ism_metadata[obj].radius_fx; move32(); -#endif #ifndef NONBE_FIX_1172_OBJ_EDIT_JBM st_ivas->hIsmMetaData[obj]->azimuth_fx = hIvasEditableParameters.ism_metadata[obj].azimuth_fx; move32(); -- GitLab From 73c02708e6003b738f9a9c9459e950a18be65cc0 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:22:36 +0100 Subject: [PATCH 12/16] [cleanup] accept UNIFIED_DECODING_PATHS_LEFTOVERS --- lib_com/ivas_cnst.h | 4 - lib_com/ivas_prot_fx.h | 15 -- lib_com/options.h | 1 - lib_dec/ivas_ism_param_dec_fx.c | 74 ------ lib_dec/ivas_jbm_dec_fx.c | 324 ----------------------- lib_dec/ivas_mc_param_dec_fx.c | 43 --- lib_dec/ivas_sba_rendering_internal_fx.c | 4 - lib_dec/lib_dec_fx.c | 6 - 8 files changed, 471 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 5185c5594..b140ca712 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -195,11 +195,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_fx.h b/lib_com/ivas_prot_fx.h index 8631fcdb2..10b6348f2 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -648,21 +648,6 @@ void ivas_jbm_dec_get_adapted_subframes_fx( Word16 *nb_subframes /* i/o: number of subframes in the frame */ ); -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS -void ivas_jbm_dec_copy_tc_no_tsm_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle Q0 */ - Word32 *tc_fx[], /* i : transport channels Q11 */ - const Word16 output_frame /* i : output frame size Q0 */ -); - -void ivas_ism_param_dec_tc_gain_ajust_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const UWord16 nSamples, /* i : number of samples to be compensate */ - const UWord16 nFadeLength, /* i : length of the crossfade in samples */ - Word32 *transport_channels_f[], /* i : synthesized core-coder transport channels/DirAC output Q_tc*/ - Word16 *Q_tc /* i/o : Q of input tc buffer */ -); -#endif /*! r: number of bits read */ Word16 read_GR0( const UWord16 *bit_stream, /* i : bitstream to be read */ diff --git a/lib_com/options.h b/lib_com/options.h index 9c0345668..927de7082 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -107,7 +107,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_fx.c b/lib_dec/ivas_ism_param_dec_fx.c index 835e35fee..1c94fbe39 100644 --- a/lib_dec/ivas_ism_param_dec_fx.c +++ b/lib_dec/ivas_ism_param_dec_fx.c @@ -44,14 +44,12 @@ #include "debug.h" -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS /*-----------------------------------------------------------------------* * Local function declarations *-----------------------------------------------------------------------*/ static void ivas_ism_param_dec_tc_gain_adjust_fx( Decoder_Struct *st_ivas, const Word16 nSamples, const Word16 nFadeLength, Word32 *p_data_fx[], Word16 *q_data ); -#endif /*-----------------------------------------------------------------------* * Local function definitions @@ -1090,30 +1088,13 @@ void ivas_param_ism_dec_digest_tc_fx( const Word16 q_data_in /* i : Q-factor of input signal for single channel */ ) { -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS Word16 i, ch, slot_idx, output_frame; Word16 num_freq_bands, cldfb_ch, n_ch_cldfb; Word32 *cldfb_real_buffer, *cldfb_imag_buffer; Word16 q_data = q_data_in; move16(); -#else - move16(); - move16(); - move16(); - - Word16 q_tc = q_data_in; - move16(); - Word16 ch, nchan_transport, i; - Word16 slot_idx; - - Word16 output_frame; - PARAM_ISM_DEC_HANDLE hParamIsmDec; - SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; - Word16 fade_len; -#endif /* Initialization */ -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS num_freq_bands = st_ivas->hSpatParamRendCom->num_freq_bands; move16(); output_frame = imult1616( nCldfbSlots, st_ivas->hSpatParamRendCom->num_freq_bands ); @@ -1141,35 +1122,7 @@ void ivas_param_ism_dec_digest_tc_fx( move16(); } } -#else - hParamIsmDec = st_ivas->hParamIsmDec; - assert( hParamIsmDec ); - hSpatParamRendCom = st_ivas->hSpatParamRendCom; - assert( hSpatParamRendCom ); - output_frame = imult1616( nCldfbSlots, hSpatParamRendCom->num_freq_bands ); - fade_len = shr( output_frame, 1 ); - - nchan_transport = st_ivas->nchan_transport; - move16(); - - IF( st_ivas->hDecoderConfig->Opt_tsm ) - { - /*TODO : FhG to check*/ - ivas_ism_param_dec_tc_gain_ajust_fx( st_ivas, output_frame, fade_len, transport_channels, &q_tc ); - - IF( NE_16( q_tc, q_tc_in ) ) - { - FOR( i = 0; i < 2; i++ ) - { - scale_sig32( transport_channels[i], output_frame, sub( q_tc_in, q_tc ) ); // q_tc_in - } - q_tc = q_tc_in; - move16(); - } - } -#endif -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS /* CLDFB Analysis */ FOR( ( ch = 0, cldfb_ch = 0 ); cldfb_ch < n_ch_cldfb; ( cldfb_ch++, ch++ ) ) { @@ -1189,29 +1142,6 @@ void ivas_param_ism_dec_digest_tc_fx( move16(); } } -#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 ) - { - Word32 RealBuffer_fx[CLDFB_NO_CHANNELS_MAX]; - Word32 ImagBuffer_fx[CLDFB_NO_CHANNELS_MAX]; - q_tc = q_tc_in; - move16(); - cldfbAnalysis_ts_fx_fixed_q( &( transport_channels[ch][hSpatParamRendCom->num_freq_bands * slot_idx] ), RealBuffer_fx, ImagBuffer_fx, hSpatParamRendCom->num_freq_bands, st_ivas->cldfbAnaDec[ch], &q_tc ); - Copy32( RealBuffer_fx, &hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_fx[slot_idx * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands], hSpatParamRendCom->num_freq_bands ); - Copy32( ImagBuffer_fx, &hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_fx[slot_idx * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands], hSpatParamRendCom->num_freq_bands ); - hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_exp = sub( 31, q_tc ); - move16(); - hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_exp = sub( 31, q_tc ); - move16(); - } - } - } -#endif return; } @@ -1437,11 +1367,7 @@ void ivas_param_ism_dec_prepare_renderer_fx( * *-------------------------------------------------------------------------*/ -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS static void ivas_ism_param_dec_tc_gain_adjust_fx( -#else -void ivas_ism_param_dec_tc_gain_ajust_fx( -#endif Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const Word16 nSamples, /* i : number of samples to be compensate */ const Word16 nFadeLength, /* i : length of the crossfade in samples */ diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 4fca73a01..418ef4be2 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -51,9 +51,6 @@ * Local function prototypes *-----------------------------------------------------------------------*/ -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS -static void ivas_jbm_dec_copy_tc( Decoder_Struct *st_ivas, const Word16 nSamplesForRendering, Word16 *nSamplesResidual, Word32 *data, Word32 *tc_digest_f[], Word16 data_q ); -#endif static void ivas_jbm_dec_tc_buffer_playout_fx( Decoder_Struct *st_ivas, const UWord16 nSamplesAsked, UWord16 *nSamplesRendered, Word32 *output_fx[] ); static void ivas_jbm_dec_copy_masa_meta_to_buffer( Decoder_Struct *st_ivas ); @@ -281,13 +278,6 @@ ivas_error ivas_jbm_dec_tc_fx( { return error; } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - test(); - IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && st_ivas->hDecoderConfig->Opt_tsm ) - { - ivas_jbm_dec_copy_masa_meta_to_buffer( st_ivas ); - } -#endif } ELSE IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) ) { @@ -805,12 +795,6 @@ ivas_error ivas_jbm_dec_tc_fx( /* Extract objects from MASA, output MASA + all objects (i.e., extracted and separated objects) */ ivas_omasa_render_objects_from_mix_fx( st_ivas, p_output_fx, st_ivas->nchan_ism, output_frame, &output_q ); } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - IF( st_ivas->hDecoderConfig->Opt_tsm ) - { - ivas_jbm_dec_copy_masa_meta_to_buffer( st_ivas ); - } -#endif } IF( NE_16( output_q, Q11 ) ) { @@ -1478,18 +1462,6 @@ ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) ) } } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS -/*----------------------------------------------------------------* - * Write IVAS transport channels - *----------------------------------------------------------------*/ - -IF( st_ivas->hDecoderConfig->Opt_tsm == 0 ) -{ - /* directly copy to tc buffers */ - /*note : the q of cldfb buffers (imag/real) are needed to be Q_p_output - 5 here 6 is taken for that*/ - ivas_jbm_dec_copy_tc_no_tsm_fx( st_ivas, p_output_fx, output_frame ); -} -#endif /*----------------------------------------------------------------* * Common updates *----------------------------------------------------------------*/ @@ -1534,7 +1506,6 @@ return IVAS_ERR_OK; } -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS /*--------------------------------------------------------------------------* * ivas_dec_feed_tc_to_renderer() @@ -1666,88 +1637,6 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx( 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_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 nSamplesForRendering, /* i : number of TC samples available for rendering */ - Word16 *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ - Word32 *data_fx /* i : transport channels Q11*/ -) -{ - Word32 data_f_fx[MAX_CLDFB_DIGEST_CHANNELS][MAX_JBM_L_FRAME48k] = { 0 }; /* Word32 buffer for transport channels that will be directly converted with the CLDFB */ - Word32 *p_data_f_fx[MAX_CLDFB_DIGEST_CHANNELS]; - Word16 i; - - FOR( i = 0; i < MAX_CLDFB_DIGEST_CHANNELS; i++ ) - { - set_zero_fx( data_f_fx[i], MAX_JBM_L_FRAME48k ); - } - if ( st_ivas->hTcBuffer ) - { - st_ivas->hTcBuffer->q_tc_fx = 11; - move16(); - } - Word16 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_fx[n] = &data_f_fx[n][0]; - } - - IF( st_ivas->hDecoderConfig->Opt_tsm == 0 ) - { - FOR( n = 0; n < ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) - { - st_ivas->hTcBuffer->tc_fx[n] = st_ivas->p_output_fx[n]; /* note: buffers needed in the TD decorellator */ - } - } - - IF( st_ivas->hDecoderConfig->Opt_tsm ) - { - ivas_jbm_dec_copy_tc( st_ivas, nSamplesForRendering, nSamplesResidual, data_fx, p_data_f_fx, 11 ); - } - ELSE - { - *nSamplesResidual = 0; - move16(); - } - n_render_timeslots = idiv1616( st_ivas->hTcBuffer->n_samples_available, st_ivas->hTcBuffer->n_samples_granularity ); - - IF( EQ_16( st_ivas->ivas_format, ISM_FORMAT ) ) - { - /* Rendering */ - IF( EQ_16( st_ivas->ism_mode, ISM_MODE_PARAM ) ) - { - test(); - IF( EQ_16( st_ivas->renderer_type, RENDERER_PARAM_ISM ) || EQ_16( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) ) - { - - ivas_param_ism_dec_digest_tc_fx( st_ivas, n_render_timeslots, p_data_f_fx, Q11 ); - } - } - } - ELSE IF( EQ_16( st_ivas->ivas_format, MC_FORMAT ) ) - { - test(); - IF( EQ_16( st_ivas->mc_mode, MC_MODE_PARAMMC ) && EQ_16( st_ivas->hTcBuffer->tc_buffer_mode, TC_BUFFER_MODE_RENDERER ) ) - { - ivas_param_mc_dec_digest_tc_fx( st_ivas, (UWord8) n_render_timeslots, (Word32 **) p_data_f_fx, Q11 ); - } - } - - pop_wmops(); - return; -} - -#endif /*--------------------------------------------------------------------------* * ivas_dec_render() @@ -1775,9 +1664,6 @@ ivas_error ivas_jbm_dec_render_fx( Word16 subframe_len, gd_bits, exp, nchan_in, i, j, ch; const Word16 output_q_factor = Q11; move16(); -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; -#endif Word16 nchan_out_syn_output; push_wmops( "ivas_dec_render" ); @@ -1785,9 +1671,6 @@ ivas_error ivas_jbm_dec_render_fx( * 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; move32(); nchan_out = st_ivas->hDecoderConfig->nchan_out; @@ -1806,29 +1689,16 @@ ivas_error ivas_jbm_dec_render_fx( IF( !st_ivas->hDecoderConfig->Opt_tsm ) { -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - FOR( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) - { - p_tc_fx[n] = &p_output_fx[n][st_ivas->hTcBuffer->n_samples_rendered]; - } -#endif FOR( n = 0; n < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; n++ ) { st_ivas->hTcBuffer->tc_fx[n] = st_ivas->p_output_fx[n]; } } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - ELSE - { -#endif FOR( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) { p_tc_fx[n] = &st_ivas->hTcBuffer->tc_fx[n][st_ivas->hTcBuffer->n_samples_rendered]; } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - } -#endif st_ivas->hTcBuffer->no_channels = st_ivas->hTcBuffer->nchan_buffer_full; move16(); @@ -1936,11 +1806,7 @@ ivas_error ivas_jbm_dec_render_fx( } } -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS ivas_ism2sba_sf_fx( p_tc_fx, p_output_fx, st_ivas->hIsmRendererData, st_ivas->nchan_transport, *nSamplesRendered, st_ivas->hTcBuffer->n_samples_rendered, st_ivas->hIntSetup.ambisonics_order ); -#else - ivas_ism2sba_sf_fx( st_ivas->hTcBuffer->tc_fx, p_output_fx, st_ivas->hIsmRendererData, st_ivas->nchan_transport, *nSamplesRendered, st_ivas->hTcBuffer->n_samples_rendered, st_ivas->hIntSetup.ambisonics_order ); -#endif Word16 sba_num_chans = imult1616( add( st_ivas->hIntSetup.ambisonics_order, 1 ), add( st_ivas->hIntSetup.ambisonics_order, 1 ) ); FOR( j = 0; j < sba_num_chans; j++ ) @@ -2125,11 +1991,7 @@ ivas_error ivas_jbm_dec_render_fx( FOR( n = 0; n < st_ivas->nchan_ism; n++ ) { -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS Copy32( p_tc_fx[n], p_output_fx[n], *nSamplesRendered ); -#else - Copy32( st_ivas->hTcBuffer->tc_fx[n] + st_ivas->hTcBuffer->n_samples_rendered, p_output_fx[n], *nSamplesRendered ); -#endif } } ELSE @@ -2175,12 +2037,6 @@ ivas_error ivas_jbm_dec_render_fx( } ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) ) { -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - FOR( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) - { - p_tc_fx[n] = &st_ivas->hTcBuffer->tc_fx[n][st_ivas->hTcBuffer->n_samples_rendered]; - } -#endif IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) ) { Word16 crendInPlaceRotation = FALSE; @@ -2462,9 +2318,6 @@ ivas_error ivas_jbm_dec_render_fx( } ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCMASA ) ) { -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - Word16 offset = imult1616( hSpatParamRendCom->slots_rendered, hSpatParamRendCom->slot_size ); -#endif nchan_remapped = st_ivas->nchan_transport; move16(); @@ -2487,11 +2340,7 @@ ivas_error ivas_jbm_dec_render_fx( /* we still need to copy the separate channel if available */ IF( st_ivas->hOutSetup.separateChannelEnabled ) { -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS Copy32( p_tc_fx[LFE_CHANNEL - 1], p_output_fx[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); -#else - Copy32( st_ivas->hTcBuffer->tc_fx[LFE_CHANNEL - 1] + offset, p_output_fx[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); -#endif } ivas_mc2sba_fx( st_ivas->hIntSetup, p_output_fx, p_output_fx, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0 ); @@ -2519,22 +2368,12 @@ ivas_error ivas_jbm_dec_render_fx( EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) || ( EQ_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && GT_16( st_ivas->hOutSetup.num_lfe, 0 ) ) ) { -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS Copy32( p_tc_fx[LFE_CHANNEL], p_output_fx[LFE_CHANNEL], *nSamplesRendered ); Copy32( p_tc_fx[LFE_CHANNEL - 1], p_output_fx[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); -#else - Copy32( st_ivas->hTcBuffer->tc_fx[LFE_CHANNEL] + offset, p_output_fx[LFE_CHANNEL], *nSamplesRendered ); - Copy32( st_ivas->hTcBuffer->tc_fx[LFE_CHANNEL - 1] + offset, p_output_fx[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); -#endif } ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && st_ivas->hOutSetup.num_lfe == 0 ) { -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS Copy32( p_tc_fx[LFE_CHANNEL - 1], p_output_fx[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); -#else - /* Delay the separated channel to sync with the DirAC rendering */ - Copy32( st_ivas->hTcBuffer->tc_fx[LFE_CHANNEL - 1] + offset, p_output_fx[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); -#endif } } } @@ -3399,74 +3238,6 @@ Word16 ivas_jbm_dec_get_num_tc_channels_fx( 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 Word16 nSamplesForRendering, /* i : number of samples to digest */ - Word16 *nSamplesResidual, /* o : number of samples that will be left for the next frame */ - Word32 *data, /* i : (interleaved) transport channel samples data_q*/ - Word32 *tc_digest_f[], /* o : samples that will be directly digested (e.g. by CLDFB) data_q*/ - Word16 data_q ) -{ - Word16 ch; - DECODER_TC_BUFFER_HANDLE hTcBuffer; - Word16 n_samples_still_available, m; - Word16 n_ch_full_copy; - Word16 n_ch_res_copy; - - hTcBuffer = st_ivas->hTcBuffer; - n_samples_still_available = sub( hTcBuffer->n_samples_buffered, hTcBuffer->n_samples_rendered ); - hTcBuffer->n_samples_buffered = add( add( n_samples_still_available, nSamplesForRendering ), hTcBuffer->n_samples_discard ); - hTcBuffer->n_samples_available = i_mult( hTcBuffer->n_samples_granularity, idiv1616( hTcBuffer->n_samples_buffered, hTcBuffer->n_samples_granularity ) ); - *nSamplesResidual = sub( hTcBuffer->n_samples_buffered, hTcBuffer->n_samples_available ); - move16(); - move16(); - move16(); - n_ch_full_copy = s_min( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); - n_ch_res_copy = sub( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); - - FOR( ch = 0; ch < n_ch_full_copy; ch++ ) - { - set32_fx( hTcBuffer->tc_fx[ch], 0, hTcBuffer->n_samples_discard ); - Copy32( hTcBuffer->tc_fx[ch] + hTcBuffer->n_samples_rendered, hTcBuffer->tc_fx[ch] + hTcBuffer->n_samples_discard, n_samples_still_available ); - FOR( m = 0; m < nSamplesForRendering; m++ ) - { - hTcBuffer->tc_fx[ch][n_samples_still_available + hTcBuffer->n_samples_discard + m] = data[m * st_ivas->hTcBuffer->nchan_transport_jbm + ch]; - move32(); - } - } - - IF( n_ch_res_copy > 0 ) - { - FOR( ; ch < hTcBuffer->nchan_transport_jbm; ch++ ) - { - Copy32( hTcBuffer->tc_fx[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]; // data_q - move32(); - } - Copy32( tc_digest_f[ch] + hTcBuffer->n_samples_available, hTcBuffer->tc_fx[ch], *nSamplesResidual ); - } - } - hTcBuffer->q_tc_fx = data_q; - move16(); - hTcBuffer->n_samples_rendered = 0; - move16(); - hTcBuffer->subframes_rendered = 0; - move16(); - - return; -} - -#endif /*--------------------------------------------------------------------------* * ivas_jbm_dec_get_render_granularity() @@ -4039,99 +3810,6 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode_fx( return buffer_mode; } -#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS - -/*--------------------------------------------------------------------------* - * ivas_jbm_dec_copy_tc_no_tsm() - * - * - *--------------------------------------------------------------------------*/ - -void ivas_jbm_dec_copy_tc_no_tsm_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle Q0 */ - Word32 *tc_fx[], /* i : transport channels Q11 */ - const Word16 output_frame /* i : output frame size Q0 */ -) -{ - Word16 Q_tc; - Word16 n_ch_cldfb; - Word16 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; - move16(); - move16(); - n_ch_cldfb = sub( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); - - Q_tc = 11; /*tc buffer is at Q11*/ - move16(); - -#ifdef DEBUGGING - assert( st_ivas->hDecoderConfig->Opt_tsm == 0 ); -#endif - /* CLDFB ana for ParamMC/ParamISM */ - IF( n_ch_cldfb > 0 ) - { - Word32 *cldfb_real_buffer_fx; - Word32 *cldfb_imag_buffer_fx; - Word16 cldfb_ch, slot_idx, num_freq_bands; - - cldfb_real_buffer_fx = NULL; - cldfb_imag_buffer_fx = NULL; - num_freq_bands = 0; - move16(); - - IF( EQ_16( (Word16) st_ivas->ivas_format, (Word16) ISM_FORMAT ) ) - { - cldfb_real_buffer_fx = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_fx; - cldfb_imag_buffer_fx = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_fx; - num_freq_bands = st_ivas->hSpatParamRendCom->num_freq_bands; - move16(); - - ivas_ism_param_dec_tc_gain_ajust_fx( st_ivas, output_frame, output_frame / 2, tc_fx, &Q_tc ); - Scale_sig32( tc_fx[0], output_frame, sub( Q11, Q_tc ) ); /*keepeing tc_fx at Q11*/ - Scale_sig32( tc_fx[1], output_frame, sub( Q11, Q_tc ) ); /*keepeing tc_fx at Q11*/ - } - ELSE IF( EQ_16( (Word16) st_ivas->ivas_format, (Word16) MC_FORMAT ) ) - { - cldfb_real_buffer_fx = st_ivas->hParamMC->Cldfb_RealBuffer_tc_fx; - cldfb_imag_buffer_fx = st_ivas->hParamMC->Cldfb_ImagBuffer_tc_fx; - num_freq_bands = st_ivas->hParamMC->num_freq_bands; - move16(); - } - - /* 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++ ) - { - Q_tc = 11; - move16(); - cldfbAnalysis_ts_fx_fixed_q( &( tc_fx[ch_idx][num_freq_bands * slot_idx] ), - &cldfb_real_buffer_fx[slot_idx * num_freq_bands * n_ch_cldfb + cldfb_ch * num_freq_bands], - &cldfb_imag_buffer_fx[slot_idx * num_freq_bands * n_ch_cldfb + cldfb_ch * num_freq_bands], - num_freq_bands, st_ivas->cldfbAnaDec[cldfb_ch], &Q_tc ); - } - } - IF( EQ_16( (Word16) st_ivas->ivas_format, (Word16) MC_FORMAT ) ) - { - st_ivas->hParamMC->Cldfb_RealBuffer_tc_e = 25; // 31-Q_tc = 31-(11-5) - st_ivas->hParamMC->Cldfb_ImagBuffer_tc_e = 25; // 31-Q_tc = 31-(11-5) - move16(); - move16(); - } - } - hTcBuffer->n_samples_rendered = 0; - move16(); - hTcBuffer->subframes_rendered = 0; - move16(); - - return; -} - -#endif /*--------------------------------------------------------------------------* * ivas_jbm_dec_metadata_open() @@ -4234,10 +3912,8 @@ static void ivas_jbm_masa_sf_to_slot_map( Word16 slot_idx; Word16 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_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index f289ec05a..1aa07241e 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -1516,37 +1516,19 @@ void ivas_param_mc_dec_digest_tc_fx( const Word16 q_data /* i : Q-factor of input signal for single channel */ ) { -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS Word16 ch, num_freq_bands, slot_idx, cldfb_ch, n_ch_cldfb; Word32 *cldfb_real_buffer, *cldfb_imag_buffer; -#else - PARAM_MC_DEC_HANDLE hParamMC; - Word16 ch, slot_idx; - Word16 nchan_transport; - - /*CLDFB*/ - - hParamMC = st_ivas->hParamMC; - assert( hParamMC ); - -#endif Word16 q_out = 0; move16(); /* Initialization */ -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS num_freq_bands = st_ivas->hParamMC->num_freq_bands; move16(); n_ch_cldfb = sub( st_ivas->hTcBuffer->nchan_transport_jbm, st_ivas->hTcBuffer->nchan_buffer_full ); cldfb_real_buffer = st_ivas->hParamMC->Cldfb_RealBuffer_tc_fx; cldfb_imag_buffer = st_ivas->hParamMC->Cldfb_ImagBuffer_tc_fx; -#else - nchan_transport = st_ivas->nchan_transport; - move16(); -#endif -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS /* CLDFB Analysis */ FOR( ( ch = 0, cldfb_ch = 0 ); cldfb_ch < n_ch_cldfb; ( cldfb_ch++, ch++ ) ) { @@ -1567,31 +1549,6 @@ void ivas_param_mc_dec_digest_tc_fx( move16(); } } -#else - /* slot loop for gathering the input data */ - FOR( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ ) - { - IF( st_ivas->hDecoderConfig->Opt_tsm ) - { - Word32 RealBuffer_fx[CLDFB_NO_CHANNELS_MAX]; - Word32 ImagBuffer_fx[CLDFB_NO_CHANNELS_MAX]; - - /* CLDFB Analysis*/ - FOR( ch = 0; ch < nchan_transport; ch++ ) - { - q_out = q_data; - move16(); - cldfbAnalysis_ts_fx_fixed_q( &( p_data_fx[ch][hParamMC->num_freq_bands * slot_idx] ), RealBuffer_fx, ImagBuffer_fx, hParamMC->num_freq_bands, st_ivas->cldfbAnaDec[ch], &q_out ); - - Copy32( RealBuffer_fx, &hParamMC->Cldfb_RealBuffer_tc_fx[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands ); - Copy32( ImagBuffer_fx, &hParamMC->Cldfb_ImagBuffer_tc_fx[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands ); - } - - hParamMC->Cldfb_ImagBuffer_tc_e = q_out; - move16(); - } - } -#endif return; } diff --git a/lib_dec/ivas_sba_rendering_internal_fx.c b/lib_dec/ivas_sba_rendering_internal_fx.c index bf64b92d8..c9d6a09c6 100644 --- a/lib_dec/ivas_sba_rendering_internal_fx.c +++ b/lib_dec/ivas_sba_rendering_internal_fx.c @@ -383,11 +383,7 @@ void ivas_ism2sba_sf_fx( FOR( j = 0; j < sba_num_chans; j++ ) { g2_fx = hIsmRendererData->interpolator_fx + offset; /*Pointer addition*/ /*Q15*/ -#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS tc_fx = buffer_in_fx[i]; /*Q_buffer_in*/ -#else - tc_fx = buffer_in_fx[i] + offset; /*Pointer addition*/ /*Q_buffer_in*/ -#endif out_fx = buffer_tmp_fx[j]; /*Q_buffer_in + 29 - 31*/ gain_fx = hIsmRendererData->gains_fx[i][j]; /*Q29*/ move32(); diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index b8958309e..e931bc6c0 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -4927,12 +4927,6 @@ static ivas_error evs_dec_main_fx( Copy32( pcm_buf_local, p_output_fx[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_fx( st_ivas, p_output_fx, nOutSamples ); - } -#endif return IVAS_ERR_OK; } -- GitLab From f420fd714b509cfe742f485a5c4d76851bd6601c Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:22:39 +0100 Subject: [PATCH 13/16] [cleanup] accept NONBE_1300_TDREND_LARGE_ITD --- lib_com/options.h | 1 - lib_rend/ivas_objectRenderer_fx.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 927de7082..ad7989246 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -103,7 +103,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 FIX_1384_MSAN_stereo_tcx_core_enc /* VA: issue 1384: fix use-of-uninitialized value in stereo_tcx_core_enc() */ -#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_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_rend/ivas_objectRenderer_fx.c b/lib_rend/ivas_objectRenderer_fx.c index fc1acd283..c2e6b73fc 100644 --- a/lib_rend/ivas_objectRenderer_fx.c +++ b/lib_rend/ivas_objectRenderer_fx.c @@ -509,10 +509,8 @@ ivas_error TDREND_GetMix_fx( Word32 hrf_left_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; Word32 hrf_right_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; Word16 intp_count; -#ifdef NONBE_1300_TDREND_LARGE_ITD Word16 currShift, prevShift, transition_len, length_in2; Word16 tmp1, tmp2, tmp_e, tmp3, tmp4, tmp_e2, tlen1, tlen2; -#endif Word16 hrf_left_delta_e = 0, hrf_right_delta_e = 0; move16(); @@ -549,7 +547,6 @@ ivas_error TDREND_GetMix_fx( &intp_count, &Src_p->filterlength, &Src_p->itd, &Src_p->Gain_fx, Src_p ); -#ifdef NONBE_1300_TDREND_LARGE_ITD /* For large ITD values at lower sampling rate, check if the transition can be done */ IF( LT_16( i_mult( Src_p->previtd, Src_p->itd ), 0 ) ) { @@ -571,7 +568,6 @@ ivas_error TDREND_GetMix_fx( move16(); } } -#endif } /* Render source if needed */ -- GitLab From 94c702e6699c3a43013f1cfae24e12b901287967 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:24:08 +0100 Subject: [PATCH 14/16] clang-format --- lib_dec/ivas_jbm_dec_fx.c | 1121 +++++++++++----------- lib_dec/ivas_sba_rendering_internal_fx.c | 6 +- lib_dec/lib_dec_fx.c | 190 ++-- 3 files changed, 659 insertions(+), 658 deletions(-) diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 418ef4be2..eb264fa71 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -781,549 +781,443 @@ ivas_error ivas_jbm_dec_tc_fx( output_q = 8; move16(); } - ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ){ - IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ){ - ivas_omasa_rearrange_channels_fx( p_output_fx, nchan_transport_ism, output_frame ); - } - ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) - { - /* Convert separate object to MASA, combine with the original MASA, and output combined MASA + empty objects. */ - ivas_omasa_combine_separate_ism_with_masa_fx( st_ivas, p_output_fx, &output_q, st_ivas->nchan_ism, output_frame ); - } - ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) - { - /* Extract objects from MASA, output MASA + all objects (i.e., extracted and separated objects) */ - ivas_omasa_render_objects_from_mix_fx( st_ivas, p_output_fx, st_ivas->nchan_ism, output_frame, &output_q ); - } -} -IF( NE_16( output_q, Q11 ) ) -{ - FOR( n = 0; n < s_max( getNumChanSynthesis( st_ivas ), nchan_transport_ism + st_ivas->nchan_transport ); n++ ) - { - Scale_sig32( p_output_fx[n], output_frame, sub( Q11, output_q ) ); // Q11 - } -} -} -ELSE IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) -{ - Word16 nchan_ism, sba_ch_idx; - - set16_fx( nb_bits_metadata, 0, MAX_SCE + 1 ); - nchan_ism = st_ivas->nchan_ism; - move16(); - IF( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) - { - /* set ISM parameters and decode ISM metadata in OSBA format */ - IF( NE_32( ( error = ivas_osba_ism_metadata_dec_fx( st_ivas, ivas_total_brate, &nchan_ism, &nb_bits_metadata[1] ) ), IVAS_ERR_OK ) ) + ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { - return error; + IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) + { + ivas_omasa_rearrange_channels_fx( p_output_fx, nchan_transport_ism, output_frame ); + } + ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) + { + /* Convert separate object to MASA, combine with the original MASA, and output combined MASA + empty objects. */ + ivas_omasa_combine_separate_ism_with_masa_fx( st_ivas, p_output_fx, &output_q, st_ivas->nchan_ism, output_frame ); + } + ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) + { + /* Extract objects from MASA, output MASA + all objects (i.e., extracted and separated objects) */ + ivas_omasa_render_objects_from_mix_fx( st_ivas, p_output_fx, st_ivas->nchan_ism, output_frame, &output_q ); + } } - sba_ch_idx = st_ivas->nchan_ism; - move16(); - } - ELSE - { - nb_bits_metadata[1] = add( nb_bits_metadata[1], NO_BITS_MASA_ISM_NO_OBJ ); - sba_ch_idx = 0; - move16(); - move16(); - } - - /* SBA metadata decoding */ - IF( NE_32( ( error = ivas_spar_dec_fx( st_ivas, nb_bits_metadata ) ), IVAS_ERR_OK ) ) - { - return error; - } - - test(); - IF( EQ_16( st_ivas->nchan_transport, CPE_CHANNELS ) && GE_16( st_ivas->nCPE, 1 ) ) - { - st_ivas->hCPE[0]->element_brate = ivas_total_brate; - move32(); - } - - /* core-decoding of transport channels */ - Word16 q_output = 11; - move16(); - - IF( EQ_16( st_ivas->nSCE, 1 ) ) - { - set32_fx( p_output_fx[0], 0, L_FRAME48k ); - - IF( NE_32( ( error = ivas_sce_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0] + nb_bits_metadata[1] ) ), IVAS_ERR_OK ) ) + IF( NE_16( output_q, Q11 ) ) { - return error; + FOR( n = 0; n < s_max( getNumChanSynthesis( st_ivas ), nchan_transport_ism + st_ivas->nchan_transport ); n++ ) + { + Scale_sig32( p_output_fx[n], output_frame, sub( Q11, output_q ) ); // Q11 + } } } - ELSE IF( EQ_16( st_ivas->nCPE, 1 ) ) + ELSE IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) { + Word16 nchan_ism, sba_ch_idx; - IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, add( nb_bits_metadata[0], nb_bits_metadata[1] ) ) ), IVAS_ERR_OK ) ) + set16_fx( nb_bits_metadata, 0, MAX_SCE + 1 ); + nchan_ism = st_ivas->nchan_ism; + move16(); + IF( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { - return error; + /* set ISM parameters and decode ISM metadata in OSBA format */ + IF( NE_32( ( error = ivas_osba_ism_metadata_dec_fx( st_ivas, ivas_total_brate, &nchan_ism, &nb_bits_metadata[1] ) ), IVAS_ERR_OK ) ) + { + return error; + } + sba_ch_idx = st_ivas->nchan_ism; + move16(); } - - IF( NE_16( q_output, Q11 ) ) + ELSE { - Scale_sig32( p_output_fx[0], output_frame, sub( Q11, q_output ) ); // Q11 - Scale_sig32( p_output_fx[1], output_frame, sub( Q11, q_output ) ); // Q11 + nb_bits_metadata[1] = add( nb_bits_metadata[1], NO_BITS_MASA_ISM_NO_OBJ ); + sba_ch_idx = 0; + move16(); + move16(); } - } - ELSE IF( GT_16( st_ivas->nCPE, 1 ) ) - { - IF( NE_32( ( error = ivas_mct_dec_fx( st_ivas, p_output_fx, output_frame, nb_bits_metadata[0] + nb_bits_metadata[1] ) ), IVAS_ERR_OK ) ) + + /* SBA metadata decoding */ + IF( NE_32( ( error = ivas_spar_dec_fx( st_ivas, nb_bits_metadata ) ), IVAS_ERR_OK ) ) { return error; } - } - IF( st_ivas->sba_dirac_stereo_flag ) - { - FOR( i = 0; i < st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport; i++ ) + test(); + IF( EQ_16( st_ivas->nchan_transport, CPE_CHANNELS ) && GE_16( st_ivas->nCPE, 1 ) ) { - Scale_sig32( p_output_fx[i + sba_ch_idx], output_frame, Q14 - Q11 ); // Q14 + st_ivas->hCPE[0]->element_brate = ivas_total_brate; + move32(); } - SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; - Word16 nchan_transport; - nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - move16(); - nchan_out = nchan_transport; + + /* core-decoding of transport channels */ + Word16 q_output = 11; move16(); - ivas_agc_dec_process_fx( st_ivas->hSpar->hAgcDec, ( p_output_fx + sba_ch_idx ), ( p_output_fx + sba_ch_idx ), st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); - IF( st_ivas->hSpar->hPCA != NULL ) - { - ivas_pca_dec_fx( st_ivas->hSpar->hPCA, output_frame, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, &p_output_fx[sba_ch_idx] ); - } - ivas_spar_dec_gen_umx_mat_fx( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi, ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ) ); + IF( EQ_16( st_ivas->nSCE, 1 ) ) { - Word16 q; - hCPE = st_ivas->hCPE[0]; - hSCE = st_ivas->hSCE[0]; - s = 0; - move16(); - FOR( i = 0; i < 2; i++ ) - { - s = s_min( s, L_norm_arr( p_output_fx[sba_ch_idx + i], L_FRAME48k ) - 11 /* Guard bits */ ); - } - FOR( i = 0; i < 2; i++ ) - { - Scale_sig32( p_output_fx[sba_ch_idx + i], L_FRAME48k, s ); // Q(11+s) - } - hCPE->hStereoDft->q_dft = add( Q11, s ); - move16(); - IF( EQ_16( hCPE->hStereoDft->first_frame, 1 ) ) - { - hCPE->hStereoDft->q_smoothed_nrg = Q6; // hCPE->hStereoDft->q_dft; - hCPE->hStereoDft->q_ap_delay_mem_fx = hCPE->hStereoDft->q_dft; - move16(); - move16(); - } + set32_fx( p_output_fx[0], 0, L_FRAME48k ); - q = hCPE->hStereoDft->q_dft; - move16(); - scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); - FOR( i = 0; i < CPE_CHANNELS; ++i ) - { - scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft - scale_sig32( hCPE->input_mem_fx[i], NS2SA_FX2( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft - } - IF( hCPE->hCoreCoder[0] != NULL ) + IF( NE_32( ( error = ivas_sce_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0] + nb_bits_metadata[1] ) ), IVAS_ERR_OK ) ) { - Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( q, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ) ); // q - Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, sub( q, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ) ); // q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_out_fx32 = q; - move16(); - } - IF( hCPE->hStereoDft != NULL ) - { - scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft - scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); // q_dft - hCPE->hStereoDft->q_ap_fade_mem_fx = hCPE->hStereoDft->q_dft; - move16(); + return error; } + } + ELSE IF( EQ_16( st_ivas->nCPE, 1 ) ) + { - IF( hSCE != NULL ) + IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, add( nb_bits_metadata[0], nb_bits_metadata[1] ) ) ), IVAS_ERR_OK ) ) { - Scale_sig32( &hSCE->save_hb_synth_fx[0], extract_l( Mpy_32_32( hCPE->hCoreCoder[0]->output_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), hCPE->hStereoDft->q_dft - hSCE->q_save_hb_synth_fx ); // q_dft - hSCE->q_save_hb_synth_fx = hCPE->hStereoDft->q_dft; - move16(); - Scale_sig32( &hSCE->save_synth_fx[0], extract_l( Mpy_32_32( hCPE->hCoreCoder[0]->output_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), hCPE->hStereoDft->q_dft - hSCE->q_save_synth_fx ); // q_dft - hSCE->q_save_synth_fx = hCPE->hStereoDft->q_dft; - move16(); + return error; } - FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) + + IF( NE_16( q_output, Q11 ) ) { - scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft - hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; - move16(); + Scale_sig32( p_output_fx[0], output_frame, sub( Q11, q_output ) ); // Q11 + Scale_sig32( p_output_fx[1], output_frame, sub( Q11, q_output ) ); // Q11 } - FOR( i = 0; i < CPE_CHANNELS; i++ ) - Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( hCPE->q_prev_synth_fx, Q11 ) ); // q_prev_synth_fx - ivas_sba_dirac_stereo_dec_fx( st_ivas, &p_output_fx[sba_ch_idx], output_frame, 0 ); - FOR( i = 0; i < 2; i++ ) + } + ELSE IF( GT_16( st_ivas->nCPE, 1 ) ) + { + IF( NE_32( ( error = ivas_mct_dec_fx( st_ivas, p_output_fx, output_frame, nb_bits_metadata[0] + nb_bits_metadata[1] ) ), IVAS_ERR_OK ) ) { - Scale_sig32( p_output_fx[sba_ch_idx + i], L_FRAME48k, negate( s ) ); + return error; } + } - FOR( i = 0; i < CPE_CHANNELS; i++ ) - Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( 11, hCPE->q_prev_synth_fx ) ); // Q11 - - scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 - FOR( i = 0; i < CPE_CHANNELS; ++i ) + IF( st_ivas->sba_dirac_stereo_flag ) + { + FOR( i = 0; i < st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport; i++ ) { - scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 - scale_sig32( hCPE->input_mem_fx[i], NS2SA_FX2( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 + Scale_sig32( p_output_fx[i + sba_ch_idx], output_frame, Q14 - Q11 ); // Q14 } + SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; + Word16 nchan_transport; + nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; + move16(); + nchan_out = nchan_transport; + move16(); + ivas_agc_dec_process_fx( st_ivas->hSpar->hAgcDec, ( p_output_fx + sba_ch_idx ), ( p_output_fx + sba_ch_idx ), st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); - IF( hCPE->hCoreCoder[0] != NULL ) + IF( st_ivas->hSpar->hPCA != NULL ) { - Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB, q ) ); // Q_old_wtda_LB - Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, L_FRAME48k, sub( hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda, q ) ); // Q_old_wtda + ivas_pca_dec_fx( st_ivas->hSpar->hPCA, output_frame, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, &p_output_fx[sba_ch_idx] ); } - IF( hCPE->hStereoDft != NULL ) + ivas_spar_dec_gen_umx_mat_fx( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi, ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ) ); { - scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 - scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); // Q11 - hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; + Word16 q; + hCPE = st_ivas->hCPE[0]; + hSCE = st_ivas->hSCE[0]; + s = 0; move16(); - } - - FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) - { - scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 - hCPE->q_output_mem_fx[ii] = Q11; + FOR( i = 0; i < 2; i++ ) + { + s = s_min( s, L_norm_arr( p_output_fx[sba_ch_idx + i], L_FRAME48k ) - 11 /* Guard bits */ ); + } + FOR( i = 0; i < 2; i++ ) + { + Scale_sig32( p_output_fx[sba_ch_idx + i], L_FRAME48k, s ); // Q(11+s) + } + hCPE->hStereoDft->q_dft = add( Q11, s ); move16(); - } - } - } - - /* HP filtering */ - FOR( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) - { - hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); - } - - nchan_remapped = ivas_sba_remapTCs_fx( &p_output_fx[sba_ch_idx], st_ivas, output_frame ); + IF( EQ_16( hCPE->hStereoDft->first_frame, 1 ) ) + { + hCPE->hStereoDft->q_smoothed_nrg = Q6; // hCPE->hStereoDft->q_dft; + hCPE->hStereoDft->q_ap_delay_mem_fx = hCPE->hStereoDft->q_dft; + move16(); + move16(); + } - test(); - test(); - IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) - { - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; - Word16 nchan_transport; - // num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; - nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - move16(); - nchan_out = nchan_transport; - move16(); - Word16 Q_p_output; - Word16 min_norm = 31; - move16(); + q = hCPE->hStereoDft->q_dft; + move16(); + scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); + FOR( i = 0; i < CPE_CHANNELS; ++i ) + { + scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft + scale_sig32( hCPE->input_mem_fx[i], NS2SA_FX2( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft + } + IF( hCPE->hCoreCoder[0] != NULL ) + { + Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( q, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ) ); // q + Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, sub( q, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ) ); // q + hCPE->hCoreCoder[0]->hHQ_core->Q_old_out_fx32 = q; + move16(); + } + IF( hCPE->hStereoDft != NULL ) + { + scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft + scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); // q_dft + hCPE->hStereoDft->q_ap_fade_mem_fx = hCPE->hStereoDft->q_dft; + move16(); + } - FOR( ch = 0; ch < nchan_transport; ++ch ) - { - Word16 norm = L_norm_arr( p_output_fx[sba_ch_idx + ch], output_frame ); // Normalize per channel - min_norm = s_min( norm, min_norm ); - } + IF( hSCE != NULL ) + { + Scale_sig32( &hSCE->save_hb_synth_fx[0], extract_l( Mpy_32_32( hCPE->hCoreCoder[0]->output_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), hCPE->hStereoDft->q_dft - hSCE->q_save_hb_synth_fx ); // q_dft + hSCE->q_save_hb_synth_fx = hCPE->hStereoDft->q_dft; + move16(); + Scale_sig32( &hSCE->save_synth_fx[0], extract_l( Mpy_32_32( hCPE->hCoreCoder[0]->output_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), hCPE->hStereoDft->q_dft - hSCE->q_save_synth_fx ); // q_dft + hSCE->q_save_synth_fx = hCPE->hStereoDft->q_dft; + move16(); + } + FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) + { + scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft + hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; + move16(); + } + FOR( i = 0; i < CPE_CHANNELS; i++ ) + Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( hCPE->q_prev_synth_fx, Q11 ) ); // q_prev_synth_fx + ivas_sba_dirac_stereo_dec_fx( st_ivas, &p_output_fx[sba_ch_idx], output_frame, 0 ); + FOR( i = 0; i < 2; i++ ) + { + Scale_sig32( p_output_fx[sba_ch_idx + i], L_FRAME48k, negate( s ) ); + } - Q_p_output = s_max( 3, sub( min_norm, 1 ) ); + FOR( i = 0; i < CPE_CHANNELS; i++ ) + Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( 11, hCPE->q_prev_synth_fx ) ); // Q11 - Q_p_output = s_min( Q_p_output, 19 ); // to restrict Q-factor of p_ouptut to Q30 - FOR( ch = 0; ch < nchan_transport; ch++ ) - { - Scale_sig32( p_output_fx[sba_ch_idx + ch], output_frame, Q_p_output ); // Q_p_output + Q11 - } - Q_p_output = add( Q11, Q_p_output ); - hSpar->hMdDec->Q_mixer_mat = 31; - move16(); + scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 + FOR( i = 0; i < CPE_CHANNELS; ++i ) + { + scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 + scale_sig32( hCPE->input_mem_fx[i], NS2SA_FX2( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 + } - ivas_sba_mix_matrix_determiner_fx( st_ivas->hSpar, &p_output_fx[sba_ch_idx], st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames, sub( Q_p_output, Q11 ) ); - FOR( Word16 c = 0; c < nchan_transport; c++ ) - { - Scale_sig32( p_output_fx[sba_ch_idx + c], output_frame, Q11 ); // Q11 - } - } - ELSE IF( NE_32( st_ivas->renderer_type, RENDERER_DISABLE ) && st_ivas->sba_dirac_stereo_flag == 0 ) - { - Word16 size = add( st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, sba_ch_idx ); - if ( EQ_16( size, 3 ) ) - { - size = add( size, 1 ); - } + IF( hCPE->hCoreCoder[0] != NULL ) + { + Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB, q ) ); // Q_old_wtda_LB + Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, L_FRAME48k, sub( hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda, q ) ); // Q_old_wtda + } + IF( hCPE->hStereoDft != NULL ) + { + scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 + scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); // Q11 + hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; + move16(); + } - FOR( i = sba_ch_idx; i < size; i++ ) - { - Scale_sig32( p_output_fx[i], output_frame, ( Q14 - Q11 ) ); // Q14 + FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) + { + scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 + hCPE->q_output_mem_fx[ii] = Q11; + move16(); + } + } } - ivas_spar_dec_agc_pca_fx( st_ivas, &p_output_fx[sba_ch_idx], output_frame ); - } - - test(); - test(); - IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) - { - /* loudness correction */ - ivas_dirac_dec_binaural_sba_gain_fx( &p_output_fx[sba_ch_idx], nchan_remapped, output_frame ); /*returns Q-1*/ - - FOR( i = 0; i < nchan_remapped; i++ ) + /* HP filtering */ + FOR( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) { - Scale_sig32( p_output_fx[i], output_frame, 1 ); // Q-1 -> Q + hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); } - } - ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) - { - ivas_ism_mono_dmx_fx( st_ivas, p_output_fx, output_frame ); - Scale_sig32( p_output_fx[0], L_FRAME48k, Q11 - Q8 ); // Q11 + nchan_remapped = ivas_sba_remapTCs_fx( &p_output_fx[sba_ch_idx], st_ivas, output_frame ); - /* add W */ - FOR( n = 0; n < nchan_out; n++ ) + test(); + test(); + IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { - v_add_32( p_output_fx[n], p_output_fx[n + s_max( nchan_out, nchan_ism )], p_output_fx[n], output_frame ); - } - } -} -ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) ) -{ + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); + SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; + Word16 nchan_transport; + // num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; + move16(); + nchan_out = nchan_transport; + move16(); + Word16 Q_p_output; + Word16 min_norm = 31; + move16(); - // st = (st_ivas->nSCE > 0) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; - IF( st_ivas->nSCE > 0 ) - { - st = st_ivas->hSCE[0]->hCoreCoder[0]; - } - ELSE - { - st = st_ivas->hCPE[0]->hCoreCoder[0]; - } + FOR( ch = 0; ch < nchan_transport; ++ch ) + { + Word16 norm = L_norm_arr( p_output_fx[sba_ch_idx + ch], output_frame ); // Normalize per channel + min_norm = s_min( norm, min_norm ); + } - IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) ) - { - /* LFE channel decoder */ - ivas_lfe_dec_fx( st_ivas->hLFE, st, output_frame, st_ivas->bfi, p_output_fx[LFE_CHANNEL] ); + Q_p_output = s_max( 3, sub( min_norm, 1 ) ); - Scale_sig32( p_output_fx[LFE_CHANNEL], L_FRAME48k, Q11 - Q9 ); // Q11 - IF( NE_32( ( error = ivas_mct_dec_fx( st_ivas, p_output_fx, output_frame, 0 ) ), IVAS_ERR_OK ) ) - { - return error; - } - /* HP filtering */ - FOR( n = 0; n < st_ivas->nchan_transport; n++ ) - { - IF( NE_16( n, LFE_CHANNEL ) ) + Q_p_output = s_min( Q_p_output, 19 ); // to restrict Q-factor of p_ouptut to Q30 + FOR( ch = 0; ch < nchan_transport; ch++ ) { - hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); + Scale_sig32( p_output_fx[sba_ch_idx + ch], output_frame, Q_p_output ); // Q_p_output + Q11 } - } + Q_p_output = add( Q11, Q_p_output ); + hSpar->hMdDec->Q_mixer_mat = 31; + move16(); - test(); - test(); - test(); - IF( NE_32( st_ivas->transport_config, st_ivas->intern_config ) && ( NE_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_FOA ) || NE_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_HOA2 ) || NE_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) - { - IF( GE_16( add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe ), add( st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->hIntSetup.num_lfe ) ) ) + ivas_sba_mix_matrix_determiner_fx( st_ivas->hSpar, &p_output_fx[sba_ch_idx], st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames, sub( Q_p_output, Q11 ) ); + FOR( Word16 c = 0; c < nchan_transport; c++ ) { - ivas_mc2sba_fx( st_ivas->hTransSetup, p_output_fx, p_output_fx, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE_FX ); + Scale_sig32( p_output_fx[sba_ch_idx + c], output_frame, Q11 ); // Q11 } } - - test(); - test(); - IF( ( EQ_32( st_ivas->renderer_type, RENDERER_MC ) || EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) ) && GE_16( add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe ), add( st_ivas->hOutSetup.nchan_out_woLFE, st_ivas->hOutSetup.num_lfe ) ) ) + ELSE IF( NE_32( st_ivas->renderer_type, RENDERER_DISABLE ) && st_ivas->sba_dirac_stereo_flag == 0 ) { - IF( EQ_32( st_ivas->renderer_type, RENDERER_MC ) ) + Word16 size = add( st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, sba_ch_idx ); + if ( EQ_16( size, 3 ) ) { - s = Q16 - Q11; - move16(); - s = sub( s, find_guarded_bits_fx( st_ivas->nchan_transport ) ); - FOR( i = 0; i < s_max( st_ivas->hDecoderConfig->nchan_out, st_ivas->nchan_transport ); ++i ) - { - Scale_sig32( p_output_fx[i], output_frame, s ); // Q(11+s) - } - ivas_ls_setup_conversion_fx( st_ivas, st_ivas->nchan_transport, output_frame, p_output_fx, p_output_fx ); - FOR( i = 0; i < s_max( st_ivas->hDecoderConfig->nchan_out, st_ivas->nchan_transport ); ++i ) - { - Scale_sig32( p_output_fx[i], output_frame, negate( s ) ); // Q11 - } - } - ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) ) - { - ivas_mc2sba_fx( st_ivas->hIntSetup, p_output_fx, p_output_fx, output_frame, st_ivas->hOutSetup.ambisonics_order, 0 ); + size = add( size, 1 ); } - } - } - ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) - { - /* LFE channel decoder */ - ivas_lfe_dec_fx( st_ivas->hLFE, st, output_frame, st_ivas->bfi, p_output_fx[LFE_CHANNEL] ); - - Scale_sig32( p_output_fx[LFE_CHANNEL], L_FRAME48k, Q11 - Q9 ); // Q11 - - ivas_mc_paramupmix_dec_read_BS( st_ivas, st, st_ivas->hMCParamUpmix, &nb_bits_metadata[0] ); - IF( NE_32( ( error = ivas_mct_dec_fx( st_ivas, p_output_fx, output_frame, nb_bits_metadata[0] ) ), IVAS_ERR_OK ) ) - { - return error; - } - /* HP filtering */ - FOR( n = 0; n < st_ivas->nchan_transport; n++ ) - { - IF( NE_16( n, LFE_CHANNEL ) ) + FOR( i = sba_ch_idx; i < size; i++ ) { - hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); + Scale_sig32( p_output_fx[i], output_frame, ( Q14 - Q11 ) ); // Q14 } + + ivas_spar_dec_agc_pca_fx( st_ivas, &p_output_fx[sba_ch_idx], output_frame ); } - /* Rendering */ test(); test(); - IF( EQ_32( st_ivas->renderer_type, RENDERER_MC ) && ( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) ) + IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { - /* Compensate loudness for not doing full upmix */ - FOR( n = 4; n < 8; n++ ) - { - Scale_sig32( p_output_fx[n], output_frame, 1 ); - } + /* loudness correction */ + ivas_dirac_dec_binaural_sba_gain_fx( &p_output_fx[sba_ch_idx], nchan_remapped, output_frame ); /*returns Q-1*/ - test(); - IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) + FOR( i = 0; i < nchan_remapped; i++ ) { - s = Q16 - Q11; - move16(); - Word16 nchan_transport; - nchan_transport = audioCfg2channels( IVAS_AUDIO_CONFIG_5_1_2 ); - s = sub( s, find_guarded_bits_fx( nchan_transport ) ); - FOR( i = 0; i < s_max( st_ivas->hDecoderConfig->nchan_out, nchan_transport ); ++i ) - { - Scale_sig32( p_output_fx[i], output_frame, s ); - } - ivas_ls_setup_conversion_fx( st_ivas, nchan_transport, output_frame, p_output_fx, p_output_fx ); - FOR( i = 0; i < s_max( st_ivas->hDecoderConfig->nchan_out, nchan_transport ); ++i ) - { - Scale_sig32( p_output_fx[i], output_frame, negate( s ) ); - } + Scale_sig32( p_output_fx[i], output_frame, 1 ); // Q-1 -> Q } } - } - ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMMC ) ) - { - /* read Parametric MC parameters from the bitstream */ - ivas_param_mc_dec_read_BS_fx( ivas_total_brate, st, st_ivas->hParamMC, &nb_bits_metadata[0] ); - - IF( EQ_16( st_ivas->nCPE, 1 ) ) + ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { - Word16 q_output = 11; - move16(); + ivas_ism_mono_dmx_fx( st_ivas, p_output_fx, output_frame ); - IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0] ) ), IVAS_ERR_OK ) ) - { - return error; - } - IF( NE_16( q_output, Q11 ) ) - { - Scale_sig32( p_output_fx[0], output_frame, sub( Q11, q_output ) ); // Q11 - Scale_sig32( p_output_fx[1], output_frame, sub( Q11, q_output ) ); // Q11 - } - } - ELSE IF( GT_16( st_ivas->nCPE, 1 ) ) - { - IF( NE_32( ( error = ivas_mct_dec_fx( st_ivas, p_output_fx, output_frame, nb_bits_metadata[0] ) ), IVAS_ERR_OK ) ) + Scale_sig32( p_output_fx[0], L_FRAME48k, Q11 - Q8 ); // Q11 + + /* add W */ + FOR( n = 0; n < nchan_out; n++ ) { - return error; + v_add_32( p_output_fx[n], p_output_fx[n + s_max( nchan_out, nchan_ism )], p_output_fx[n], output_frame ); } } - - /* HP filtering */ - FOR( n = 0; n < st_ivas->nchan_transport; n++ ) - { - hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); - } - - /* Rendering */ - test(); - IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) - { - ivas_ls_setup_conversion_fx( st_ivas, st_ivas->nchan_transport, output_frame, p_output_fx, p_output_fx ); - } } - ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCMASA ) ) + ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) ) { - IF( st_ivas->hOutSetup.separateChannelEnabled ) + + // st = (st_ivas->nSCE > 0) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; + IF( st_ivas->nSCE > 0 ) { - st = st_ivas->hCPE[0]->hCoreCoder[0]; /* Metadata is always with CPE in the case of separated channel */ + st = st_ivas->hSCE[0]->hCoreCoder[0]; } - - /* read McMASA parameters from the bitstream */ - - IF( NE_32( ( error = ivas_masa_decode_fx( st_ivas, st, &nb_bits_metadata[0] ) ), IVAS_ERR_OK ) ) + ELSE { - return error; + st = st_ivas->hCPE[0]->hCoreCoder[0]; } - IF( st_ivas->hOutSetup.separateChannelEnabled ) + IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) ) { - /* Decode the transport audio signals */ - Word16 q_output = 11; - move16(); + /* LFE channel decoder */ + ivas_lfe_dec_fx( st_ivas->hLFE, st, output_frame, st_ivas->bfi, p_output_fx[LFE_CHANNEL] ); - IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0] ) ), IVAS_ERR_OK ) ) + Scale_sig32( p_output_fx[LFE_CHANNEL], L_FRAME48k, Q11 - Q9 ); // Q11 + IF( NE_32( ( error = ivas_mct_dec_fx( st_ivas, p_output_fx, output_frame, 0 ) ), IVAS_ERR_OK ) ) { return error; } - IF( NE_16( q_output, Q11 ) ) + /* HP filtering */ + FOR( n = 0; n < st_ivas->nchan_transport; n++ ) { - Scale_sig32( p_output_fx[0], output_frame, sub( Q11, q_output ) ); // Q11 - Scale_sig32( p_output_fx[1], output_frame, sub( Q11, q_output ) ); // Q11 + IF( NE_16( n, LFE_CHANNEL ) ) + { + hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); + } } - /* Identify the index of the separated channel, always LFE_CHANNEL-1 here */ - n = LFE_CHANNEL - 1; - move16(); - - /* Decode the separated channel to output[n] to be combined with the synthesized channels */ - - set32_fx( p_output_fx[n], 0, L_FRAME48k ); - - IF( NE_32( ( error = ivas_sce_dec_fx( st_ivas, 0, &p_output_fx[n], output_frame, 0 ) ), IVAS_ERR_OK ) ) - { - return error; - } - test(); - test(); test(); test(); test(); + IF( NE_32( st_ivas->transport_config, st_ivas->intern_config ) && ( NE_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_FOA ) || NE_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_HOA2 ) || NE_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) + { + IF( GE_16( add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe ), add( st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->hIntSetup.num_lfe ) ) ) + { + ivas_mc2sba_fx( st_ivas->hTransSetup, p_output_fx, p_output_fx, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE_FX ); + } + } + test(); test(); - /* Delay the separated channel to sync with CLDFB delay of the DirAC synthesis, and synthesize the LFE signal. */ - IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) || - EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) || ( EQ_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && st_ivas->hOutSetup.num_lfe > 0 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) + IF( ( EQ_32( st_ivas->renderer_type, RENDERER_MC ) || EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) ) && GE_16( add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe ), add( st_ivas->hOutSetup.nchan_out_woLFE, st_ivas->hOutSetup.num_lfe ) ) ) + { + IF( EQ_32( st_ivas->renderer_type, RENDERER_MC ) ) + { + s = Q16 - Q11; + move16(); + s = sub( s, find_guarded_bits_fx( st_ivas->nchan_transport ) ); + FOR( i = 0; i < s_max( st_ivas->hDecoderConfig->nchan_out, st_ivas->nchan_transport ); ++i ) + { + Scale_sig32( p_output_fx[i], output_frame, s ); // Q(11+s) + } + ivas_ls_setup_conversion_fx( st_ivas, st_ivas->nchan_transport, output_frame, p_output_fx, p_output_fx ); + FOR( i = 0; i < s_max( st_ivas->hDecoderConfig->nchan_out, st_ivas->nchan_transport ); ++i ) + { + Scale_sig32( p_output_fx[i], output_frame, negate( s ) ); // Q11 + } + } + ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) ) + { + ivas_mc2sba_fx( st_ivas->hIntSetup, p_output_fx, p_output_fx, output_frame, st_ivas->hOutSetup.ambisonics_order, 0 ); + } + } + } + ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) + { + /* LFE channel decoder */ + ivas_lfe_dec_fx( st_ivas->hLFE, st, output_frame, st_ivas->bfi, p_output_fx[LFE_CHANNEL] ); + + Scale_sig32( p_output_fx[LFE_CHANNEL], L_FRAME48k, Q11 - Q9 ); // Q11 + + ivas_mc_paramupmix_dec_read_BS( st_ivas, st, st_ivas->hMCParamUpmix, &nb_bits_metadata[0] ); + + IF( NE_32( ( error = ivas_mct_dec_fx( st_ivas, p_output_fx, output_frame, nb_bits_metadata[0] ) ), IVAS_ERR_OK ) ) { - ivas_lfe_synth_with_filters_fx( st_ivas->hMasa->hMasaLfeSynth, p_output_fx, output_frame, n, LFE_CHANNEL ); + return error; } - ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && st_ivas->hOutSetup.num_lfe == 0 ) + /* HP filtering */ + FOR( n = 0; n < st_ivas->nchan_transport; n++ ) { - /* Delay the separated channel to sync with the DirAC rendering */ - delay_signal32_fx( p_output_fx[n], output_frame, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_size ); + IF( NE_16( n, LFE_CHANNEL ) ) + { + hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); + } } - } - ELSE - { - Word16 q_output = 11; - move16(); - IF( EQ_16( st_ivas->nSCE, 1 ) ) + + /* Rendering */ + test(); + test(); + IF( EQ_32( st_ivas->renderer_type, RENDERER_MC ) && ( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) ) { - set32_fx( p_output_fx[0], 0, L_FRAME48k ); + /* Compensate loudness for not doing full upmix */ + FOR( n = 4; n < 8; n++ ) + { + Scale_sig32( p_output_fx[n], output_frame, 1 ); + } - IF( NE_32( ( error = ivas_sce_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0] ) ), IVAS_ERR_OK ) ) + test(); + IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) { - return error; + s = Q16 - Q11; + move16(); + Word16 nchan_transport; + nchan_transport = audioCfg2channels( IVAS_AUDIO_CONFIG_5_1_2 ); + s = sub( s, find_guarded_bits_fx( nchan_transport ) ); + FOR( i = 0; i < s_max( st_ivas->hDecoderConfig->nchan_out, nchan_transport ); ++i ) + { + Scale_sig32( p_output_fx[i], output_frame, s ); + } + ivas_ls_setup_conversion_fx( st_ivas, nchan_transport, output_frame, p_output_fx, p_output_fx ); + FOR( i = 0; i < s_max( st_ivas->hDecoderConfig->nchan_out, nchan_transport ); ++i ) + { + Scale_sig32( p_output_fx[i], output_frame, negate( s ) ); + } } } - ELSE IF( EQ_16( st_ivas->nCPE, 1 ) ) + } + ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMMC ) ) + { + /* read Parametric MC parameters from the bitstream */ + ivas_param_mc_dec_read_BS_fx( ivas_total_brate, st, st_ivas->hParamMC, &nb_bits_metadata[0] ); + + IF( EQ_16( st_ivas->nCPE, 1 ) ) { + Word16 q_output = 11; + move16(); IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0] ) ), IVAS_ERR_OK ) ) { @@ -1335,178 +1229,285 @@ ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) ) Scale_sig32( p_output_fx[1], output_frame, sub( Q11, q_output ) ); // Q11 } } - } - - IF( st_ivas->sba_dirac_stereo_flag != 0 ) /* use the flag to trigger the DFT upmix */ - { - Word16 q; - hCPE = st_ivas->hCPE[0]; - hSCE = st_ivas->hSCE[0]; - s = 0; - move16(); - FOR( i = 0; i < 2; i++ ) + ELSE IF( GT_16( st_ivas->nCPE, 1 ) ) { - s = s_min( s, L_norm_arr( p_output_fx[i], L_FRAME48k ) - 11 /* Guard bits */ ); + IF( NE_32( ( error = ivas_mct_dec_fx( st_ivas, p_output_fx, output_frame, nb_bits_metadata[0] ) ), IVAS_ERR_OK ) ) + { + return error; + } } - FOR( i = 0; i < 2; i++ ) + + /* HP filtering */ + FOR( n = 0; n < st_ivas->nchan_transport; n++ ) { - Scale_sig32( p_output_fx[i], L_FRAME48k, s ); // Q(11+s) + hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); } - hCPE->hStereoDft->q_dft = add( Q11, s ); - move16(); - IF( EQ_16( hCPE->hStereoDft->first_frame, 1 ) ) + /* Rendering */ + test(); + IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) { - hCPE->hStereoDft->q_smoothed_nrg = Q6; // hCPE->hStereoDft->q_dft; - hCPE->hStereoDft->q_ap_delay_mem_fx = hCPE->hStereoDft->q_dft; - - move16(); - move16(); + ivas_ls_setup_conversion_fx( st_ivas, st_ivas->nchan_transport, output_frame, p_output_fx, p_output_fx ); + } + } + ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCMASA ) ) + { + IF( st_ivas->hOutSetup.separateChannelEnabled ) + { + st = st_ivas->hCPE[0]->hCoreCoder[0]; /* Metadata is always with CPE in the case of separated channel */ } - q = hCPE->hStereoDft->q_dft; - move16(); + /* read McMASA parameters from the bitstream */ - scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); - FOR( i = 0; i < CPE_CHANNELS; ++i ) + IF( NE_32( ( error = ivas_masa_decode_fx( st_ivas, st, &nb_bits_metadata[0] ) ), IVAS_ERR_OK ) ) { - scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft - scale_sig32( hCPE->input_mem_fx[i], NS2SA_FX2( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft + return error; } - IF( hCPE->hCoreCoder[0] != NULL ) + IF( st_ivas->hOutSetup.separateChannelEnabled ) { - Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ); // q - Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); // q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_out_fx32 = q; + /* Decode the transport audio signals */ + Word16 q_output = 11; move16(); - } - IF( hCPE->hStereoDft != NULL ) - { - scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft - scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); // q_dft - hCPE->hStereoDft->q_ap_fade_mem_fx = hCPE->hStereoDft->q_dft; + + IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0] ) ), IVAS_ERR_OK ) ) + { + return error; + } + IF( NE_16( q_output, Q11 ) ) + { + Scale_sig32( p_output_fx[0], output_frame, sub( Q11, q_output ) ); // Q11 + Scale_sig32( p_output_fx[1], output_frame, sub( Q11, q_output ) ); // Q11 + } + + /* Identify the index of the separated channel, always LFE_CHANNEL-1 here */ + n = LFE_CHANNEL - 1; move16(); + + /* Decode the separated channel to output[n] to be combined with the synthesized channels */ + + set32_fx( p_output_fx[n], 0, L_FRAME48k ); + + IF( NE_32( ( error = ivas_sce_dec_fx( st_ivas, 0, &p_output_fx[n], output_frame, 0 ) ), IVAS_ERR_OK ) ) + { + return error; + } + test(); + test(); + test(); + test(); + test(); + test(); + test(); + /* Delay the separated channel to sync with CLDFB delay of the DirAC synthesis, and synthesize the LFE signal. */ + IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) || + EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) || ( EQ_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && st_ivas->hOutSetup.num_lfe > 0 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) + { + ivas_lfe_synth_with_filters_fx( st_ivas->hMasa->hMasaLfeSynth, p_output_fx, output_frame, n, LFE_CHANNEL ); + } + ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && st_ivas->hOutSetup.num_lfe == 0 ) + { + /* Delay the separated channel to sync with the DirAC rendering */ + delay_signal32_fx( p_output_fx[n], output_frame, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_size ); + } } - IF( st_ivas->hSpar != NULL ) + ELSE { - st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; + Word16 q_output = 11; move16(); + IF( EQ_16( st_ivas->nSCE, 1 ) ) + { + set32_fx( p_output_fx[0], 0, L_FRAME48k ); + + IF( NE_32( ( error = ivas_sce_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0] ) ), IVAS_ERR_OK ) ) + { + return error; + } + } + ELSE IF( EQ_16( st_ivas->nCPE, 1 ) ) + { + + IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0] ) ), IVAS_ERR_OK ) ) + { + return error; + } + IF( NE_16( q_output, Q11 ) ) + { + Scale_sig32( p_output_fx[0], output_frame, sub( Q11, q_output ) ); // Q11 + Scale_sig32( p_output_fx[1], output_frame, sub( Q11, q_output ) ); // Q11 + } + } } - IF( hSCE != NULL ) + IF( st_ivas->sba_dirac_stereo_flag != 0 ) /* use the flag to trigger the DFT upmix */ { - Scale_sig32( &hSCE->save_hb_synth_fx[0], extract_l( Mpy_32_32( hCPE->hCoreCoder[0]->output_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), hCPE->hStereoDft->q_dft - hSCE->q_save_hb_synth_fx ); // q_dft - hSCE->q_save_hb_synth_fx = hCPE->hStereoDft->q_dft; - move16(); - Scale_sig32( &hSCE->save_synth_fx[0], extract_l( Mpy_32_32( hCPE->hCoreCoder[0]->output_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), hCPE->hStereoDft->q_dft - hSCE->q_save_synth_fx ); // q_dft - hSCE->q_save_synth_fx = hCPE->hStereoDft->q_dft; + Word16 q; + hCPE = st_ivas->hCPE[0]; + hSCE = st_ivas->hSCE[0]; + s = 0; move16(); - } - FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) - { - scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, hCPE->q_output_mem_fx[ii] ) ); // q_dft - hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; + FOR( i = 0; i < 2; i++ ) + { + s = s_min( s, L_norm_arr( p_output_fx[i], L_FRAME48k ) - 11 /* Guard bits */ ); + } + FOR( i = 0; i < 2; i++ ) + { + Scale_sig32( p_output_fx[i], L_FRAME48k, s ); // Q(11+s) + } + + hCPE->hStereoDft->q_dft = add( Q11, s ); move16(); - } - FOR( i = 0; i < CPE_CHANNELS; i++ ) - Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( hCPE->q_prev_synth_fx, Q11 ) ); // q_prev_synth_fx - ivas_sba_dirac_stereo_dec_fx( st_ivas, p_output_fx, output_frame, 1 ); - FOR( i = 0; i < 2; i++ ) - { - Scale_sig32( p_output_fx[i], L_FRAME48k, negate( s ) ); - } - FOR( i = 0; i < CPE_CHANNELS; i++ ) - Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->q_prev_synth_fx ) ); // Q11 + IF( EQ_16( hCPE->hStereoDft->first_frame, 1 ) ) + { + hCPE->hStereoDft->q_smoothed_nrg = Q6; // hCPE->hStereoDft->q_dft; + hCPE->hStereoDft->q_ap_delay_mem_fx = hCPE->hStereoDft->q_dft; - scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); - FOR( i = 0; i < CPE_CHANNELS; ++i ) - { - scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 - scale_sig32( hCPE->input_mem_fx[i], NS2SA_FX2( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 - } + move16(); + move16(); + } - IF( hCPE->hCoreCoder[0] != NULL ) - { - Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB, q ) ); // Q_old_wtda_LB - Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, L_FRAME48k, sub( hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda, q ) ); // Q_old_wtda - } - IF( hCPE->hStereoDft != NULL ) - { - scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 - scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA_FX2( 16000, DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); // Q11 - hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; + q = hCPE->hStereoDft->q_dft; move16(); - } - IF( st_ivas->hSpar != NULL ) - { + + scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); + FOR( i = 0; i < CPE_CHANNELS; ++i ) + { + scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft + scale_sig32( hCPE->input_mem_fx[i], NS2SA_FX2( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft + } + + IF( hCPE->hCoreCoder[0] != NULL ) + { + Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ); // q + Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); // q + hCPE->hCoreCoder[0]->hHQ_core->Q_old_out_fx32 = q; + move16(); + } + IF( hCPE->hStereoDft != NULL ) + { + scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft + scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA( 16000, DELAY_BWE_TOTAL_NS ), sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); // q_dft + hCPE->hStereoDft->q_ap_fade_mem_fx = hCPE->hStereoDft->q_dft; + move16(); + } + IF( st_ivas->hSpar != NULL ) + { + st_ivas->hSpar->hMdDec->Q_mixer_mat = 30; + move16(); + } + + IF( hSCE != NULL ) + { + Scale_sig32( &hSCE->save_hb_synth_fx[0], extract_l( Mpy_32_32( hCPE->hCoreCoder[0]->output_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), hCPE->hStereoDft->q_dft - hSCE->q_save_hb_synth_fx ); // q_dft + hSCE->q_save_hb_synth_fx = hCPE->hStereoDft->q_dft; + move16(); + Scale_sig32( &hSCE->save_synth_fx[0], extract_l( Mpy_32_32( hCPE->hCoreCoder[0]->output_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), hCPE->hStereoDft->q_dft - hSCE->q_save_synth_fx ); // q_dft + hSCE->q_save_synth_fx = hCPE->hStereoDft->q_dft; + move16(); + } FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) { - scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 - hCPE->q_output_mem_fx[ii] = Q11; + scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, hCPE->q_output_mem_fx[ii] ) ); // q_dft + hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; + move16(); + } + FOR( i = 0; i < CPE_CHANNELS; i++ ) + Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( hCPE->q_prev_synth_fx, Q11 ) ); // q_prev_synth_fx + ivas_sba_dirac_stereo_dec_fx( st_ivas, p_output_fx, output_frame, 1 ); + FOR( i = 0; i < 2; i++ ) + { + Scale_sig32( p_output_fx[i], L_FRAME48k, negate( s ) ); + } + FOR( i = 0; i < CPE_CHANNELS; i++ ) + Scale_sig32( hCPE->prev_synth_fx[i], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->q_prev_synth_fx ) ); // Q11 + + scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); + FOR( i = 0; i < CPE_CHANNELS; ++i ) + { + scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 + scale_sig32( hCPE->input_mem_fx[i], NS2SA_FX2( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 + } + + IF( hCPE->hCoreCoder[0] != NULL ) + { + Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB, q ) ); // Q_old_wtda_LB + Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, L_FRAME48k, sub( hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda, q ) ); // Q_old_wtda + } + IF( hCPE->hStereoDft != NULL ) + { + scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 + scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA_FX2( 16000, DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); // Q11 + hCPE->hStereoDft->q_ap_fade_mem_fx = Q11; move16(); } + IF( st_ivas->hSpar != NULL ) + { + FOR( ii = 0; ii < CPE_CHANNELS; ii++ ) + { + scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11 + hCPE->q_output_mem_fx[ii] = Q11; + move16(); + } + } } - } - /* HP filtering */ - FOR( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) - { - hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); - } + /* HP filtering */ + FOR( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) + { + hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs ); + } - IF( EQ_32( st_ivas->renderer_type, RENDERER_MCMASA_MONO_STEREO ) ) - { - ivas_mono_stereo_downmix_mcmasa_fx( st_ivas, p_output_fx, output_frame ); + IF( EQ_32( st_ivas->renderer_type, RENDERER_MCMASA_MONO_STEREO ) ) + { + ivas_mono_stereo_downmix_mcmasa_fx( st_ivas, p_output_fx, output_frame ); + } } } -} -/*----------------------------------------------------------------* - * Common updates - *----------------------------------------------------------------*/ + /*----------------------------------------------------------------* + * Common updates + *----------------------------------------------------------------*/ -IF( !st_ivas->bfi ) /* do not update if first frame(s) are lost or NO_DATA */ -{ - st_ivas->hDecoderConfig->last_ivas_total_brate = ivas_total_brate; - move32(); - IF( LE_32( ivas_total_brate, IVAS_SID_5k2 ) ) + IF( !st_ivas->bfi ) /* do not update if first frame(s) are lost or NO_DATA */ { - st_ivas->last_active_ivas_total_brate = st_ivas->last_active_ivas_total_brate; + st_ivas->hDecoderConfig->last_ivas_total_brate = ivas_total_brate; move32(); + IF( LE_32( ivas_total_brate, IVAS_SID_5k2 ) ) + { + st_ivas->last_active_ivas_total_brate = st_ivas->last_active_ivas_total_brate; + move32(); + } + ELSE + { + st_ivas->last_active_ivas_total_brate = ivas_total_brate; + move32(); + } } - ELSE + + test(); + test(); + if ( LT_16( st_ivas->ini_frame, MAX_FRAME_COUNTER ) && !( st_ivas->bfi && st_ivas->ini_frame == 0 ) ) /* keep "st_ivas->ini_frame = 0" until first good received frame */ { - st_ivas->last_active_ivas_total_brate = ivas_total_brate; - move32(); + st_ivas->ini_frame = add( st_ivas->ini_frame, 1 ); + move16(); } -} - -test(); -test(); -if ( LT_16( st_ivas->ini_frame, MAX_FRAME_COUNTER ) && !( st_ivas->bfi && st_ivas->ini_frame == 0 ) ) /* keep "st_ivas->ini_frame = 0" until first good received frame */ -{ - st_ivas->ini_frame = add( st_ivas->ini_frame, 1 ); - move16(); -} -test(); -test(); -if ( LT_16( st_ivas->ini_active_frame, MAX_FRAME_COUNTER ) && !( st_ivas->bfi && st_ivas->ini_frame == 0 ) && GT_32( ivas_total_brate, IVAS_SID_5k2 ) ) /* needed in MASA decoder in case the first active frame is BFI, and there were SID-frames decoded before */ -{ - st_ivas->ini_active_frame = add( st_ivas->ini_active_frame, 1 ); - move16(); -} + test(); + test(); + if ( LT_16( st_ivas->ini_active_frame, MAX_FRAME_COUNTER ) && !( st_ivas->bfi && st_ivas->ini_frame == 0 ) && GT_32( ivas_total_brate, IVAS_SID_5k2 ) ) /* needed in MASA decoder in case the first active frame is BFI, and there were SID-frames decoded before */ + { + st_ivas->ini_active_frame = add( st_ivas->ini_active_frame, 1 ); + move16(); + } -st_ivas->last_ivas_format = st_ivas->ivas_format; -move32(); -pop_wmops(); + st_ivas->last_ivas_format = st_ivas->ivas_format; + move32(); + pop_wmops(); -return IVAS_ERR_OK; + return IVAS_ERR_OK; } - /*--------------------------------------------------------------------------* * ivas_dec_feed_tc_to_renderer() * @@ -1695,10 +1696,10 @@ ivas_error ivas_jbm_dec_render_fx( } } - FOR( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) - { - p_tc_fx[n] = &st_ivas->hTcBuffer->tc_fx[n][st_ivas->hTcBuffer->n_samples_rendered]; - } + FOR( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) + { + p_tc_fx[n] = &st_ivas->hTcBuffer->tc_fx[n][st_ivas->hTcBuffer->n_samples_rendered]; + } st_ivas->hTcBuffer->no_channels = st_ivas->hTcBuffer->nchan_buffer_full; move16(); diff --git a/lib_dec/ivas_sba_rendering_internal_fx.c b/lib_dec/ivas_sba_rendering_internal_fx.c index c9d6a09c6..d9f7b26be 100644 --- a/lib_dec/ivas_sba_rendering_internal_fx.c +++ b/lib_dec/ivas_sba_rendering_internal_fx.c @@ -383,9 +383,9 @@ void ivas_ism2sba_sf_fx( FOR( j = 0; j < sba_num_chans; j++ ) { g2_fx = hIsmRendererData->interpolator_fx + offset; /*Pointer addition*/ /*Q15*/ - tc_fx = buffer_in_fx[i]; /*Q_buffer_in*/ - out_fx = buffer_tmp_fx[j]; /*Q_buffer_in + 29 - 31*/ - gain_fx = hIsmRendererData->gains_fx[i][j]; /*Q29*/ + tc_fx = buffer_in_fx[i]; /*Q_buffer_in*/ + out_fx = buffer_tmp_fx[j]; /*Q_buffer_in + 29 - 31*/ + gain_fx = hIsmRendererData->gains_fx[i][j]; /*Q29*/ move32(); prev_gain_fx = hIsmRendererData->prev_gains_fx[i][j]; /*Q29*/ move32(); diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index e931bc6c0..5034c9144 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -494,9 +494,9 @@ static ivas_error create_flush_buffer_fx( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_Configure( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const UWord32 sampleRate, /* i : output sampling frequency */ - const IVAS_AUDIO_CONFIG outputConfig, /* i : output configuration */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const UWord32 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 */ @@ -1208,28 +1208,28 @@ ivas_error IVAS_DEC_GetSamplesRenderer( } ELSE { - nOutChannels = (UWord8) st_ivas->hDecoderConfig->nchan_out; - hIvasDec->hasBeenFedFrame = false; + nOutChannels = (UWord8) st_ivas->hDecoderConfig->nchan_out; + hIvasDec->hasBeenFedFrame = false; - /* check for possible flushed samples from a rate switch */ - IF( GE_16( hIvasDec->nSamplesFlushed, 0 ) ) - { - /* note: offset (rendered samples) is always 0 */ - Copy( hIvasDec->flushbuffer, pcmBuf, imult1616( hIvasDec->nSamplesFlushed, nOutChannels ) ); + /* check for possible flushed samples from a rate switch */ + IF( GE_16( hIvasDec->nSamplesFlushed, 0 ) ) + { + /* note: offset (rendered samples) is always 0 */ + Copy( hIvasDec->flushbuffer, pcmBuf, imult1616( hIvasDec->nSamplesFlushed, nOutChannels ) ); - nSamplesRendered = hIvasDec->nSamplesFlushed; - hIvasDec->nSamplesFlushed = 0; - move16(); - move16(); - } + nSamplesRendered = hIvasDec->nSamplesFlushed; + hIvasDec->nSamplesFlushed = 0; + move16(); + move16(); + } - /* render IVAS frames directly to the output buffer */ - IF( ( error = ivas_jbm_dec_render_fx( st_ivas, sub( nSamplesAsked, nSamplesRendered ), &nSamplesRendered_loop, &hIvasDec->nSamplesAvailableNext, pcmBuf + imult3216( nSamplesRendered, nOutChannels ) ) ) != IVAS_ERR_OK ) - { - return error; - } + /* render IVAS frames directly to the output buffer */ + IF( ( error = ivas_jbm_dec_render_fx( st_ivas, sub( nSamplesAsked, nSamplesRendered ), &nSamplesRendered_loop, &hIvasDec->nSamplesAvailableNext, pcmBuf + imult3216( nSamplesRendered, nOutChannels ) ) ) != IVAS_ERR_OK ) + { + return error; + } - nSamplesRendered = add( nSamplesRendered, nSamplesRendered_loop ); + nSamplesRendered = add( nSamplesRendered, nSamplesRendered_loop ); } IF( hIvasDec->nSamplesAvailableNext == 0 ) @@ -2811,7 +2811,6 @@ ivas_error IVAS_DEC_HasDecodedFirstGoodFrame( } - /*---------------------------------------------------------------------* * isSidFrame( ) * @@ -4831,8 +4830,7 @@ void IVAS_DEC_PrintDisclaimer( void ) *---------------------------------------------------------------------*/ static ivas_error evs_dec_main_fx( - Decoder_Struct *st_ivas -) + Decoder_Struct *st_ivas ) { DEC_CORE_HANDLE *hCoreCoder; Word16 mixer_left_fx, mixer_right_fx; @@ -5002,89 +5000,91 @@ static ivas_error apa_setup( { DECODER_CONFIG_HANDLE hDecoderConfig; - UWord16 wss, css; - Word32 startQuality; + UWord16 wss, css; + Word32 startQuality; - startQuality = L_shl( L_deposit_l( hIvasDec->tsm_quality ), Q2 ); /* Q14 --> Q16*/ - apa_buffer_size = APA_BUF_PER_CHANNEL; + startQuality = L_shl( L_deposit_l( hIvasDec->tsm_quality ), Q2 ); /* Q14 --> Q16*/ + apa_buffer_size = APA_BUF_PER_CHANNEL; - move16(); - /* get current renderer type*/ - hDecoderConfig = hIvasDec->st_ivas->hDecoderConfig; + move16(); + /* get current renderer type*/ + hDecoderConfig = hIvasDec->st_ivas->hDecoderConfig; - IF( EQ_32( hDecoderConfig->output_Fs, 8000 ) ) - { - wss = 1; - css = 1; - } - ELSE IF( EQ_32( hDecoderConfig->output_Fs, 16000 ) ) - { - wss = 2; - css = 1; - } - ELSE IF( EQ_32( hDecoderConfig->output_Fs, 32000 ) ) - { - wss = 4; - css = 2; - } - ELSE IF( EQ_32( hDecoderConfig->output_Fs, 48000 ) ) - { - wss = 6; - css = 3; - } - ELSE - { - return IVAS_ERR_INIT_ERROR; - } + IF( EQ_32( hDecoderConfig->output_Fs, 8000 ) ) + { + wss = 1; + css = 1; + } + ELSE IF( EQ_32( hDecoderConfig->output_Fs, 16000 ) ) + { + wss = 2; + css = 1; + } + ELSE IF( EQ_32( hDecoderConfig->output_Fs, 32000 ) ) + { + wss = 4; + css = 2; + } + ELSE IF( EQ_32( hDecoderConfig->output_Fs, 48000 ) ) + { + wss = 6; + css = 3; + } + ELSE + { + return IVAS_ERR_INIT_ERROR; + } - move16(); - move16(); - test(); - test(); - test(); - test(); - IF( NE_32( (Word32) 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; - } + move16(); + move16(); + test(); + test(); + test(); + test(); + IF( NE_32( (Word32) 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( EQ_16( (Word16) hIvasDec->mode, IVAS_DEC_MODE_EVS ) ) + IF( EQ_16( (Word16) 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_fx = malloc( sizeof( Word32 ) * L_mult0( apa_buffer_size, (Word16) nTransportChannels ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); - } + IF( ( hIvasDec->apaExecBuffer_fx = malloc( sizeof( Word32 ) * L_mult0( apa_buffer_size, (Word16) nTransportChannels ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); + } - set_zero2_fx( hIvasDec->apaExecBuffer_fx, L_mult0( apa_buffer_size, (Word16) nTransportChannels ) ); + set_zero2_fx( hIvasDec->apaExecBuffer_fx, L_mult0( apa_buffer_size, (Word16) nTransportChannels ) ); + } + ELSE + { + IF( apa_reconfigure( hIvasDec->hTimeScaler, nTransportChannels, l_ts ) != 0 ) + { + return IVAS_ERR_INIT_ERROR; + } + apa_buffer_size = APA_BUF_PER_CHANNEL; + move16(); + free( hIvasDec->apaExecBuffer_fx ); + IF( ( hIvasDec->apaExecBuffer_fx = malloc( sizeof( Word32 ) * L_mult0( apa_buffer_size, (Word16) nTransportChannels ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); + } + set_zero2_fx( hIvasDec->apaExecBuffer_fx, L_mult0( apa_buffer_size, (Word16) nTransportChannels ) ); } - ELSE{ - IF( apa_reconfigure( hIvasDec->hTimeScaler, nTransportChannels, l_ts ) != 0 ){ - return IVAS_ERR_INIT_ERROR; -} -apa_buffer_size = APA_BUF_PER_CHANNEL; -move16(); -free( hIvasDec->apaExecBuffer_fx ); -IF( ( hIvasDec->apaExecBuffer_fx = malloc( sizeof( Word32 ) * L_mult0( apa_buffer_size, (Word16) nTransportChannels ) ) ) == NULL ) -{ - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); -} -set_zero2_fx( hIvasDec->apaExecBuffer_fx, L_mult0( apa_buffer_size, (Word16) nTransportChannels ) ); -} -hIvasDec->nTransportChannelsOld = nTransportChannels; -move16(); + hIvasDec->nTransportChannelsOld = nTransportChannels; + move16(); -return IVAS_ERR_OK; + return IVAS_ERR_OK; } -- GitLab From 64375ab23db7b000034d7456d96f98b23000e5f4 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:38:20 +0100 Subject: [PATCH 15/16] [cleanup] accept NONBE_FIX_1197_OMASA_META_BUFFER --- lib_com/options.h | 1 - lib_dec/ivas_omasa_dec_fx.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index ad7989246..568e29336 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -109,7 +109,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_fx.c b/lib_dec/ivas_omasa_dec_fx.c index c977395c4..3e9545245 100644 --- a/lib_dec/ivas_omasa_dec_fx.c +++ b/lib_dec/ivas_omasa_dec_fx.c @@ -662,7 +662,6 @@ ivas_error ivas_omasa_dec_config_fx( ivas_omasa_separate_object_renderer_close( st_ivas ); } -#ifdef NONBE_FIX_1197_OMASA_META_BUFFER test(); IF( EQ_32( 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 */ { @@ -679,7 +678,6 @@ ivas_error ivas_omasa_dec_config_fx( set_s( hMasaIsmData->azimuth_separated_ism_fx, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); set_s( hMasaIsmData->elevation_separated_ism_fx, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); } -#endif IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) ) { -- GitLab From 0c453dec5a289f39117851344f0e518c457878e8 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 27 Oct 2025 13:38:23 +0100 Subject: [PATCH 16/16] [cleanup] accept FIX_1113_EXTREND_ISAR --- lib_com/options.h | 1 - lib_rend/ivas_rotation_fx.c | 4 ---- lib_rend/lib_rend.h | 8 -------- lib_rend/lib_rend_fx.c | 12 ------------ 4 files changed, 25 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 568e29336..ac6854f9e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -95,7 +95,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_fx.c b/lib_rend/ivas_rotation_fx.c index 7a7fac369..10838dce6 100644 --- a/lib_rend/ivas_rotation_fx.c +++ b/lib_rend/ivas_rotation_fx.c @@ -1026,12 +1026,8 @@ void rotateFrame_shd_cldfb_fx( move16(); move16(); -#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.h b/lib_rend/lib_rend.h index 3709804b5..c06d6f3cf 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -260,20 +260,12 @@ ivas_error IVAS_REND_InitConfig( const IVAS_AUDIO_CONFIG outAudioConfig /* i : output audioConfig */ ); -#ifdef FIX_1113_EXTREND_ISAR ivas_error IVAS_REND_GetRenderConfig( -#else -Word16 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 -Word16 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_fx.c b/lib_rend/lib_rend_fx.c index 5827cc275..c4b0472e5 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -2967,11 +2967,7 @@ static ivas_error updateSbaPanGains( { IF( EQ_32( 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; @@ -4794,11 +4790,7 @@ ivas_error IVAS_REND_InitConfig( * *-------------------------------------------------------------------*/ -#ifdef FIX_1113_EXTREND_ISAR ivas_error IVAS_REND_GetRenderConfig( -#else -Word16 IVAS_REND_GetRenderConfig( -#endif IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ ) @@ -4855,11 +4847,7 @@ Word16 IVAS_REND_GetRenderConfig( * *-------------------------------------------------------------------*/ -#ifdef FIX_1113_EXTREND_ISAR ivas_error IVAS_REND_FeedRenderConfig( -#else -Word16 IVAS_REND_FeedRenderConfig( -#endif IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ ) -- GitLab