[x265-commits] [x265] NALWrite: simplify emulation detection

Steve Borho steve at borho.org
Tue Feb 4 18:54:20 CET 2014


details:   http://hg.videolan.org/x265/rev/ff430d39d428
branches:  
changeset: 5999:ff430d39d428
user:      Steve Borho <steve at borho.org>
date:      Mon Feb 03 23:59:51 2014 -0600
description:
NALWrite: simplify emulation detection
Subject: [x265] cleanup unused variables

details:   http://hg.videolan.org/x265/rev/b54aa2713111
branches:  
changeset: 6000:b54aa2713111
user:      Satoshi Nakagawa <nakagawa424 at oki.com>
date:      Tue Feb 04 10:47:30 2014 +0900
description:
cleanup unused variables
Subject: [x265] TComTrQuant: avoid bogus warning from VC9/VC10

details:   http://hg.videolan.org/x265/rev/4be0ca7b4448
branches:  
changeset: 6001:4be0ca7b4448
user:      Steve Borho <steve at borho.org>
date:      Tue Feb 04 11:28:17 2014 -0600
description:
TComTrQuant: avoid bogus warning from VC9/VC10

diffstat:

 source/Lib/TLibCommon/TComDataCU.h    |   5 -----
 source/Lib/TLibCommon/TComTrQuant.cpp |   3 +++
 source/Lib/TLibEncoder/NALwrite.cpp   |   5 ++---
 source/Lib/TLibEncoder/TEncCu.cpp     |  25 -------------------------
 source/Lib/TLibEncoder/TEncCu.h       |   4 ----
 source/encoder/compress.cpp           |   4 ----
 6 files changed, 5 insertions(+), 41 deletions(-)

diffs (186 lines):

diff -r f121e16811be -r 4be0ca7b4448 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h	Mon Feb 03 23:33:36 2014 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.h	Tue Feb 04 11:28:17 2014 -0600
@@ -145,7 +145,6 @@ private:
 
     bool*         m_bMergeFlags;      ///< array of merge flags
     UChar*        m_mergeIndex;       ///< array of merge candidate indices
-    bool          m_bIsMergeAMP;
     UChar*        m_lumaIntraDir;     ///< array of intra directions (luma)
     UChar*        m_chromaIntraDir;   ///< array of intra directions (chroma)
     UChar*        m_interDir;         ///< array of inter directions
@@ -337,10 +336,6 @@ public:
     template<typename T>
     void          setSubPart(T bParameter, T* pbBaseLCU, uint32_t cuAddr, uint32_t cuDepth, uint32_t puIdx);
 
-    void          setMergeAMP(bool b)       { m_bIsMergeAMP = b; }
-
-    bool          getMergeAMP()             { return m_bIsMergeAMP; }
-
     UChar*        getLumaIntraDir()         { return m_lumaIntraDir; }
 
     UChar         getLumaIntraDir(uint32_t idx) { return m_lumaIntraDir[idx]; }
