Skip to content

Commit

Permalink
v1.3.1: bugfixes, parameter checks, better output handling, subpic su…
Browse files Browse the repository at this point in the history
…pport (#122)
  • Loading branch information
adamjw24 authored Dec 17, 2021
1 parent a4cd29c commit 7c9c994
Show file tree
Hide file tree
Showing 24 changed files with 395 additions and 283 deletions.
21 changes: 21 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
/////////////////////////////////////////
tag 1.3.1

* libvvenc:
- fixed QPA encoding with tiles
- allowing encoding of videos compatible with subpic-merging functionality of VVC
- API extended, but ABI compatible
- added paramter: m_treatAsSubPic, m_explicitAPSid
- temporarily forbidding rate control combined with DebugBitstream

* vvencapp:
- fixed output of `vvencapp --version`
- aligned output with full-featured app

* vvencFFapp:
- aligned output with vvencapp
- added command line parameters
- TreatAsSubPic
- ExplicitAPSid


/////////////////////////////////////////
tag 1.3.0

Expand Down
4 changes: 3 additions & 1 deletion include/apputils/ParseArg.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ namespace df
virtual ~ErrorReporter() {}
virtual std::ostream& error(const std::string& where);
virtual std::ostream& warn(const std::string& where);
bool is_errored;
bool is_errored = false;
bool is_warning = false;
std::stringstream outstr;
};

extern ErrorReporter default_error_reporter;
Expand Down
7 changes: 4 additions & 3 deletions include/apputils/VVEncAppCfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class APPUTILS_DECL VVEncAppCfg
bool m_packedYUVOutput = false; ///< If true, output 10-bit and 12-bit YUV data as 5-byte and 3-byte (respectively) packed YUV data
bool m_decode = false;
bool m_showVersion = false;
bool m_showHelp = false;

std::string m_additionalSettings; ///< set additional settings (always parsed and set after other params are set)
///< options must be defined as tuple key=value, entries must be separated by space' ' or colon ':'
Expand Down Expand Up @@ -112,15 +113,15 @@ class APPUTILS_DECL VVEncAppCfg
}

public:
int parse( int argc, char* argv[], vvenc_config* c );
int parse( int argc, char* argv[], vvenc_config* c, std::ostream& rcOstr );

bool checkCfg( vvenc_config* c );
bool checkCfg( vvenc_config* c, std::ostream& rcOstr );
virtual std::string getAppConfigAsString( vvencMsgLevel eMsgLevel ) const;

std::vector <std::tuple<std::string, std::string>> getAdditionalSettingList();

private:
bool xCheckCfg( vvenc_config* c );
bool xCheckCfg( vvenc_config* c, std::ostream& rcOstr );

std::vector<std::string> tokenize(std::string str, char delimiter );
};
Expand Down
8 changes: 5 additions & 3 deletions include/vvenc/vvencCfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -745,10 +745,12 @@ typedef struct vvenc_config
unsigned m_summaryVerboseness; // Specifies the level of the verboseness of the text output.
int m_numIntraModesFullRD; // Number Modes for Full RD Intra Search
bool m_reduceIntraChromaModesFullRD; // Reduce Number Modes for Full RD Intra Chroma Search

// reserved parameters for internal use
int m_reservedInt[10];
bool m_reservedFlag[10];
int m_reservedInt[9];
int m_explicitAPSid;
bool m_reservedFlag[9];
bool m_treatAsSubPic;
double m_reservedDouble[10];

