[x265-commits] [x265] check: another pile of assert->X265_CHECK conversions

Steve Borho steve at borho.org
Thu May 15 19:29:15 CEST 2014


details:   http://hg.videolan.org/x265/rev/d5b42a9fe43b
branches:  
changeset: 6858:d5b42a9fe43b
user:      Steve Borho <steve at borho.org>
date:      Wed May 14 21:01:56 2014 +0530
description:
check: another pile of assert->X265_CHECK conversions
Subject: [x265] check: fix MSVC warnings and check behavior

details:   http://hg.videolan.org/x265/rev/4fe655fb3f24
branches:  
changeset: 6859:4fe655fb3f24
user:      Steve Borho <steve at borho.org>
date:      Thu May 15 22:17:03 2014 +0530
description:
check: fix MSVC warnings and check behavior
Subject: [x265] check: disable MSVC warnings about constant conditionals with checked builds

details:   http://hg.videolan.org/x265/rev/bbc026370c52
branches:  
changeset: 6860:bbc026370c52
user:      Steve Borho <steve at borho.org>
date:      Thu May 15 22:19:59 2014 +0530
description:
check: disable MSVC warnings about constant conditionals with checked builds
Subject: [x265] checked: enable check macros in debug builds

details:   http://hg.videolan.org/x265/rev/a9c403e19928
branches:  
changeset: 6861:a9c403e19928
user:      Steve Borho <steve at borho.org>
date:      Thu May 15 17:53:19 2014 +0530
description:
checked: enable check macros in debug builds
Subject: [x265] cli: remove default strings for preset and tune, modify default AQ mode to match

details:   http://hg.videolan.org/x265/rev/b03ef02dc2a2
branches:  
changeset: 6862:b03ef02dc2a2
user:      Steve Borho <steve at borho.org>
date:      Thu May 15 07:48:51 2014 +0530
description:
cli: remove default strings for preset and tune, modify default AQ mode to match

The cli has used --tune ssim as the default since we've had an ssim tune, but
API users were getting the default aq-mode of 1 instead.  This commit removes
the default tune (and preset) strings and fixes the default param structure to
match the previous CLI default behavior (aq-mode 2)
Subject: [x265] api: introduce x265_encoder_parameters(), copy param earlier to avoid mods

details:   http://hg.videolan.org/x265/rev/4da6be0eca52
branches:  
changeset: 6863:4da6be0eca52
user:      Steve Borho <steve at borho.org>
date:      Thu May 15 08:34:09 2014 +0530
description:
api: introduce x265_encoder_parameters(), copy param earlier to avoid mods

in x265_encoder_open(), make a copy of the provided param structure much earlier
to avoid making any changes to the param strucutre provided by the user, in
case they want to use that same param again to allocate another encoder.
Subject: [x265] cutree: adjust the rowSatd with qpoffset only for reference frames

details:   http://hg.videolan.org/x265/rev/3212839ec987
branches:  
changeset: 6864:3212839ec987
user:      Gopu Govindaswamy
date:      Thu May 15 15:12:28 2014 +0530
description:
cutree: adjust the rowSatd with qpoffset only for reference frames
Subject: [x265] cutree: removed logLevel check from if loop

details:   http://hg.videolan.org/x265/rev/63f4a60cb268
branches:  
changeset: 6865:63f4a60cb268
user:      Gopu Govindaswamy
date:      Thu May 15 16:11:37 2014 +0530
description:
cutree: removed logLevel check from if loop
Subject: [x265] adapt psy-rd from x264

details:   http://hg.videolan.org/x265/rev/d95ad61c8abc
branches:  
changeset: 6866:d95ad61c8abc
user:      Sumalatha Polureddy<sumalatha at multicorewareinc.com>
date:      Thu May 08 16:48:56 2014 +0530
description:
adapt psy-rd from x264

In this initial implementation, we only use sa8d to estimate the energy of the
source and reconstructed blocks. psy-rd is disabled by default, to evaluate use
--preset veryslow --psy-rd 1.0

