# HG changeset patch
# User Steve Borho <st...@borho.org>
# Date 1428256600 18000
#      Sun Apr 05 12:56:40 2015 -0500
# Node ID 775436f7364dd763c6fcd35ee2b80a5d0831f666
# Parent  ebe5e57c4b45b45338035a1009b64585f21d66d5
api: add --allow-non-conformance param, default to False

The encoder will now abort any encode that would result in a non-conformant
stream, unless --allow-non-conformance is specified

diff -r ebe5e57c4b45 -r 775436f7364d doc/reST/cli.rst
--- a/doc/reST/cli.rst  Sat Apr 04 15:11:39 2015 -0500
+++ b/doc/reST/cli.rst  Sun Apr 05 12:56:40 2015 -0500
@@ -464,11 +464,22 @@
        HEVC specification.  If x265 detects that the total reference count
        is greater than 8, it will issue a warning that the resulting stream
        is non-compliant and it signals the stream as profile NONE and level
-       NONE but still allows the encode to continue.  Compliant HEVC
+       NONE and will abort the encode unless
+       :option:`--allow-non-conformance` it specified.  Compliant HEVC
        decoders may refuse to decode such streams.
        
        Default 3
 
+.. option:: --allow-non-conformance, --no-allow-non-conformance
+
+       Allow libx265 to generate a bitstream with profile and level NONE.
+       By default it will abort any encode which does not meet strict level
+       compliance. The two most likely causes for non-conformance are
+       :option:`--ctu` being too small, :option:`--ref` being too high,
+       or the bitrate or resolution being out of specification.
+
+       Default: disabled
+
 .. note::
        :option:`--profile`, :option:`--level-idc`, and
        :option:`--high-tier` are only intended for use when you are
@@ -476,7 +487,7 @@
        limitations and must constrain the bitstream within those limits.
        Specifying a profile or level may lower the encode quality
        parameters to meet those requirements but it will never raise
-       them.
+       them. It may enable VBV constraints on a CRF encode.
 
 Mode decision / Analysis
 ========================
diff -r ebe5e57c4b45 -r 775436f7364d source/CMakeLists.txt
--- a/source/CMakeLists.txt     Sat Apr 04 15:11:39 2015 -0500
+++ b/source/CMakeLists.txt     Sun Apr 05 12:56:40 2015 -0500
@@ -30,7 +30,7 @@
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 52)
+set(X265_BUILD 53)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r ebe5e57c4b45 -r 775436f7364d source/common/param.cpp
--- a/source/common/param.cpp   Sat Apr 04 15:11:39 2015 -0500
+++ b/source/common/param.cpp   Sun Apr 05 12:56:40 2015 -0500
@@ -565,6 +565,7 @@
             p->levelIdc = atoi(value);
     }
     OPT("high-tier") p->bHighTier = atobool(value);
+    OPT("allow-non-conformance") p->bAllowNonConformance = atobool(value);
     OPT2("log-level", "log")
     {
         p->logLevel = atoi(value);
diff -r ebe5e57c4b45 -r 775436f7364d source/encoder/api.cpp
--- a/source/encoder/api.cpp    Sat Apr 04 15:11:39 2015 -0500
+++ b/source/encoder/api.cpp    Sun Apr 05 12:56:40 2015 -0500
@@ -72,6 +72,13 @@
     // will detect and set profile/tier/level in VPS
     determineLevel(*param, encoder->m_vps);
 
+    if (!param->bAllowNonConformance && encoder->m_vps.ptl.profileIdc == 
Profile::NONE)
+    {
+        x265_log(param, X265_LOG_INFO, "non-conformant bitstreams not allowed 
(--allow-non-conformance)\n");
+        delete encoder;
+        return NULL;
+    }
+
     encoder->create();
     if (encoder->m_aborted)
     {
diff -r ebe5e57c4b45 -r 775436f7364d source/x265.h
--- a/source/x265.h     Sat Apr 04 15:11:39 2015 -0500
+++ b/source/x265.h     Sun Apr 05 12:56:40 2015 -0500
@@ -522,6 +522,10 @@
      * performance. Value must be between 1 and 16, default is 3 */
     int       maxNumReferences;
 
+    /* Allow libx265 to emit HEVC bitstreams which do not meet strict level
+     * requirements. Defaults to false */
+    int       bAllowNonConformance;
+
     /*== Bitstream Options ==*/
 
     /* Flag indicating whether VPS, SPS and PPS headers should be output with
diff -r ebe5e57c4b45 -r 775436f7364d source/x265cli.h
--- a/source/x265cli.h  Sat Apr 04 15:11:39 2015 -0500
+++ b/source/x265cli.h  Sun Apr 05 12:56:40 2015 -0500
@@ -51,6 +51,8 @@
     { "level-idc",      required_argument, NULL, 0 },
     { "high-tier",            no_argument, NULL, 0 },
     { "no-high-tier",         no_argument, NULL, 0 },
+    { "allow-non-conformance",no_argument, NULL, 0 },
+    { "no-allow-non-conformance",no_argument, NULL, 0 },
     { "csv",            required_argument, NULL, 0 },
     { "no-cu-stats",          no_argument, NULL, 0 },
     { "cu-stats",             no_argument, NULL, 0 },
@@ -258,6 +260,7 @@
     H0("   --profile <string>            Enforce an encode profile: main, 
main10, mainstillpicture\n");
     H0("   --level-idc <integer|float>   Force a minimum required decoder 
level (as '5.0' or '50')\n");
     H0("   --[no-]high-tier              If a decoder level is specified, this 
modifier selects High tier of that level\n");
+    H0("   --[no-]allow-non-conformance  Allow the encoder to generate profile 
NONE bitstreams. Default %s\n", OPT(param->bAllowNonConformance));
     H0("\nThreading, performance:\n");
     H0("   --pools <integer,...>         Comma separated thread count per 
thread pool (pool per NUMA node)\n");
     H0("                                 '-' implies no threads on node, '+' 
implies one thread per core on node\n");
_______________________________________________
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel

Reply via email to