[x265-commits] [x265] rc: fix type of actualBits

Steve Borho steve at borho.org
Thu Jun 5 06:26:24 CEST 2014


details:   http://hg.videolan.org/x265/rev/30e6d62afa3d
branches:  
changeset: 6998:30e6d62afa3d
user:      Steve Borho <steve at borho.org>
date:      Wed Jun 04 19:04:51 2014 -0500
description:
rc: fix type of actualBits
Subject: [x265] api: must match X265_ALLOC with X265_FREE for m_nalUnitData

details:   http://hg.videolan.org/x265/rev/e3a5aa8afeae
branches:  
changeset: 6999:e3a5aa8afeae
user:      Steve Borho <steve at borho.org>
date:      Wed Jun 04 19:15:10 2014 -0500
description:
api: must match X265_ALLOC with X265_FREE for m_nalUnitData

This was only an issue on Windows
Subject: [x265] nal: check padded buffer size

details:   http://hg.videolan.org/x265/rev/522e419ed55d
branches:  
changeset: 7000:522e419ed55d
user:      Steve Borho <steve at borho.org>
date:      Wed Jun 04 19:16:34 2014 -0500
description:
nal: check padded buffer size
Subject: [x265] rc: convert RateControl to a class

details:   http://hg.videolan.org/x265/rev/d3b1d2d3f104
branches:  
changeset: 7001:d3b1d2d3f104
user:      Steve Borho <steve at borho.org>
date:      Wed Jun 04 18:53:11 2014 -0500
description:
rc: convert RateControl to a class

The "struct with methods" metaphore was too stretched here. The methods are too
complicated to keep track of which variables were members; variable shadowing
was very common.
Subject: [x265] rc: nit

details:   http://hg.videolan.org/x265/rev/969811ce69da
branches:  
changeset: 7002:969811ce69da
user:      Steve Borho <steve at borho.org>
date:      Wed Jun 04 19:28:16 2014 -0500
description:
rc: nit
Subject: [x265] slicetype: convert lookahead "structs with methods" to classes

details:   http://hg.videolan.org/x265/rev/72a00c40366a
branches:  
changeset: 7003:72a00c40366a
user:      Steve Borho <steve at borho.org>
date:      Wed Jun 04 19:39:42 2014 -0500
description:
slicetype: convert lookahead "structs with methods" to classes
Subject: [x265] encoder: remove m_useLossless

details:   http://hg.videolan.org/x265/rev/65b385fa9989
branches:  
changeset: 7004:65b385fa9989
user:      Steve Borho <steve at borho.org>
date:      Wed Jun 04 19:40:17 2014 -0500
description:
encoder: remove m_useLossless
Subject: [x265] encoder: param->m_param for consistency

details:   http://hg.videolan.org/x265/rev/c02dacf1a13b
branches:  
changeset: 7005:c02dacf1a13b
user:      Steve Borho <steve at borho.org>
date:      Wed Jun 04 19:41:54 2014 -0500
description:
encoder: param->m_param for consistency
Subject: [x265] encoder: bEnableRDOQ->m_bEnableRDOQ for consistency

details:   http://hg.videolan.org/x265/rev/2a228a28395c
branches:  
changeset: 7006:2a228a28395c
user:      Steve Borho <steve at borho.org>
date:      Wed Jun 04 19:42:45 2014 -0500
description:
encoder: bEnableRDOQ->m_bEnableRDOQ for consistency
Subject: [x265] remove Encoder::bEnableRDOQTS, we did not allow separate config for it

details:   http://hg.videolan.org/x265/rev/eca52aac2ec5
branches:  
changeset: 7007:eca52aac2ec5
user:      Steve Borho <steve at borho.org>
date:      Wed Jun 04 19:58:00 2014 -0500
description:
remove Encoder::bEnableRDOQTS, we did not allow separate config for it

Either RDOQ and RDOQTS were enabled at once, or both were disabled, or TSKIP
was disabled and it didn't matter how RDOQTS was set.

Removed RDOQ_CHROMA as well, which allowed the removal of a warning disable
Subject: [x265] TComBitstream: nits