// internal state variables
Expand Down
51 changes: 34 additions & 17 deletions source/App/vvencFFapp/EncApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,29 +91,43 @@ void msgApp( int level, const char* fmt, ... )
bool EncApp::parseCfg( int argc, char* argv[])
{
vvenc_set_msg_callback( &m_vvenc_config, this, &::msgFnc ); // register local (thread safe) logger (global logger is overwritten )
std::stringstream cParserStr;

try
bool ret = true;

if( argc )
{
// remove application name
argc--;
argv++;
}

int parserRes = m_cEncAppCfg.parse( argc, argv, &m_vvenc_config, cParserStr);
if( parserRes != 0 )
{
if( argc )
if( m_cEncAppCfg.m_showHelp )
{
// remove application name
argc--;
argv++;
msgApp( VVENC_INFO, "vvencFFapp: %s\n", vvenc_get_enc_information( nullptr ));
if( !cParserStr.str().empty() )
msgApp( VVENC_INFO, "%s", cParserStr.str().c_str() );
return true;
}

if( 0 != m_cEncAppCfg.parse( argc, argv, &m_vvenc_config ) )
else if( m_cEncAppCfg.m_showVersion)
{
return false;
msgApp( VVENC_INFO,"vvencFFapp version %s\n", vvenc_get_version());
if( !cParserStr.str().empty() )
msgApp( VVENC_INFO, "%s", cParserStr.str().c_str() );
return true;
}
}
catch( apputils::df::program_options_lite::ParseFailure &e )
{
msgApp( VVENC_ERROR, "Error parsing option \"%s\" with argument \"%s\".\n", e.arg.c_str(), e.val.c_str() );
return false;
}
g_verbosity = m_vvenc_config.m_verbosity;

bool ret = true;
if( parserRes >= 0 ) g_verbosity = m_vvenc_config.m_verbosity;
else ret = false;

msgApp( VVENC_INFO, "vvencFFapp: %s\n", vvenc_get_enc_information( nullptr ));

if( !cParserStr.str().empty() )
msgApp( (parserRes < 0 ) ? VVENC_ERROR : ((parserRes > 0) ? VVENC_WARNING : VVENC_INFO), "%s", cParserStr.str().c_str() );

if( !m_cEncAppCfg.m_additionalSettings.empty() )
{
Expand All @@ -133,7 +147,7 @@ bool EncApp::parseCfg( int argc, char* argv[])
switch (parse_ret)
{
case VVENC_PARAM_BAD_NAME:
msgApp( VVENC_ERROR, "additional params: unknown option\"%s\" \n", key.c_str() );
msgApp( VVENC_ERROR, "additional params: unknown option \"%s\" \n", key.c_str() );
ret = false;
break;
case VVENC_PARAM_BAD_VALUE:
Expand Down Expand Up @@ -166,8 +180,11 @@ bool EncApp::parseCfg( int argc, char* argv[])
ret = false;
}

if( m_cEncAppCfg.checkCfg( &m_vvenc_config ))
cParserStr.str("");
cParserStr.clear();
if( m_cEncAppCfg.checkCfg( &m_vvenc_config, cParserStr ))
{
msgApp( VVENC_ERROR, "%s", cParserStr.str().c_str() );
ret = false;
}

Expand Down
12 changes: 2 additions & 10 deletions source/App/vvencFFapp/EncApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,9 @@ static void changePreset( vvenc_config* c, vvencPresetMode preset )
void outputAU ( const vvencAccessUnit& au ); ///< write encoded access units to bitstream
static void outputYuv( void*, vvencYUVBuffer* ); ///< write reconstructed yuv output

void msgFnc( int level, const char* fmt, va_list args )
bool isShowVersionHelp()
{
if ( g_verbosity >= level )
{
vfprintf( level == 1 ? stderr : stdout, fmt, args );
}
}

bool isShowVersion()
{
return m_cEncAppCfg.m_showVersion;
return (m_cEncAppCfg.m_showVersion || m_cEncAppCfg.m_showHelp );
}

private:
Expand Down
18 changes: 3 additions & 15 deletions source/App/vvencFFapp/encmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,33 +76,21 @@ int main(int argc, char* argv[])
opts.addOptions()
( "c", apputils::df::program_options_lite::parseConfigFile, "" )
( "SIMD", simdOpt, "" );

apputils::df::program_options_lite::SilentReporter err;
apputils::df::program_options_lite::scanArgv( opts, argc, ( const char** ) argv, err );

const char* pSimd = vvenc_set_SIMD_extension( simdOpt.c_str() );
pSimd == nullptr ? simdOpt = "NA" : simdOpt = pSimd;

// print information
msgApp( VVENC_INFO, "\n");
msgApp( VVENC_INFO, "vvencFFapp: Encoder Version %s ", vvenc_get_version() );
msgApp( VVENC_INFO, "%s", vvenc_get_compile_info_string() );
msgApp( VVENC_INFO, "[SIMD=%s]", simdOpt.c_str() );
if ( vvenc_is_tracing_enabled() )
{
msgApp( VVENC_INFO, "[ENABLE_TRACING]" );
}
msgApp( VVENC_INFO, "\n" );
vvenc_set_SIMD_extension( simdOpt.c_str() );

EncApp* pcEncApp = new EncApp;
//g_vvencEncApp = (vvencEncApp*)pcEncApp;

// parse configuration
if ( ! pcEncApp->parseCfg( argc, argv ) )
{
return 1;
}

if( pcEncApp->isShowVersion() )
if( pcEncApp->isShowVersionHelp() )
{
return 0;
}
Expand Down
Loading

0 comments on commit 7c9c994

Please sign in to comment.