From 3dc57ea7e155dc2bb414aadcb92a7acbf2899c83 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 24 Jan 2023 15:38:48 +0100 Subject: [PATCH 01/11] [cleanup] accept FIX_245_RANGE_CODER_VOIP_MSAN --- lib_com/options.h | 1 - lib_dec/lib_dec.c | 6 ------ 2 files changed, 7 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index e6c4e17a47..27ffc017b8 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -147,7 +147,6 @@ #endif #define FIX_I59_DELAY_ROUNDING /* Issue 59: rounding in sample domain instead of nanosec for IVAS_ENC_GetDelay() and IVAS_DEC_GetDelay() */ #define FIX_FIX_I59 /* Issue 59: small fix concerning LFE delay rounding */ -#define FIX_245_RANGE_CODER_VOIP_MSAN /* Issue 245: fix use-of-uninitialized-value in range coder in VoIP mode */ #define REND_CFG_LFE /* Issue 110: Configurable LFE handling for external renderer */ #define FIX_235 /* Issue 235: Deallocation of HR filter memory separately for lib_rend (ROM) and lib_util (from file) */ #define ENV_STAB_FIX /* Contribution 23: HQ envelope stability memory fix */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 50524bf5f5..ea82d57716 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -517,11 +517,7 @@ ivas_error IVAS_DEC_EnableVoIP( #define WMC_TOOL_SKIP /* Bitstream conversion is not counted towards complexity and memory usage */ -#ifdef FIX_245_RANGE_CODER_VOIP_MSAN hIvasDec->hVoIP->bs_conversion_buf = malloc( sizeof( uint16_t ) * ( MAX_BITS_PER_FRAME + 4 * 8 ) ); -#else - hIvasDec->hVoIP->bs_conversion_buf = malloc( sizeof( uint16_t ) * MAX_BITS_PER_FRAME + 4 * 8 ); -#endif #undef WMC_TOOL_SKIP if ( hIvasDec->hVoIP->bs_conversion_buf == NULL ) @@ -1225,13 +1221,11 @@ static void bsCompactToSerial( const uint8_t *compact, uint16_t *serial, uint16_ byte <<= 1; } -#ifdef FIX_245_RANGE_CODER_VOIP_MSAN /* Add 4 padding bytes required by core coder */ for ( i = 0; i < 4 * 8; ++i ) { serial[num_bits + i] = 0; } -#endif #undef WMC_TOOL_SKIP } -- GitLab From d1517cab100db4a8a8d1cd8f075b21e8142c09e9 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 24 Jan 2023 15:39:45 +0100 Subject: [PATCH 02/11] [cleanup] accept REND_CFG_LFE --- apps/renderer.c | 80 --------------------------------------- lib_com/options.h | 1 - lib_rend/ivas_stat_rend.h | 2 - lib_rend/lib_rend.c | 41 -------------------- lib_rend/lib_rend.h | 19 ---------- 5 files changed, 143 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index f222976396..75111fbf1b 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -132,14 +132,12 @@ typedef struct bool quietModeEnabled; bool sceneDescriptionInput; float inputGainGlobal; /* Linear gain (not in dB) */ -#ifdef REND_CFG_LFE bool lfePanningEnabled; float lfeConfigGain; /* Linear gain (not in dB) */ float lfeConfigAzimuth; float lfeConfigElevation; bool lfeCustomRoutingEnabled; char inLfePanningMatrixFile[RENDERER_MAX_CLI_ARG_LENGTH]; -#endif } CmdlnArgs; typedef enum @@ -154,12 +152,8 @@ typedef enum CmdLnOptionId_renderConfigFile, CmdLnOptionId_noDiegeticPan, CmdLnOptionId_orientationTracking, -#ifdef REND_CFG_LFE CmdlnOptionId_lfePosition, CmdlnOptionId_lfeMatrix, -#else - CmdLnOptionId_customLfeRouting, -#endif CmdLnOptionId_noDelayCmp, CmdLnOptionId_quietModeEnabled, CmdLnOptionId_inputMetadata, @@ -235,26 +229,15 @@ static const CmdLnParser_Option cliOptions[] = { .description = "Head orientation tracking type: 'ref' or 'avg' (only for BINAURAL and BINAURAL_ROOM) (todo: check implementation)", }, { -#ifdef REND_CFG_LFE .id = CmdlnOptionId_lfePosition, .match = "lfe_position", .matchShort = "lp", .description = "Output LFE position. Comma-delimited triplet of [gain, azimuth, elevation] where gain is linear (like --gain, -g) and azimuth, elevation are in degrees.\nIf specified, overrides the default behavior which attempts to map input to output LFE channel(s)", -#else - /* TODO(sgi): Replace with more configurable input, e.g. ask for a list of triplets: (gain, azimuth, elevation) to place LFE signal */ - /* rename to "lfeHandling" */ - .id = CmdLnOptionId_customLfeRouting, - .match = "neverDropLfe", - .matchShort = "ndl", - .description = "[flag] If set, renderer tries to render LFE into other channels in an optimal way when rendering to configs w/o LFE", -#endif }, -#ifdef REND_CFG_LFE { .id = CmdlnOptionId_lfeMatrix, .match = "lfe_matrix", .matchShort = "lm", .description = "LFE panning matrix. File (CSV table) containing a matrix of dimensions [ num_input_lfe x num_output_channels ] with elements specifying linear routing gain (like --gain, -g). \nIf specified, overrides the output LFE position option and the default behavior which attempts to map input to output LFE channel(s)" }, -#endif { .id = CmdLnOptionId_noDelayCmp, .match = "no_delay_cmp", @@ -360,11 +343,9 @@ static void parseMetadata( IsmPositionProvider *positionProvider, MasaFileReader **masaReaders ); -#ifdef REND_CFG_LFE static ivas_error parseLfePanMtxFile( const char *lfeRoutingMatrixFilePath, IVAS_REND_LfePanMtx *lfePanMtx ); -#endif static void convert_backslash( char *str ); @@ -582,9 +563,7 @@ int main( convert_backslash( args.inputFilePath ); convert_backslash( args.outputFilePath ); convert_backslash( args.headRotationFilePath ); -#ifdef REND_CFG_LFE convert_backslash( args.inLfePanningMatrixFile ); -#endif if ( !isEmptyString( args.headRotationFilePath ) ) { @@ -691,7 +670,6 @@ int main( } } -#ifdef REND_CFG_LFE IVAS_REND_LfePanMtx lfePanMatrix; /* parse input LFE panning matrix */ @@ -704,7 +682,6 @@ int main( exit( -1 ); } } -#endif for ( i = 0; i < args.inConfig.numMultiChannelBuses; ++i ) { @@ -729,7 +706,6 @@ int main( } } -#ifdef REND_CFG_LFE /* set panning matrix for input LFE */ if ( args.lfeCustomRoutingEnabled ) { @@ -754,9 +730,6 @@ int main( exit( -1 ); } } -#else - /* TODO(sgi): Test custom LFE routing here */ -#endif } for ( i = 0; i < args.inConfig.numAudioObjects; ++i ) @@ -1265,18 +1238,10 @@ static bool parseOutConfig( return true; } -#ifdef REND_CFG_LFE static bool parseDiegeticPan( -#else -static int8_t parseDiegeticPan( -#endif char *value, float *noDiegeticPan ) { -#ifndef REND_CFG_LFE - int8_t success; - success = 1; -#endif to_upper( value ); if ( ( strcmp( value, "CENTER" ) == 0 ) || ( strchr( value, 'C' ) != NULL ) ) @@ -1298,32 +1263,16 @@ static int8_t parseDiegeticPan( if ( *noDiegeticPan > 1.0f || *noDiegeticPan < -1.0f ) { fprintf( stderr, "Error: Incorrect value for panning option argument specified!\n\n" ); -#ifdef REND_CFG_LFE return false; -#else - success = 0; -#endif } } -#ifdef REND_CFG_LFE return false; -#else - return success ? 0 : -1; -#endif } -#ifdef REND_CFG_LFE static bool parseOrientationTracking( -#else -static int8_t parseOrientationTracking( -#endif char *value, int8_t *tracking_type ) { -#ifndef REND_CFG_LFE - int8_t success; - success = 1; -#endif to_upper( value ); @@ -1338,18 +1287,10 @@ static int8_t parseOrientationTracking( else { fprintf( stderr, "Error: Invalid orientation tracking type %s \n\n", value ); -#ifdef REND_CFG_LFE return false; -#else - success = 0; -#endif } -#ifdef REND_CFG_LFE return true; -#else - return success ? 0 : -1; -#endif } static IVAS_REND_AudioConfig parseAudioConfig( @@ -1444,7 +1385,6 @@ static IVAS_REND_AudioConfig parseAudioConfig( return IVAS_REND_AUDIO_CONFIG_UNKNOWN; } -#ifdef REND_CFG_LFE static bool parseLfePositionConfig( const char *value, float *lfeGain, @@ -1490,7 +1430,6 @@ static bool parseLfePositionConfig( *lfeElevation = values[2]; return true; } -#endif #ifndef FIX_293_EXT_RENDERER_CLI static const CmdLnParser_Option *findOptionById( @@ -1591,7 +1530,6 @@ static CmdlnArgs defaultArgs( args.sceneDescriptionInput = false; args.inputGainGlobal = 1.0f; -#ifdef REND_CFG_LFE args.lfePanningEnabled = false; args.lfeConfigGain = 1.0f; args.lfeConfigAzimuth = 0; @@ -1599,7 +1537,6 @@ static CmdlnArgs defaultArgs( args.lfeCustomRoutingEnabled = false; clearString( args.inLfePanningMatrixFile ); -#endif return args; } @@ -1670,11 +1607,7 @@ static void parseOption( break; case CmdLnOptionId_noDiegeticPan: assert( numOptionValues == 1 ); -#ifdef REND_CFG_LFE if ( !parseDiegeticPan( optionValues[0], &args->noDiegeticPan ) ) -#else - if ( parseDiegeticPan( optionValues[0], &args->noDiegeticPan ) != 0 ) -#endif { fprintf( stderr, "Unknown option for diegetic panning: %s\n", optionValues[0] ); exit( -1 ); @@ -1682,17 +1615,12 @@ static void parseOption( break; case CmdLnOptionId_orientationTracking: assert( numOptionValues == 1 ); -#ifdef REND_CFG_LFE if ( !parseOrientationTracking( optionValues[0], &args->orientationTracking ) ) -#else - if ( parseOrientationTracking( optionValues[0], &args->orientationTracking ) != 0 ) -#endif { fprintf( stderr, "Unknown option for orientation tracking: %s\n", optionValues[0] ); exit( -1 ); } break; -#ifdef REND_CFG_LFE case CmdlnOptionId_lfePosition: assert( numOptionValues == 1 ); if ( !parseLfePositionConfig( optionValues[0], &args->lfeConfigGain, &args->lfeConfigAzimuth, &args->lfeConfigElevation ) ) @@ -1702,18 +1630,12 @@ static void parseOption( } args->lfePanningEnabled = true; break; -#else - case CmdLnOptionId_customLfeRouting: - assert( 0 && "Not yet implemented in CLI" ); -#endif break; -#ifdef REND_CFG_LFE case CmdlnOptionId_lfeMatrix: assert( numOptionValues == 1 ); strncpy( args->inLfePanningMatrixFile, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); args->lfeCustomRoutingEnabled = true; break; -#endif case CmdLnOptionId_noDelayCmp: assert( numOptionValues == 0 ); args->delayCompensationEnabled = false; @@ -2496,7 +2418,6 @@ static void printSupportedAudioConfigs() return; } -#ifdef REND_CFG_LFE static ivas_error parseLfePanMtxFile( const char *lfeRoutingMatrixFilePath, IVAS_REND_LfePanMtx *lfePanMtx ) @@ -2560,7 +2481,6 @@ static ivas_error parseLfePanMtxFile( fclose( mtxFile ); return IVAS_ERR_OK; } -#endif // VE2AT: possibly move these functions to cmdln_parser.c ? static void convert_backslash( diff --git a/lib_com/options.h b/lib_com/options.h index 27ffc017b8..65f37502d7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -147,7 +147,6 @@ #endif #define FIX_I59_DELAY_ROUNDING /* Issue 59: rounding in sample domain instead of nanosec for IVAS_ENC_GetDelay() and IVAS_DEC_GetDelay() */ #define FIX_FIX_I59 /* Issue 59: small fix concerning LFE delay rounding */ -#define REND_CFG_LFE /* Issue 110: Configurable LFE handling for external renderer */ #define FIX_235 /* Issue 235: Deallocation of HR filter memory separately for lib_rend (ROM) and lib_util (from file) */ #define ENV_STAB_FIX /* Contribution 23: HQ envelope stability memory fix */ #define STABILIZE_GIPD /* FhG: Contribution 22: gIPD stabilization */ diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 7e081b7a17..4f37d92cb3 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -48,9 +48,7 @@ #define RENDERER_HEAD_POSITIONS_PER_FRAME 4 // todo (Marc) -> renanr IVAS_RENDERER_HEAD_POSITIONS_PER_FRAME ? -#ifdef REND_CFG_LFE typedef float IVAS_REND_LfePanMtx[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; -#endif typedef struct { int16_t numSamplesPerChannel; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 72b284f5c5..ac91990502 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -122,7 +122,6 @@ typedef struct rotation_matrix rot_mat_prev; } input_ism; -#ifdef REND_CFG_LFE typedef struct { int16_t numLfeChannels; @@ -132,7 +131,6 @@ typedef struct float lfeOutputElevation; IVAS_REND_LfePanMtx lfePanMtx; } lfe_routing; -#endif typedef struct { @@ -151,11 +149,7 @@ typedef struct CREND_WRAPPER crendWrapper; #endif rotation_gains rot_gains_prev; -#ifdef REND_CFG_LFE lfe_routing lfeRouting; -#else - IVAS_REND_LfeRouting lfeRouting; -#endif } input_mc; typedef struct @@ -1449,7 +1443,6 @@ static bool configsAreEqual( return configA == configB; } -#ifdef REND_CFG_LFE static ivas_error updateLfePanGainsForMcOut( input_mc *inputMc, const IVAS_REND_AudioConfig outConfig ) @@ -1538,7 +1531,6 @@ static ivas_error updateLfePanGainsForAmbiOut( return error; } -#endif static ivas_error updateMcPanGainsForMcOut( input_mc *inputMc, @@ -1581,7 +1573,6 @@ static ivas_error updateMcPanGainsForMcOut( error = initMcPanGainsWithConversionMapping( inputMc, outConfig ); } -#ifdef REND_CFG_LFE /* check for errors from above block */ if ( error != IVAS_ERR_OK ) { @@ -1590,7 +1581,6 @@ static ivas_error updateMcPanGainsForMcOut( /* update LFE panning */ error = updateLfePanGainsForMcOut( inputMc, outConfig ); -#endif return error; } @@ -1654,13 +1644,11 @@ static ivas_error updateMcPanGainsForAmbiOut( } } -#ifdef REND_CFG_LFE /* update LFE panning */ if ( ( error = updateLfePanGainsForAmbiOut( inputMc, outConfig ) ) != IVAS_ERR_OK ) { return error; } -#endif return IVAS_ERR_OK; } @@ -1801,22 +1789,14 @@ static ivas_error initMcBinauralRendering( return error; } -#ifdef REND_CFG_LFE static lfe_routing defaultLfeRouting( -#else -static IVAS_REND_LfeRouting defaultLfeRouting( -#endif IVAS_REND_AudioConfig inConfig, LSSETUP_CUSTOM_STRUCT customLsIn, IVAS_REND_AudioConfig outConfig, LSSETUP_CUSTOM_STRUCT customLsOut ) { int32_t i; -#ifdef REND_CFG_LFE lfe_routing routing; -#else - IVAS_REND_LfeRouting routing; -#endif /* Set all output gains to zero, then route each input LFE consecutively to the next available output LFE. */ @@ -1825,10 +1805,8 @@ static IVAS_REND_LfeRouting defaultLfeRouting( set_zero( routing.lfePanMtx[i], IVAS_MAX_OUTPUT_CHANNELS ); } -#ifdef REND_CFG_LFE routing.pan_lfe = false; routing.lfeInputGain = 1.0f; -#endif switch ( inConfig ) { @@ -3189,7 +3167,6 @@ ivas_error IVAS_REND_SetInputGain( return IVAS_ERR_OK; } -#ifdef REND_CFG_LFE ivas_error IVAS_REND_SetInputLfeMtx( IVAS_REND_HANDLE hIvasRend, const IVAS_REND_InputId inputId, @@ -3232,22 +3209,13 @@ ivas_error IVAS_REND_SetInputLfeMtx( return IVAS_ERR_OK; } -#endif -#ifdef REND_CFG_LFE ivas_error IVAS_REND_SetInputLfePos( -#else -ivas_error IVAS_REND_SetInputLfeRouting( -#endif IVAS_REND_HANDLE hIvasRend, const IVAS_REND_InputId inputId, -#ifdef REND_CFG_LFE const float inputGain, const float outputAzimuth, const float outputElevation -#else - const IVAS_REND_LfeRouting lfeRouting -#endif ) { input_base *pInputBase; @@ -3273,19 +3241,10 @@ ivas_error IVAS_REND_SetInputLfeRouting( } pInputMc = (input_mc *) pInputBase; -#ifdef REND_CFG_LFE pInputMc->lfeRouting.pan_lfe = true; pInputMc->lfeRouting.lfeInputGain = inputGain; pInputMc->lfeRouting.lfeOutputAzimuth = outputAzimuth; pInputMc->lfeRouting.lfeOutputElevation = outputElevation; -#else - if ( getNumLfeChannels( pInputMc ) != lfeRouting.numLfeChannels ) - { - return IVAS_ERR_WRONG_NUM_CHANNELS; - } - - pInputMc->lfeRouting = lfeRouting; -#endif if ( ( error = updateMcPanGains( pInputMc, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index f9fac4347c..b2ca45c70c 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -53,9 +53,7 @@ #define RENDERER_HEAD_POSITIONS_PER_FRAME 4 -#ifdef REND_CFG_LFE typedef float IVAS_REND_LfePanMtx[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; -#endif typedef struct { @@ -141,13 +139,6 @@ typedef enum typedef uint16_t IVAS_REND_InputId; -#ifndef REND_CFG_LFE -typedef struct -{ - int16_t numLfeChannels; - float lfeOutputGains[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; -} IVAS_REND_LfeRouting; -#endif #else @@ -208,28 +199,18 @@ ivas_error IVAS_REND_SetInputGain( const float gain /* i : linear gain (not in dB) */ ); -#ifdef REND_CFG_LFE ivas_error IVAS_REND_SetInputLfeMtx( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ const IVAS_REND_LfePanMtx *lfePanMtx /* i : LFE panning matrix */ ); -#endif -#ifdef REND_CFG_LFE ivas_error IVAS_REND_SetInputLfePos( -#else -ivas_error IVAS_REND_SetInputLfeRouting( -#endif IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ -#ifdef REND_CFG_LFE const float inputGain, /* i : Input gain to be applied to the LFE channel(s) */ const float outputAzimuth, /* i : Output azimuth position */ const float outputElevation /* i : Output elevation position */ -#else - const IVAS_REND_LfeRouting lfeRouting /* i : custom LFE routing struct */ -#endif ); ivas_error IVAS_REND_RemoveInput( -- GitLab From cea17ad5f0e7132110b416e624bf104bb0ef93d2 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 24 Jan 2023 15:40:26 +0100 Subject: [PATCH 03/11] [cleanup] accept FIX_235 --- apps/decoder.c | 2 - lib_com/ivas_prot.h | 5 -- lib_com/options.h | 1 - lib_dec/ivas_init_dec.c | 7 -- lib_dec/ivas_sba_dec.c | 7 -- lib_rend/ivas_objectRenderer_hrFilt.c | 110 -------------------------- lib_rend/ivas_objectRenderer_mix.c | 6 -- lib_util/hrtf_file_reader.c | 10 --- lib_util/hrtf_file_reader.h | 2 - 9 files changed, 150 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index cc86a4fa02..1ca5806331 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -501,14 +501,12 @@ cleanup: #ifdef DEBUG_SBA_AUDIO_DUMP IVAS_DEC_GetSbaDebugParams( hIvasDec, &numOutChannels, &numTransportChannels, &pca_ingest_channels ); #endif -#ifdef FIX_235 if ( arg.hrtfReaderEnabled ) { IVAS_DEC_HRTF_HANDLE hHrtfTD; IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD ); dealloc_HRTF_binary( hHrtfTD ); } -#endif IVAS_DEC_Close( &hIvasDec ); CustomLsReader_close( &hLsCustomReader ); hrtfFileReader_close( &hrtfReader ); diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 2f727d30d7..7d43035900 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5089,11 +5089,6 @@ void BSplineModelEvalDealloc( ModelEval_t *modelEval /* i : Model evaluation structure */ ); -#ifndef FIX_235 -void BSplineModelEvalITDDealloc( - ModelParamsITD_t *model /* i : Model parameters */ -); -#endif #ifdef TDREND_HRTF_TABLE_METHODS void TDREND_HRFILT_SetFiltSet( diff --git a/lib_com/options.h b/lib_com/options.h index 65f37502d7..c39ea9d2e1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -147,7 +147,6 @@ #endif #define FIX_I59_DELAY_ROUNDING /* Issue 59: rounding in sample domain instead of nanosec for IVAS_ENC_GetDelay() and IVAS_DEC_GetDelay() */ #define FIX_FIX_I59 /* Issue 59: small fix concerning LFE delay rounding */ -#define FIX_235 /* Issue 235: Deallocation of HR filter memory separately for lib_rend (ROM) and lib_util (from file) */ #define ENV_STAB_FIX /* Contribution 23: HQ envelope stability memory fix */ #define STABILIZE_GIPD /* FhG: Contribution 22: gIPD stabilization */ #define FIX_292_VBAP_CALLOC_REMOVAL /* Nokia: Fixes issue 292 by removing the remnant callocs */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index da7c5fdab0..0e5f58fc3d 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1709,13 +1709,6 @@ void ivas_destroy_dec( } else if ( st_ivas->hHrtfTD != NULL ) { -#ifndef FIX_235 - /* Case when HRTF filter is mistakenly specified but TD renderer was not active */ - if ( st_ivas->hHrtfTD->ModelParams.UseItdModel && !st_ivas->hHrtfTD->ModelParams.modelROM ) - { - BSplineModelEvalITDDealloc( &st_ivas->hHrtfTD->ModelParamsITD ); - } -#endif BSplineModelEvalDealloc( &st_ivas->hHrtfTD->ModelParams, &st_ivas->hHrtfTD->ModelEval ); ivas_HRTF_binary_close( &st_ivas->hHrtfTD ); diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 3c18851a93..c8565cf042 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -213,13 +213,6 @@ ivas_error ivas_sba_dec_reinit( } else if ( st_ivas->hHrtfTD != NULL ) { -#ifndef FIX_235 - /* Case when HRTF filter is mistakenly specified but TD renderer was not active */ - if ( st_ivas->hHrtfTD->ModelParams.UseItdModel && !st_ivas->hHrtfTD->ModelParams.modelROM ) - { - BSplineModelEvalITDDealloc( &st_ivas->hHrtfTD->ModelParamsITD ); - } -#endif BSplineModelEvalDealloc( &st_ivas->hHrtfTD->ModelParams, &st_ivas->hHrtfTD->ModelEval ); ivas_HRTF_binary_close( &st_ivas->hHrtfTD ); diff --git a/lib_rend/ivas_objectRenderer_hrFilt.c b/lib_rend/ivas_objectRenderer_hrFilt.c index 2dc9498d90..f09b2881c5 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt.c +++ b/lib_rend/ivas_objectRenderer_hrFilt.c @@ -1064,19 +1064,8 @@ void HRTF_model_precalc( ModelParams_t *model /* i/o: HRTF model parameters */ ) { -#ifdef FIX_235 int16_t sec_length; int16_t i; -#else - int16_t sec_length; - int16_t i, k, j; - float *pEL; - float *pER; - const float *pAlphaL; - const float *pAlphaR; - float tmp; - int16_t AlphaN; -#endif sec_length = model->K / HRTF_MODEL_N_SECTIONS; @@ -1092,44 +1081,6 @@ void HRTF_model_precalc( maximum_s( model->azimDim3, model->elevDim3, &model->azimDim3Max ); -#ifndef FIX_235 - if ( !model->modelROM ) - { - AlphaN = model->AlphaN; - - /* Precalculated energies for each section and each row of the alpha matrices */ - model->EL_dyn = (float *) malloc( HRTF_MODEL_N_SECTIONS * AlphaN * sizeof( float ) ); - model->ER_dyn = (float *) malloc( HRTF_MODEL_N_SECTIONS * AlphaN * sizeof( float ) ); - pEL = model->EL_dyn; - pER = model->ER_dyn; - for ( i = 0; i < HRTF_MODEL_N_SECTIONS; i++ ) - { - for ( j = 0; j < AlphaN; j++ ) /* rows of Alpha matrices */ - { - *pEL = 0.0f; - *pER = 0.0f; - - pAlphaL = &model->AlphaL[model->iSecFirst[i] * AlphaN + j]; - pAlphaR = &model->AlphaR[model->iSecFirst[i] * AlphaN + j]; - - for ( k = model->iSecFirst[i]; k < model->iSecLast[i]; k++ ) /* k within the sections */ - { - /* Energy calculation */ - tmp = *pAlphaL; - *pEL += tmp * tmp; - tmp = *pAlphaR; - *pER += tmp * tmp; - pAlphaL += AlphaN; - pAlphaR += AlphaN; - } - pEL++; - pER++; - } - } - model->EL = (const float *) model->EL_dyn; - model->ER = (const float *) model->ER_dyn; - } -#endif return; } @@ -1147,44 +1098,6 @@ void BSplineModelEvalDealloc( { /* Allocated in LoadBSplineBinary() */ int16_t i; -#ifndef FIX_235 -#define WMC_TOOL_SKIP - if ( !model->modelROM ) - { - free( model->elevKSeq_dyn ); - free( model->azim_start_idx_dyn ); - free( model->azimDim2_dyn ); - free( model->azimDim3_dyn ); - free( model->AlphaL_dyn ); - free( model->AlphaR_dyn ); - free( model->azimSegSamples_dyn ); - - free( model->azimShapeIdx_dyn ); - free( model->azimShapeSampFactor_dyn ); - free( model->elevBsShape_dyn ); - - free( model->EL_dyn ); - free( model->ER_dyn ); - - for ( i = 0; i < model->num_unique_azim_splines; i++ ) - { - free( model->azimBsShape_dyn[i] ); - } - free( model->azimBsShape_dyn ); - } - free( (void *) model->azimBsShape ); /* void* cast needed to please both gcc and Visual studio compilers. Deallocating const float** should be fine and gcc agrees, but Visual studio complains. */ - for ( i = 0; i < model->elevDim3; i++ ) - { - free( model->azimKSeq[i] ); - } - free( model->azimKSeq ); - if ( modelEval != NULL ) - { - free( modelEval->hrfModL ); - free( modelEval->hrfModR ); - } -#undef WMC_TOOL_SKIP -#else if ( model->modelROM ) { free( (void *) model->azimBsShape ); /* void* cast needed to please both gcc and Visual studio compilers. Deallocating const float** should be fine and gcc agrees, but Visual studio complains. */ @@ -1199,33 +1112,10 @@ void BSplineModelEvalDealloc( free( modelEval->hrfModR ); } } -#endif return; } -#ifndef FIX_235 -/*-------------------------------------------------------------------* - * BSplineModelEvalITDDealloc() - * - * Deallocates the ITD model. - --------------------------------------------------------------------*/ - -void BSplineModelEvalITDDealloc( - ModelParamsITD_t *model /* i : Model parameters */ -) -{ -#define WMC_TOOL_SKIP - free( model->elevKSeq_dyn ); - free( model->azimKSeq_dyn ); - free( model->W_dyn ); - free( model->azimBsShape_dyn ); - free( model->elevBsShape_dyn ); -#undef WMC_TOOL_SKIP - - return; -} -#endif /*-------------------------------------------------------------------* * SkipSmallest_ValueIndex() diff --git a/lib_rend/ivas_objectRenderer_mix.c b/lib_rend/ivas_objectRenderer_mix.c index c44b23356b..f62951248e 100644 --- a/lib_rend/ivas_objectRenderer_mix.c +++ b/lib_rend/ivas_objectRenderer_mix.c @@ -130,12 +130,6 @@ void TDREND_MIX_Dealloc( { if ( hBinRendererTd->HrFiltSet_p->FilterMethod == TDREND_HRFILT_Method_BSplineModel ) { -#ifndef FIX_235 - if ( hBinRendererTd->HrFiltSet_p->ModelParams.UseItdModel && !hBinRendererTd->HrFiltSet_p->ModelParams.modelROM ) - { - BSplineModelEvalITDDealloc( &hBinRendererTd->HrFiltSet_p->ModelParamsITD ); - } -#endif BSplineModelEvalDealloc( &hBinRendererTd->HrFiltSet_p->ModelParams, &hBinRendererTd->HrFiltSet_p->ModelEval ); } else diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index b1ccc6d8aa..01b6f8951c 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -50,13 +50,11 @@ struct hrtfFileReader #define RESAMPLE_FACTOR_16_48 ( 16.0f / 48.0f ) #define RESAMPLE_FACTOR_32_48 ( 32.0f / 48.0f ) -#ifdef FIX_235 /*---------------------------------------------------------------------* * Local function declarations *---------------------------------------------------------------------*/ static void HRTF_energy_sections_precalc( ModelParams_t *model ); -#endif /*---------------------------------------------------------------------* * hrtfFileReader_open() @@ -301,17 +299,11 @@ static ivas_error LoadBSplineBinary( } HRTF_model_precalc( model ); -#ifdef FIX_235 HRTF_energy_sections_precalc( model ); -#endif HrFiltSet_p->FiltLength = HrFiltSet_p->ModelParams.K; -#ifdef FIX_235 HrFiltSet_p->ModelEval.hrfModL = (float *) malloc( model->K * sizeof( float ) ); HrFiltSet_p->ModelEval.hrfModR = (float *) malloc( model->K * sizeof( float ) ); -#else - BSplineModelEvalAlloc( &HrFiltSet_p->ModelParams, &HrFiltSet_p->ModelEval ); -#endif if ( HrFiltSet_p->ModelParams.UseItdModel ) { @@ -390,7 +382,6 @@ ivas_error load_HRTF_binary( return error; } -#ifdef FIX_235 /*---------------------------------------------------------------------* * HRTF_energy_sections_precalc() * @@ -509,4 +500,3 @@ ivas_error dealloc_HRTF_binary( return error; } -#endif diff --git a/lib_util/hrtf_file_reader.h b/lib_util/hrtf_file_reader.h index df3b2002c7..e2c95bc8e5 100644 --- a/lib_util/hrtf_file_reader.h +++ b/lib_util/hrtf_file_reader.h @@ -73,7 +73,6 @@ ivas_error load_HRTF_binary( const hrtfFileReader *hrtfReader /* i/o: pointer to hrtfFileReader handle */ ); -#ifdef FIX_235 /*---------------------------------------------------------------------* * dealloc_HRTF_binary() * @@ -83,6 +82,5 @@ ivas_error load_HRTF_binary( ivas_error dealloc_HRTF_binary( IVAS_DEC_HRTF_HANDLE hHrtf /* i/o: HRTF handle */ ); -#endif #endif /* IVAS_HRTF_FILE_READER_H */ -- GitLab From 1cc3e2cba45ca1c140ceea4649cea8aa2762a1f7 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 24 Jan 2023 15:41:08 +0100 Subject: [PATCH 04/11] [cleanup] accept ENV_STAB_FIX --- lib_com/cnst.h | 2 -- lib_com/env_stab.c | 55 ------------------------------------ lib_com/options.h | 1 - lib_com/prot.h | 8 ------ lib_dec/core_switching_dec.c | 11 -------- lib_dec/hq_core_dec.c | 4 --- lib_dec/hq_hr_dec.c | 20 ------------- lib_dec/init_dec.c | 2 -- lib_dec/stat_dec.h | 2 -- lib_dec/updt_dec.c | 6 ---- 10 files changed, 111 deletions(-) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 531f47d06a..db1dc3d898 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -1682,14 +1682,12 @@ enum #define HALF_D_STAB_TBL_FX ( (Word16) 422 ) /* Q13 0.1013138/2.0 */ #define NUM_ENV_STAB_PLC_STATES 2 /* Number of states of markov model */ -#ifdef ENV_STAB_FIX #define ENV_STAB_EST1 2.93f /* env_stab estimation coefficient 1 */ #define ENV_STAB_EST2 (-2.20f) /* env_stab estimation coefficient 2 */ #define ENV_STAB_EST3 0.741f /* env_stab estimation coefficient 3 */ #define STAB_FAC_EST1 1.093f /* stab_fac HQ estimation coefficient 1 */ #define STAB_FAC_EST2 (-5.84e-05f) /* stab_fac HQ estimation coefficient 2, including Q12 scaling */ #define STAB_FAC_EST3 0.125f /* stab_fac HQ estimation coefficient 3 */ -#endif #define ATT_LIM_HANGOVER 150 /* Number of hangover frames for disabling stability dependent attenuation */ #define DELTA_TH 5.0f /* Delta energy threshold for transient detection for envelope stability */ diff --git a/lib_com/env_stab.c b/lib_com/env_stab.c index 84bac479ee..df00277621 100644 --- a/lib_com/env_stab.c +++ b/lib_com/env_stab.c @@ -66,12 +66,8 @@ float env_stability( const int16_t *ynrm, /* i : Norm vector for current frame */ const int16_t nb_sfm, /* i : Number of sub-bands */ int16_t *mem_norm, /* i/o: Norm vector memory from past frame */ -#ifdef ENV_STAB_FIX int16_t *mem_env_delta, /* i/o: Envelope stability memory for smoothing*/ const int16_t core_switching_flag /* i : Core switching flag */ -#else - int16_t *mem_env_delta /* i/o: Envelope stability memory for smoothing*/ -#endif ) { Word16 env_delta; @@ -87,7 +83,6 @@ float env_stability( Flag Overflow; #endif /* BASOP_NOGLOB */ -#ifdef ENV_STAB_FIX if ( core_switching_flag ) { for ( i = 0; i < nb_sfm; i++ ) @@ -150,56 +145,6 @@ float env_stability( env_delta = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /* Q13 */ #endif /* BASOP_NOGLOB */ } -#else - - /* Calculate envelope stability parameter */ - L_env_delta = L_deposit_l( 0 ); - for ( i = 0; i < nb_sfm; i++ ) - { - tmp = sub( mem_norm[i], ynrm[i] ); - L_env_delta = L_mac0( L_env_delta, tmp, tmp ); - mem_norm[i] = ynrm[i]; - } - -#ifdef DEBUGGING - assert( nb_sfm == 27 || nb_sfm == 26 ); -#endif - inv_nb_sfm = 19418; /* Q19 */ - if ( nb_sfm == 26 ) - { - inv_nb_sfm = 20165; /* Q19 */ - } - exp = norm_l( L_env_delta ); - L_env_delta = Mult_32_16( L_shl( L_env_delta, exp ), inv_nb_sfm ); /* 0+exp+19-15 */ - - L_tmp = Sqrt_l( L_env_delta, &exp2 ); /* exp+4+31+exp2 */ - - exp = add( 35, add( exp, exp2 ) ); - if ( sub( s_and( exp, 1 ), 1 ) == 0 ) - { - L_tmp = Mult_32_16( L_tmp, 23170 ); /* 1/sqrt(2) in Q15 */ - } - exp = shr( exp, 1 ); - -#ifndef BASOP_NOGLOB - env_delta = round_fx( L_shl( L_tmp, sub( 26, exp ) ) ); /* Q10 */ - L_tmp = L_mult0( 26214, env_delta ); /* 26214 is 0.1 in Q18. Q28 */ - L_tmp = L_mac( L_tmp, 29491, *mem_env_delta ); /* 29491 is 0.9 in Q15. Q28 */ - *mem_env_delta = round_fx( L_tmp ); /* Q12 */ -#else /* BASOP_NOGLOB */ - env_delta = round_fx_o( L_shl_o( L_tmp, sub( 26, exp ), &Overflow ), &Overflow ); /* Q10 */ - L_tmp = L_mult0( 26214, env_delta ); /* 26214 is 0.1 in Q18. Q28 */ - L_tmp = L_mac_o( L_tmp, 29491, *mem_env_delta, &Overflow ); /* 29491 is 0.9 in Q15. Q28 */ - *mem_env_delta = round_fx_o( L_tmp, &Overflow ); /* Q12 */ -#endif /* BASOP_NOGLOB */ - Overflow = 0; -#ifndef BASOP_NOGLOB - env_delta = round_fx( L_shl( L_tmp, 1 ) ); /* Q13 */ -#else /* BASOP_NOGLOB */ - env_delta = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /* Q13 */ -#endif - /* BASOP_NOGLOB */ -#endif if ( Overflow != 0 ) /* Saturated due to the above up-shifting operation. */ { env_stab = stab_trans_fx[L_STAB_TBL - 1]; /* The highest quantized index. */ diff --git a/lib_com/options.h b/lib_com/options.h index c39ea9d2e1..bac4a3a525 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -147,7 +147,6 @@ #endif #define FIX_I59_DELAY_ROUNDING /* Issue 59: rounding in sample domain instead of nanosec for IVAS_ENC_GetDelay() and IVAS_DEC_GetDelay() */ #define FIX_FIX_I59 /* Issue 59: small fix concerning LFE delay rounding */ -#define ENV_STAB_FIX /* Contribution 23: HQ envelope stability memory fix */ #define STABILIZE_GIPD /* FhG: Contribution 22: gIPD stabilization */ #define FIX_292_VBAP_CALLOC_REMOVAL /* Nokia: Fixes issue 292 by removing the remnant callocs */ #define FIX_293_EXT_RENDERER_CLI /* FhG: Fix bugs in external renderer CLI */ diff --git a/lib_com/prot.h b/lib_com/prot.h index eff2f6188e..989252210b 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -5395,12 +5395,8 @@ void hq_hr_dec( int16_t *ynrm, /* o : norm quantization index vector */ int16_t *is_transient, /* o : transient flag */ int16_t *hqswb_clas, /* o : HQ SWB class */ -#ifdef ENV_STAB_FIX float *SWB_fenv, /* o : SWB frequency envelopes */ const int16_t core_switching_flag /* i : Core switching flag */ -#else - float *SWB_fenv /* o : SWB frequency envelopes */ -#endif ); @@ -5828,12 +5824,8 @@ float env_stability( const int16_t *ynrm, /* i : Norm vector for current frame */ const int16_t nb_sfm, /* i : Number of sub-bands */ int16_t *mem_norm, /* i/o: Norm vector memory from past frame */ -#ifdef ENV_STAB_FIX int16_t *mem_env_delta, /* i/o: Envelope stability memory for smoothing*/ const int16_t core_switching_flag /* i : Core switching flag */ -#else - int16_t *mem_env_delta /* i/o: Envelope stability memory for smoothing*/ -#endif ); /*! r: New speech/music state */ diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index 88215670ac..c79ecfacbd 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -70,9 +70,7 @@ ivas_error core_switching_pre_dec( { int16_t i, oldLenClasBuff, newLenClasBuff; ivas_error error; -#ifdef ENV_STAB_FIX float tmp; -#endif error = IVAS_ERR_OK; @@ -404,11 +402,7 @@ ivas_error core_switching_pre_dec( } } -#ifdef ENV_STAB_FIX if ( st->core == HQ_CORE && ( st->last_core == ACELP_CORE || st->last_core == AMR_WB_CORE || ( ( st->element_mode != EVS_MONO ) && ( st->last_core != HQ_CORE ) ) ) ) -#else - if ( st->core == HQ_CORE && ( st->last_core == ACELP_CORE || st->last_core == AMR_WB_CORE ) ) -#endif { set_f( st->hHQ_core->prev_env, 0, SFM_N_WB ); set_f( st->hHQ_core->prev_normq, 0, SFM_N_WB ); @@ -425,7 +419,6 @@ ivas_error core_switching_pre_dec( set_f( st->hHQ_core->prev_coeff_out, 0, L_HQ_WB_BWE ); } -#ifdef ENV_STAB_FIX if ( st->element_mode != EVS_MONO ) { /* Estimate mem_env_delta to reinit env_stab */ @@ -454,10 +447,6 @@ ivas_error core_switching_pre_dec( set_f( st->hHQ_core->old_out, 0, output_frame ); set_f( st->hHQ_core->old_outLB, 0, L_FRAME16k ); } -#else - set_f( st->hHQ_core->old_out, 0, output_frame ); - set_f( st->hHQ_core->old_outLB, 0, L_FRAME16k ); -#endif } /* handle switching cases where preecho_sb was not called in the last frame (memory not up to date) */ diff --git a/lib_dec/hq_core_dec.c b/lib_dec/hq_core_dec.c index 58721430c2..cdb9601679 100644 --- a/lib_dec/hq_core_dec.c +++ b/lib_dec/hq_core_dec.c @@ -249,11 +249,7 @@ void hq_core_dec( else { /* HQ high rate decoder */ -#ifdef ENV_STAB_FIX hq_hr_dec( st, t_audio_q, L_spec, num_bits, ynrm, &is_transient, &hqswb_clas, SWB_fenv, core_switching_flag ); -#else - hq_hr_dec( st, t_audio_q, L_spec, num_bits, ynrm, &is_transient, &hqswb_clas, SWB_fenv ); -#endif } if ( st->element_mode == EVS_MONO || ( !core_switching_flag && !hq_recovery_flag ) ) diff --git a/lib_dec/hq_hr_dec.c b/lib_dec/hq_hr_dec.c index c7b5fef402..661b1fa127 100644 --- a/lib_dec/hq_hr_dec.c +++ b/lib_dec/hq_hr_dec.c @@ -107,12 +107,8 @@ void hq_hr_dec( int16_t *ynrm, /* o : norm quantization index vector */ int16_t *is_transient, /* o : transient flag */ int16_t *hqswb_clas, /* o : HQ SWB class */ -#ifdef ENV_STAB_FIX float *SWB_fenv, /* o : SWB frequency envelopes */ const int16_t core_switching_flag /* i : Core switching flag */ -#else - float *SWB_fenv /* o : SWB frequency envelopes */ -#endif ) { int16_t nb_sfm; @@ -198,17 +194,9 @@ void hq_hr_dec( { hHQ_core->mem_env_delta = 0; } -#ifdef ENV_STAB_FIX else if ( length == L_FRAME32k || ( core_switching_flag && ( st->element_mode != EVS_MONO ) && length == L_SPEC32k_EXT ) ) -#else - else if ( length == L_FRAME32k ) -#endif { -#ifdef ENV_STAB_FIX env_stab = env_stability( ynrm, SFM_N_ENV_STAB, hHQ_core->mem_norm, &hHQ_core->mem_env_delta, core_switching_flag && ( st->element_mode != EVS_MONO ) ); -#else - env_stab = env_stability( ynrm, SFM_N_ENV_STAB, hHQ_core->mem_norm, &hHQ_core->mem_env_delta ); -#endif } else { @@ -222,21 +210,13 @@ void hq_hr_dec( } else { -#ifdef ENV_STAB_FIX if ( length == L_FRAME32k || ( core_switching_flag && ( st->element_mode != EVS_MONO ) && length == L_SPEC32k_EXT ) ) -#else - if ( length == L_FRAME32k ) -#endif { hHQ_core->env_stab = env_stab; /* calculated stability */ } else { -#ifdef ENV_STAB_FIX hHQ_core->env_stab = env_stability( ynrm, SFM_N_ENV_STAB_WB, hHQ_core->mem_norm_hqfec, &hHQ_core->mem_env_delta_hqfec, core_switching_flag && ( st->element_mode != EVS_MONO ) ); -#else - hHQ_core->env_stab = env_stability( ynrm, SFM_N_ENV_STAB_WB, hHQ_core->mem_norm_hqfec, &hHQ_core->mem_env_delta_hqfec ); -#endif } } hHQ_core->env_stab_plc = env_stab_smo( min( hHQ_core->env_stab, 1.0f - stab_trans[L_STAB_TBL - 1] ), hHQ_core->env_stab_state_p, &hHQ_core->envstabplc_hocnt ); diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 8f200066a5..d7862d2c56 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -127,11 +127,9 @@ ivas_error init_decoder( st->stab_fac_smooth = 0.0f; set_f( st->agc_mem2, 0, 2 ); set_f( st->mem_syn3, 0, M ); -#ifdef ENV_STAB_FIX st->stab_fac_smooth_lt = 0.0f; st->log_energy_diff_lt = 0.0f; st->log_energy_old = 0.0f; -#endif mvr2r( GEWB_Ave, st->lsf_old, M ); lsf2lsp( st->lsf_old, st->lsp_old, M, INT_FS_12k8 ); diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 0338b584d4..eee29406f6 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -955,11 +955,9 @@ typedef struct Decoder_State float agc_mem2[2]; /* memory of AGC for saturation control */ int16_t mid_lsf_int; int16_t safety_net; -#ifdef ENV_STAB_FIX float stab_fac_smooth_lt; float log_energy_old; float log_energy_diff_lt; -#endif int16_t GSC_noisy_speech; /* AC mode (GSC) - flag to indicate GSC on SWB noisy speech */ int16_t GSC_IVAS_mode; /* AC mode (GSC) - GSC IVAS mode */ diff --git a/lib_dec/updt_dec.c b/lib_dec/updt_dec.c index 0765ea4d1a..1103a36d9f 100644 --- a/lib_dec/updt_dec.c +++ b/lib_dec/updt_dec.c @@ -43,9 +43,7 @@ #include "prot.h" #include "rom_com.h" #include "cnst.h" -#ifdef ENV_STAB_FIX #include -#endif #include "wmc_auto.h" /*-------------------------------------------------------------------* @@ -416,10 +414,8 @@ void updt_dec_common( ) { int16_t i; -#ifdef ENV_STAB_FIX float log_energy, log_energy_diff; int16_t output_frame; -#endif st->last_codec_mode = st->codec_mode; st->last_extl = st->extl; @@ -509,7 +505,6 @@ void updt_dec_common( mvr2r( synth + NS2SA( st->output_Fs, ACELP_LOOK_NS + DELAY_BWE_TOTAL_NS ), st->old_synth_sw, NS2SA( st->output_Fs, FRAME_SIZE_NS - ACELP_LOOK_NS - DELAY_BWE_TOTAL_NS ) ); } -#ifdef ENV_STAB_FIX /* Store long-term estimates of stab_fac and log energy diff to estimate env_stab in case of core switch ACELP/TCX->HQ */ if ( st->element_mode != EVS_MONO ) { @@ -525,7 +520,6 @@ void updt_dec_common( } st->stab_fac_smooth_lt = ENV_SMOOTH_FAC * st->stab_fac + ( 1.0f - ENV_SMOOTH_FAC ) * st->stab_fac_smooth_lt; } -#endif if ( ( st->core_brate <= SID_2k40 && st->cng_type == FD_CNG ) || ( st->tcxonly && st->codec_mode == MODE2 ) ) { -- GitLab From b3f7f4c50c4eef84ebe0523ddf1b294430d7cf1b Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 24 Jan 2023 15:41:53 +0100 Subject: [PATCH 05/11] [cleanup] accept STABILIZE_GIPD --- lib_com/ivas_cnst.h | 2 -- lib_com/options.h | 1 - lib_enc/ivas_stat_enc.h | 2 -- lib_enc/ivas_stereo_dft_enc.c | 45 ----------------------------------- 4 files changed, 50 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 5922ed9b6c..fbd9c006bf 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -520,9 +520,7 @@ typedef enum #define STEREO_DFT_XCORR_LB_MAX 24 -#ifdef STABILIZE_GIPD #define STEREO_DFT_IPD_BUF_LEN 5 -#endif #define STEREO_DFT_N_COH_PRED 4 /* Number of intra-frame predictors for coherence vector */ #define STEREO_DFT_COH_PRED_COEFFS 15 /* Number of coefficients per predictor */ diff --git a/lib_com/options.h b/lib_com/options.h index bac4a3a525..072386debc 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -147,7 +147,6 @@ #endif #define FIX_I59_DELAY_ROUNDING /* Issue 59: rounding in sample domain instead of nanosec for IVAS_ENC_GetDelay() and IVAS_DEC_GetDelay() */ #define FIX_FIX_I59 /* Issue 59: small fix concerning LFE delay rounding */ -#define STABILIZE_GIPD /* FhG: Contribution 22: gIPD stabilization */ #define FIX_292_VBAP_CALLOC_REMOVAL /* Nokia: Fixes issue 292 by removing the remnant callocs */ #define FIX_293_EXT_RENDERER_CLI /* FhG: Fix bugs in external renderer CLI */ #define FIX_268 /* Issue 268: Add low cost dry-run of memory analysis */ diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index a397191d90..ecf730cffa 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -210,12 +210,10 @@ typedef struct stereo_dft_enc_data_struct float sfm; float sum_dot_prod_real; float sum_dot_prod_img; -#ifdef STABILIZE_GIPD float dot_prod_real_smooth[STEREO_DFT_BAND_MAX]; float dot_prod_img_smooth[STEREO_DFT_BAND_MAX]; float ipd_buf[STEREO_DFT_BAND_MAX][STEREO_DFT_IPD_BUF_LEN]; float prev_gipd; -#endif /*ITD*/ ITD_DATA_HANDLE hItd; diff --git a/lib_enc/ivas_stereo_dft_enc.c b/lib_enc/ivas_stereo_dft_enc.c index 4bcbec4921..ab4844ab94 100644 --- a/lib_enc/ivas_stereo_dft_enc.c +++ b/lib_enc/ivas_stereo_dft_enc.c @@ -73,13 +73,11 @@ static void stereo_dft_enc_open( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, const in static void stereo_dft_enc_compute_prm( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, float *DFT_L, float *DFT_R, int16_t k_offset, int16_t flag_quant, const int16_t sp_aud_decision0, const int16_t vad_flag, float *bin_nrgL, float *bin_nrgR, float *dot_prod_nrg_ratio ); -#ifdef STABILIZE_GIPD static float stereo_dft_calc_mean_bipd( float *pIpd, float ipd_buf[STEREO_DFT_IPD_BUF_LEN] ); static float stereo_dft_calc_mean_ipd_change( float *pIpd, float *ipd_smooth, int16_t gipd_band_max ); static void stereo_dft_gipd_stabilization( float *pgIpd, float prev_gipd, float ipd_mean_change ); -#endif #ifdef DEBUG_MODE_DFT static void stereo_dft_enc_get_nipd_flag( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, float *pgIpd, const int16_t sp_aud_decision0, const float gainIPD ); @@ -441,7 +439,6 @@ void stereo_dft_enc_reset( hStereoDft->side_gain_counter = 0; hStereoDft->side_gain_bitdiff_lp = STEREO_DFT_BITDIFF_INIT; set_zero( hStereoDft->gipd, STEREO_DFT_ENC_DFT_NB ); -#ifdef STABILIZE_GIPD set_zero( hStereoDft->dot_prod_real_smooth, STEREO_DFT_BAND_MAX ); set_zero( hStereoDft->dot_prod_img_smooth, STEREO_DFT_BAND_MAX ); for ( i = 0; i < STEREO_DFT_BAND_MAX; i++ ) @@ -449,7 +446,6 @@ void stereo_dft_enc_reset( set_zero( hStereoDft->ipd_buf[i], STEREO_DFT_IPD_BUF_LEN ); } hStereoDft->prev_gipd = 0.f; -#endif hStereoDft->gipd_index = 0; set_zero( hStereoDft->res_pred_gain, STEREO_DFT_ENC_DFT_NB * STEREO_DFT_BAND_MAX ); set_s( hStereoDft->res_pred_index_EC, 0, STEREO_DFT_BAND_MAX ); @@ -643,11 +639,7 @@ void stereo_dft_enc_update( hStereoDft->nbands_dmx = stereo_dft_band_config( hStereoDft->band_limits_dmx, 1, NFFT_inner, ENC ); /*Compute main parameters*/ -#ifdef STABILIZE_GIPD hStereoDft->gipd_band_max = dft_band_ipd[1][3]; -#else - hStereoDft->gipd_band_max = dft_band_ipd[hStereoDft->hConfig->band_res][3]; -#endif hStereoDft->res_cod_band_max = dft_band_res_cod[hStereoDft->hConfig->band_res][hStereoDft->res_cod_mode[k_offset]]; hStereoDft->res_cod_line_max = (int16_t) ( 0.5f + ( hStereoDft->band_limits[hStereoDft->res_cod_band_max] - 1 ) * 2.f * hStereoDft->N / (float) ( hStereoDft->NFFT ) ); hStereoDft->res_cod_line_max = 8 * ( hStereoDft->res_cod_line_max / 8 ); @@ -1296,11 +1288,7 @@ void stereo_dft_enc_process( /* Initialization */ k_offset = STEREO_DFT_OFFSET; /*Add an offset at encoder*/ -#ifdef STABILIZE_GIPD hStereoDft->gipd_band_max = dft_band_ipd[1][3]; -#else - hStereoDft->gipd_band_max = dft_band_ipd[hStereoDft->band_res[k_offset]][3]; -#endif hStereoDft->res_cod_band_max = dft_band_res_cod[hStereoDft->band_res[k_offset]][hStereoDft->res_cod_mode[k_offset]]; hStereoDft->res_cod_line_max = (int16_t) ( 0.5f + ( hStereoDft->band_limits[hStereoDft->res_cod_band_max] - 1 ) * 2.f * input_frame / (float) ( hStereoDft->NFFT ) ); hStereoDft->res_cod_line_max = 8 * ( hStereoDft->res_cod_line_max / 8 ); @@ -2611,14 +2599,10 @@ static void stereo_dft_enc_compute_prm( float sum_energy_L, sum_energy_R; float g, c; float abs_L_R; -#ifdef STABILIZE_GIPD float abs_L_R2; -#endif float gain_IPD; float sub_nrg_DMX[STEREO_DFT_BAND_MAX]; -#ifdef STABILIZE_GIPD float sub_nrg_DMX2; -#endif float sub_nrg_L[STEREO_DFT_BAND_MAX]; float sub_nrg_R[STEREO_DFT_BAND_MAX]; float diff_ipd; @@ -2632,11 +2616,9 @@ static void stereo_dft_enc_compute_prm( float sum_past_dot_prod_abs, sum_past_dot_prod_abs2; float sum_past_nrg_dmx; int16_t pos; -#ifdef STABILIZE_GIPD float pIpd[STEREO_DFT_BAND_MAX]; float ipd_smooth[STEREO_DFT_BAND_MAX]; float ipd_mean_change; -#endif /*------------------------------------------------------------------* * Initialization @@ -2657,9 +2639,7 @@ static void stereo_dft_enc_compute_prm( sum_energy_R = EPSILON; sum_dot_prod_real = EPSILON; sum_dot_prod_img = EPSILON; -#ifdef STABILIZE_GIPD sub_nrg_DMX2 = 0.f; -#endif #ifdef DEBUG_MODE_DFT sum_nrg_L = EPSILON; sum_nrg_R = EPSILON; @@ -2689,17 +2669,10 @@ static void stereo_dft_enc_compute_prm( pNrgL = bin_nrgL; pNrgR = bin_nrgR; -#ifdef STABILIZE_GIPD sum_nrg_L2 = EPSILON; sum_nrg_R2 = EPSILON; dot_prod_real2 = EPSILON; dot_prod_img2 = EPSILON; -#else - sum_nrg_L2 = 0; - sum_nrg_R2 = 0; - dot_prod_real2 = 0; - dot_prod_img2 = 0; -#endif for ( i = hStereoDft->band_limits_dmx[b2]; i < hStereoDft->band_limits_dmx[b2 + 1]; i++ ) { @@ -2710,7 +2683,6 @@ static void stereo_dft_enc_compute_prm( dot_prod_real2 += pDFT_L[2 * i] * pDFT_R[2 * i] + pDFT_L[2 * i + 1] * pDFT_R[2 * i + 1]; dot_prod_img2 += pDFT_L[2 * i + 1] * pDFT_R[2 * i] - pDFT_L[2 * i] * pDFT_R[2 * i + 1]; } -#ifdef STABILIZE_GIPD abs_L_R2 = sqrtf( dot_prod_real2 * dot_prod_real2 + dot_prod_img2 * dot_prod_img2 ); sub_nrg_DMX2 = sum_nrg_L2 + sum_nrg_R2 + 2 * abs_L_R2; @@ -2724,7 +2696,6 @@ static void stereo_dft_enc_compute_prm( gain_IPD += ( sum_nrg_L2 + sum_nrg_R2 + 2 * dot_prod_real2 ) / sub_nrg_DMX2 / hStereoDft->gipd_band_max; } -#endif sum_past_nrgL2 = EPSILON; sum_past_nrgR2 = EPSILON; @@ -2878,31 +2849,17 @@ static void stereo_dft_enc_compute_prm( pPredGain[b] = 0.f; } -#ifndef STABILIZE_GIPD - if ( b < hStereoDft->gipd_band_max ) - { - gain_IPD += ( sum_nrg_L + sum_nrg_R + 2 * dot_prod_real ) / sub_nrg_DMX[b] / hStereoDft->gipd_band_max; - } -#endif -#ifdef STABILIZE_GIPD if ( b2 == hStereoDft->gipd_band_max ) -#else - if ( b == hStereoDft->gipd_band_max - 1 ) -#endif { -#ifdef STABILIZE_GIPD ipd_mean_change = stereo_dft_calc_mean_ipd_change( pIpd, ipd_smooth, hStereoDft->gipd_band_max ); -#endif hStereoDft->sum_dot_prod_real = ( 1.f - hStereoDft->sfm ) * hStereoDft->sum_dot_prod_real + hStereoDft->sfm * sum_dot_prod_real; hStereoDft->sum_dot_prod_img = ( 1.f - hStereoDft->sfm ) * hStereoDft->sum_dot_prod_img + hStereoDft->sfm * sum_dot_prod_img; pgIpd[0] = (float) atan2( hStereoDft->sum_dot_prod_img, hStereoDft->sum_dot_prod_real ); -#ifdef STABILIZE_GIPD stereo_dft_gipd_stabilization( &pgIpd[0], hStereoDft->prev_gipd, ipd_mean_change ); hStereoDft->prev_gipd = pgIpd[0]; -#endif } } @@ -3241,7 +3198,6 @@ static void res_pred_gain_mode_decision( } -#ifdef STABILIZE_GIPD /*------------------------------------------------------------------------- * stereo_dft_calc_mean_bipd() * @@ -3405,7 +3361,6 @@ static void stereo_dft_gipd_stabilization( } return; } -#endif /*------------------------------------------------------------------------- -- GitLab From 1cf10e8961836553fa0d347359747456d368309e Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 24 Jan 2023 15:42:47 +0100 Subject: [PATCH 06/11] [cleanup] accept FIX_292_VBAP_CALLOC_REMOVAL --- lib_com/options.h | 1 - lib_dec/ivas_vbap.c | 12 ------------ 2 files changed, 13 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 072386debc..2b8eab9c4d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -147,7 +147,6 @@ #endif #define FIX_I59_DELAY_ROUNDING /* Issue 59: rounding in sample domain instead of nanosec for IVAS_ENC_GetDelay() and IVAS_DEC_GetDelay() */ #define FIX_FIX_I59 /* Issue 59: small fix concerning LFE delay rounding */ -#define FIX_292_VBAP_CALLOC_REMOVAL /* Nokia: Fixes issue 292 by removing the remnant callocs */ #define FIX_293_EXT_RENDERER_CLI /* FhG: Fix bugs in external renderer CLI */ #define FIX_268 /* Issue 268: Add low cost dry-run of memory analysis */ #define LOW_RATE_TRANS_FIX /* Eri: Fix for critical item during transitions */ diff --git a/lib_dec/ivas_vbap.c b/lib_dec/ivas_vbap.c index 7769f306f6..e0deb652dc 100644 --- a/lib_dec/ivas_vbap.c +++ b/lib_dec/ivas_vbap.c @@ -200,12 +200,8 @@ ivas_error vbap_init_data( if ( is_success && virtual_bottom_type != NO_VIRTUAL_SPEAKER_NODE ) { -#ifdef FIX_292_VBAP_CALLOC_REMOVAL vbap->bottom_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); set_zero( vbap->bottom_virtual_speaker_node_division_gains, num_speaker_nodes ); -#else - vbap->bottom_virtual_speaker_node_division_gains = (float *) calloc( num_speaker_nodes, sizeof( float ) ); -#endif is_success &= vbap->bottom_virtual_speaker_node_division_gains != NULL; speaker_node_azi_deg_internal[vbap->bottom_virtual_speaker_node_index] = 0.0f; speaker_node_ele_deg_internal[vbap->bottom_virtual_speaker_node_index] = -90.0f; @@ -213,12 +209,8 @@ ivas_error vbap_init_data( if ( is_success && virtual_top_type != NO_VIRTUAL_SPEAKER_NODE ) { -#ifdef FIX_292_VBAP_CALLOC_REMOVAL vbap->top_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); set_zero( vbap->top_virtual_speaker_node_division_gains, num_speaker_nodes ); -#else - vbap->top_virtual_speaker_node_division_gains = (float *) calloc( num_speaker_nodes, sizeof( float ) ); -#endif is_success &= vbap->top_virtual_speaker_node_division_gains != NULL; speaker_node_azi_deg_internal[vbap->top_virtual_speaker_node_index] = 0.0f; speaker_node_ele_deg_internal[vbap->top_virtual_speaker_node_index] = 90.0f; @@ -226,12 +218,8 @@ ivas_error vbap_init_data( if ( is_success && virtual_back_type != NO_VIRTUAL_SPEAKER_NODE ) { -#ifdef FIX_292_VBAP_CALLOC_REMOVAL vbap->back_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); set_zero( vbap->back_virtual_speaker_node_division_gains, num_speaker_nodes ); -#else - vbap->back_virtual_speaker_node_division_gains = (float *) calloc( num_speaker_nodes, sizeof( float ) ); -#endif is_success &= vbap->back_virtual_speaker_node_division_gains != NULL; speaker_node_azi_deg_internal[vbap->back_virtual_speaker_node_index] = 180.0f; speaker_node_ele_deg_internal[vbap->back_virtual_speaker_node_index] = 0.0f; -- GitLab From d574fef8e388d7ea6b4a6806edf8fdc163a77cf8 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 24 Jan 2023 15:44:00 +0100 Subject: [PATCH 07/11] [cleanup] accept FIX_293_EXT_RENDERER_CLI --- apps/renderer.c | 47 ------------------------------------- lib_com/options.h | 1 - lib_rend/lib_rend.c | 4 ---- lib_util/ism_file_writer.c | 8 ------- lib_util/masa_file_writer.c | 4 ---- 5 files changed, 64 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 75111fbf1b..e5c6aebfd6 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1073,7 +1073,6 @@ static IVAS_REND_AudioConfig ambisonicsOrderToEnum( return IVAS_REND_AUDIO_CONFIG_UNKNOWN; } -#ifdef FIX_293_EXT_RENDERER_CLI static const CmdLnParser_Option *findOptionById( const int32_t id ) { @@ -1087,7 +1086,6 @@ static const CmdLnParser_Option *findOptionById( return NULL; } -#endif static bool parseInConfig( const char *inFormatStr, @@ -1176,13 +1174,9 @@ static bool parseInConfig( if ( error == IVAS_ERR_FAILED_FILE_OPEN ) { -#ifdef FIX_293_EXT_RENDERER_CLI /* Failed to open with given string - most likely wasn't a file path */ const CmdLnParser_Option *listOption = findOptionById( CmdLnOptionId_listFormats ); fprintf( stderr, "Unsupported input format: %s. To list valid formats, use option --%s.\n", inFormatStr, listOption->match ); -#else - fprintf( stderr, "Unsupported input format: %s\n", inFormatStr ); -#endif return false; } if ( error != IVAS_ERR_OK ) @@ -1197,7 +1191,6 @@ static bool parseInConfig( } break; default: -#ifdef FIX_293_EXT_RENDERER_CLI { /* Default case covers formats that are defined in the IVAS_REND_AudioConfig enum, * but cannot be used at input, e.g. BINAURAL */ @@ -1205,12 +1198,6 @@ static bool parseInConfig( fprintf( stderr, "Unsupported input format: %s. To list valid formats, use option --%s.\n", inFormatStr, listOption->match ); return false; } -#else - /* Default case covers formats that are defined in the IVAS_REND_AudioConfig enum, - * but cannot be used at input, e.g. BINAURAL */ - fprintf( stderr, "Unsupported input format: %s\n", inFormatStr ); - return false; -#endif } return true; @@ -1344,7 +1331,6 @@ static IVAS_REND_AudioConfig parseAudioConfig( } if ( strncmp( charBuf, "ISM", 3 ) == 0 ) { -#ifdef FIX_293_EXT_RENDERER_CLI /* Accept input config as ISM only if the 4th character is a number from 1 to 4. * Otherwise, do nothing. Unknown audio config will be returned. */ switch ( charBuf[3] ) @@ -1355,9 +1341,6 @@ static IVAS_REND_AudioConfig parseAudioConfig( case '4': return IVAS_REND_AUDIO_CONFIG_OBJECT; } -#else - return IVAS_REND_AUDIO_CONFIG_OBJECT; -#endif } if ( strncmp( charBuf, "MASA", 4 ) == 0 ) { @@ -1431,21 +1414,6 @@ static bool parseLfePositionConfig( return true; } -#ifndef FIX_293_EXT_RENDERER_CLI -static const CmdLnParser_Option *findOptionById( - const int32_t id ) -{ - for ( int32_t i = 0; i < numCliOptions; ++i ) - { - if ( cliOptions[i].id == id ) - { - return &cliOptions[i]; - } - } - - return NULL; -} -#endif static bool checkRequiredArgs( CmdlnArgs args ) @@ -1758,7 +1726,6 @@ void IsmPositionProvider_getNextFrame( for ( objIdx = 0; objIdx < positionProvider->numObjects; ++objIdx ) { -#ifdef FIX_293_EXT_RENDERER_CLI /* If ISM metadata reader is open, read from metadata file */ if ( positionProvider->ismReaders[objIdx] != NULL ) { @@ -1775,16 +1742,6 @@ void IsmPositionProvider_getNextFrame( objectMetadataBuffer->positions[objIdx].azimuth = 0.0f; objectMetadataBuffer->positions[objIdx].elevation = 0.0f; } -#else - if ( positionProvider->ismReaders[objIdx] != NULL ) - { - getMetadataFromFileReader( positionProvider->ismReaders[objIdx], objectMetadataBuffer, objIdx ); - } - else - { - readFromShorthandMetadata( positionProvider, objectMetadataBuffer, objIdx ); - } -#endif /* Wrap azimuth to lie within (-180, 180] range */ while ( objectMetadataBuffer->positions[objIdx].azimuth < 0.0f ) @@ -2172,11 +2129,7 @@ static void parseMasa( if ( strncmp( line, "MASA", 4 ) != 0 ) { char numTcs = *line; -#ifdef FIX_293_EXT_RENDERER_CLI snprintf( line, 6 /* write at most 6 characters: MASAx + null termination */, "MASA%c", numTcs ); -#else - sprintf( line, "MASA%c", numTcs ); -#endif } inConfig->masaBuses[idx].audioConfig = parseAudioConfig( line ); diff --git a/lib_com/options.h b/lib_com/options.h index 2b8eab9c4d..e976221581 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -147,7 +147,6 @@ #endif #define FIX_I59_DELAY_ROUNDING /* Issue 59: rounding in sample domain instead of nanosec for IVAS_ENC_GetDelay() and IVAS_DEC_GetDelay() */ #define FIX_FIX_I59 /* Issue 59: small fix concerning LFE delay rounding */ -#define FIX_293_EXT_RENDERER_CLI /* FhG: Fix bugs in external renderer CLI */ #define FIX_268 /* Issue 268: Add low cost dry-run of memory analysis */ #define LOW_RATE_TRANS_FIX /* Eri: Fix for critical item during transitions */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ac91990502..790f3d8dcb 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2842,11 +2842,7 @@ static IVAS_REND_InputId makeInputId( /* Put config type in second byte (from LSB), put index + 1 in first byte * * Index is incremented here so that a valid ID can never be 0. */ -#ifdef FIX_293_EXT_RENDERER_CLI return (IVAS_REND_InputId) ( ( ( (uint32_t) getAudioConfigType( config ) ) << 8 ) | ( inputIndex + 1 ) ); -#else - return (IVAS_REND_InputId) ( ( getAudioConfigType( config ) << 8 ) | ( inputIndex + 1 ) ); -#endif } static ivas_error getInputById( diff --git a/lib_util/ism_file_writer.c b/lib_util/ism_file_writer.c index 6bcf4a686a..46705316c8 100644 --- a/lib_util/ism_file_writer.c +++ b/lib_util/ism_file_writer.c @@ -64,11 +64,7 @@ ivas_error IsmFileWriter_open( FILE *file; strncpy( metadata_filename_loc, filePathWav, sizeof( metadata_filename_loc ) - 1 ); -#ifdef FIX_293_EXT_RENDERER_CLI snprintf( ext_meta, sizeof( ext_meta ), ".%d.csv", obj_num ); -#else - sprintf( ext_meta, ".%d.csv", obj_num ); -#endif const int32_t maxNumCharactersToAppend = (int32_t) sizeof( metadata_filename_loc ) - strlen( metadata_filename_loc ) - 1; strncat( metadata_filename_loc, ext_meta, maxNumCharactersToAppend ); @@ -120,11 +116,7 @@ ivas_error IsmFileWriter_writeFrame( file = ismWriter->file; /* IVAS_fmToDo: work in progress; currently position_azimuth, position_elevation, position_radius, spread, gain_factor */ -#ifdef FIX_293_EXT_RENDERER_CLI snprintf( char_buff, sizeof( char_buff ), "%+07.2f,%+06.2f,%05.2f,%06.2f,%04.2f\n", ismMetadata.azimuth, ismMetadata.elevation, ismMetadata.radius, ismMetadata.spread, ismMetadata.gainFactor ); -#else - sprintf( char_buff, "%+07.2f,%+06.2f,%05.2f,%06.2f,%04.2f\n", ismMetadata.azimuth, ismMetadata.elevation, ismMetadata.radius, ismMetadata.spread, ismMetadata.gainFactor ); -#endif if ( file ) { diff --git a/lib_util/masa_file_writer.c b/lib_util/masa_file_writer.c index 6687c39d7c..3b4df4f1c9 100644 --- a/lib_util/masa_file_writer.c +++ b/lib_util/masa_file_writer.c @@ -66,11 +66,7 @@ static void getExtMasaMetadataFileName( /* sizeof( ext_meta ) accounts for terminating NULL, don't subtract extra 1 */ const int32_t maxNameLenWithoutExt = sizeof( metadata_filename[0] ) - sizeof( ext_meta ); strncpy( metadata_filename[0], outputWavFilename, maxNameLenWithoutExt ); -#ifdef FIX_293_EXT_RENDERER_CLI snprintf( ext_meta, sizeof( ext_meta ), ".met" ); -#else - sprintf( ext_meta, ".met" ); -#endif /* strlen( metadata_filename[0] ) doesn't account for terminating NULL, subtract extra 1 */ const int32_t maxNumCharactersToAppend = (int32_t) ( sizeof( metadata_filename[0] ) - strlen( metadata_filename[0] ) - 1 ); -- GitLab From 9598fd5fc6de526d5438a8225c6f2dc58268297a Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 24 Jan 2023 15:44:53 +0100 Subject: [PATCH 08/11] [cleanup] accept FIX_268 --- lib_com/options.h | 1 - lib_dec/jbm_jb4_inputbuffer.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index e976221581..e1b36b0454 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -147,7 +147,6 @@ #endif #define FIX_I59_DELAY_ROUNDING /* Issue 59: rounding in sample domain instead of nanosec for IVAS_ENC_GetDelay() and IVAS_DEC_GetDelay() */ #define FIX_FIX_I59 /* Issue 59: small fix concerning LFE delay rounding */ -#define FIX_268 /* Issue 268: Add low cost dry-run of memory analysis */ #define LOW_RATE_TRANS_FIX /* Eri: Fix for critical item during transitions */ #define FIX_197_CREND_INTERFACE diff --git a/lib_dec/jbm_jb4_inputbuffer.c b/lib_dec/jbm_jb4_inputbuffer.c index b399b0fdf9..8cec3bdf61 100644 --- a/lib_dec/jbm_jb4_inputbuffer.c +++ b/lib_dec/jbm_jb4_inputbuffer.c @@ -45,9 +45,7 @@ #include "debug.h" #endif #include "jbm_jb4_inputbuffer.h" -#ifdef FIX_268 #include "wmc_auto.h" -#endif #define WMC_TOOL_SKIP -- GitLab From 8f0c19438473346f87e2c3e2dcf1fb77f9099916 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 24 Jan 2023 15:45:29 +0100 Subject: [PATCH 09/11] [cleanup] accept FIX_268 --- lib_com/options.h | 1 - lib_enc/ivas_cpe_enc.c | 2 -- lib_enc/ivas_ism_enc.c | 2 -- lib_enc/stat_enc.h | 2 -- lib_enc/transient_detection.c | 6 ------ 5 files changed, 13 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index e1b36b0454..c6e6f61209 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -147,7 +147,6 @@ #endif #define FIX_I59_DELAY_ROUNDING /* Issue 59: rounding in sample domain instead of nanosec for IVAS_ENC_GetDelay() and IVAS_DEC_GetDelay() */ #define FIX_FIX_I59 /* Issue 59: small fix concerning LFE delay rounding */ -#define LOW_RATE_TRANS_FIX /* Eri: Fix for critical item during transitions */ #define FIX_197_CREND_INTERFACE /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index d27ac68b50..9aec652f05 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -656,7 +656,6 @@ ivas_error ivas_cpe_enc( hCPE->hFrontVad[0]->ini_frame = min( hCPE->hFrontVad[0]->ini_frame, MAX_FRAME_COUNTER ); } -#ifdef LOW_RATE_TRANS_FIX /* Store previous attack detection flag */ for ( n = 0; n < CPE_CHANNELS; n++ ) { @@ -665,7 +664,6 @@ ivas_error ivas_cpe_enc( sts[n]->hTranDet->transientDetector.prev_bIsAttackPresent = sts[n]->hTranDet->transientDetector.bIsAttackPresent; } } -#endif #ifdef DEBUG_MODE_INFO if ( hCPE->element_mode == IVAS_CPE_DFT ) diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 4e1208b93d..92435ac7b2 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -274,10 +274,8 @@ ivas_error ivas_ism_enc( /* update input samples buffer */ mvr2r( st->input, st->old_input_signal, input_frame ); -#ifdef LOW_RATE_TRANS_FIX /* Store previous attack detection flag */ st->hTranDet->transientDetector.prev_bIsAttackPresent = st->hTranDet->transientDetector.bIsAttackPresent; -#endif } pop_wmops(); diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 054f0d9115..0af4d30f0c 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -140,9 +140,7 @@ typedef struct TransientDetector TCheckSubblocksForAttack CheckSubblocksForAttack; /* Function for checking a presence of an attack. */ float attackRatioThreshold; /* Attack ratio threshold. */ int16_t bIsAttackPresent; /* True when an attack was detected. */ -#ifdef LOW_RATE_TRANS_FIX int16_t prev_bIsAttackPresent; /* True if an attack was detected in the previous frame. */ -#endif int16_t attackIndex; /* The index of an attack. */ } TransientDetector; diff --git a/lib_enc/transient_detection.c b/lib_enc/transient_detection.c index f3eac9249f..91106686c0 100644 --- a/lib_enc/transient_detection.c +++ b/lib_enc/transient_detection.c @@ -577,9 +577,7 @@ static void InitTransientDetector( pTransientDetector->CheckSubblocksForAttack = pCheckSubblocksForAttack; pTransientDetector->attackRatioThreshold = attackRatioThreshold; pTransientDetector->bIsAttackPresent = FALSE; -#ifdef LOW_RATE_TRANS_FIX pTransientDetector->prev_bIsAttackPresent = FALSE; -#endif pTransientDetector->attackIndex = -1; pTransientDetector->pSubblockEnergies->ramp_up_flag = 0x0; @@ -900,11 +898,7 @@ int16_t transient_analysis( prel_force_td |= 0x0001; } } -#ifdef LOW_RATE_TRANS_FIX if ( prel_force_td == 0 && hTranDet->transientDetector.prev_bIsAttackPresent == 1 ) -#else - if ( prel_force_td == 0 ) -#endif { /* release analysis */ pSubblockNrg = hTranDet->transientDetector.pSubblockEnergies->subblockNrg; -- GitLab From e7296a14ad55ff6616dbc7b4e4dac49982e5bda8 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 24 Jan 2023 16:11:09 +0100 Subject: [PATCH 10/11] formatting --- lib_com/env_stab.c | 6 +++--- lib_com/prot.h | 20 ++++++++++---------- lib_dec/hq_hr_dec.c | 14 +++++++------- lib_enc/stat_enc.h | 4 ++-- lib_rend/lib_rend.c | 3 +-- lib_util/hrtf_file_reader.c | 1 - 6 files changed, 23 insertions(+), 25 deletions(-) diff --git a/lib_com/env_stab.c b/lib_com/env_stab.c index df00277621..b4da4ce9d7 100644 --- a/lib_com/env_stab.c +++ b/lib_com/env_stab.c @@ -63,9 +63,9 @@ /*--------------------------------------------------------------------------*/ float env_stability( - const int16_t *ynrm, /* i : Norm vector for current frame */ - const int16_t nb_sfm, /* i : Number of sub-bands */ - int16_t *mem_norm, /* i/o: Norm vector memory from past frame */ + const int16_t *ynrm, /* i : Norm vector for current frame */ + const int16_t nb_sfm, /* i : Number of sub-bands */ + int16_t *mem_norm, /* i/o: Norm vector memory from past frame */ int16_t *mem_env_delta, /* i/o: Envelope stability memory for smoothing*/ const int16_t core_switching_flag /* i : Core switching flag */ ) diff --git a/lib_com/prot.h b/lib_com/prot.h index 989252210b..784527e1bf 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -5388,13 +5388,13 @@ void IMDCT( float *acelp_zir ); void hq_hr_dec( - Decoder_State *st, /* i/o: decoder state structure */ - float *t_audio_q, /* o : transform-domain coefficients */ - const int16_t length, /* i : frame length */ - const int16_t num_bits, /* i : number of available bits */ - int16_t *ynrm, /* o : norm quantization index vector */ - int16_t *is_transient, /* o : transient flag */ - int16_t *hqswb_clas, /* o : HQ SWB class */ + Decoder_State *st, /* i/o: decoder state structure */ + float *t_audio_q, /* o : transform-domain coefficients */ + const int16_t length, /* i : frame length */ + const int16_t num_bits, /* i : number of available bits */ + int16_t *ynrm, /* o : norm quantization index vector */ + int16_t *is_transient, /* o : transient flag */ + int16_t *hqswb_clas, /* o : HQ SWB class */ float *SWB_fenv, /* o : SWB frequency envelopes */ const int16_t core_switching_flag /* i : Core switching flag */ @@ -5821,9 +5821,9 @@ void env_adj( ); float env_stability( - const int16_t *ynrm, /* i : Norm vector for current frame */ - const int16_t nb_sfm, /* i : Number of sub-bands */ - int16_t *mem_norm, /* i/o: Norm vector memory from past frame */ + const int16_t *ynrm, /* i : Norm vector for current frame */ + const int16_t nb_sfm, /* i : Number of sub-bands */ + int16_t *mem_norm, /* i/o: Norm vector memory from past frame */ int16_t *mem_env_delta, /* i/o: Envelope stability memory for smoothing*/ const int16_t core_switching_flag /* i : Core switching flag */ ); diff --git a/lib_dec/hq_hr_dec.c b/lib_dec/hq_hr_dec.c index 661b1fa127..5153af07ea 100644 --- a/lib_dec/hq_hr_dec.c +++ b/lib_dec/hq_hr_dec.c @@ -100,13 +100,13 @@ static void hq_pred_hb_bws( *--------------------------------------------------------------------------*/ void hq_hr_dec( - Decoder_State *st, /* i/o: decoder state structure */ - float *t_audio_q, /* o : transform-domain coefficients */ - const int16_t length, /* i : frame length */ - const int16_t num_bits, /* i : number of available bits */ - int16_t *ynrm, /* o : norm quantization index vector */ - int16_t *is_transient, /* o : transient flag */ - int16_t *hqswb_clas, /* o : HQ SWB class */ + Decoder_State *st, /* i/o: decoder state structure */ + float *t_audio_q, /* o : transform-domain coefficients */ + const int16_t length, /* i : frame length */ + const int16_t num_bits, /* i : number of available bits */ + int16_t *ynrm, /* o : norm quantization index vector */ + int16_t *is_transient, /* o : transient flag */ + int16_t *hqswb_clas, /* o : HQ SWB class */ float *SWB_fenv, /* o : SWB frequency envelopes */ const int16_t core_switching_flag /* i : Core switching flag */ ) diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 0af4d30f0c..ec7fb594d1 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -140,8 +140,8 @@ typedef struct TransientDetector TCheckSubblocksForAttack CheckSubblocksForAttack; /* Function for checking a presence of an attack. */ float attackRatioThreshold; /* Attack ratio threshold. */ int16_t bIsAttackPresent; /* True when an attack was detected. */ - int16_t prev_bIsAttackPresent; /* True if an attack was detected in the previous frame. */ - int16_t attackIndex; /* The index of an attack. */ + int16_t prev_bIsAttackPresent; /* True if an attack was detected in the previous frame. */ + int16_t attackIndex; /* The index of an attack. */ } TransientDetector; /* Transient detection: Holds all transient detectors and buffers used by them. */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 790f3d8dcb..61a3682680 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3211,8 +3211,7 @@ ivas_error IVAS_REND_SetInputLfePos( const IVAS_REND_InputId inputId, const float inputGain, const float outputAzimuth, - const float outputElevation -) + const float outputElevation ) { input_base *pInputBase; input_mc *pInputMc; diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 01b6f8951c..d6896ad9e1 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -499,4 +499,3 @@ ivas_error dealloc_HRTF_binary( return error; } - -- GitLab From 9577cd28044ad2555e3fbc9ac1a95ebbebb2072a Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 24 Jan 2023 16:37:28 +0100 Subject: [PATCH 11/11] delete accidetially commited file --- lib_com/.#options.h | 1 - 1 file changed, 1 deletion(-) delete mode 120000 lib_com/.#options.h diff --git a/lib_com/.#options.h b/lib_com/.#options.h deleted file mode 120000 index 6b7ef5ee12..0000000000 --- a/lib_com/.#options.h +++ /dev/null @@ -1 +0,0 @@ -mul@ix1347.iis.fhg.de.217051 \ No newline at end of file -- GitLab