diffstat:

 doc/reST/api.rst                                    |  14 ++++-
 doc/reST/cli.rst                                    |   8 +++
 source/CMakeLists.txt                               |   2 +-
 source/Lib/TLibCommon/TComBitStream.cpp             |   6 +-
 source/Lib/TLibCommon/TComBitStream.h               |   2 +-
 source/Lib/TLibCommon/TComDataCU.cpp                |  54 ++++++++++----------
 source/Lib/TLibCommon/TComLoopFilter.cpp            |   8 +-
 source/Lib/TLibCommon/TComMotionInfo.cpp            |   4 +-
 source/Lib/TLibCommon/TComPrediction.cpp            |  32 ++++++------
 source/Lib/TLibCommon/TComRdCost.h                  |  55 +++++++++++++++++---
 source/Lib/TLibCommon/TComSlice.cpp                 |  10 +-
 source/Lib/TLibCommon/TComSlice.h                   |  14 ++--
 source/Lib/TLibCommon/TComTrQuant.cpp               |  50 +++++++++---------
 source/Lib/TLibCommon/TComTrQuant.h                 |   8 +-
 source/Lib/TLibCommon/TComWeightPrediction.cpp      |  14 ++--
 source/Lib/TLibCommon/TComYuv.cpp                   |   2 +-
 source/Lib/TLibEncoder/SEIwrite.cpp                 |   5 +-
 source/Lib/TLibEncoder/SyntaxElementWriter.cpp      |   4 +-
 source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp        |  12 +--
 source/Lib/TLibEncoder/TEncBinCoderCABAC.h          |   7 +--
 source/Lib/TLibEncoder/TEncCu.cpp                   |  56 +++++++++++++-------
 source/Lib/TLibEncoder/TEncEntropy.cpp              |  42 ++++++---------
 source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp |   7 +-
 source/Lib/TLibEncoder/TEncSbac.cpp                 |  30 +++++-----
 source/Lib/TLibEncoder/TEncSearch.cpp               |  36 +++++++++---
 source/common/common.h                              |   5 +-
 source/common/param.cpp                             |   8 ++-
 source/encoder/api.cpp                              |  25 ++++++---
 source/encoder/cturow.cpp                           |   2 +-
 source/encoder/encoder.cpp                          |   2 +
 source/encoder/slicetype.cpp                        |   4 +-
 source/x265.cpp                                     |   6 +-
 source/x265.def.in                                  |   1 +
 source/x265.h                                       |  13 ++++
 34 files changed, 329 insertions(+), 219 deletions(-)

diffs (truncated from 1798 to 300 lines):

diff -r 890b34705c95 -r d95ad61c8abc doc/reST/api.rst
--- a/doc/reST/api.rst	Wed May 14 14:13:08 2014 +0900
+++ b/doc/reST/api.rst	Thu May 08 16:48:56 2014 +0530
@@ -136,7 +136,7 @@ Finally you configure any remaining opti
 	int x265_param_parse(x265_param *p, const char *name, const char *value);
 
 See :ref:`string options <string-options-ref>` for the list of options (and their
-descriptions) which can be set by **x265_param_parse**.
+descriptions) which can be set by **x265_param_parse()**.
 
 After the encoder has been created, you may release the param structure::
 
@@ -153,6 +153,18 @@ After the encoder has been created, you 
 	x265 that does not match the version of the header you are compiling
 	against. This is function of the X265_BUILD macro.
 
+**x265_encoder_parameters()** may be used to get a copy of the param
+structure from the encoder after it has been opened, in order to see the
+changes made to the parameters for auto-detection and other reasons::
+
+	/* x265_encoder_parameters:
+	 *      copies the current internal set of parameters to the pointer provided
+	 *      by the caller.  useful when the calling application needs to know
+	 *      how x265_encoder_open has changed the parameters.
+	 *      note that the data accessible through pointers in the returned param struct
+	 *      (e.g. filenames) should not be modified by the calling application. */
+	void x265_encoder_parameters(x265_encoder *, x265_param *);                                                                      
+
 Pictures
 ========
 
