[x265] [PATCH] api: add an option to disable the informational SEI message

Steve Borho steve at borho.org
Tue Jul 15 07:35:50 CEST 2014


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1405402535 18000
#      Tue Jul 15 00:35:35 2014 -0500
# Node ID 6f51bf4ba665e05349bf94bb763db035e689f16a
# Parent  59855812b4ef540a7f8862415885c975222d48ba
api: add an option to disable the informational SEI message

For regression testing, or comparing outputs between compilers or platforms,
this header is quite unhelpful, so make it optional.

diff -r 59855812b4ef -r 6f51bf4ba665 doc/reST/cli.rst
--- a/doc/reST/cli.rst	Tue Jul 15 00:00:14 2014 -0500
+++ b/doc/reST/cli.rst	Tue Jul 15 00:35:35 2014 -0500
@@ -904,6 +904,14 @@
 	to keep the stream headers for you and you want keyframes to be
 	random access points. Default disabled
 
+.. option:: --info, --no-info
+
+	Emit an informational SEI with the stream headers which describes
+	the encoder version, build info, and encode parameters. This is very
+	helpful for debugging purposes but encoding version numbers and
+	build info could make your bitstreams diverge and interfere with
+	regression testing. Default enabled
+
 .. option:: --hrd, --no-hrd
 
 	Enable the signalling of HRD parameters to the decoder. The HRD
diff -r 59855812b4ef -r 6f51bf4ba665 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Tue Jul 15 00:00:14 2014 -0500
+++ b/source/CMakeLists.txt	Tue Jul 15 00:35:35 2014 -0500
@@ -19,7 +19,7 @@
 include(CheckCXXCompilerFlag)
 
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 26)
+set(X265_BUILD 27)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 59855812b4ef -r 6f51bf4ba665 source/common/param.cpp
--- a/source/common/param.cpp	Tue Jul 15 00:00:14 2014 -0500
+++ b/source/common/param.cpp	Tue Jul 15 00:35:35 2014 -0500
@@ -106,6 +106,7 @@
     param->csvfn = NULL;
     param->rc.lambdaFileName = NULL;
     param->bLogCuStats = 0;
+    param->bEmitInfoSEI = 1;
 
     /* Source specifications */
     param->internalBitDepth = x265_max_bit_depth;
@@ -634,6 +635,7 @@
     OPT("psnr") p->bEnablePsnr = atobool(value);
     OPT("hash") p->decodedPictureHashSEI = atoi(value);
     OPT("aud") p->bEnableAccessUnitDelimiters = atobool(value);
+    OPT("info") p->bEmitInfoSEI = atobool(value);
     OPT("b-pyramid") p->bBPyramid = atobool(value);
     OPT("hrd") p->bEmitHRDSEI = atobool(value);
     OPT2("ipratio", "ip-factor") p->rc.ipFactor = atof(value);
diff -r 59855812b4ef -r 6f51bf4ba665 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Tue Jul 15 00:00:14 2014 -0500
+++ b/source/encoder/frameencoder.cpp	Tue Jul 15 00:35:35 2014 -0500
@@ -224,30 +224,33 @@
     bs.writeByteAlignment();
     list.serialize(NAL_UNIT_PPS, bs);
 
