From d1eceed95e146ffbf712d18fe2c42253f62f9594 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 9 Nov 2022 11:59:46 +0100 Subject: [PATCH 1/5] group debugging parameters/options/code --- apps/decoder.c | 65 +++++++++--------- apps/encoder.c | 145 ++++++++++++++++++++-------------------- lib_com/ivas_error.h | 6 +- lib_enc/ivas_agc_enc.c | 22 +++--- lib_enc/ivas_stat_enc.h | 6 +- lib_enc/lib_enc.c | 20 +++--- lib_enc/lib_enc.h | 2 +- 7 files changed, 136 insertions(+), 130 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 968dc79ec2..91dd36357d 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -105,20 +105,22 @@ typedef struct bool hrtfReaderEnabled; char *hrtfFileName; IVAS_DEC_INPUT_FORMAT inputFormat; -#ifdef DEBUGGING - bool forceSubframeBinauralization; - IVAS_DEC_FORCED_REND_MODE forcedRendMode; -#endif bool customLsOutputEnabled; char *customLsSetupFilename; int16_t orientation_tracking; float no_diegetic_pan; bool renderConfigEnabled; char *renderConfigFilename; + +#ifdef DEBUGGING + bool forceSubframeBinauralization; + IVAS_DEC_FORCED_REND_MODE forcedRendMode; #ifdef DEBUG_FOA_AGC FILE *agcBitstream; /* temporary */ #endif +#endif + } DecArguments; @@ -128,12 +130,10 @@ typedef struct static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); -#ifdef DEBUGGING -static int16_t app_own_random( int16_t *seed ); -#endif static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); #ifdef DEBUGGING +static int16_t app_own_random( int16_t *seed ); static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec( char *forcedRendModeChar ); #endif @@ -582,11 +582,12 @@ cleanup: printf( "\n" ); } +#ifdef DEBUGGING + dbgclose(); + #ifdef DEBUG_SBA_AUDIO_DUMP ivas_close_sba_decoder_debug_files( arg.output_Fs, numOutChannels, numTransportChannels, pca_ingest_channels ); #endif -#ifdef DEBUGGING - dbgclose(); #endif return mainFailed ? -1 : 0; @@ -689,6 +690,9 @@ static bool parseCmdlIVAS_dec( arg->forcedRendMode = IVAS_DEC_FORCE_REND_UNFORCED; arg->forceSubframeBinauralization = false; +#ifdef DEBUG_FOA_AGC + arg->agcBitstream = NULL; +#endif #endif arg->output_Fs = 48000; arg->outputFormat = IVAS_DEC_OUTPUT_MONO; @@ -720,9 +724,6 @@ static bool parseCmdlIVAS_dec( arg->inputFormat = IVAS_DEC_INPUT_FORMAT_G192; arg->no_diegetic_pan = 0.f; -#ifdef DEBUG_FOA_AGC - arg->agcBitstream = NULL; -#endif /*-----------------------------------------------------------------* * Initialization @@ -791,21 +792,6 @@ static bool parseCmdlIVAS_dec( arg->jbmOffsetFilename = argv[i]; i++; } -#ifdef DEBUGGING - else if ( strcmp( argv_to_upper, "-FEC" ) == 0 ) - { - ftmp = 0.0f; - if ( sscanf( argv[i + 1], "%f", &ftmp ) != 1 ) - { - arg->FEPatterFileName = argv[i + 1]; - } - else - { - arg->FER = ftmp; - } - i += 2; - } -#endif else if ( strcmp( argv_to_upper, "-Q" ) == 0 ) { arg->quietModeEnabled = true; @@ -827,6 +813,19 @@ static bool parseCmdlIVAS_dec( } } #ifdef DEBUGGING + else if ( strcmp( argv_to_upper, "-FEC" ) == 0 ) + { + ftmp = 0.0f; + if ( sscanf( argv[i + 1], "%f", &ftmp ) != 1 ) + { + arg->FEPatterFileName = argv[i + 1]; + } + else + { + arg->FER = ftmp; + } + i += 2; + } else if ( strcmp( argv_to_upper, "-FORCE" ) == 0 ) { i++; @@ -837,6 +836,11 @@ static bool parseCmdlIVAS_dec( i++; } } + else if ( strcmp( argv_to_upper, "-FORCE_SUBFRAME_BIN" ) == 0 ) /* Force binauralization to subframe (5 ms) resolution */ + { + arg->forceSubframeBinauralization = true; + i++; + } #ifdef DEBUG_MODE_INFO #ifdef DEBUG_MODE_INFO_TWEAK /*-----------------------------------------------------------------* @@ -948,13 +952,6 @@ static bool parseCmdlIVAS_dec( } i++; } -#ifdef DEBUGGING - else if ( strcmp( argv_to_upper, "-FORCE_SUBFRAME_BIN" ) == 0 ) /* Force binauralization to subframe (5 ms) resolution */ - { - arg->forceSubframeBinauralization = true; - i++; - } -#endif /*-----------------------------------------------------------------* * Option not recognized diff --git a/apps/encoder.c b/apps/encoder.c index df0cf8f9ca..037d35316f 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -72,6 +72,7 @@ typedef union _EncInputFormatConfig { /* MONO details */ bool stereoToMonoDownmix; + #ifdef DEBUGGING /* STEREO details */ IVAS_ENC_STEREO_MODE stereoMode; @@ -83,16 +84,20 @@ typedef union _EncInputFormatConfig int16_t numObjects; const char *metadataFiles[IVAS_MAX_NUM_OBJECTS]; } ism; + /* SBA details */ struct EncSbaConfig { IVAS_ENC_SBA_ORDER order; bool isPlanar; } sba; + /* MASA details */ IVAS_ENC_MASA_VARIANT masaVariant; + /* MC details */ IVAS_ENC_MC_LAYOUT mcLayout; + } EncInputFormatConfig; /* Struct for storing cmdln arguments */ @@ -112,24 +117,24 @@ typedef struct bool quietModeEnabled; bool delayCompensationEnabled; const char *masaMetadataFile; -#ifdef DEBUGGING - IVAS_ENC_FORCED_MODE forcedMode; - const char *forcedModeFile; -#endif IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig; const char *ca_config_file; bool mimeOutput; +#ifdef DEBUGGING + IVAS_ENC_FORCED_MODE forcedMode; + const char *forcedModeFile; #ifdef DEBUG_AGC_ENCODER_CMD_OPTION IVAS_ENC_AGC agc; #endif - bool pca; #ifdef DEBUG_FOA_AGC FILE *agcBitstream; /* temporary */ #endif #ifdef DEBUG_SBA const char *dbg_file_tag; #endif +#endif + bool pca; } EncArguments; @@ -214,17 +219,13 @@ int main( int16_t *pcmBuf = NULL; #ifdef DEBUGGING FILE *f_forcedModeProfile = NULL; -#endif - #ifdef DEBUG_SBA int16_t numTransportChannels = 1; #endif - -#ifdef WMOPS - size_t SRAM_size = 0; #endif #ifdef WMOPS + size_t SRAM_size = 0; reset_wmops(); reset_stack(); #endif @@ -820,13 +821,6 @@ cleanup: fclose( f_bitrateProfile ); } -#ifdef DEBUGGING - if ( f_forcedModeProfile ) - { - fclose( f_forcedModeProfile ); - } -#endif - IVAS_ENC_Close( &hIvasEnc ); #ifdef RAM_COUNTING_TOOL @@ -842,13 +836,18 @@ cleanup: #ifdef DEBUGGING dbgclose(); -#endif + + if ( f_forcedModeProfile ) + { + fclose( f_forcedModeProfile ); + } #ifdef DEBUG_SBA ivas_close_sba_encoder_debug_files(); #ifdef DEBUG_AGC ivas_close_agc_debug_files(); #endif +#endif #endif return mainFailed ? -1 : 0; @@ -878,24 +877,24 @@ static void initArgStruct( EncArguments *arg ) arg->quietModeEnabled = false; arg->delayCompensationEnabled = true; arg->masaMetadataFile = NULL; -#ifdef DEBUGGING - arg->forcedMode = IVAS_ENC_FORCE_UNFORCED; - arg->forcedModeFile = NULL; -#endif arg->caConfig = IVAS_ENC_GetDefaultChannelAwareConfig(); arg->ca_config_file = NULL; arg->mimeOutput = false; +#ifdef DEBUGGING + arg->forcedMode = IVAS_ENC_FORCE_UNFORCED; + arg->forcedModeFile = NULL; #ifdef DEBUG_AGC_ENCODER_CMD_OPTION arg->agc = IVAS_ENC_AGC_UNDEFINED; #endif - arg->pca = false; #ifdef DEBUG_FOA_AGC arg->agcBitstream = NULL; #endif #ifdef DEBUG_SBA arg->dbg_file_tag = NULL; #endif +#endif + arg->pca = false; return; } @@ -1057,6 +1056,54 @@ static bool parseCmdlIVAS_enc( } #endif /* #ifdef DEBUG_MODE_INFO_TWEAK */ #endif /* #ifdef DEBUG_MODE_INFO */ + +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + /*-----------------------------------------------------------------* + * IVAS SPAR AGC option + *-----------------------------------------------------------------*/ + else if ( strcmp( argv_to_upper, "-AGC" ) == 0 ) + { + i++; + if ( i < argc - 4 ) + { + arg->agc = ( atoi( argv[i] ) ) ? IVAS_ENC_AGC_ENABLED : IVAS_ENC_AGC_DISABLED; + if ( argv[i] == NULL || atoi( argv[i] ) < 0 || atoi( argv[i] ) > 1 ) + { + fprintf( stderr, "Error: wrong adaptive gain control option specified (%d), expected 0 or 1\n\n", (int32_t) atoi( argv[i] ) ); + usage_enc(); + return false; + } + i++; + } + else + { + fprintf( stderr, "Error: unspecified adaptive gain control option\n\n" ); + usage_enc(); + return false; + } + } +#endif + +#ifdef DEBUG_SBA + /*-----------------------------------------------------------------* + * IVAS SPAR debug files tag + *-----------------------------------------------------------------*/ + else if ( strcmp( argv_to_upper, "-TAG" ) == 0 ) + { + i++; + if ( i < argc - 4 ) + { + arg->dbg_file_tag = argv[i]; + ++i; + } + else + { + fprintf( stderr, "Error: [IVAS SPAR Encoder] unspecified tag value \n\n" ); + usage_enc(); + return false; + } + } +#endif #endif /* #ifdef DEBUGGING */ /*-----------------------------------------------------------------* @@ -1394,29 +1441,6 @@ static bool parseCmdlIVAS_enc( arg->inputFormatConfig.stereoToMonoDownmix = true; i++; } -#ifdef DEBUG_AGC_ENCODER_CMD_OPTION - else if ( strcmp( argv_to_upper, "-AGC" ) == 0 ) - { - i++; - if ( i < argc - 4 ) - { - arg->agc = ( atoi( argv[i] ) ) ? IVAS_ENC_AGC_ENABLED : IVAS_ENC_AGC_DISABLED; - if ( argv[i] == NULL || atoi( argv[i] ) < 0 || atoi( argv[i] ) > 1 ) - { - fprintf( stderr, "Error: wrong adaptive gain control option specified (%d), expected 0 or 1\n\n", (int32_t) atoi( argv[i] ) ); - usage_enc(); - return false; - } - i++; - } - else - { - fprintf( stderr, "Error: unspecified adaptive gain control option\n\n" ); - usage_enc(); - return false; - } - } -#endif else if ( strcmp( argv_to_upper, "-BYPASS" ) == 0 ) // VE: should be renamed to "-pca" { i++; @@ -1450,26 +1474,6 @@ static bool parseCmdlIVAS_enc( return false; } } -#ifdef DEBUG_SBA - /*-----------------------------------------------------------------* - * IVAS SPAR debug files tag - *-----------------------------------------------------------------*/ - else if ( strcmp( argv_to_upper, "-TAG" ) == 0 ) - { - i++; - if ( i < argc - 4 ) - { - arg->dbg_file_tag = argv[i]; - ++i; - } - else - { - fprintf( stderr, "Error: [IVAS SPAR Encoder] unspecified tag value \n\n" ); - usage_enc(); - return false; - } - } -#endif /*-----------------------------------------------------------------* * Option not recognized @@ -1653,6 +1657,10 @@ static void usage_enc( void ) fprintf( stdout, " The encoder produces TS26.445 Annex.2.6 Mime Storage Format, (not RFC4867 Mime Format).\n" ); fprintf( stdout, " default output bitstream file format is G.192\n" ); + fprintf( stdout, "-bypass mode : SBA PCA by-pass, mode = (1, 2), 1 = PCA off, 2 = signal adaptive, default is 1\n" ); +#ifdef DEBUGGING + fprintf( stdout, "-force T : Force specific mode, T = (speech, music, ACELP, GSC, TCX, HQ),\n" ); + fprintf( stdout, " alternatively, T can be a text file where each line contains \"nb_frames T\"\n" ); #ifdef DEBUG_SBA fprintf( stdout, "-tag : Tag name for intermediate debug files\n" ); #endif @@ -1661,11 +1669,6 @@ static void usage_enc( void ) fprintf( stdout, " By default op is 1 (activated) for bitrates between 24400 and 32000,\n" ); fprintf( stdout, " otherwise it is 0 (deactivated) for all other bitrates\n" ); #endif - - fprintf( stdout, "-bypass mode : SBA PCA by-pass, mode = (1, 2), 1 = PCA off, 2 = signal adaptive, default is 1\n" ); -#ifdef DEBUGGING - fprintf( stdout, "-force T : Force specific mode, T = (speech, music, ACELP, GSC, TCX, HQ),\n" ); - fprintf( stdout, " alternatively, T can be a text file where each line contains \"nb_frames T\"\n" ); #ifdef DEBUG_MODE_INFO #ifdef DEBUG_MODE_INFO_TWEAK fprintf( stdout, "-info : specify subfolder name for debug output\n" ); diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index 8d09e48bbd..e73c02fba8 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -80,14 +80,14 @@ typedef enum IVAS_ERR_INVALID_INDEX, IVAS_ERR_NOT_SUPPORTED_OPTION, IVAS_ERR_NOT_IMPLEMENTED, -#ifdef DEBUGGING - IVAS_ERR_INVALID_FORCE_MODE, -#endif IVAS_ERR_FILE_READER_TIMESTAMP_MISMATCH, IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT, IVAS_ERR_INVALID_MASA_FORMAT_METADATA_FILE, +#ifdef DEBUGGING + IVAS_ERR_INVALID_FORCE_MODE, #ifdef DEBUG_AGC_ENCODER_CMD_OPTION IVAS_ERR_INVALID_AGC, +#endif #endif /*----------------------------------------* diff --git a/lib_enc/ivas_agc_enc.c b/lib_enc/ivas_agc_enc.c index 8207336b82..d890e920a8 100644 --- a/lib_enc/ivas_agc_enc.c +++ b/lib_enc/ivas_agc_enc.c @@ -68,6 +68,16 @@ static int16_t ivas_agc_writeBits( FILE *stream, const int16_t n_channels, ivas_ * enablement, otherwise AGC is enabled only if there is one transport channel. * *-----------------------------------------------------------------------------------------*/ + +/*! r: AGC enable flag */ +int16_t ivas_agc_enc_get_flag( + int16_t agc_configuration, /* i : AGC configuration from command-line */ + int16_t nchan_transport /* i : number of transport channels */ +) +{ + return (int16_t) ( ( agc_configuration == SBA_AGC_DEFAULT ) ? ( nchan_transport == 1 ) : agc_configuration ); +} + #else /*-----------------------------------------------------------------------------------------* * Function ivas_agc_enc_get_flag() @@ -76,25 +86,17 @@ static int16_t ivas_agc_writeBits( FILE *stream, const int16_t n_channels, ivas_ * AGC is enabled only if there is one transport channel. * *-----------------------------------------------------------------------------------------*/ -#endif /*! r: AGC enable flag */ int16_t ivas_agc_enc_get_flag( -#ifdef DEBUG_AGC_ENCODER_CMD_OPTION - int16_t agc_configuration, /* i : AGC configuration from command-line */ -#endif int16_t nchan_transport /* i : number of transport channels */ ) { -#ifdef DEBUG_AGC_ENCODER_CMD_OPTION - return (int16_t) ( ( agc_configuration == SBA_AGC_DEFAULT ) - ? ( nchan_transport == 1 ) - : agc_configuration ); -#else return (int16_t) ( nchan_transport == 1 ); -#endif } +#endif + /*-----------------------------------------------------------------------------------------* * Function ivas_agc_enc_init() * diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 9d04506d79..0644fcd918 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -999,9 +999,6 @@ typedef struct encoder_config_structure int16_t last_Opt_SC_VBR; /* flag indicating prev frame's SC-VBR mode */ /* temp. development parameters */ -#ifdef DEBUG_AGC_ENCODER_CMD_OPTION - int16_t Opt_AGC_ON; /* flag indicating AGC operation in SBA */ -#endif int16_t Opt_PCA_ON; /* flag indicating PCA operation in SBA */ #ifdef DEBUGGING @@ -1009,6 +1006,9 @@ typedef struct encoder_config_structure int16_t stereo_mode_cmdl; /* stereo mode forced from the command-line */ int16_t force; /* parameter to force specific "core" of the Core-Coder*/ int16_t mdct_stereo_mode_cmdl; /* mdct stereo mode forced from command-line, employed only when DEBUG_FORCE_MDCT_STEREO_MODE is activated */ +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + int16_t Opt_AGC_ON; /* flag indicating AGC operation in SBA */ +#endif #endif diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index e7957a47e5..06ea721564 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -888,7 +888,6 @@ static ivas_error configureEncoder( } #endif - if ( hEncoderConfig->Opt_PCA_ON && !( hEncoderConfig->ivas_format == SBA_FORMAT && hEncoderConfig->ivas_total_brate == PCA_BRATE && hEncoderConfig->sba_order == SBA_FOA_ORDER ) ) { return IVAS_ERROR( IVAS_ERR_NOT_SUPPORTED_OPTION, "PCA supported at SBA FOA 256 kbps only." ); @@ -1505,6 +1504,7 @@ static ivas_error printConfigInfo_enc( { fprintf( stdout, "- PCA configured with signal adaptive decision " ); } + #ifdef DEBUG_AGC_ENCODER_CMD_OPTION switch ( hEncoderConfig->Opt_AGC_ON ) { @@ -1521,8 +1521,6 @@ static ivas_error printConfigInfo_enc( fprintf( stdout, "- AGC unknown " ); break; } -#else - fprintf( stdout, "- AGC default mode " ); #endif fprintf( stdout, "\n" ); } @@ -2057,6 +2055,12 @@ static ivas_error bandwidthApiToInternal( } #ifdef DEBUG_AGC_ENCODER_CMD_OPTION +/*---------------------------------------------------------------------* + * agcAPIToInternal() + * + * + *---------------------------------------------------------------------*/ + static ivas_error agcAPIToInternal( const IVAS_ENC_AGC agcOption, int16_t *internalAGCOption ) @@ -2206,17 +2210,17 @@ static void init_encoder_config( hEncoderConfig->rf_fec_indicator = 1; hEncoderConfig->interval_SID = FIXED_SID_RATE; hEncoderConfig->var_SID_rate_flag = 1; -#ifdef DEBUGGING - hEncoderConfig->stereo_mode_cmdl = 0; - hEncoderConfig->force = -1; - hEncoderConfig->mdct_stereo_mode_cmdl = SMDCT_MS_DECISION; -#endif hEncoderConfig->mc_input_setup = MC_LS_SETUP_INVALID; hEncoderConfig->stereo_dmx_evs = 0; hEncoderConfig->sba_order = 0; hEncoderConfig->sba_planar = 0; +#ifdef DEBUGGING + hEncoderConfig->stereo_mode_cmdl = 0; + hEncoderConfig->force = -1; + hEncoderConfig->mdct_stereo_mode_cmdl = SMDCT_MS_DECISION; #ifdef DEBUG_AGC_ENCODER_CMD_OPTION hEncoderConfig->Opt_AGC_ON = SBA_AGC_DEFAULT; +#endif #endif hEncoderConfig->Opt_PCA_ON = 0; diff --git a/lib_enc/lib_enc.h b/lib_enc/lib_enc.h index fd0a4adfa2..1403b92b37 100644 --- a/lib_enc/lib_enc.h +++ b/lib_enc/lib_enc.h @@ -121,7 +121,6 @@ typedef enum _IVAS_ENC_FORCED_MODE IVAS_ENC_FORCE_UNFORCED, IVAS_ENC_FORCE_UNDEFINED = 0xffff } IVAS_ENC_FORCED_MODE; -#endif #ifdef DEBUG_AGC_ENCODER_CMD_OPTION typedef enum _IVAS_ENC_AGC @@ -131,6 +130,7 @@ typedef enum _IVAS_ENC_AGC IVAS_ENC_AGC_UNDEFINED = 0xffff } IVAS_ENC_AGC; #endif +#endif /*---------------------------------------------------------------------* * Encoder structures -- GitLab From a2a4512751db2dab33cb8fb8330909935ac35e41 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 10 Nov 2022 08:55:29 +0100 Subject: [PATCH 2/5] changes in ivas_agc_enc_get_flag() --- lib_enc/ivas_agc_enc.c | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/lib_enc/ivas_agc_enc.c b/lib_enc/ivas_agc_enc.c index d890e920a8..f39f2b8148 100644 --- a/lib_enc/ivas_agc_enc.c +++ b/lib_enc/ivas_agc_enc.c @@ -59,43 +59,35 @@ extern FILE *agcOut; static int16_t ivas_agc_writeBits( FILE *stream, const int16_t n_channels, ivas_agc_enc_state_t *pState ); #endif -#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + /*-----------------------------------------------------------------------------------------* * Function ivas_agc_enc_get_flag() * - * This function determines if AGC should be enabled or disabled. - * If agc_configuration is not undefined, then this value decides on the state of - * enablement, otherwise AGC is enabled only if there is one transport channel. - * + * This function determines if AGC is enabled or disabled. *-----------------------------------------------------------------------------------------*/ /*! r: AGC enable flag */ int16_t ivas_agc_enc_get_flag( +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION int16_t agc_configuration, /* i : AGC configuration from command-line */ - int16_t nchan_transport /* i : number of transport channels */ +#endif + int16_t nchan_transport /* i : number of transport channels */ ) { - return (int16_t) ( ( agc_configuration == SBA_AGC_DEFAULT ) ? ( nchan_transport == 1 ) : agc_configuration ); -} + int16_t agc_flag; -#else -/*-----------------------------------------------------------------------------------------* - * Function ivas_agc_enc_get_flag() - * - * This function determines if AGC should be enabled or disabled. - * AGC is enabled only if there is one transport channel. - * - *-----------------------------------------------------------------------------------------*/ + /* AGC is enabled only if there is one transport channel. */ + agc_flag = (int16_t) ( nchan_transport == 1 ); -/*! r: AGC enable flag */ -int16_t ivas_agc_enc_get_flag( - int16_t nchan_transport /* i : number of transport channels */ -) -{ - return (int16_t) ( nchan_transport == 1 ); +#ifdef DEBUG_AGC_ENCODER_CMD_OPTION + /* If agc_configuration is not undefined, then this value decides on the state of * enablement, + otherwise AGC is enabled only if there is one transport channel. */ + agc_flag = ( agc_configuration != SBA_AGC_DEFAULT ) ? agc_configuration : agc_flag; +#endif + + return agc_flag; } -#endif /*-----------------------------------------------------------------------------------------* * Function ivas_agc_enc_init() -- GitLab From 7dddc5d51f8b65987c43af5c6bb066251c0e0cd9 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 10 Nov 2022 08:56:27 +0100 Subject: [PATCH 3/5] change of order of dbgclose --- apps/decoder.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 91dd36357d..e8d8019e00 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -583,11 +583,10 @@ cleanup: } #ifdef DEBUGGING - dbgclose(); - #ifdef DEBUG_SBA_AUDIO_DUMP ivas_close_sba_decoder_debug_files( arg.output_Fs, numOutChannels, numTransportChannels, pca_ingest_channels ); #endif + dbgclose(); #endif return mainFailed ? -1 : 0; -- GitLab From 585490f588f84e92063fbcc360841e6dcfeb2252 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 10 Nov 2022 09:15:44 +0100 Subject: [PATCH 4/5] fix merge issue causing a build failure --- lib_com/ivas_error.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index c1c21046b0..f0435aaac2 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -89,13 +89,6 @@ typedef enum IVAS_ERR_INVALID_MASA_FORMAT_METADATA_FILE, #ifdef DEBUGGING IVAS_ERR_INVALID_FORCE_MODE, -#ifdef EXT_RENDERER - IVAS_ERR_NUM_CHANNELS_UNKNOWN, - IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT, - IVAS_ERR_INVALID_INPUT_ID, - IVAS_ERR_WRONG_NUM_CHANNELS, - IVAS_ERR_INVALID_BUFFER_SIZE, -#endif #ifdef DEBUG_AGC_ENCODER_CMD_OPTION IVAS_ERR_INVALID_AGC, #endif @@ -129,6 +122,18 @@ typedef enum IVAS_ERR_BITSTREAM_READER_INVALID_DATA, IVAS_ERR_BITSTREAM_READER_INVALID_FORMAT, +#ifdef EXT_RENDERER + /*----------------------------------------* + * renderer (lib_rend only) * + *----------------------------------------*/ + + IVAS_ERR_NUM_CHANNELS_UNKNOWN, + IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT, + IVAS_ERR_INVALID_INPUT_ID, + IVAS_ERR_WRONG_NUM_CHANNELS, + IVAS_ERR_INVALID_BUFFER_SIZE, +#endif + /*----------------------------------------* * unknown error * *----------------------------------------*/ -- GitLab From 17fab5fd910731fe5ec8d10cfdb6418fabf0554c Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 10 Nov 2022 09:17:08 +0100 Subject: [PATCH 5/5] move 'IVAS_ENC_STEREO_MODE' --- lib_enc/lib_enc.h | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/lib_enc/lib_enc.h b/lib_enc/lib_enc.h index 1403b92b37..dbcb21c989 100644 --- a/lib_enc/lib_enc.h +++ b/lib_enc/lib_enc.h @@ -71,19 +71,6 @@ typedef struct _IVAS_ENC_DTX_CONFIG int16_t SID_interval; } IVAS_ENC_DTX_CONFIG; -#ifdef DEBUGGING -typedef enum _IVAS_ENC_STEREO_MODE -{ - IVAS_ENC_STEREO_MODE_UNIFIED, - IVAS_ENC_STEREO_MODE_DFT, - IVAS_ENC_STEREO_MODE_TD, - IVAS_ENC_STEREO_MODE_MDCT_DECISION, - IVAS_ENC_STEREO_MODE_MDCT_FORCE_LR, - IVAS_ENC_STEREO_MODE_MDCT_FORCE_MS, - IVAS_ENC_STEREO_MODE_UNDEFINED = 0xffff -} IVAS_ENC_STEREO_MODE; -#endif /* DEBUGGING */ - typedef enum _IVAS_ENC_SBA_ORDER { IVAS_ENC_SBA_FOA = 1, @@ -110,6 +97,17 @@ typedef enum _IVAS_ENC_MASA_VARIANT } IVAS_ENC_MASA_VARIANT; #ifdef DEBUGGING +typedef enum _IVAS_ENC_STEREO_MODE +{ + IVAS_ENC_STEREO_MODE_UNIFIED, + IVAS_ENC_STEREO_MODE_DFT, + IVAS_ENC_STEREO_MODE_TD, + IVAS_ENC_STEREO_MODE_MDCT_DECISION, + IVAS_ENC_STEREO_MODE_MDCT_FORCE_LR, + IVAS_ENC_STEREO_MODE_MDCT_FORCE_MS, + IVAS_ENC_STEREO_MODE_UNDEFINED = 0xffff +} IVAS_ENC_STEREO_MODE; + typedef enum _IVAS_ENC_FORCED_MODE { IVAS_ENC_FORCE_SPEECH, -- GitLab