From c2b27b4e8d044acd6b96f557a90388e55aecbf26 Mon Sep 17 00:00:00 2001 From: knj Date: Thu, 11 May 2023 18:26:23 +0200 Subject: [PATCH 1/3] add complexity level indication placeholder in encoder --- apps/encoder.c | 34 ++++++++++++++++++++++++++++++++++ lib_com/options.h | 2 ++ lib_enc/lib_enc.h | 9 +++++++++ 3 files changed, 45 insertions(+) diff --git a/apps/encoder.c b/apps/encoder.c index 7f6d6baa30..53b5f7ff6b 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -111,6 +111,9 @@ typedef struct IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig; const char *ca_config_file; bool mimeOutput; +#ifdef COMPLEXITY_LEVEL_INDICATION + IVAS_ENC_COMPLEXITY_LEVEL complexityLevel; +#endif #ifdef DEBUGGING IVAS_ENC_FORCED_MODE forcedMode; @@ -878,6 +881,9 @@ static void initArgStruct( EncArguments *arg ) arg->ca_config_file = NULL; arg->mimeOutput = false; arg->ism_extended_metadata = false; +#ifdef COMPLEXITY_LEVEL_INDICATION + arg->complexityLevel = IVAS_ENC_COMPLEXITY_LEVEL_THREE; +#endif #ifdef DEBUGGING arg->forcedMode = IVAS_ENC_FORCE_UNFORCED; @@ -1190,6 +1196,32 @@ static bool parseCmdlIVAS_enc( ++i; } + +#ifdef COMPLEXITY_LEVEL_INDICATION + /*-----------------------------------------------------------------* + * Complexity Level + *-----------------------------------------------------------------*/ + + /* actual parsing of level will be implemented after characterization */ + else if ( strcmp( argv_to_upper, "-LEVEL" ) == 0 ) + { + int16_t level; + + ++i; + level = atoi( argv[i++] ); + if ( level < IVAS_ENC_COMPLEXITY_LEVEL_ONE || level > IVAS_ENC_COMPLEXITY_LEVEL_THREE ) + { + fprintf( stdout, "Invalid complexity level specified.\n" ); + usage_enc(); + return false; + } + else if ( level == IVAS_ENC_COMPLEXITY_LEVEL_ONE || level == IVAS_ENC_COMPLEXITY_LEVEL_TWO ) + { + fprintf( stdout, "Complexity levels 1 and 2 will be defined after characterisation - default to level 3 (full functionality).\n" ); + } + } +#endif + /*-----------------------------------------------------------------* * IVAS Formats *-----------------------------------------------------------------*/ @@ -1697,6 +1729,8 @@ static void usage_enc( void ) 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" ); + 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" ); #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" ); diff --git a/lib_com/options.h b/lib_com/options.h index dfe0f53d07..4b7a1494ae 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -213,6 +213,8 @@ //#define HODIRAC_READ_PARAMS #endif +#define COMPLEXITY_LEVEL_INDICATION + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_enc/lib_enc.h b/lib_enc/lib_enc.h index 349c41ebef..3a6a619f73 100644 --- a/lib_enc/lib_enc.h +++ b/lib_enc/lib_enc.h @@ -94,6 +94,15 @@ typedef enum _IVAS_ENC_MASA_VARIANT IVAS_ENC_MASA_UNDEFINED = 0xffff } IVAS_ENC_MASA_VARIANT; +#ifdef COMPLEXITY_LEVEL_INDICATION +typedef enum _IVAS_ENC_COMPLEXITY_LEVEL +{ + IVAS_ENC_COMPLEXITY_LEVEL_ONE = 1, + IVAS_ENC_COMPLEXITY_LEVEL_TWO = 2, + IVAS_ENC_COMPLEXITY_LEVEL_THREE = 3 +} IVAS_ENC_COMPLEXITY_LEVEL; +#endif + #ifdef DEBUGGING typedef enum _IVAS_ENC_STEREO_MODE { -- GitLab From adbb4b16c9ae72490437fc2df74c8c2d0acf7c42 Mon Sep 17 00:00:00 2001 From: knj Date: Thu, 11 May 2023 18:35:25 +0200 Subject: [PATCH 2/3] add complexity level placeholder in decoder --- apps/decoder.c | 29 +++++++++++++++++++++++++++++ lib_dec/lib_dec.h | 9 +++++++++ 2 files changed, 38 insertions(+) diff --git a/apps/decoder.c b/apps/decoder.c index 22dc235fff..869dbc8520 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -109,6 +109,9 @@ typedef struct float no_diegetic_pan; bool renderConfigEnabled; char *renderConfigFilename; +#ifdef COMPLEXITY_LEVEL_INDICATION + IVAS_DEC_COMPLEXITY_LEVEL complexityLevel; +#endif #ifdef DEBUGGING IVAS_DEC_FORCED_REND_MODE forcedRendMode; @@ -757,6 +760,9 @@ static bool parseCmdlIVAS_dec( arg->quietModeEnabled = false; arg->delayCompensationEnabled = true; arg->voipMode = false; +#ifdef COMPLEXITY_LEVEL_INDICATION + arg->complexityLevel = IVAS_DEC_COMPLEXITY_LEVEL_THREE; +#endif arg->enableHeadRotation = false; arg->headrotTrajFileName = NULL; @@ -1051,6 +1057,25 @@ static bool parseCmdlIVAS_dec( } i++; } +#ifdef COMPLEXITY_LEVEL_INDICATION + else if ( strcmp( argv_to_upper, "-LEVEL" ) == 0 ) + { + int16_t level; + + ++i; + level = atoi( argv[i++] ); + if ( level < IVAS_DEC_COMPLEXITY_LEVEL_ONE || level > IVAS_DEC_COMPLEXITY_LEVEL_THREE ) + { + fprintf( stdout, "Invalid complexity level specified.\n" ); + usage_dec(); + return false; + } + else if ( level == IVAS_DEC_COMPLEXITY_LEVEL_ONE || level == IVAS_DEC_COMPLEXITY_LEVEL_TWO ) + { + fprintf( stdout, "Complexity levels 1 and 2 will be defined after characterisation - default to level 3 (full functionality).\n" ); + } + } +#endif /*-----------------------------------------------------------------* * Option not recognized @@ -1202,6 +1227,10 @@ static void usage_dec( void ) fprintf( stdout, " containing FEC pattern (short values of 0 (good) or 1 (bad))\n" ); fprintf( stdout, " default is OFF, if this option is not used\n" ); fprintf( stdout, "-force R : Force specific binaural rendering mode, R = (TDREND, CLDFBREND),\n" ); +#ifdef COMPLEXITY_LEVEL_INDICATION + 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" ); +#endif #endif #ifdef DEBUG_MODE_INFO #ifdef DEBUG_MODE_INFO_TWEAK diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 17af564295..f220184ca1 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -77,6 +77,15 @@ typedef enum IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF = 4, /* RTP payload: only Header-Full format without zero padding for size collision avoidance */ } IVAS_DEC_INPUT_FORMAT; +#ifdef COMPLEXITY_LEVEL_INDICATION +typedef enum _IVAS_DEC_COMPLEXITY_LEVEL +{ + IVAS_DEC_COMPLEXITY_LEVEL_ONE = 1, + IVAS_DEC_COMPLEXITY_LEVEL_TWO = 2, + IVAS_DEC_COMPLEXITY_LEVEL_THREE = 3 +} IVAS_DEC_COMPLEXITY_LEVEL; +#endif + #ifdef DEBUGGING typedef enum _IVAS_DEC_FORCED_REND_MODE { -- GitLab From 49454c8578b9b7b684dafc1b2cdbd678c04bd90b Mon Sep 17 00:00:00 2001 From: knj Date: Fri, 12 May 2023 09:19:47 +0200 Subject: [PATCH 3/3] fix warning on windows --- apps/decoder.c | 2 +- apps/encoder.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 869dbc8520..616b36e37e 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1063,7 +1063,7 @@ static bool parseCmdlIVAS_dec( int16_t level; ++i; - level = atoi( argv[i++] ); + level = (int16_t) atoi( argv[i++] ); if ( level < IVAS_DEC_COMPLEXITY_LEVEL_ONE || level > IVAS_DEC_COMPLEXITY_LEVEL_THREE ) { fprintf( stdout, "Invalid complexity level specified.\n" ); diff --git a/apps/encoder.c b/apps/encoder.c index 53b5f7ff6b..a23970a270 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -1208,7 +1208,7 @@ static bool parseCmdlIVAS_enc( int16_t level; ++i; - level = atoi( argv[i++] ); + level = (int16_t) atoi( argv[i++] ); if ( level < IVAS_ENC_COMPLEXITY_LEVEL_ONE || level > IVAS_ENC_COMPLEXITY_LEVEL_THREE ) { fprintf( stdout, "Invalid complexity level specified.\n" ); -- GitLab