-    char *opts = x265_param2string(m_param);
-    if (opts)
+    if (m_param->bEmitInfoSEI)
     {
-        char *buffer = X265_MALLOC(char, strlen(opts) + strlen(x265_version_str) +
-                                         strlen(x265_build_info_str) + 200);
-        if (buffer)
+        char *opts = x265_param2string(m_param);
+        if (opts)
         {
-            sprintf(buffer, "x265 (build %d) - %s:%s - H.265/HEVC codec - "
-                    "Copyright 2013-2014 (c) Multicoreware Inc - "
-                    "http://x265.org - options: %s",
-                    X265_BUILD, x265_version_str, x265_build_info_str, opts);
-            
-            bs.resetBits();
-            SEIuserDataUnregistered idsei;
-            idsei.m_userData = (uint8_t*)buffer;
-            idsei.m_userDataLength = (uint32_t)strlen(buffer);
-            idsei.write(bs, m_sps);
-            bs.writeByteAlignment();
-            list.serialize(NAL_UNIT_PREFIX_SEI, bs);
+            char *buffer = X265_MALLOC(char, strlen(opts) + strlen(x265_version_str) +
+                                            strlen(x265_build_info_str) + 200);
+            if (buffer)
+            {
+                sprintf(buffer, "x265 (build %d) - %s:%s - H.265/HEVC codec - "
+                        "Copyright 2013-2014 (c) Multicoreware Inc - "
+                        "http://x265.org - options: %s",
+                        X265_BUILD, x265_version_str, x265_build_info_str, opts);
+                
+                bs.resetBits();
+                SEIuserDataUnregistered idsei;
+                idsei.m_userData = (uint8_t*)buffer;
+                idsei.m_userDataLength = (uint32_t)strlen(buffer);
+                idsei.write(bs, m_sps);
+                bs.writeByteAlignment();
+                list.serialize(NAL_UNIT_PREFIX_SEI, bs);
 
-            X265_FREE(buffer);
+                X265_FREE(buffer);
+            }
+
+            X265_FREE(opts);
         }
-
-        X265_FREE(opts);
     }
 
     if (m_param->bEmitHRDSEI)
diff -r 59855812b4ef -r 6f51bf4ba665 source/x265.cpp
--- a/source/x265.cpp	Tue Jul 15 00:00:14 2014 -0500
+++ b/source/x265.cpp	Tue Jul 15 00:35:35 2014 -0500
@@ -184,6 +184,8 @@
     { "repeat-headers",       no_argument, NULL, 0 },
     { "aud",                  no_argument, NULL, 0 },
     { "no-aud",               no_argument, NULL, 0 },
+    { "info",                 no_argument, NULL, 0 },
+    { "no-info",              no_argument, NULL, 0 },
     { "qpfile",         required_argument, NULL, 0 },
     { "lambda-file",    required_argument, NULL, 0 },
     { "b-intra",              no_argument, NULL, 0 },
@@ -432,6 +434,7 @@
     H0("                                 smpte240m, GBR, YCgCo, bt2020nc, bt2020c. Default undef\n");
     H0("   --chromaloc <integer>         Specify chroma sample location (0 to 5). Default of %d\n", param->vui.chromaSampleLocTypeTopField);
     H0("\nBitstream options:\n");
+    H0("   --[no-]info                   Emit SEI identifying encoder and parameters. Default %s\n", OPT(param->bEmitInfoSEI));
     H0("   --[no-]aud                    Emit access unit delimiters at the start of each access unit. Default %s\n", OPT(param->bEnableAccessUnitDelimiters));
     H0("   --[no-]repeat-headers         Emit SPS and PPS headers at each keyframe. Default %s\n", OPT(param->bRepeatHeaders));
     H0("   --hash <integer>              Decoded Picture Hash SEI 0: disabled, 1: MD5, 2: CRC, 3: Checksum. Default %d\n", param->decodedPictureHashSEI);
diff -r 59855812b4ef -r 6f51bf4ba665 source/x265.h
--- a/source/x265.h	Tue Jul 15 00:00:14 2014 -0500
+++ b/source/x265.h	Tue Jul 15 00:35:35 2014 -0500
@@ -418,6 +418,11 @@
      * parameteres. Default is disabled */
     int       bEmitHRDSEI;
 
+    /* Enables the emission of a user data SEI with the stream headers which
+     * describes the encoder version, build info, and parameters. This is
+     * very helpful for debugging, but may interfere with regression tests. */
+    int       bEmitInfoSEI;
+
     /*== Coding Unit (CU) definitions ==*/
 
     /* Maxiumum CU width and height in pixels.  The size must be 64, 32, or 16.


More information about the x265-devel mailing list