[x265-commits] [x265] rest: update introduction page, add more detail about sof...

Steve Borho steve at borho.org
Mon May 5 23:15:41 CEST 2014


details:   http://hg.videolan.org/x265/rev/d0b17e3ef9db
branches:  
changeset: 6808:d0b17e3ef9db
user:      Steve Borho <steve at borho.org>
date:      Mon May 05 12:50:26 2014 -0500
description:
rest: update introduction page, add more detail about software patents
Subject: [x265] cli: report input bit depth

details:   http://hg.videolan.org/x265/rev/5ca8717a3ec2
branches:  
changeset: 6809:5ca8717a3ec2
user:      Steve Borho <steve at borho.org>
date:      Sun May 04 23:53:30 2014 -0500
description:
cli: report input bit depth
Subject: [x265] y4m: support variable bit depth via CXXXpDD Y4MPEG header; ie: C420p10

details:   http://hg.videolan.org/x265/rev/c4adcaef8d1d
branches:  
changeset: 6810:c4adcaef8d1d
user:      Steve Borho <steve at borho.org>
date:      Mon May 05 00:22:50 2014 -0500
description:
y4m: support variable bit depth via CXXXpDD Y4MPEG header; ie: C420p10

ffmpeg's support for this is non-standard, so you must use -strict -1, aka:

ffmpeg -i vid.avi -pix_fmt yuv420p10le -strict -1 -f yuv4mpegpipe - | ./x265 - --y4m o.hevc

closes issue #53

diffstat:

 doc/reST/introduction.rst |  66 ++++++++++++++++++++++++++++----------
 source/input/y4m.cpp      |  78 +++++++++++++++++++++++++++-------------------
 source/input/y4m.h        |   4 +-
 source/x265.cpp           |   4 +-
 4 files changed, 97 insertions(+), 55 deletions(-)

diffs (283 lines):

diff -r dcf74ea39e31 -r c4adcaef8d1d doc/reST/introduction.rst
--- a/doc/reST/introduction.rst	Sat May 03 15:08:24 2014 -0500
+++ b/doc/reST/introduction.rst	Mon May 05 00:22:50 2014 -0500
@@ -2,22 +2,23 @@
 Introduction
 ************
 
-Increase in demand for high resolution video along with increase in the
-consumption of video can be met only with the supply of a high
-efficiency codec. The x265 codec from MCW aims at providing the most
-efficient video encoder with the highest possible quality at even the
-lowest given bit rate.
+Increasing demand for high definition and ultra-high definition video,
+along with an increasing desire for video on demand has led to
+exponential growth in demand for bandwidth and storage requirements.
+These challenges can be met by the new High Efficiency Video Coding
+(HEVC) standard, also known as H.265. The x265 HEVC encoder project was
+launched by MulticoreWare in 2013, aiming to provide the most efficient,
+highest performance HEVC video encoder.
 
 About HEVC
 ==========
 
-The High Efficiency Video Coding (HEVC) is the latest generation video
-compression standard. This standard was developed by the ISO/IEC Moving
-Picture Experts Group (MPEG) and ITU-T Video Coding Experts Group
+The High Efficiency Video Coding (HEVC) was developed by the ISO/IEC
+Moving Picture Experts Group (MPEG) and ITU-T Video Coding Experts Group
 (VCEG), through their Joint Collaborative Team on Video Coding (JCT-VC).
 HEVC is also known as ISO/IEC 23008-2 MPEG-H Part 2 and ITU-T H.265.
 HEVC provides superior video quality and up to twice the data
-compression as the previous standard (H.264/MPEG-4 AVC). HEVC can
+compression as the previous standard (H.264/MPEG-4 AVC).  HEVC can
 support 8K Ultra High Definition video, with a picture size up to
 8192x4320 pixels.
 
@@ -28,16 +29,18 @@ The primary objective of x265 is to beco
 available anywhere, offering the highest compression efficiency and the
 highest performance on a wide variety of hardware platforms. The x265
 encoder is available as an open source library, published under the
-GPLv2 license. It is also available under a commercial license similar
-to the x264s commercial license.
+GPLv2 license. It is also available under a commercial license, enabling
+commercial companies to utilize and distribute x265 in their solutions
+without being subject to the restrictions of the GPL license.
 
