[x265] fix sao

Satoshi Nakagawa nakagawa424 at oki.com
Sun Sep 7 05:56:22 CEST 2014


# HG changeset patch
# User Satoshi Nakagawa <nakagawa424 at oki.com>
# Date 1410062067 -32400
#      Sun Sep 07 12:54:27 2014 +0900
# Node ID ce0c1eb81072b4dae5253b27d5c9bb3117975066
# Parent  ed4c9acafc11ccdd9ea5221175a891e43e24b1cc
fix sao

diff -r ed4c9acafc11 -r ce0c1eb81072 source/encoder/sao.cpp
--- a/source/encoder/sao.cpp	Fri Sep 05 17:36:18 2014 -0700
+++ b/source/encoder/sao.cpp	Sun Sep 07 12:54:27 2014 +0900
@@ -1481,14 +1481,10 @@
     pixel* fenc;
     pixel* recon;
     int stride;
-    int lcuHeight;
-    int lcuWidth;
     uint32_t rPelX;
     uint32_t bPelY;
     int64_t* stats;
     int64_t* count;
-    uint32_t picWidthTmp = 0;
-    uint32_t picHeightTmp = 0;
     int classIdx;
     int startX;
     int startY;
@@ -1510,38 +1506,39 @@
     {
         // NOTE: Col
         {
-            lcuHeight = g_maxCUSize;
-            lcuWidth  = g_maxCUSize;
             addr    = idxX + frameWidthInCU * idxY;
             cu      = pic->getCU(addr);
+
+            uint32_t picWidthTmp  = m_param->sourceWidth;
+            uint32_t picHeightTmp = m_param->sourceHeight;
+            int lcuWidth  = g_maxCUSize;
+            int lcuHeight = g_maxCUSize;
             lPelX   = cu->getCUPelX();
             tPelY   = cu->getCUPelY();
-
-            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));
+            rPelX     = lPelX + lcuWidth;
+            bPelY     = tPelY + lcuHeight;
+            rPelX     = rPelX > picWidthTmp  ? picWidthTmp  : rPelX;
+            bPelY     = bPelY > picHeightTmp ? picHeightTmp : bPelY;
+            lcuWidth  = rPelX - lPelX;
+            lcuHeight = bPelY - tPelY;
+
+            memset(m_countPreDblk[addr], 0, sizeof(PerPlane));
+            memset(m_offsetOrgPreDblk[addr], 0, sizeof(PerPlane));
+
             for (int plane = 0; plane < 3; plane++)
             {
                 isChroma = !!plane;
-                if (plane == 0)
+                if (plane == 1)
                 {
-                    picWidthTmp  = m_param->sourceWidth;
-                    picHeightTmp = m_param->sourceHeight;
+                    picWidthTmp  >>= m_hChromaShift;
+                    picHeightTmp >>= m_vChromaShift;
+                    lcuWidth     >>= m_hChromaShift;
+                    lcuHeight    >>= m_vChromaShift;
+                    lPelX        >>= m_hChromaShift;
+                    tPelY        >>= m_vChromaShift;
+                    rPelX     = lPelX + lcuWidth;
+                    bPelY     = tPelY + lcuHeight;
                 }
-                else if (plane == 1)
-                {
-                    picWidthTmp  = m_param->sourceWidth  >> isChroma;
-                    picHeightTmp = m_param->sourceHeight >> isChroma;
-                    lcuWidth     = lcuWidth    >> isChroma;
-                    lcuHeight    = lcuHeight   >> isChroma;
-                    lPelX        = lPelX       >> isChroma;
-                    tPelY        = tPelY       >> isChroma;
-                }
-                rPelX     = lPelX + lcuWidth;
-                bPelY     = tPelY + lcuHeight;
-                rPelX     = rPelX > picWidthTmp  ? picWidthTmp  : rPelX;
-                bPelY     = bPelY > picHeightTmp ? picHeightTmp : bPelY;
-                lcuWidth  = rPelX - lPelX;
-                lcuHeight = bPelY - tPelY;
 
                 stride   = (plane == 0) ? pic->getStride() : pic->getCStride();
 


More information about the x265-devel mailing list