[x265] [PATCH 1 of 2] move calcSaoStatsRowCus_BeforeDblk into encode loop

Min Chen chenm003 at 163.com
Tue Jun 24 02:06:12 CEST 2014


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1403568229 25200
# Node ID 12c1d8aaa8f56a8f2de74c8ff1451d99d04c817d
# Parent  b5fbe9e2a10ab03b433de42edd8d77976d42df51
move calcSaoStatsRowCus_BeforeDblk into encode loop

diff -r b5fbe9e2a10a -r 12c1d8aaa8f5 source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
--- a/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp	Fri Jun 20 15:17:49 2014 +0530
+++ b/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp	Mon Jun 23 17:03:49 2014 -0700
@@ -813,11 +813,10 @@
     }
 }
 
-void TEncSampleAdaptiveOffset::calcSaoStatsRowCus_BeforeDblk(Frame* pic, int idxY)
+void TEncSampleAdaptiveOffset::calcSaoStatsCu_BeforeDblk(Frame* pic, int idxX, int idxY)
 {
-    int addr, yCbCr;
+    int addr;
     int x, y;
-    TComSPS *pTmpSPS =  pic->getSlice()->getSPS();
 
     pixel* fenc;
     pixel* pRec;
@@ -837,7 +836,6 @@
     int endY;
     int firstX, firstY;
 
-    int idxX;
     int frameWidthInCU  = m_numCuInWidth;
 
     int isChroma;
@@ -848,11 +846,12 @@
     pixel* pTableBo;
     int32_t *tmp_swap;
 
+    // NOTE: Row
     {
-        for (idxX = 0; idxX < frameWidthInCU; idxX++)
+        // NOTE: Col
         {
-            lcuHeight = pTmpSPS->getMaxCUSize();
-            lcuWidth  = pTmpSPS->getMaxCUSize();
+            lcuHeight = g_maxCUSize;
+            lcuWidth  = g_maxCUSize;
             addr     = idxX  + frameWidthInCU * idxY;
             pTmpCu = pic->getCU(addr);
             lPelX   = pTmpCu->getCUPelX();
@@ -860,7 +859,7 @@
 
             memset(m_countPreDblk[addr], 0, 3 * MAX_NUM_SAO_TYPE * MAX_NUM_SAO_CLASS * sizeof(int64_t));
             memset(m_offsetOrgPreDblk[addr], 0, 3 * MAX_NUM_SAO_TYPE * MAX_NUM_SAO_CLASS * sizeof(int64_t));
-            for (yCbCr = 0; yCbCr < 3; yCbCr++)
+            for (int yCbCr = 0; yCbCr < 3; yCbCr++)
             {
                 isChroma = (yCbCr != 0) ? 1 : 0;
 
@@ -1116,9 +1115,6 @@
     }
 }
 
-/** get SAO statistics
- * \param  *psQTPart,  yCbCr
- */
 void TEncSampleAdaptiveOffset::getSaoStats(SAOQTPart *psQTPart, int yCbCr)
 {
     int levelIdx, partIdx, typeIdx, classIdx;
diff -r b5fbe9e2a10a -r 12c1d8aaa8f5 source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h
--- a/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h	Fri Jun 20 15:17:49 2014 +0530
+++ b/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h	Mon Jun 23 17:03:49 2014 -0700
@@ -101,7 +101,7 @@
     void disablePartTree(SAOQTPart *psQTPart, int partIdx);
     void getSaoStats(SAOQTPart *psQTPart, int yCbCr);
     void calcSaoStatsCu(int addr, int partIdx, int yCbCr);
-    void calcSaoStatsRowCus_BeforeDblk(Frame* pic, int idxY);
+    void calcSaoStatsCu_BeforeDblk(Frame* pic, int idxX, int idxY);
     void destroyEncBuffer();
     void createEncBuffer();
     void assignSaoUnitSyntax(SaoLcuParam* saoLcuParam,  SAOQTPart* saoPart, bool &oneUnitFlag);
diff -r b5fbe9e2a10a -r 12c1d8aaa8f5 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Fri Jun 20 15:17:49 2014 +0530
+++ b/source/encoder/frameencoder.cpp	Mon Jun 23 17:03:49 2014 -0700
@@ -976,6 +976,18 @@
                 }
             }
         }
+
+        // NOTE: do CU level Filter
+        {
+            // SAO parameter estimation using non-deblocked pixels for LCU bottom and right boundary areas
+            if (m_param->bEnableSAO && m_param->saoLcuBasedOptimization && m_param->saoLcuBoundary)
+            {
+                // TODO: seems dead code, DEBUG IT!
+                m_frameFilter.m_sao.calcSaoStatsCu_BeforeDblk(m_frame, col, row);
+            }
+        }
+
+        // NOTE: active next row
         if (curRow.m_completed >= 2 && row < m_numRows - 1)
         {
             ScopedLock below(m_rows[row + 1].m_lock);
diff -r b5fbe9e2a10a -r 12c1d8aaa8f5 source/encoder/framefilter.cpp
--- a/source/encoder/framefilter.cpp	Fri Jun 20 15:17:49 2014 +0530
+++ b/source/encoder/framefilter.cpp	Mon Jun 23 17:03:49 2014 -0700
@@ -142,11 +142,7 @@
     const uint32_t numCols = m_pic->getPicSym()->getFrameWidthInCU();
     const uint32_t lineStartCUAddr = row * numCols;
 
-    // SAO parameter estimation using non-deblocked pixels for LCU bottom and right boundary areas
-    if (m_param->bEnableSAO && m_param->saoLcuBasedOptimization && m_param->saoLcuBoundary)
-    {
-        m_sao.calcSaoStatsRowCus_BeforeDblk(m_pic, row);
-    }
+    // NOTE: remove m_sao.calcSaoStatsRowCus_BeforeDblk at here, we do it in encode loop now
 
     if (m_param->bEnableLoopFilter)
     {



More information about the x265-devel mailing list