diff -r 890b34705c95 -r d95ad61c8abc doc/reST/cli.rst
--- a/doc/reST/cli.rst	Wed May 14 14:13:08 2014 +0900
+++ b/doc/reST/cli.rst	Thu May 08 16:48:56 2014 +0530
@@ -619,6 +619,14 @@ Quality, rate control and rate distortio
 
 	**Range of values:** 0: least .. 6: full RDO analysis
 
+.. option:: --psy-rd <float>
+
+	Influence rate distortion optimizations to try to preserve the
+	energy of the source image in the encoded image, at the expense of
+	compression efficiency. 1.0 is a typical value. Default disabled
+
+	**Range of values:** 0 .. 2.0
+
 .. option:: --signhide, --no-signhide
 
 	Hide sign bit of one coeff per TU (rdo). Default enabled
diff -r 890b34705c95 -r d95ad61c8abc source/CMakeLists.txt
--- a/source/CMakeLists.txt	Wed May 14 14:13:08 2014 +0900
+++ b/source/CMakeLists.txt	Thu May 08 16:48:56 2014 +0530
@@ -19,7 +19,7 @@ include(CheckSymbolExists)
 include(CheckCXXCompilerFlag)
 
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 17)
+set(X265_BUILD 18)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 890b34705c95 -r d95ad61c8abc source/Lib/TLibCommon/TComBitStream.cpp
--- a/source/Lib/TLibCommon/TComBitStream.cpp	Wed May 14 14:13:08 2014 +0900
+++ b/source/Lib/TLibCommon/TComBitStream.cpp	Thu May 08 16:48:56 2014 +0530
@@ -82,8 +82,8 @@ void TComOutputBitstream::clear()
 
 void TComOutputBitstream::write(uint32_t bits, uint32_t numBits)
 {
-    assert(numBits <= 32);
-    assert(numBits == 32 || (bits & (~0 << numBits)) == 0);
+    X265_CHECK(numBits <= 32, "numBits out of range\n");
+    X265_CHECK(numBits == 32 || (bits & (~0 << numBits)) == 0, "numBits & bits out of range\n");
 
     /* any modulo 8 remainder of num_total_bits cannot be written this time,
      * and will be held until next time. */
@@ -127,7 +127,7 @@ void TComOutputBitstream::write(uint32_t
 void TComOutputBitstream::writeByte(uint32_t val)
 {
     // NOTE: we are here only in Cabac
-    assert(m_num_held_bits == 0);
+    X265_CHECK(!m_num_held_bits, "expecting m_num_held_bits = 0\n");
 
     push_back(val);
 }
diff -r 890b34705c95 -r d95ad61c8abc source/Lib/TLibCommon/TComBitStream.h
--- a/source/Lib/TLibCommon/TComBitStream.h	Wed May 14 14:13:08 2014 +0900
+++ b/source/Lib/TLibCommon/TComBitStream.h	Thu May 08 16:48:56 2014 +0530
@@ -109,7 +109,7 @@ public:
     void        writeAlignZero();
 
     /** this function should never be called */
-    void resetBits() { assert(0); }
+    void resetBits() { X265_CHECK(0, "resetBits called on base class\n"); }
 
     // utility functions
 
diff -r 890b34705c95 -r d95ad61c8abc source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Wed May 14 14:13:08 2014 +0900
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Thu May 08 16:48:56 2014 +0530
@@ -112,7 +112,7 @@ bool TComDataCU::create(uint32_t numPart
 
     uint32_t tmp = 4 * AMVP_DECIMATION_FACTOR / unitSize;
     tmp = tmp * tmp;
-    assert(tmp == (1 << (g_convertToBit[tmp] + 2)));
+    X265_CHECK(tmp == (1 << (g_convertToBit[tmp] + 2)), "unexpected pixel count\n");
     tmp = g_convertToBit[tmp] + 2;
     m_unitMask = ~((1 << tmp) - 1);
 
@@ -229,7 +229,7 @@ void TComDataCU::initCU(TComPic* pic, ui
 
     // CHECK_ME: why partStartIdx always negative
     int numElements = m_numPartitions;
-    assert(numElements > 0);
+    X265_CHECK(numElements > 0, "unexpected partition count\n");
 
     {
         memset(m_skipFlag,           false,         numElements * sizeof(*m_skipFlag));
@@ -377,7 +377,7 @@ void TComDataCU::initEstData(uint32_t de
 // initialize Sub partition
 void TComDataCU::initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t depth, int qp)
 {
-    assert(partUnitIdx < 4);
+    X265_CHECK(partUnitIdx < 4, "part unit should be less than 4\n");
 
     uint32_t partOffset = (cu->getTotalNumPart() >> 2) * partUnitIdx;
 
@@ -441,7 +441,7 @@ void TComDataCU::initSubCU(TComDataCU* c
 // initialize Sub partition
 void TComDataCU::initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t depth)
 {
-    assert(partUnitIdx < 4);
+    X265_CHECK(partUnitIdx < 4, "part unit should be less than 4\n");
 
     uint32_t partOffset = (cu->getTotalNumPart() >> 2) * partUnitIdx;
 
@@ -504,7 +504,7 @@ void TComDataCU::initSubCU(TComDataCU* c
 
 void TComDataCU::copyToSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t depth)
 {
-    assert(partUnitIdx < 4);
+    X265_CHECK(partUnitIdx < 4, "part unit should be less than 4\n");
 
     uint32_t partOffset = (cu->getTotalNumPart() >> 2) * partUnitIdx;
 
@@ -544,7 +544,7 @@ void TComDataCU::copyToSubCU(TComDataCU*
 // One of quarter parts overwritten by predicted sub part.
 void TComDataCU::copyPartFrom(TComDataCU* cu, uint32_t partUnitIdx, uint32_t depth, bool isRDObasedAnalysis)
 {
-    assert(partUnitIdx < 4);
+    X265_CHECK(partUnitIdx < 4, "part unit should be less than 4\n");
     if (isRDObasedAnalysis)
         m_totalCost += cu->m_totalCost;
 
@@ -1355,7 +1355,7 @@ bool TComDataCU::isFirstAbsZorderIdxInDe
 
 void TComDataCU::setPartSizeSubParts(PartSize mode, uint32_t absPartIdx, uint32_t depth)
 {
-    assert(sizeof(*m_partSizes) == 1);
+    X265_CHECK(sizeof(*m_partSizes) == 1, "size check failure\n");
     memset(m_partSizes + absPartIdx, mode, m_pic->getNumPartInCU() >> (2 * depth));
 }
 
@@ -1366,13 +1366,13 @@ void TComDataCU::setCUTransquantBypassSu
 
 void TComDataCU::setSkipFlagSubParts(bool skip, uint32_t absPartIdx, uint32_t depth)
 {
-    assert(sizeof(*m_skipFlag) == 1);
+    X265_CHECK(sizeof(*m_skipFlag) == 1, "size check failure\n");
     memset(m_skipFlag + absPartIdx, skip, m_pic->getNumPartInCU() >> (2 * depth));
 }
 
 void TComDataCU::setPredModeSubParts(PredMode eMode, uint32_t absPartIdx, uint32_t depth)
 {
-    assert(sizeof(*m_predModes) == 1);
+    X265_CHECK(sizeof(*m_predModes) == 1, "size check failure\n");
     memset(m_predModes + absPartIdx, eMode, m_pic->getNumPartInCU() >> (2 * depth));
 }
 
@@ -1424,7 +1424,7 @@ void TComDataCU::setLumaIntraDirSubParts
 template<typename T>
 void TComDataCU::setSubPart(T param, T* baseLCU, uint32_t cuAddr, uint32_t cuDepth, uint32_t puIdx)
 {
-    assert(sizeof(T) == 1); // Using memset() works only for types of size 1
+    X265_CHECK(sizeof(T) == 1, "size check failure\n"); // Using memset() works only for types of size 1
 
     uint32_t curPartNumQ = (m_pic->getNumPartInCU() >> (2 * cuDepth)) >> 2;
     switch (m_partSizes[cuAddr])
@@ -1455,7 +1455,7 @@ void TComDataCU::setSubPart(T param, T* 
         }
         else
         {
-            assert(0);
+            X265_CHECK(0, "unexpected part unit index\n");
         }
         break;
     case SIZE_2NxnD:
@@ -1471,7 +1471,7 @@ void TComDataCU::setSubPart(T param, T* 
         }
         else
         {
-            assert(0);
+            X265_CHECK(0, "unexpected part unit index\n");
         }
         break;
     case SIZE_nLx2N:
@@ -1491,7 +1491,7 @@ void TComDataCU::setSubPart(T param, T* 
         }
         else
         {
-            assert(0);
+            X265_CHECK(0, "unexpected part unit index\n");
         }
         break;
     case SIZE_nRx2N:
@@ -1511,11 +1511,11 @@ void TComDataCU::setSubPart(T param, T* 
         }
         else
         {
-            assert(0);
+            X265_CHECK(0, "unexpected part unit index\n");
         }
         break;
     default:
-        assert(0);
+        X265_CHECK(0, "unexpected part type\n");
     }
 }
 
@@ -1581,7 +1581,7 @@ uint8_t TComDataCU::getNumPartInter()
         break;
     case SIZE_nRx2N:    numPart = 2;
         break;
-    default:            assert(0);
+    default:            X265_CHECK(0, "unexpected part type\n");
         break;
     }
 
@@ -1630,7 +1630,7 @@ void TComDataCU::getPartIndexAndSize(uin
         outPartAddr = (partIdx == 0) ? 0 : (m_numPartitions >> 2) + (m_numPartitions >> 4);
         break;
     default:
-        assert(m_partSizes[0] == SIZE_2Nx2N);
+        X265_CHECK(m_partSizes[0] == SIZE_2Nx2N, "unexpected part type\n");
         outWidth = cuSize;
         outHeight = cuSize;
         outPartAddr = 0;
@@ -1682,7 +1682,7 @@ void TComDataCU::deriveLeftRightTopIdxGe
         }
         else
         {
-            assert(0);
+            X265_CHECK(0, "unexpected part index\n");
         }
         break;
     case SIZE_nRx2N:
@@ -1696,11 +1696,11 @@ void TComDataCU::deriveLeftRightTopIdxGe
         }
         else
         {
-            assert(0);
+            X265_CHECK(0, "unexpected part index\n");
         }
         break;
     default:
-        assert(0);
+        X265_CHECK(0, "unexpected part type\n");
         break;
     }
 
@@ -1733,7 +1733,7 @@ void TComDataCU::deriveLeftBottomIdxGene
         }
         else
         {
-            assert(0);
+            X265_CHECK(0, "unexpected part index\n");
         }
         break;
     case SIZE_2NxnD:
@@ -1747,7 +1747,7 @@ void TComDataCU::deriveLeftBottomIdxGene
         }
         else
         {
-            assert(0);
+            X265_CHECK(0, "unexpected part index\n");
         }
         break;
     case SIZE_nLx2N: puHeight = cuSize;
@@ -1755,7 +1755,7 @@ void TComDataCU::deriveLeftBottomIdxGene
     case SIZE_nRx2N: puHeight = cuSize;
         break;
     default:
-        assert(0);
+        X265_CHECK(0, "unexpected part type\n");
         break;
     }
 
@@ -1799,7 +1799,7 @@ void TComDataCU::deriveLeftRightTopIdx(u
         ruiPartIdxRT -= (partIdx == 1) ? 0 : m_numPartitions >> 4;
         break;
     default:


More information about the x265-commits mailing list