[x265] clear m_tempPel only once

Steve Borho steve at borho.org
Fri Feb 21 08:47:26 CET 2014


On Thu, Feb 20, 2014 at 11:57 PM, Satoshi Nakagawa <nakagawa424 at oki.com> wrote:
> # 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);

I was digging around this same function today and actually changed a
lot of these buffers to X265_MALLOC's pixel or uint8_t arrays; so
unfortunately this collides with those patches.


>      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);

hmm; after I push my commits maybe you could move this memset and
rename the buffer to m_zerobuf or something.  I didn't realize it was
only used to measure sum of squares.

>
>      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);
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel



-- 
Steve Borho


More information about the x265-devel mailing list