[x265] [PATCH] Avoid pointer copies in ReferencePlanes::{lowresMC, lowresQPelCost}

Karam Singh karam.singh at multicorewareinc.com
Tue Oct 15 06:35:38 UTC 2024


This patch has been pushed to the public repo.
*__________________________*
*Karam Singh*
*Ph.D. IIT Guwahati*
Senior Software (Video Coding) Engineer
Mobile: +91 8011279030
Block 9A, 6th floor, DLF Cyber City
Manapakkam, Chennai 600 089


On Fri, Oct 11, 2024 at 9:49 PM George Steed <george.steed at arm.com> wrote:

> These copies are reasonably hot in perf traces and there is no need to
> copy the pointers here. Just set a pointer to the array to read from and
> use that directly.
>
> Benchmarks show this gives a nice improvement in FPS reported for an
> encoding using --preset=medium:
>
> Cortex-A715: +0.2%
>   Cortex-X3: +0.7%
> Neoverse V2: +0.9%
>
> Change-Id: I33ba6854e7fbe6ecb1778b8201030a717f60f34e
> ---
>  source/common/lowres.h | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/source/common/lowres.h b/source/common/lowres.h
> index c9c2e3712..7e6baa844 100644
> --- a/source/common/lowres.h
> +++ b/source/common/lowres.h
> @@ -71,11 +71,7 @@ struct ReferencePlanes
>      inline pixel *lowresMC(intptr_t blockOffset, const MV& qmv, pixel
> *buf, intptr_t& outstride, bool hme)
>      {
>          intptr_t YStride = hme ? lumaStride / 2 : lumaStride;
> -        pixel *plane[4];
> -        for (int i = 0; i < 4; i++)
> -        {
> -            plane[i] = hme ? lowerResPlane[i] : lowresPlane[i];
> -        }
> +        pixel **plane = hme ? lowerResPlane : lowresPlane;
>          if ((qmv.x | qmv.y) & 1)
>          {
>              int hpelA = (qmv.y & 2) | ((qmv.x & 2) >> 1);
> @@ -98,11 +94,7 @@ struct ReferencePlanes
>      inline int lowresQPelCost(pixel *fenc, intptr_t blockOffset, const
> MV& qmv, pixelcmp_t comp, bool hme)
>      {
>          intptr_t YStride = hme ? lumaStride / 2 : lumaStride;
> -        pixel *plane[4];
> -        for (int i = 0; i < 4; i++)
> -        {
> -            plane[i] = hme ? lowerResPlane[i] : lowresPlane[i];
> -        }
> +        pixel **plane = hme ? lowerResPlane : lowresPlane;
>          if ((qmv.x | qmv.y) & 1)
>          {
>              ALIGN_VAR_16(pixel, subpelbuf[8 * 8]);
> --
> 2.34.1
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20241015/a5331df0/attachment.htm>


More information about the x265-devel mailing list