[x265] [PATCH 07 of 24] simplify control logic on Deblock Disable and Sao Enable

Min Chen chenm003 at 163.com
Tue Dec 8 00:54:44 CET 2015


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1449511565 21600
# Node ID 7d6d5444aa9704b092bcf5ff23c5c50773e08f72
# Parent  b2c551a2927e2ee0852d1983da9226ef3c2c1871
simplify control logic on Deblock Disable and Sao Enable
---
 source/encoder/frameencoder.cpp |   18 ++++++------------
 source/encoder/framefilter.cpp  |   23 +++++++++++++++++------
 2 files changed, 23 insertions(+), 18 deletions(-)

diff -r b2c551a2927e -r 7d6d5444aa97 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Mon Dec 07 12:06:03 2015 -0600
+++ b/source/encoder/frameencoder.cpp	Mon Dec 07 12:06:05 2015 -0600
@@ -104,7 +104,8 @@
     m_param = top->m_param;
     m_numRows = numRows;
     m_numCols = numCols;
-    m_filterRowDelay = (m_param->bEnableSAO && m_param->bSaoNonDeblocked) ?
+    m_filterRowDelay = ((m_param->bEnableSAO && m_param->bSaoNonDeblocked)
+                        || (!m_param->bEnableLoopFilter && m_param->bEnableSAO)) ?
                         2 : (m_param->bEnableSAO || m_param->bEnableLoopFilter ? 1 : 0);
     m_filterRowDelayCus = m_filterRowDelay * numCols;
     m_rows = new CTURow[m_numRows];
@@ -1096,11 +1097,11 @@
             m_frameFilter.m_parallelFilter[row].m_sao.calcSaoStatsCu_BeforeDblk(m_frame, col, row);
 
         /* Deblock with idle threading */
-        if (m_param->bEnableLoopFilter)
+        if (m_param->bEnableLoopFilter | m_param->bEnableSAO)
         {
             // TODO: Multiple Threading
             // Delay ONE row to avoid Intra Prediction Conflict
-            if (row > 0)
+            if (row >= 1)
             {
                 // Waitting last threading finish
                 m_frameFilter.m_parallelFilter[row - 1].waitForExit();
@@ -1124,13 +1125,6 @@
             }
         }
 
-        /* Case of DEBLOCK Disable and SAO Enable */
-        if (!m_param->bEnableLoopFilter && m_param->bEnableSAO)
-        {
-            PicYuv* reconPic = curEncData.m_reconPic;
-            m_frameFilter.m_parallelFilter[row].copySaoAboveRef(reconPic, cuAddr, col);
-        }
-
         if (m_param->bEnableWavefront && curRow.completed >= 2 && row < m_numRows - 1 &&
             (!m_bAllRowsStop || intRow + 1 < m_vbvResetTriggerRow))
         {
@@ -1192,7 +1186,7 @@
     if (m_param->bEnableWavefront)
     {
         /* Processing left Deblock block with current threading */
-        if (m_param->bEnableLoopFilter & (row > 0))
+        if ((m_param->bEnableLoopFilter | m_param->bEnableSAO) & (row >= 1))
         {
             /* TODO: Multiple Threading */
             m_frameFilter.m_parallelFilter[row - 1].waitForExit();
@@ -1222,7 +1216,7 @@
         if (row == m_numRows - 1)
         {
             /* TODO: Early start last row */
-            if (m_param->bEnableLoopFilter)
+            if (m_param->bEnableLoopFilter | m_param->bEnableSAO)
             {
                 X265_CHECK(m_frameFilter.m_parallelFilter[row - 1].m_allowedCol.get() == (int)numCols, "Deblock m_EncodedCol check failed");
 
diff -r b2c551a2927e -r 7d6d5444aa97 source/encoder/framefilter.cpp
--- a/source/encoder/framefilter.cpp	Mon Dec 07 12:06:03 2015 -0600
+++ b/source/encoder/framefilter.cpp	Mon Dec 07 12:06:05 2015 -0600
@@ -162,13 +162,20 @@
     for (uint32_t col = (uint32_t)colStart; col < (uint32_t)colEnd; col++)
     {
         const uint32_t cuAddr = m_rowAddr + col;
-        const CUData* ctu = m_encData->getPicCTU(cuAddr);
-        deblockCTU(ctu, cuGeoms[ctuGeomMap[cuAddr]], Deblock::EDGE_VER);
+
+        if (m_param->bEnableLoopFilter)
+        {
+            const CUData* ctu = m_encData->getPicCTU(cuAddr);
+            deblockCTU(ctu, cuGeoms[ctuGeomMap[cuAddr]], Deblock::EDGE_VER);
+        }
 
         if (col > 0)
         {
-            const CUData* ctuPrev = m_encData->getPicCTU(cuAddr - 1);
-            deblockCTU(ctuPrev, cuGeoms[ctuGeomMap[cuAddr - 1]], Deblock::EDGE_HOR);
+            if (m_param->bEnableLoopFilter)
+            {
+                const CUData* ctuPrev = m_encData->getPicCTU(cuAddr - 1);
+                deblockCTU(ctuPrev, cuGeoms[ctuGeomMap[cuAddr - 1]], Deblock::EDGE_HOR);
+            }
 
             if (m_param->bEnableSAO)
                 copySaoAboveRef(reconPic, cuAddr - 1, col - 1);
@@ -179,8 +186,12 @@
     if (colEnd == (int)numCols)
     {
         const uint32_t cuAddr = m_rowAddr + numCols - 1;
-        const CUData* ctuPrev = m_encData->getPicCTU(cuAddr);
-        deblockCTU(ctuPrev, cuGeoms[ctuGeomMap[cuAddr]], Deblock::EDGE_HOR);
+
+        if (m_param->bEnableLoopFilter)
+        {
+            const CUData* ctuPrev = m_encData->getPicCTU(cuAddr);
+            deblockCTU(ctuPrev, cuGeoms[ctuGeomMap[cuAddr]], Deblock::EDGE_HOR);
+        }
 
         if (m_param->bEnableSAO)
             copySaoAboveRef(reconPic, cuAddr, numCols - 1);



More information about the x265-devel mailing list