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

Min Chen chenm003 at 163.com
Wed Dec 2 18:28:30 CET 2015


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1449076359 21600
# Node ID 015698a0de808459f496f78ac7bcb7e6eefc706f
# Parent  1c6f6e627722c767bb9484064a1cea6286c62103
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 1c6f6e627722 -r 015698a0de80 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Wed Dec 02 11:12:36 2015 -0600
+++ b/source/encoder/frameencoder.cpp	Wed Dec 02 11:12:39 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 1c6f6e627722 -r 015698a0de80 source/encoder/framefilter.cpp
--- a/source/encoder/framefilter.cpp	Wed Dec 02 11:12:36 2015 -0600
+++ b/source/encoder/framefilter.cpp	Wed Dec 02 11:12:39 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