[x265] [PATCH 17 of 24] sao: individual statistics data every row

Min Chen chenm003 at 163.com
Tue Dec 8 00:54:54 CET 2015


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1449511592 21600
# Node ID 294ae06be8aab74f7113a60a4abb0b63efc18ea3
# Parent  6180f5987872c4b0c39f22ca3797ef82694ef781
sao: individual statistics data every row
---
 source/encoder/sao.cpp |   29 ++++++++++-------------------
 1 files changed, 10 insertions(+), 19 deletions(-)

diff -r 6180f5987872 -r 294ae06be8aa source/encoder/sao.cpp
--- a/source/encoder/sao.cpp	Mon Dec 07 12:06:30 2015 -0600
+++ b/source/encoder/sao.cpp	Mon Dec 07 12:06:32 2015 -0600
@@ -132,21 +132,18 @@
         m_tmpU[i] += 1;
     }
 
+    CHECKED_MALLOC(m_count, PerClass, NUM_PLANE);
+    CHECKED_MALLOC(m_offset, PerClass, NUM_PLANE);
+    CHECKED_MALLOC(m_offsetOrg, PerClass, NUM_PLANE);
+
     if (initCommon)
     {
-        CHECKED_MALLOC(m_count, PerClass, NUM_PLANE);
-        CHECKED_MALLOC(m_offset, PerClass, NUM_PLANE);
-        CHECKED_MALLOC(m_offsetOrg, PerClass, NUM_PLANE);
-
         CHECKED_MALLOC(m_countPreDblk, PerPlane, numCtu);
         CHECKED_MALLOC(m_offsetOrgPreDblk, PerPlane, numCtu);
     }
     else
     {
         // must initialize these common pointer outside of function
-        m_count = NULL;
-        m_offset = NULL;
-        m_offsetOrg = NULL;
         m_countPreDblk = NULL;
         m_offsetOrgPreDblk = NULL;
     }
@@ -170,15 +167,9 @@
 
 void SAO::createFromRootNode(SAO* root)
 {
-    X265_CHECK(m_count == NULL, "duplicate initialize on m_count");
-    X265_CHECK(m_offset == NULL, "duplicate initialize on m_offset");
-    X265_CHECK(m_offsetOrg == NULL, "duplicate initialize on m_offsetOrg");
     X265_CHECK(m_countPreDblk == NULL, "duplicate initialize on m_countPreDblk");
     X265_CHECK(m_offsetOrgPreDblk == NULL, "duplicate initialize on m_offsetOrgPreDblk");
 
-    m_count = root->m_count;
-    m_offset = root->m_offset;
-    m_offsetOrg = root->m_offsetOrg;
     m_countPreDblk = root->m_countPreDblk;
     m_offsetOrgPreDblk = root->m_offsetOrgPreDblk;
 }
@@ -187,7 +178,6 @@
 {
     X265_FREE_ZERO(m_clipTableBase);
 
-
     for (int i = 0; i < 3; i++)
     {
         if (m_tmpL1[i])
@@ -209,13 +199,14 @@
         }
     }
 
+    if (m_count) X265_FREE_ZERO(m_count);
+    if (m_offset) X265_FREE_ZERO(m_offset);
+    if (m_offsetOrg) X265_FREE_ZERO(m_offsetOrg);
+
     if (destoryCommon)
     {
-        X265_FREE(m_count);
-        X265_FREE(m_offset);
-        X265_FREE(m_offsetOrg);
-        X265_FREE(m_countPreDblk);
-        X265_FREE(m_offsetOrgPreDblk);
+        X265_FREE_ZERO(m_countPreDblk);
+        X265_FREE_ZERO(m_offsetOrgPreDblk);
     }
 }
 



More information about the x265-devel mailing list