[x265] [PATCH] deblock: removed bonded task group support in filtering

ashok at multicorewareinc.com ashok at multicorewareinc.com
Thu Sep 21 16:46:14 CEST 2017


# HG changeset patch
# User Ashok Kumar Mishra <ashok at multicorewareinc.com>
# Date 1498722236 -19800
#      Thu Jun 29 13:13:56 2017 +0530
# Node ID 1a7edb6fd9932b09c2b5646c7dcc820a51795827
# Parent  f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677
deblock: removed bonded task group support in filtering
Since filtering is very light weight process compared to encoding the ctu,
there is no need to use bonded task group for filtering. There is little
improvement in performance after removing bonded task group.

diff -r f8ae7afc1f61 -r 1a7edb6fd993 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Mon Sep 11 11:12:19 2017 +0530
+++ b/source/encoder/frameencoder.cpp	Thu Jun 29 13:13:56 2017 +0530
@@ -1264,10 +1264,7 @@
     if (bFirstRowInSlice && !curRow.completed)
     {
         // Load SBAC coder context from previous row and initialize row state.
-        //rowCoder.copyState(m_initSliceContext);
-        //rowCoder.loadContexts(m_rows[row - 1].bufferedEntropy);
-        rowCoder.load(m_initSliceContext);
-        //m_rows[row - 1].bufferedEntropy.loadContexts(m_initSliceContext);
+        rowCoder.load(m_initSliceContext);        
     }
 
     // calculate mean QP for consistent deltaQP signalling calculation
@@ -1328,9 +1325,7 @@
             }
             curRow.avgQPComputed = 1;
         }
-    }
-
-    // TODO: specially case handle on first and last row
+    }    
 
     // Initialize restrict on MV range in slices
     tld.analysis.m_sliceMinY = -(int16_t)(rowInSlice * m_param->maxCUSize * 4) + 3 * 4;
@@ -1428,15 +1423,10 @@
         {
             // NOTE: in VBV mode, we may reencode anytime, so we can't do Deblock stage-Horizon and SAO
             if (!bIsVbv)
-            {
-                // TODO: Multiple Threading
-                // Delay ONE row to avoid Intra Prediction Conflict
+            {                
+                // Delay one row to avoid intra prediction conflict
                 if (m_pool && !bFirstRowInSlice)
-                {
-                    // Waitting last threading finish
-                    m_frameFilter.m_parallelFilter[row - 1].waitForExit();
-
-                    // Processing new group
+                {                    
                     int allowCol = col;
 
                     // avoid race condition on last column
@@ -1446,15 +1436,11 @@
                                                                   : m_frameFilter.m_parallelFilter[row - 2].m_lastCol.get()), (int)col);
                     }
                     m_frameFilter.m_parallelFilter[row - 1].m_allowedCol.set(allowCol);
-                    m_frameFilter.m_parallelFilter[row - 1].tryBondPeers(*this, 1);
                 }
 
                 // Last Row may start early
                 if (m_pool && bLastRowInSlice)
                 {
-                    // Waiting for the last thread to finish
-                    m_frameFilter.m_parallelFilter[row].waitForExit();
-
                     // Deblocking last row
                     int allowCol = col;
 
@@ -1465,7 +1451,6 @@
                                                                   : m_frameFilter.m_parallelFilter[row - 1].m_lastCol.get()), (int)col);
                     }
                     m_frameFilter.m_parallelFilter[row].m_allowedCol.set(allowCol);
-                    m_frameFilter.m_parallelFilter[row].tryBondPeers(*this, 1);
                 }
             } // end of !bIsVbv
         }
@@ -1481,7 +1466,7 @@
         FrameStats frameLog;
         curEncData.m_rowStat[row].sumQpAq += collectCTUStatistics(*ctu, &frameLog);
 
-        // copy no. of intra, inter Cu cnt per row into frame stats for 2 pass
+        // copy number of intra, inter cu per row into frame stats for 2 pass
         if (m_param->rc.bStatWrite)
         {
             curRow.rowStats.mvBits    += best.mvBits;
@@ -1537,7 +1522,6 @@
             }
             
             // If current block is at row end checkpoint, call vbv ratecontrol.
-
             if (!m_param->bEnableWavefront && col == numCols - 1)
             {
                 double qpBase = curEncData.m_cuStat[cuAddr].baseQp;
@@ -1566,9 +1550,7 @@
                     curEncData.m_rowStat[row].sumQpAq = 0;
                 }
             }
-
             // If current block is at row diagonal checkpoint, call vbv ratecontrol.
-
             else if (m_param->bEnableWavefront && row == col && row)
             {
                 if (m_param->rc.bEnableConstVbv)
@@ -1683,7 +1665,7 @@
         }
     }
 
-    /** this row of CTUs has been compressed **/
+    /* this row of CTUs has been compressed */
     if (m_param->bEnableWavefront && m_param->rc.bEnableConstVbv)
     {
         if (row == m_numRows - 1)
@@ -1740,13 +1722,10 @@
     /* Processing left Deblock block with current threading */
     if ((m_param->bEnableLoopFilter | m_param->bEnableSAO) & (rowInSlice >= 2))
     {
-        /* TODO: Multiple Threading */
-
         /* Check conditional to start previous row process with current threading */
         if (m_frameFilter.m_parallelFilter[row - 2].m_lastDeblocked.get() == (int)numCols)
         {
             /* stop threading on current row and restart it */
-            m_frameFilter.m_parallelFilter[row - 1].waitForExit();
             m_frameFilter.m_parallelFilter[row - 1].m_allowedCol.set(numCols);
             m_frameFilter.m_parallelFilter[row - 1].processTasks(-1);
         }
diff -r f8ae7afc1f61 -r 1a7edb6fd993 source/encoder/framefilter.cpp
--- a/source/encoder/framefilter.cpp	Mon Sep 11 11:12:19 2017 +0530
+++ b/source/encoder/framefilter.cpp	Thu Jun 29 13:13:56 2017 +0530
@@ -582,10 +582,7 @@
     CUData* ctu = encData.getPicCTU(m_parallelFilter[row].m_rowAddr);
 
     /* Processing left block Deblock with current threading */
-    {
-        /* stop threading on current row */
-        m_parallelFilter[row].waitForExit();
-
+    {        
         /* Check to avoid previous row process slower than current row */
         X265_CHECK(ctu->m_bFirstRowInSlice || m_parallelFilter[row - 1].m_lastDeblocked.get() == m_numCols, "previous row not finish");
 
@@ -618,7 +615,6 @@
     }
 
     // this row of CTUs has been encoded
-
     if (!ctu->m_bFirstRowInSlice)
         processPostRow(row - 1);
 
diff -r f8ae7afc1f61 -r 1a7edb6fd993 source/encoder/framefilter.h
--- a/source/encoder/framefilter.h	Mon Sep 11 11:12:19 2017 +0530
+++ b/source/encoder/framefilter.h	Thu Jun 29 13:13:56 2017 +0530
@@ -62,7 +62,7 @@
     void*         m_ssimBuf;        /* Temp storage for ssim computation */
 
 #define MAX_PFILTER_CUS     (4) /* maximum CUs for every thread */
-    class ParallelFilter : public BondedTaskGroup, public Deblock
+    class ParallelFilter : public Deblock
     {
     public:
         uint32_t            m_rowHeight;
@@ -104,10 +104,6 @@
         {
             return m_rowHeight;
         }
-
-    protected:
-
-        ParallelFilter operator=(const ParallelFilter&);
     };
 
     ParallelFilter*     m_parallelFilter;


More information about the x265-devel mailing list