diff -r f121e16811be -r 4be0ca7b4448 source/Lib/TLibCommon/TComTrQuant.cpp
--- a/source/Lib/TLibCommon/TComTrQuant.cpp	Mon Feb 03 23:33:36 2014 -0600
+++ b/source/Lib/TLibCommon/TComTrQuant.cpp	Tue Feb 04 11:28:17 2014 -0600
@@ -261,6 +261,9 @@ uint32_t TComTrQuant::xQuant(TComDataCU*
 
     assert(width == height);
 
+#if _MSC_VER
+#pragma warning(disable: 4127) // conditional expression is constant
+#endif
     if (useRDOQ && (ttype == TEXT_LUMA || RDOQ_CHROMA))
     {
         acSum = xRateDistOptQuant(cu, coef, qCoef, width, height, ttype, absPartIdx, lastPos);
diff -r f121e16811be -r 4be0ca7b4448 source/Lib/TLibEncoder/NALwrite.cpp
--- a/source/Lib/TLibEncoder/NALwrite.cpp	Mon Feb 03 23:33:36 2014 -0600
+++ b/source/Lib/TLibEncoder/NALwrite.cpp	Tue Feb 04 11:28:17 2014 -0600
@@ -84,7 +84,7 @@ void write(uint8_t*& out, OutputNALUnit&
      */
     uint32_t fsize = nalu.m_bitstream.getByteStreamLength();
     uint8_t* fifo = nalu.m_bitstream.getFIFO();
-    uint32_t  emulationSize = fsize / 2;
+    uint32_t emulationSize = fsize / 2;
     uint8_t* emulation = X265_MALLOC(uint8_t, fsize + emulationSize);
     uint32_t nalsize = 0;
 
@@ -93,8 +93,7 @@ void write(uint8_t*& out, OutputNALUnit&
         for (int count = 0; count < fsize; count++)
         {
             uint8_t val = fifo[count];
-            if (count > 3 && (emulation[nalsize - 1] == 0x00 || emulation[nalsize - 1] == 0x01 || emulation[nalsize - 1] == 0x02 || emulation[nalsize - 1] == 0x03)
-                && emulation[nalsize - 2] == 0x00 && emulation[nalsize - 3] == 0x00)
+            if (count > 3 && !emulation[nalsize - 2] && !emulation[nalsize - 3] && emulation[nalsize - 1] <= 0x03)
             {
                 uint8_t tmp = emulation[nalsize - 1];
                 emulation[nalsize - 1] = emulation_prevention_three_byte[0];
diff -r f121e16811be -r 4be0ca7b4448 source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp	Mon Feb 03 23:33:36 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncCu.cpp	Tue Feb 04 11:28:17 2014 -0600
@@ -167,9 +167,6 @@ void TEncCu::create(UChar totalDepth, ui
     }
 
     m_bEncodeDQP = false;
-    m_LCUPredictionSAD = 0;
-    m_addSADDepth      = 0;
-    m_temporalSAD      = 0;
 }
 
 void TEncCu::destroy()
@@ -351,10 +348,6 @@ void TEncCu::compressCU(TComDataCU* cu)
     m_bestCU[0]->initCU(cu->getPic(), cu->getAddr());
     m_tempCU[0]->initCU(cu->getPic(), cu->getAddr());
 
-    m_addSADDepth      = 0;
-    m_LCUPredictionSAD = 0;
-    m_temporalSAD      = 0;
-
     // analysis of CU
 #if LOG_CU_STATISTICS
     int numPartition = cu->getTotalNumPart();
@@ -537,7 +530,6 @@ void TEncCu::xCompressIntraCU(TComDataCU
 {
     //PPAScopeEvent(TEncCu_xCompressIntraCU + depth);
 
-    m_abortFlag = false;
     TComPic* pic = outBestCU->getPic();
 
     // get Original YUV data from picture
@@ -579,12 +571,6 @@ void TEncCu::xCompressIntraCU(TComDataCU
 
         bTrySplitDQP = bTrySplit;
 
-        if (depth <= m_addSADDepth)
-        {
-            m_LCUPredictionSAD += m_temporalSAD;
-            m_addSADDepth = depth;
-        }
-
         xCheckRDCostIntra(outBestCU, outTempCU, SIZE_2Nx2N);
         outTempCU->initEstData(depth, qp);
 
@@ -610,7 +596,6 @@ void TEncCu::xCompressIntraCU(TComDataCU
     else if (!(bSliceEnd && bInsidePicture))
     {
         bBoundary = true;
-        m_addSADDepth++;
     }
 
     outTempCU->initEstData(depth, qp);
@@ -708,8 +693,6 @@ void TEncCu::xCompressCU(TComDataCU*& ou
 
     TComPic* pic = outBestCU->getPic();
 
-    m_abortFlag = false;
-
     // get Original YUV data from picture
     m_origYuv[depth]->copyFromPicYuv(pic->getPicYuvOrg(), outBestCU->getAddr(), outBestCU->getZorderIdxInCU());
 
@@ -778,12 +761,6 @@ void TEncCu::xCompressCU(TComDataCU*& ou
 
         bTrySplitDQP = bTrySplit;
 
-        if (depth <= m_addSADDepth)
-        {
-            m_LCUPredictionSAD += m_temporalSAD;
-            m_addSADDepth = depth;
-        }
-
         if (!earlyDetectionSkipMode)
         {
             outTempCU->initEstData(depth, qp);
@@ -961,7 +938,6 @@ void TEncCu::xCompressCU(TComDataCU*& ou
     else if (!(bSliceEnd && bInsidePicture))
     {
         bBoundary = true;
-        m_addSADDepth++;
     }
 
     // copy original YUV samples to PCM buffer
@@ -1396,7 +1372,6 @@ void TEncCu::xCheckRDCostInter(TComDataC
     outTempCU->setPredModeSubParts(MODE_INTER, 0, depth);
     outTempCU->setCUTransquantBypassSubParts(m_cfg->getCUTransquantBypassFlagValue(), 0, depth);
 
-    outTempCU->setMergeAMP(true);
     m_tmpRecoYuv[depth]->clear();
     m_tmpResiYuv[depth]->clear();
     m_search->predInterSearch(outTempCU, m_tmpPredYuv[depth], bUseMRG);
diff -r f121e16811be -r 4be0ca7b4448 source/Lib/TLibEncoder/TEncCu.h
--- a/source/Lib/TLibEncoder/TEncCu.h	Mon Feb 03 23:33:36 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncCu.h	Tue Feb 04 11:28:17 2014 -0600
@@ -122,13 +122,9 @@ private:
     TEncSbac***  m_rdSbacCoders;
     TEncSbac*    m_rdGoOnSbacCoder;
 
-    uint32_t     m_LCUPredictionSAD;
-    int          m_addSADDepth;
-    int          m_temporalSAD;
     UChar        m_totalDepth;
 
     bool         m_bEncodeDQP;
-    bool         m_abortFlag; // aborts recursion when the child CU costs more than parent CU
 
 public:
 
diff -r f121e16811be -r 4be0ca7b4448 source/encoder/compress.cpp
--- a/source/encoder/compress.cpp	Mon Feb 03 23:33:36 2014 -0600
+++ b/source/encoder/compress.cpp	Tue Feb 04 11:28:17 2014 -0600
@@ -199,8 +199,6 @@ void TEncCu::xComputeCostInter(TComDataC
     outTempCU->setPredModeSubParts(MODE_INTER, 0, depth);
     outTempCU->setCUTransquantBypassSubParts(m_cfg->getCUTransquantBypassFlagValue(), 0, depth);
 
-    outTempCU->setMergeAMP(true);
-
     //do motion compensation only for Luma since luma cost alone is calculated
     outTempCU->m_totalBits = 0;
     m_search->predInterSearch(outTempCU, outPredYuv, bUseMRG, true, false);
@@ -327,8 +325,6 @@ void TEncCu::xComputeCostMerge2Nx2N(TCom
 
 void TEncCu::xCompressInterCU(TComDataCU*& outBestCU, TComDataCU*& outTempCU, TComDataCU*& cu, uint32_t depth, uint32_t PartitionIndex, UChar minDepth)
 {
-    m_abortFlag = false;
-
     TComPic* pic = outTempCU->getPic();
 
     // get Original YUV data from picture


More information about the x265-commits mailing list