-x265 is developed by `MulticoreWare <http://www.multicorewareinc.com>`_, leaders
-in high performance software solutions, with backing from leading video technology
-providers including `Telestream <http://www.telestream.com>`_ and
-`Doremi Labs <http://www.doremilabs.com>`_ (and other companies who want to remain
-anonymous at this time), and with contributions from open source developers.
-x265 leverages many of the outstanding video encoding features and optimizations
-from the x264 AVC encoder project.
+x265 is developed by `MulticoreWare <http://www.multicorewareinc.com>`_,
+leaders in high performance software solutions, with backing from
+leading video technology providers including `Telestream
+<http://www.telestream.com>`_ and `Doremi Labs
+<http://www.doremilabs.com>`_ (and other companies who want to remain
+anonymous at this time), and with contributions from open source
+developers.  x265 leverages many of the outstanding video encoding
+features and optimizations from the x264 AVC encoder project.
 
 The x265 software is available for free under the GNU GPL 2 license,
 from https://bitbucket.org/multicoreware/x265.  For commercial companies
@@ -50,3 +53,30 @@ While x265 is primarily designed as a vi
 command-line executable is provided to facilitate testing and
 development.  We expect x265 to be utilized in many leading video
 hardware and software products and services in the coming months.
+
+LEGAL NOTICES
+=============
+
+The x265 software is owned and copyrighted by MulticoreWare, Inc.
+MulticoreWare is committed to offering the x265 software under the GNU
+GPL v2 license.  Companies who do not wish to integrate the x265
+Software in their products under the terms of the GPL license can
+contact MulticoreWare (license @ x265.com) to obtain a commercial
+license agreement.  Companies who use x265 under the GPL may also wish
+to work with MulticoreWare to accelerate the development of specific
+features or optimized support for specific hardware or software
+platforms, or to contract for support.
+
+The GNU GPL v2 license or the x265 commercial license agreement govern
+your rights to access the copyrighted x265 software source code, but do
+not cover any patents that may be applicable to the function of binary
+executable software created from the x265 source code.  You are
+responsible for understanding the laws in your country, and for
+licensing all applicable patent rights needed for use or distribution of
+software applications created from the x265 source code.  A good place
+to start is with the Motion Picture Experts Group - Licensing Authority
+- HEVC Licensing Program.
+
+x265 is a registered trademark of MulticoreWare, Inc.  The x265 logo is
+a trademark of MulticoreWare, and may only be used with explicit written
+permission.  All rights reserved.
diff -r dcf74ea39e31 -r c4adcaef8d1d source/input/y4m.cpp
--- a/source/input/y4m.cpp	Sat May 03 15:08:24 2014 -0500
+++ b/source/input/y4m.cpp	Mon May 05 00:22:50 2014 -0500
@@ -53,6 +53,7 @@ Y4MInput::Y4MInput(InputFileInfo& info)
     head.set(0);
     tail.set(0);
 
+    threadActive = false;
     colorSpace = info.csp;
     sarWidth = info.sarWidth;
     sarHeight = info.sarHeight;
@@ -60,6 +61,7 @@ Y4MInput::Y4MInput(InputFileInfo& info)
     height = info.height;
     rateNum = info.fpsNum;
     rateDenom = info.fpsDenom;
+    depth = info.depth;
 
     ifs = NULL;
     if (!strcmp(info.filename, "-"))
@@ -72,13 +74,30 @@ Y4MInput::Y4MInput(InputFileInfo& info)
     else
         ifs = new ifstream(info.filename, ios::binary | ios::in);
 
-    threadActive = false;
+    uint32_t bytesPerPixel = 1;
+    size_t frameSize = strlen(header) + 1;
     if (ifs && ifs->good() && parseHeader())
     {
+        bytesPerPixel = depth > 8 ? 2 : 1;
+        for (int i = 0; i < x265_cli_csps[colorSpace].planes; i++)
+        {
+            plane_stride[i] = (uint32_t)(width >> x265_cli_csps[colorSpace].width[i]) * bytesPerPixel;
+            plane_size[i] =   (uint32_t)(plane_stride[i] * (height >> x265_cli_csps[colorSpace].height[i]));
+            frameSize += plane_size[i];
+        }
         threadActive = true;
-        for (uint32_t i = 0; i < QUEUE_SIZE; i++)
+        for (uint32_t q = 0; q < QUEUE_SIZE && threadActive; q++)
         {
-            pictureAlloc(i);
+            for (int i = 0; i < x265_cli_csps[colorSpace].planes; i++)
+            {
+                plane[q][i] = X265_MALLOC(char, plane_size[i]);
+                if (!plane[q][i])
+                {
+                    x265_log(NULL, X265_LOG_ERROR, "y4m: buffer allocation failure, aborting");
+                    threadActive = false;
+                    break;
+                }
+            }
         }
     }
     if (!threadActive)
@@ -96,16 +115,9 @@ Y4MInput::Y4MInput(InputFileInfo& info)
     info.fpsNum = rateNum;
     info.fpsDenom = rateDenom;
     info.csp = colorSpace;
