[x265] [PATCH] SAO: Improved saoStatsInitialOffset() function

ashok at multicorewareinc.com ashok at multicorewareinc.com
Tue Feb 16 16:10:17 CET 2016


# HG changeset patch
# User Ashok Kumar Mishra<ashok at multicorewareinc.com>
# Date 1454404824 -19800
#      Tue Feb 02 14:50:24 2016 +0530
# Node ID 11cb0f838b5a9ba2e38e1412e139d0cf94c66e7d
# Parent  425b583f25dbb57af86fc5c128548038954baf31
SAO: Improved saoStatsInitialOffset() function

diff -r 425b583f25db -r 11cb0f838b5a source/encoder/sao.cpp
--- a/source/encoder/sao.cpp	Thu Feb 11 13:15:03 2016 +0530
+++ b/source/encoder/sao.cpp	Tue Feb 02 14:50:24 2016 +0530
@@ -1259,19 +1259,16 @@
         saoParam->ctuParam[i][addr].reset();
 
     if (saoParam->bSaoFlag[0])
-    {
         calcSaoStatsCu(addr, 0);
-        saoStatsInitialOffset(0);
-    }
 
     if (saoParam->bSaoFlag[1])
     {
         calcSaoStatsCu(addr, 1);
         calcSaoStatsCu(addr, 2);
-        saoStatsInitialOffset(1);
-//        saoStatsInitialOffset(2);
     }
 
+    saoStatsInitialOffset(chroma);
+
     double mergeDist[NUM_MERGE_MODE] = { 0.0 };
     saoLumaComponentParamDist(saoParam, addr, mergeDist);
     if (chroma)
@@ -1364,10 +1361,12 @@
 
 // Rounds the division of initial offsets by the number of samples in
 // each of the statistics table entries.
-void SAO::saoStatsInitialOffset(int planes)
+void SAO::saoStatsInitialOffset(bool chroma)
 {
+    int planes = chroma ? 3 : 1;
+
     // EO
-    for (int plane = planes; plane <= 2*planes; plane++)
+    for (int plane = 0; plane < planes; plane++)
     {
         for (int typeIdx = 0; typeIdx < MAX_NUM_SAO_TYPE - 1; typeIdx++)
         {
@@ -1392,7 +1391,7 @@
     }
 
     // BO
-    for (int plane = planes; plane <= 2*planes; plane++)
+    for (int plane = 0; plane < planes; plane++)
     {
         for (int classIdx = 1; classIdx < SAO_NUM_BO_CLASSES + 1; classIdx++)
         {
diff -r 425b583f25db -r 11cb0f838b5a source/encoder/sao.h
--- a/source/encoder/sao.h	Thu Feb 11 13:15:03 2016 +0530
+++ b/source/encoder/sao.h	Tue Feb 02 14:50:24 2016 +0530
@@ -128,7 +128,6 @@
 
     void startSlice(Frame* pic, Entropy& initState, int qp);
     void resetStats();
-    void resetSaoUnit(SaoCtuParam* saoUnit);
 
     // CTU-based SAO process without slice granularity
     void processSaoCu(int addr, int typeIdx, int plane);
@@ -136,8 +135,6 @@
     void processSaoUnitCuLuma(SaoCtuParam* ctuParam, int idxY, int idxX);
     void processSaoUnitCuChroma(SaoCtuParam* ctuParam[3], int idxY, int idxX);
 
-//    void copySaoUnit(SaoCtuParam* saoUnitDst, const SaoCtuParam* saoUnitSrc);
-
     void calcSaoStatsCu(int addr, int plane);
     void calcSaoStatsCu_BeforeDblk(Frame* pic, int idxX, int idxY);
 
@@ -147,10 +144,9 @@
     inline int estIterOffset(int typeIdx, double lambda, int offset, int32_t count, int32_t offsetOrg,
                              int& currentDistortionTableBo, double& currentRdCostTableBo);
     void rdoSaoUnitRowEnd(const SAOParam* saoParam, int numctus);
-//    void rdoSaoUnitRow(SAOParam* saoParam, int idxY);
     void rdoSaoUnitCu(SAOParam* saoParam, int rowBaseAddr, int idxX, int addr);
 
-    void saoStatsInitialOffset(int plane);
+    void saoStatsInitialOffset(bool chroma);
 
     friend class FrameFilter;
 };


More information about the x265-devel mailing list