[x265] clear m_tempPel only once

Satoshi Nakagawa nakagawa424 at oki.com
Fri Feb 21 06:57:47 CET 2014


# HG changeset patch
# User Satoshi Nakagawa <nakagawa424 at oki.com>
# Date 1392962042 -32400
#      Fri Feb 21 14:54:02 2014 +0900
# Node ID 3706b57addade77ee6d06bd95600c99e80abb93a
# Parent  0c19c44af2d3a8825d804597f1c2f82e32e4d4b7
clear m_tempPel only once

diff -r 0c19c44af2d3 -r 3706b57addad source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Fri Feb 21 12:23:22 2014 +0900
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Fri Feb 21 14:54:02 2014 +0900
@@ -79,7 +79,7 @@
 
 TEncSearch::~TEncSearch()
 {
-    delete [] m_tempPel;
+    X265_FREE(m_tempPel);
 
     if (m_cfg)
     {
@@ -135,7 +135,8 @@
 
     initTempBuff(cfg->param.internalCsp);
 
-    m_tempPel = new Pel[g_maxCUWidth * g_maxCUHeight];
+    m_tempPel = X265_MALLOC(Pel, g_maxCUWidth * g_maxCUHeight);
+    memset(m_tempPel, 0, sizeof(Pel) * g_maxCUWidth * g_maxCUHeight);
 
     const uint32_t numLayersToAllocate = cfg->getQuadtreeTULog2MaxSize() - cfg->getQuadtreeTULog2MinSize() + 1;
     m_qtTempCoeffY  = new TCoeff*[numLayersToAllocate];
@@ -3564,8 +3565,6 @@
         const uint32_t numSamplesLuma = 1 << (trSizeLog2 << 1);
         const uint32_t numSamplesChroma = 1 << (trSizeCLog2 << 1);
 
-        ::memset(m_tempPel, 0, sizeof(Pel) * numSamplesLuma); // not necessary needed for inside of recursion (only at the beginning)
-
         int partSize = partitionFromSizes(trWidth, trHeight);
         uint32_t distY = primitives.sse_sp[partSize](resiYuv->getLumaAddr(absTUPartIdx), resiYuv->m_width, m_tempPel, trWidth);
 


More information about the x265-devel mailing list