details:   http://hg.videolan.org/x265/rev/d94a29bb9ce7
branches:  
changeset: 7008:d94a29bb9ce7
user:      Steve Borho <steve at borho.org>
date:      Wed Jun 04 20:01:26 2014 -0500
description:
TComBitstream: nits
Subject: [x265] encoder: no longer needs NALwrite.h

details:   http://hg.videolan.org/x265/rev/e4b3061770b9
branches:  
changeset: 7009:e4b3061770b9
user:      Steve Borho <steve at borho.org>
date:      Wed Jun 04 20:05:27 2014 -0500
description:
encoder: no longer needs NALwrite.h
Subject: [x265] nal: fix checked build

details:   http://hg.videolan.org/x265/rev/7186f76fe62c
branches:  
changeset: 7010:7186f76fe62c
user:      Steve Borho <steve at borho.org>
date:      Wed Jun 04 21:20:46 2014 -0500
description:
nal: fix checked build
Subject: [x265] combine NAL output semantics into one clean(er) interface

details:   http://hg.videolan.org/x265/rev/4a146c01fcab
branches:  
changeset: 7011:4a146c01fcab
user:      Steve Borho <steve at borho.org>
date:      Wed Jun 04 21:19:28 2014 -0500
description:
combine NAL output semantics into one clean(er) interface
Subject: [x265] rc: set pbFactor to default with cutree

details:   http://hg.videolan.org/x265/rev/a076f4fc8d36
branches:  stable
changeset: 7012:a076f4fc8d36
user:      Aarthi Thirumalai
date:      Wed Jun 04 19:17:06 2014 +0530
description:
rc: set pbFactor to default with cutree
Subject: [x265] rc: use actual bits to update vbv buffer

details:   http://hg.videolan.org/x265/rev/4df4e48d24a0
branches:  stable
changeset: 7013:4df4e48d24a0
user:      Aarthi Thirumalai
date:      Thu Jun 05 09:28:18 2014 +0530
description:
rc: use actual bits to update vbv buffer
Subject: [x265] rc: fixes to improve quality in vbv

details:   http://hg.videolan.org/x265/rev/93921c0afac5
branches:  stable
changeset: 7014:93921c0afac5
user:      Aarthi Thirumalai
date:      Wed Jun 04 19:19:35 2014 +0530
description:
rc: fixes to improve quality in vbv
Subject: [x265] Merge with stable

details:   http://hg.videolan.org/x265/rev/c11920cb6f04
branches:  
changeset: 7015:c11920cb6f04
user:      Steve Borho <steve at borho.org>
date:      Wed Jun 04 23:14:37 2014 -0500
description:
Merge with stable

diffstat:

 source/Lib/TLibCommon/NAL.h           |   79 ----
 source/Lib/TLibCommon/TComBitStream.h |   24 +-
 source/Lib/TLibCommon/TComPic.cpp     |   18 +-
 source/Lib/TLibCommon/TComTrQuant.cpp |   12 +-
 source/Lib/TLibCommon/TComTrQuant.h   |    3 +-
 source/Lib/TLibEncoder/NALwrite.cpp   |  109 -----
 source/Lib/TLibEncoder/NALwrite.h     |   81 ----
 source/Lib/TLibEncoder/TEncCu.cpp     |    2 +-
 source/Lib/TLibEncoder/TEncSearch.cpp |   44 +-
 source/common/CMakeLists.txt          |    1 -
 source/encoder/CMakeLists.txt         |    3 +-
 source/encoder/api.cpp                |   27 +-
 source/encoder/cturow.cpp             |    4 +-
 source/encoder/dpb.h                  |    6 +-
 source/encoder/encoder.cpp            |  323 +++++++---------
 source/encoder/encoder.h              |   20 +-
 source/encoder/frameencoder.cpp       |  322 ++++++++--------
 source/encoder/frameencoder.h         |   12 +-
 source/encoder/framefilter.cpp        |   12 +-
 source/encoder/nal.cpp                |   89 ++++
 source/encoder/nal.h                  |   48 ++
 source/encoder/ratecontrol.cpp        |  656 +++++++++++++++++-----------------
 source/encoder/ratecontrol.h          |  114 +++--
 source/encoder/slicetype.cpp          |  606 +++++++++++++++---------------
 source/encoder/slicetype.h            |  111 +++--
 25 files changed, 1277 insertions(+), 1449 deletions(-)

