From 81324fdbb3d2139fc2e7fef7f4b499d2c2609e48 Mon Sep 17 00:00:00 2001 From: Frank Bossen <fbossen@gmail.com> Date: Fri, 14 Apr 2023 11:41:44 -0400 Subject: [PATCH] Add command line option to print per-frame encoding time in float format --- doc/software-manual.tex | 6 ++++++ source/App/EncoderApp/EncApp.cpp | 1 + source/App/EncoderApp/EncAppCfg.cpp | 1 + source/App/EncoderApp/EncAppCfg.h | 1 + source/Lib/EncoderLib/EncCfg.h | 4 ++++ source/Lib/EncoderLib/EncGOP.cpp | 2 +- 6 files changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/software-manual.tex b/doc/software-manual.tex index 46935e138..9dc8e64fc 100644 --- a/doc/software-manual.tex +++ b/doc/software-manual.tex @@ -801,6 +801,12 @@ When 1, the Mean Square Error (MSE) values of the entire sequence will also be o When 1, weighted PSNR (wPSNR) values of the entire sequence will also be output. \\ +\Option{PrintHighPrecEncTime} & +%\ShortOption{\None} & +\Default{false} & +When 1, prints per-frame encoding time in floating-point format. Otherwise prints an integer number of seconds. +\\ + \Option{PrintRefLayerMetrics} & %\ShortOption{\None} & \Default{false} & diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 751e39bde..1c58a602b 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -254,6 +254,7 @@ void EncApp::xInitLibCfg( int layerIdx ) m_cEncLib.setPrintSequenceMSE ( m_printSequenceMSE); m_cEncLib.setPrintMSSSIM ( m_printMSSSIM ); m_cEncLib.setPrintWPSNR ( m_printWPSNR ); + m_cEncLib.setPrintHightPrecEncTime(m_printHighPrecEncTime); m_cEncLib.setCabacZeroWordPaddingEnabled ( m_cabacZeroWordPaddingEnabled ); m_cEncLib.setFrameRate(m_frameRate); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index dbf9c5403..3b9924576 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -822,6 +822,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("PrintSequenceMSE", m_printSequenceMSE, false, "0 (default) emit only bit rate and PSNRs for the whole sequence, 1 = also emit MSE values") ("PrintMSSSIM", m_printMSSSIM, false, "0 (default) do not print MS-SSIM scores, 1 = print MS-SSIM scores for each frame and for the whole sequence") ("PrintWPSNR", m_printWPSNR, false, "0 (default) do not print HDR-PQ based wPSNR, 1 = print HDR-PQ based wPSNR") + ("PrintHighPrecEncTime", m_printHighPrecEncTime, false, "0 (default): print integer value of encoding time in seconds, 1: print floating-point value of encoding time") ("CabacZeroWordPaddingEnabled", m_cabacZeroWordPaddingEnabled, true, "0 do not add conforming cabac-zero-words to bit streams, 1 (default) = add cabac-zero-words as required") ("ChromaFormatIDC,-cf", tmpChromaFormat, 0, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)") ("ConformanceWindowMode", m_conformanceWindowMode, 1, "Window conformance mode (0: no window, 1:automatic padding (default), 2:padding parameters specified, 3:conformance window parameters specified") diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index e0c04bb3f..f84e446fd 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -136,6 +136,7 @@ protected: bool m_printSequenceMSE; bool m_printMSSSIM; bool m_printWPSNR; + bool m_printHighPrecEncTime = false; bool m_cabacZeroWordPaddingEnabled; bool m_clipInputVideoToRec709Range; bool m_clipOutputVideoToRec709Range; diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 24270071f..ecfdfeea1 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -176,6 +176,7 @@ protected: bool m_printSequenceMSE; bool m_printMSSSIM; bool m_printWPSNR; + bool m_printHighPrecEncTime = false; bool m_cabacZeroWordPaddingEnabled; #if JVET_Z0120_SII_SEI_PROCESSING bool m_ShutterFilterEnable; ///< enable Pre-Filtering with Shutter Interval SEI @@ -1245,6 +1246,9 @@ public: bool getPrintWPSNR () const { return m_printWPSNR; } void setPrintWPSNR (bool value) { m_printWPSNR = value; } + bool getPrintHighPrecEncTime() const { return m_printHighPrecEncTime; } + void setPrintHightPrecEncTime(bool val) { m_printHighPrecEncTime = val; } + bool getCabacZeroWordPaddingEnabled() const { return m_cabacZeroWordPaddingEnabled; } void setCabacZeroWordPaddingEnabled(bool value) { m_cabacZeroWordPaddingEnabled = value; } diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index 70e40cd2c..3f11c32ab 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -5465,7 +5465,7 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni } } #endif - msg( NOTICE, " [ET %5.0f ]", dEncTime ); + msg(NOTICE, m_pcCfg->getPrintHighPrecEncTime() ? " [ET %6.3f ]" : " [ET %5.0f ]", dEncTime); // msg( SOME, " [WP %d]", pcSlice->getUseWeightedPrediction()); -- GitLab