-    info.depth = 8;
+    info.depth = depth;
     info.frameCount = -1;
 
-    size_t frameSize = strlen(header) + 1;
-    for (int i = 0; i < x265_cli_csps[colorSpace].planes; i++)
-    {
-        frameSize += (size_t)((width  >> x265_cli_csps[colorSpace].width[i]) *
-                              (height >> x265_cli_csps[colorSpace].height[i]));
-    }
-
     /* try to estimate frame count, if this is not stdin */
     if (ifs != &cin)
     {
@@ -157,23 +169,7 @@ Y4MInput::~Y4MInput()
     {
         for (int j = 0; j < x265_cli_csps[colorSpace].planes; j++)
         {
-            delete[] plane[i][j];
-        }
-    }
-}
-
-void Y4MInput::pictureAlloc(int queueindex)
-{
-    for (int i = 0; i < x265_cli_csps[colorSpace].planes; i++)
-    {
-        plane_stride[i] = (uint32_t)(width >> x265_cli_csps[colorSpace].width[i]);
-        plane_size[i] =   (uint32_t)(plane_stride[i] * (height >> x265_cli_csps[colorSpace].height[i]));
-        plane[queueindex][i] = new char[plane_size[i]];
-        if (!plane[queueindex][i])
-        {
-            x265_log(NULL, X265_LOG_ERROR, "y4m: buffer allocation failure, aborting");
-            threadActive = false;
-            return;
+            x265_free(plane[i][j]);
         }
     }
 }
@@ -184,6 +180,7 @@ bool Y4MInput::parseHeader()
         return false;
 
     int csp = 0;
+    int d = 0;
 
     while (!ifs->eof())
     {
@@ -313,20 +310,35 @@ bool Y4MInput::parseHeader()
 
             case 'C':
                 csp = 0;
+                d = 0;
                 while (!ifs->eof())
                 {
                     c = ifs->get();
 
-                    if (c == ' ' || c == '\n')
+                    if (c <= '9' && c >= '0')
                     {
+                        csp = csp * 10 + (c - '0');
+                    }
+                    else if (c == 'p')
+                    {
+                        // example: C420p16
+                        while (!ifs->eof())
+                        {
+                            c = ifs->get();
+
+                            if (c <= '9' && c >= '0')
+                                d = d * 10 + (c - '0');
+                            else
+                                break;
+                        }
                         break;
                     }
                     else
-                    {
-                        csp = csp * 10 + (c - '0');
-                    }
+                        break;
                 }
 
+                if (d >= 8 && d <= 16)
+                    depth = d;
                 colorSpace = (csp == 444) ? X265_CSP_I444 : (csp == 422) ? X265_CSP_I422 : X265_CSP_I420;
                 break;
 
@@ -406,7 +418,7 @@ bool Y4MInput::readPicture(x265_picture&
     if (!frameStat[curHead])
         return false;
 
-    pic.bitDepth = 8;
+    pic.bitDepth = depth;
     pic.colorSpace = colorSpace;
     for (int i = 0; i < x265_cli_csps[colorSpace].planes; i++)
     {
diff -r dcf74ea39e31 -r c4adcaef8d1d source/input/y4m.h
--- a/source/input/y4m.h	Sat May 03 15:08:24 2014 -0500
+++ b/source/input/y4m.h	Mon May 05 00:22:50 2014 -0500
@@ -45,6 +45,8 @@ protected:
 
     uint32_t sarHeight;
 
+    int depth;
+
     int width;
 
     int height;
@@ -69,8 +71,6 @@ protected:
 
     bool parseHeader();
 
-    void pictureAlloc(int index);
-
     void threadMain();
 
     bool populateFrameQueue();
diff -r dcf74ea39e31 -r c4adcaef8d1d source/x265.cpp
--- a/source/x265.cpp	Sat May 03 15:08:24 2014 -0500
+++ b/source/x265.cpp	Mon May 05 00:22:50 2014 -0500
@@ -594,8 +594,8 @@ bool CLIOptions::parse(int argc, char **
     if (param->logLevel >= X265_LOG_INFO)
     {
         char buf[128];
-        int p = sprintf(buf, "%dx%d fps %d/%d %s", param->sourceWidth, param->sourceHeight,
-                        param->fpsNum, param->fpsDenom, x265_source_csp_names[param->internalCsp]);
+        int p = sprintf(buf, "%dx%d fps %d/%d %sp%d", param->sourceWidth, param->sourceHeight,
+                        param->fpsNum, param->fpsDenom, x265_source_csp_names[param->internalCsp], info.depth);
 
         int width, height;
         getParamAspectRatio(param, width, height);


More information about the x265-commits mailing list