diffs (truncated from 5535 to 300 lines):

diff -r c3a4e0ab37c2 -r c11920cb6f04 source/Lib/TLibCommon/NAL.h
--- a/source/Lib/TLibCommon/NAL.h	Wed Jun 04 16:25:27 2014 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/* The copyright in this software is being made available under the BSD
- * License, included below. This software may be subject to other third party
- * and contributor rights, including patent rights, and no such rights are
- * granted under this license.
- *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
- *    be used to endorse or promote products derived from this software without
- *    specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef X265_NAL_H
-#define X265_NAL_H
-
-#include "CommonDef.h"
-#include "x265.h"
-
-namespace x265 {
-// private namespace
-
-/**
- * Represents a single NALunit header and the associated RBSPayload
- */
-struct NALUnit
-{
-    NalUnitType m_nalUnitType;       ///< nal_unit_type
-    uint32_t    m_temporalId;        ///< temporal_id
-    uint32_t    m_reservedZero6Bits; ///< reserved_zero_6bits
-
-    NALUnit() : m_nalUnitType(NAL_UNIT_INVALID), m_temporalId(0), m_reservedZero6Bits(0) {}
-
-    NALUnit(NalUnitType nalUnitType)
-    {
-        m_nalUnitType = nalUnitType;
-        m_temporalId = 0;
-        m_reservedZero6Bits = 0;
-    }
-};
-
-/**
- * A single NALunit, with complete payload in EBSP format.
- */
-struct NALUnitEBSP : public NALUnit
-{
-    uint32_t m_packetSize;
-    uint8_t *m_nalUnitData;
-
-    /**
-     * convert the OutputNALUnit #nalu# into EBSP format by writing out
-     * the NALUnit header, then the rbsp_bytes including any
-     * emulation_prevention_three_byte symbols.
-     */
-    void init(const struct OutputNALUnit& nalu);
-};
-}
-
-#endif // ifndef X265_NAL_H
diff -r c3a4e0ab37c2 -r c11920cb6f04 source/Lib/TLibCommon/TComBitStream.h
--- a/source/Lib/TLibCommon/TComBitStream.h	Wed Jun 04 16:25:27 2014 -0500
+++ b/source/Lib/TLibCommon/TComBitStream.h	Wed Jun 04 23:14:37 2014 -0500
@@ -55,14 +55,12 @@ class TComBitIf
 {
 public:
 
-    virtual void        writeAlignOne() {}
-
-    virtual void        writeAlignZero() {}
-
-    virtual void        write(uint32_t uiBits, uint32_t uiNumberOfBits)  = 0;
-    virtual void        writeByte(uint32_t val)                      = 0;
-    virtual void        resetBits()                              = 0;
-    virtual uint32_t getNumberOfWrittenBits() const = 0;
+    virtual void     writeAlignOne() {}
+    virtual void     writeAlignZero() {}
+    virtual void     write(uint32_t val, uint32_t numBits)  = 0;
+    virtual void     writeByte(uint32_t val)                = 0;
+    virtual void     resetBits()                            = 0;
+    virtual uint32_t getNumberOfWrittenBits() const         = 0;
     virtual ~TComBitIf() {}
 };
 
@@ -84,7 +82,7 @@ class TComOutputBitstream : public TComB
     uint32_t m_buffsize;
 
     uint32_t m_num_held_bits; /// number of bits not flushed to bytestream.
-    uint8_t m_held_bits; /// the bits held and not flushed to bytestream.
+    uint8_t  m_held_bits;     /// the bits held and not flushed to bytestream.
     /// this value is always msb-aligned, bigendian.
 
 public:
@@ -109,7 +107,7 @@ public:
     void        writeAlignZero();
 
     /** this function should never be called */
-    void resetBits() { X265_CHECK(0, "resetBits called on base class\n"); }
+    void        resetBits() { X265_CHECK(0, "resetBits called on base class\n"); }
 
     // utility functions
 
@@ -145,14 +143,14 @@ public:
     /**
      * Return a reference to the internal fifo
      */
-    uint8_t* getFIFO() { return m_fifo; }
+    uint8_t* getFIFO()     { return m_fifo; }
 
