[x265] [PATCH 3 of 4] alloc concatenation memory for m_cuData

Min Chen chenm003 at 163.com
Sat Jun 21 01:41:40 CEST 2014


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1403307671 25200
# Node ID 20a73ed13f54b3fea69e97ed8f8a4f907f1d7373
# Parent  f6efadb8d2413e321f2b1964e6589410baeacc20
alloc concatenation memory for m_cuData

diff -r f6efadb8d241 -r 20a73ed13f54 source/Lib/TLibCommon/TComPicSym.cpp
--- a/source/Lib/TLibCommon/TComPicSym.cpp	Fri Jun 20 16:40:58 2014 -0700
+++ b/source/Lib/TLibCommon/TComPicSym.cpp	Fri Jun 20 16:41:11 2014 -0700
@@ -77,22 +77,18 @@
     m_numCUsInFrame   = m_widthInCU * m_heightInCU;
 
     m_slice = new TComSlice;
-    m_cuData = new TComDataCU*[m_numCUsInFrame];
+    m_cuData = new TComDataCU[m_numCUsInFrame];
     if (!m_slice || !m_cuData)
         return false;
 
     for (i = 0; i < m_numCUsInFrame; i++)
     {
-        m_cuData[i] = new TComDataCU;
-        if (!m_cuData[i])
+        uint32_t sizeL = g_maxCUSize * g_maxCUSize;
+        uint32_t sizeC = sizeL >> (CHROMA_H_SHIFT(picCsp) + CHROMA_V_SHIFT(picCsp));
+        if (!m_cuData[i].initialize(m_numPartitions, sizeL, sizeC, 1))
             return false;
 
-        uint32_t sizeL = g_maxCUSize * g_maxCUSize;
-        uint32_t sizeC = sizeL >> (CHROMA_H_SHIFT(picCsp) + CHROMA_V_SHIFT(picCsp));
-        if (!m_cuData[i]->initialize(m_numPartitions, sizeL, sizeC, 1))
-            return false;
-
-        m_cuData[i]->create(m_cuData[i], m_numPartitions, g_maxCUSize, m_unitSize, picCsp, 0);
+        m_cuData[i].create(&m_cuData[i], m_numPartitions, g_maxCUSize, m_unitSize, picCsp, 0);
     }
 
     return true;
@@ -103,12 +99,6 @@
     delete m_slice;
     m_slice = NULL;
 
-    for (int i = 0; i < m_numCUsInFrame; i++)
-    {
-        m_cuData[i]->destroy();
-        delete m_cuData[i];
-    }
-
     delete [] m_cuData;
     m_cuData = NULL;
 
diff -r f6efadb8d241 -r 20a73ed13f54 source/Lib/TLibCommon/TComPicSym.h
--- a/source/Lib/TLibCommon/TComPicSym.h	Fri Jun 20 16:40:58 2014 -0700
+++ b/source/Lib/TLibCommon/TComPicSym.h	Fri Jun 20 16:41:11 2014 -0700
@@ -73,7 +73,7 @@
     uint32_t      m_numCUsInFrame;
 
     TComSlice*    m_slice;
-    TComDataCU**  m_cuData;
+    TComDataCU*   m_cuData;
 
     SAOParam*     m_saoParam;
 
@@ -99,7 +99,7 @@
 
     uint32_t    getNumberOfCUsInFrame() const { return m_numCUsInFrame; }
 
-    TComDataCU* getCU(uint32_t cuAddr)    { return m_cuData[cuAddr]; }
+    TComDataCU* getCU(uint32_t cuAddr)    { return &m_cuData[cuAddr]; }
 
     uint32_t    getNumPartition() const   { return m_numPartitions; }
 



More information about the x265-devel mailing list