[x265] [PATCH] SAO: Don't allocate memory for sao pre-deblock buffers if the same is disabled

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


# HG changeset patch
# User Ashok Kumar Mishra<ashok at multicorewareinc.com>
# Date 1455633033 -19800
#      Tue Feb 16 20:00:33 2016 +0530
# Node ID a26f3d8c9758c1ee510c75518304d4c9445a202b
# Parent  dfc4d87df196e94be70757d648dfb935c100c32a
SAO: Don't allocate memory for sao pre-deblock buffers if the same is disabled

diff -r dfc4d87df196 -r a26f3d8c9758 source/encoder/sao.cpp
--- a/source/encoder/sao.cpp	Tue Feb 16 19:46:06 2016 +0530
+++ b/source/encoder/sao.cpp	Tue Feb 16 20:00:33 2016 +0530
@@ -120,8 +120,11 @@
 
     if (initCommon)
     {
-        CHECKED_MALLOC(m_countPreDblk, PerPlane, numCtu);
-        CHECKED_MALLOC(m_offsetOrgPreDblk, PerPlane, numCtu);
+        if (m_param->bSaoNonDeblocked)
+        {
+            CHECKED_MALLOC(m_countPreDblk, PerPlane, numCtu);
+            CHECKED_MALLOC(m_offsetOrgPreDblk, PerPlane, numCtu);
+        }
         CHECKED_MALLOC(m_depthSaoRate, double, 2 * SAO_DEPTHRATE_SIZE);
 
         m_depthSaoRate[0 * SAO_DEPTHRATE_SIZE + 0] = 0;
@@ -137,17 +140,16 @@
         m_clipTable = &(m_clipTableBase[rangeExt]);
 
         // Share with fast clip lookup table
-        if (initCommon)
-        {
-            for (int i = 0; i < rangeExt; i++)
-                m_clipTableBase[i] = 0;
 
-            for (int i = 0; i < maxY; i++)
-                m_clipTable[i] = (pixel)i;
+        for (int i = 0; i < rangeExt; i++)
+            m_clipTableBase[i] = 0;
 
-            for (int i = maxY; i < maxY + rangeExt; i++)
-                m_clipTable[i] = maxY;
-        }
+        for (int i = 0; i < maxY; i++)
+            m_clipTable[i] = (pixel)i;
+
+        for (int i = maxY; i < maxY + rangeExt; i++)
+            m_clipTable[i] = maxY;
+
     }
     else
     {
@@ -204,8 +206,11 @@
 
     if (destoryCommon)
     {
-        X265_FREE_ZERO(m_countPreDblk);
-        X265_FREE_ZERO(m_offsetOrgPreDblk);
+        if (m_param->bSaoNonDeblocked)
+        {
+            X265_FREE_ZERO(m_countPreDblk);
+            X265_FREE_ZERO(m_offsetOrgPreDblk);
+        }
         X265_FREE_ZERO(m_depthSaoRate);
         X265_FREE_ZERO(m_clipTableBase);
     }


More information about the x265-devel mailing list