-    uint8_t getHeldBits()          { return m_held_bits; }
+    uint8_t  getHeldBits() { return m_held_bits; }
 
     /** Return a reference to the internal fifo */
     uint8_t* getFIFO() const { return m_fifo; }
 
-    void          addSubstream(TComOutputBitstream* pcSubstream);
+    void addSubstream(TComOutputBitstream* substream);
     void writeByteAlignment();
 
     //! returns the number of start code emulations contained in the current buffer
diff -r c3a4e0ab37c2 -r c11920cb6f04 source/Lib/TLibCommon/TComPic.cpp
--- a/source/Lib/TLibCommon/TComPic.cpp	Wed Jun 04 16:25:27 2014 -0500
+++ b/source/Lib/TLibCommon/TComPic.cpp	Wed Jun 04 23:14:37 2014 -0500
@@ -103,18 +103,18 @@ bool TComPic::create(Encoder* cfg)
         return false;
 
     bool ok = true;
-    ok &= m_picSym->create(cfg->param->sourceWidth, cfg->param->sourceHeight, cfg->param->internalCsp, g_maxCUSize, g_maxCUDepth);
-    ok &= m_origPicYuv->create(cfg->param->sourceWidth, cfg->param->sourceHeight, cfg->param->internalCsp, g_maxCUSize, g_maxCUDepth);
-    ok &= m_reconPicYuv->create(cfg->param->sourceWidth, cfg->param->sourceHeight, cfg->param->internalCsp, g_maxCUSize, g_maxCUDepth);
-    ok &= m_lowres.create(m_origPicYuv, cfg->param->bframes, !!cfg->param->rc.aqMode);
+    ok &= m_picSym->create(cfg->m_param->sourceWidth, cfg->m_param->sourceHeight, cfg->m_param->internalCsp, g_maxCUSize, g_maxCUDepth);
+    ok &= m_origPicYuv->create(cfg->m_param->sourceWidth, cfg->m_param->sourceHeight, cfg->m_param->internalCsp, g_maxCUSize, g_maxCUDepth);
+    ok &= m_reconPicYuv->create(cfg->m_param->sourceWidth, cfg->m_param->sourceHeight, cfg->m_param->internalCsp, g_maxCUSize, g_maxCUDepth);
+    ok &= m_lowres.create(m_origPicYuv, cfg->m_param->bframes, !!cfg->m_param->rc.aqMode);
 
