[x265] m_tempPel as static const

Satoshi Nakagawa nakagawa424 at oki.com
Fri Feb 21 10:23:23 CET 2014


# HG changeset patch
# User Satoshi Nakagawa <nakagawa424 at oki.com>
# Date 1392974423 -32400
#      Fri Feb 21 18:20:23 2014 +0900
# Node ID b0fafcc4a8a18520b25e16965bc41ccabc70d1d7
# Parent  13f73b241382ad46ef12f11c5e3d6db7e84152df
m_tempPel as static const

diff -r 13f73b241382 -r b0fafcc4a8a1 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Fri Feb 21 02:25:58 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Fri Feb 21 18:20:23 2014 +0900
@@ -71,7 +71,6 @@
     m_cfg = NULL;
     m_rdCost  = NULL;
     m_trQuant = NULL;
-    m_tempPel = NULL;
     m_entropyCoder = NULL;
     m_rdSbacCoders    = NULL;
     m_rdGoOnSbacCoder = NULL;
@@ -93,7 +92,6 @@
     X265_FREE(m_qtTempTUCoeffY);
     X265_FREE(m_qtTempTUCoeffCb);
     X265_FREE(m_qtTempTUCoeffCr);
-    X265_FREE(m_tempPel);
     X265_FREE(m_qtTempTrIdx);
     for (uint32_t i = 0; i < 3; ++i)
     {
@@ -162,7 +160,6 @@
     m_qtTempTUCoeffCb = X265_MALLOC(TCoeff, MAX_TS_WIDTH * MAX_TS_HEIGHT);
     m_qtTempTUCoeffCr = X265_MALLOC(TCoeff, MAX_TS_WIDTH * MAX_TS_HEIGHT);
 
-    m_tempPel = X265_MALLOC(pixel, g_maxCUWidth * g_maxCUHeight);
     m_qtTempTransformSkipYuv.create(g_maxCUWidth, g_maxCUHeight, cfg->param.internalCsp);
 
     m_tmpYuvPred.create(MAX_CU_SIZE, MAX_CU_SIZE, cfg->param.internalCsp);
@@ -3552,10 +3549,10 @@
         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)
+        ALIGN_VAR_32(static const pixel, zeroPel[MAX_CU_SIZE * MAX_CU_SIZE]) = { 0 };
 
         int partSize = partitionFromSizes(trWidth, trHeight);
-        uint32_t distY = primitives.sse_sp[partSize](resiYuv->getLumaAddr(absTUPartIdx), resiYuv->m_width, m_tempPel, trWidth);
+        uint32_t distY = primitives.sse_sp[partSize](resiYuv->getLumaAddr(absTUPartIdx), resiYuv->m_width, (pixel*)zeroPel, trWidth);
 
         if (outZeroDist)
         {
@@ -3626,7 +3623,7 @@
         int partSizeC = partitionFromSizes(trWidthC, trHeightC);
         if (bCodeChroma)
         {
-            distU = m_rdCost->scaleChromaDistCb(primitives.sse_sp[partSizeC](resiYuv->getCbAddr(absTUPartIdxC), resiYuv->m_cwidth, m_tempPel, trWidthC));
+            distU = m_rdCost->scaleChromaDistCb(primitives.sse_sp[partSizeC](resiYuv->getCbAddr(absTUPartIdxC), resiYuv->m_cwidth, (pixel*)zeroPel, trWidthC));
 
             if (outZeroDist)
             {
@@ -3692,7 +3689,7 @@
                 primitives.blockfill_s[(int)g_convertToBit[trWidthC]](ptr, stride, 0);
             }
 
-            distV = m_rdCost->scaleChromaDistCr(primitives.sse_sp[partSizeC](resiYuv->getCrAddr(absTUPartIdxC), resiYuv->m_cwidth, m_tempPel, trWidthC));
+            distV = m_rdCost->scaleChromaDistCr(primitives.sse_sp[partSizeC](resiYuv->getCrAddr(absTUPartIdxC), resiYuv->m_cwidth, (pixel*)zeroPel, trWidthC));
             if (outZeroDist)
             {
                 *outZeroDist += distV;
diff -r 13f73b241382 -r b0fafcc4a8a1 source/Lib/TLibEncoder/TEncSearch.h
--- a/source/Lib/TLibEncoder/TEncSearch.h	Fri Feb 21 02:25:58 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncSearch.h	Fri Feb 21 18:20:23 2014 +0900
@@ -112,7 +112,6 @@
     MV              m_mvPredictors[3];
 
     TComYuv         m_tmpYuvPred; // to avoid constant memory allocation/deallocation in xGetInterPredictionError()
-    pixel*          m_tempPel;    // avoid mallocs in xEstimateResidualQT
 
     // Color space parameters
     uint32_t        m_section;


More information about the x265-devel mailing list