[x265] [PATCH 1 of 4] limitTU : modify condition for limitTU 1 and 2

bhavna at multicorewareinc.com bhavna at multicorewareinc.com
Fri Nov 18 13:06:26 CET 2016


# HG changeset patch
# User Bhavna Hariharan <bhavna at multicorewareinc.com>
# Date 1479449945 -19800
#      Fri Nov 18 11:49:05 2016 +0530
# Node ID c5295126f248411481a8361acfd2bc8b0636cedc
# Parent  4c1652f3884fba9fab4c589dd057b12e6bf33d5b
limitTU : modify condition for limitTU 1 and 2

diff -r 4c1652f3884f -r c5295126f248 source/encoder/search.cpp
--- a/source/encoder/search.cpp	Tue Nov 15 11:16:04 2016 +0530
+++ b/source/encoder/search.cpp	Fri Nov 18 11:49:05 2016 +0530
@@ -94,6 +94,15 @@
     uint32_t sizeC = sizeL >> (m_hChromaShift + m_vChromaShift);
     uint32_t numPartitions = 1 << (maxLog2CUSize - LOG2_UNIT_SIZE) * 2;
 
+    m_limitTU = 0;
+    if (m_param->limitTU)
+    {
+        if (m_param->limitTU == 1)
+            m_limitTU = X265_TU_LIMIT_BFS;
+        else if (m_param->limitTU == 2)
+            m_limitTU = X265_TU_LIMIT_DFS;
+    }
+
     /* these are indexed by qtLayer (log2size - 2) so nominally 0=4x4, 1=8x8, 2=16x16, 3=32x32
      * the coeffRQT and reconQtYuv are allocated to the max CU size at every depth. The parts
      * which are reconstructed at each depth are valid. At the end, the transform depth table
@@ -2621,9 +2630,9 @@
 
     m_entropyCoder.load(m_rqt[depth].cur);
 
-    if (m_param->limitTU == X265_TU_LIMIT_DFS)
+    if (m_param->limitTU & X265_TU_LIMIT_DFS)
         m_maxTUDepth = 0;
-    else if (m_param->limitTU == X265_TU_LIMIT_BFS)
+    else if (m_param->limitTU & X265_TU_LIMIT_BFS)
         memset(&m_cacheTU, 0, sizeof(TUInfoCache));
 
     Cost costs;
@@ -2886,7 +2895,7 @@
     uint32_t ycbf = 0, ucbf = 0, vcbf = 0;
     for (uint32_t qIdx = 0, qPartIdx = absPartIdx; qIdx < 4; ++qIdx, qPartIdx += qNumParts)
     {
-        if (m_param->limitTU == X265_TU_LIMIT_DFS && tuDepth == 0 && qIdx == 1)
+        if ((m_param->limitTU & X265_TU_LIMIT_DFS) && tuDepth == 0 && qIdx == 1)
         {
             // Fetch maximum TU depth of first sub partition to limit recursion of others
             for (uint32_t i = 0; i < cuGeom.numPartitions / 4; i++)
@@ -2937,12 +2946,12 @@
     bool bSaveTUData = false, bLoadTUData = false;
     uint32_t idx = 0;
 
-    if (m_param->limitTU == X265_TU_LIMIT_DFS && m_maxTUDepth)
+    if ((m_param->limitTU & X265_TU_LIMIT_DFS) && m_maxTUDepth)
     {
         uint32_t log2MaxTrSize = cuGeom.log2CUSize - m_maxTUDepth;
         bCheckSplit = log2TrSize > log2MaxTrSize;
     }
-    else if (m_param->limitTU == X265_TU_LIMIT_BFS && splitMore >= 0)
+    else if ((m_param->limitTU & X265_TU_LIMIT_BFS) && splitMore >= 0)
     {
         if (bCheckSplit && bCheckFull && tuDepth)
         {
@@ -3488,7 +3497,7 @@
         {
             if (splitCost.rdcost < fullCost.rdcost)
             {
-                if (m_param->limitTU == X265_TU_LIMIT_BFS)
+                if (m_param->limitTU & X265_TU_LIMIT_BFS)
                 {
                     uint32_t nextlog2TrSize = cuGeom.log2CUSize - (tuDepth + 1);
                     bool nextSplit = nextlog2TrSize > depthRange[0];
diff -r 4c1652f3884f -r c5295126f248 source/encoder/search.h
--- a/source/encoder/search.h	Tue Nov 15 11:16:04 2016 +0530
+++ b/source/encoder/search.h	Fri Nov 18 11:49:05 2016 +0530
@@ -276,7 +276,9 @@
     bool            m_bFrameParallel;
     uint32_t        m_numLayers;
     uint32_t        m_refLagPixels;
+
     uint32_t        m_maxTUDepth;
+    uint16_t        m_limitTU;
 
     int16_t         m_sliceMaxY;
     int16_t         m_sliceMinY;


More information about the x265-devel mailing list