-    bool isVbv = cfg->param->rc.vbvBufferSize > 0 && cfg->param->rc.vbvMaxBitrate > 0;
-    if (ok && (isVbv || cfg->param->rc.aqMode))
+    bool isVbv = cfg->m_param->rc.vbvBufferSize > 0 && cfg->m_param->rc.vbvMaxBitrate > 0;
+    if (ok && (isVbv || cfg->m_param->rc.aqMode))
     {
         int numRows = m_picSym->getFrameHeightInCU();
         int numCols = m_picSym->getFrameWidthInCU();
 
-        if (cfg->param->rc.aqMode)
+        if (cfg->m_param->rc.aqMode)
             CHECKED_MALLOC(m_qpaAq, double, numRows);
         if (isVbv)
         {
@@ -141,7 +141,7 @@ fail:
 
 void TComPic::reInit(Encoder* cfg)
 {
-    if (cfg->param->rc.vbvBufferSize > 0 && cfg->param->rc.vbvMaxBitrate > 0)
+    if (cfg->m_param->rc.vbvBufferSize > 0 && cfg->m_param->rc.vbvMaxBitrate > 0)
     {
         int numRows = m_picSym->getFrameHeightInCU();
         int numCols = m_picSym->getFrameWidthInCU();
@@ -156,7 +156,7 @@ void TComPic::reInit(Encoder* cfg)
         memset(m_intraCuCostsForVbv, 0, numRows * numCols * sizeof(uint32_t));
         memset(m_qpaRc, 0, numRows * sizeof(double));
     }
-    if (cfg->param->rc.aqMode)
+    if (cfg->m_param->rc.aqMode)
         memset(m_qpaAq, 0,  m_picSym->getFrameHeightInCU() * sizeof(double));
 }
 
diff -r c3a4e0ab37c2 -r c11920cb6f04 source/Lib/TLibCommon/TComTrQuant.cpp
--- a/source/Lib/TLibCommon/TComTrQuant.cpp	Wed Jun 04 16:25:27 2014 -0500
+++ b/source/Lib/TLibCommon/TComTrQuant.cpp	Wed Jun 04 23:14:37 2014 -0500
@@ -58,8 +58,6 @@ typedef struct
 // Constants
 // ====================================================================================================================
 
-#define RDOQ_CHROMA 1  ///< use of RDOQ in chroma
-
 inline static int x265_min_fast(int x, int y)
 {
     return y + ((x - y) & ((x - y) >> (sizeof(int) * CHAR_BIT - 1))); // min(x, y)
@@ -268,12 +266,9 @@ uint32_t TComTrQuant::xQuant(TComDataCU*
 {
     uint32_t acSum = 0;
     int add = 0;
-    bool useRDOQ = (cu->getTransformSkip(absPartIdx, ttype) ? m_useRDOQTS : m_useRDOQ) && curUseRDOQ;
+    bool useRDOQ = m_useRDOQ && curUseRDOQ;
 
-#if _MSC_VER
-#pragma warning(disable: 4127) // conditional expression is constant
-#endif
-    if (useRDOQ && (ttype == TEXT_LUMA || RDOQ_CHROMA))
+    if (useRDOQ)
     {
         acSum = xRateDistOptQuant(cu, coef, qCoef, trSize, ttype, absPartIdx, lastPos);
     }
@@ -305,11 +300,10 @@ uint32_t TComTrQuant::xQuant(TComDataCU*
     return acSum;
 }
 
-void TComTrQuant::init(uint32_t maxTrSize, bool useRDOQ, bool useRDOQTS, bool useTransformSkipFast)
+void TComTrQuant::init(uint32_t maxTrSize, bool useRDOQ, bool useTransformSkipFast)
 {
     m_maxTrSize            = maxTrSize;
     m_useRDOQ              = useRDOQ;
-    m_useRDOQTS            = useRDOQTS;
     m_useTransformSkipFast = useTransformSkipFast;
 }
 
diff -r c3a4e0ab37c2 -r c11920cb6f04 source/Lib/TLibCommon/TComTrQuant.h
--- a/source/Lib/TLibCommon/TComTrQuant.h	Wed Jun 04 16:25:27 2014 -0500
+++ b/source/Lib/TLibCommon/TComTrQuant.h	Wed Jun 04 23:14:37 2014 -0500
@@ -124,7 +124,7 @@ public:
     ~TComTrQuant();
 
     // initialize class
-    void init(uint32_t maxTrSize, bool useRDOQ, bool useRDOQTS, bool useTransformSkipFast);
+    void init(uint32_t maxTrSize, bool useRDOQ, bool useTransformSkipFast);
 
     // transform & inverse transform functions
     uint32_t transformNxN(TComDataCU* cu, int16_t* residual, uint32_t stride, coeff_t* coeff, uint32_t trSize,
@@ -211,7 +211,6 @@ protected:
 
     uint32_t m_maxTrSize;
     bool     m_useRDOQ;
-    bool     m_useRDOQTS;
     bool     m_useTransformSkipFast;
     bool     m_scalingListEnabledFlag;
 
diff -r c3a4e0ab37c2 -r c11920cb6f04 source/Lib/TLibEncoder/NALwrite.cpp
--- a/source/Lib/TLibEncoder/NALwrite.cpp	Wed Jun 04 16:25:27 2014 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/* The copyright in this software is being made available under the BSD
- * License, included below. This software may be subject to other third party
- * and contributor rights, including patent rights, and no such rights are
- * granted under this license.
- *
- * Copyright (c) 2010-2013, ITU/ISO/IEC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
- *    be used to endorse or promote products derived from this software without
- *    specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "common.h"
-#include "TLibCommon/NAL.h"
-#include "TLibCommon/TComBitStream.h"
-#include "NALwrite.h"
-
-namespace x265 {
-
-/**
- * write nalu to bytestream out, performing RBSP anti startcode
- * emulation as required.  nalu.m_RBSPayload must be byte aligned.
- * caller is responsible for freeing returned allocated pointer
- */
-uint8_t *write(const OutputNALUnit& nalu, uint32_t &bytes)


More information about the x265-commits mailing list