[x265] [PATCH] Modify TEncSearch structure to fix 420 format output mismatch

ashok at multicorewareinc.com ashok at multicorewareinc.com
Wed Jan 8 13:07:03 CET 2014


# HG changeset patch
# User ashok at multicorewareinc.com
# Date 1389182787 -19800
#      Wed Jan 08 17:36:27 2014 +0530
# Node ID 1dfb57f88df1576693fc963347eedb41a56aea07
# Parent  f7d21da102acf8d88be3f6ea6b6db5dc12134cdb
Modify TEncSearch structure to fix 420 format output mismatch

diff -r f7d21da102ac -r 1dfb57f88df1 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Tue Jan 07 16:44:39 2014 +0530
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Wed Jan 08 17:36:27 2014 +0530
@@ -4204,10 +4204,20 @@
     }
 
     assert(cu->getPredictionMode(absPartIdx) != MODE_INTRA);
+
+    bool mCodeAll = true;
+    int width  = 1 << trSizeLog2;
+    int height = 1 << trSizeLog2;
+    const uint32_t numPels = (width >> cu->getHorzChromaShift()) * (height >> cu->getHorzChromaShift());
+    if(numPels < (MIN_TU_SIZE * MIN_TU_SIZE))
+    {
+        mCodeAll = false;
+    }
+
     if (bSubdivAndCbf)
     {
         const bool bFirstCbfOfCU = curTrMode == 0;
-        if (bFirstCbfOfCU || trSizeLog2 > 2)
+        if (bFirstCbfOfCU || mCodeAll)
         {
             if (bFirstCbfOfCU || cu->getCbf(absPartIdx, TEXT_CHROMA_U, curTrMode - 1))
             {
@@ -4218,7 +4228,7 @@
                 m_entropyCoder->encodeQtCbf(cu, absPartIdx, TEXT_CHROMA_V, curTrMode);
             }
         }
-        else if (trSizeLog2 == 2)
+        else
         {
             assert(cu->getCbf(absPartIdx, TEXT_CHROMA_U, curTrMode) == cu->getCbf(absPartIdx, TEXT_CHROMA_U, curTrMode - 1));
             assert(cu->getCbf(absPartIdx, TEXT_CHROMA_V, curTrMode) == cu->getCbf(absPartIdx, TEXT_CHROMA_V, curTrMode - 1));


More information about the x265-devel mailing list