[FFmpeg-devel] [PATCH 4/4] swscale/aarch64/rgb2rgb: add neon implementation for rgb24toyv12

Ramiro Polla ramiro.polla at gmail.com
Thu Aug 29 01:20:07 EEST 2024


On Wed, Aug 28, 2024 at 11:23 PM Martin Storsjö <martin at martin.st> wrote:
> On Wed, 28 Aug 2024, Ramiro Polla wrote:

> > +2:
> > +        // load first line
> > +        ld3             {v16.8b, v17.8b, v18.8b}, [x0], #24
> > +        ld3             {v19.8b, v20.8b, v21.8b}, [x0], #24
>
> Hmm, can't we do just one single ld3 with .16b registers, instead of two
> separate ones?
>
> If you want to keep the same register layout as now, load into v19-v21,
> then do "uxtl v16.8h, v19.8b; uxtl2 v19.8h, v19.16b".

Thanks, that made it faster.

> > +        uxtl            v16.8h, v16.8b              // v16 = B11
> > +        uxtl            v17.8h, v17.8b              // v17 = G11
> > +        uxtl            v18.8h, v18.8b              // v18 = R11
> > +        uxtl            v19.8h, v19.8b              // v19 = B12
> > +        uxtl            v20.8h, v20.8b              // v20 = G12
> > +        uxtl            v21.8h, v21.8b              // v21 = R12
> > +
> > +        // calculate Y values for first line
> > +        rgbconv16       v24, v16, v17, v18, BY, GY, RY // v24 = Y11
> > +        rgbconv16       v25, v19, v20, v21, BY, GY, RY // v25 = Y12
> > +
> > +        // pairwise add and save rgb values to calculate average
> > +        addp            v5.8h, v16.8h, v19.8h
> > +        addp            v6.8h, v17.8h, v20.8h
> > +        addp            v7.8h, v18.8h, v21.8h
> > +
> > +        // load second line
> > +        ld3             {v16.8b, v17.8b, v18.8b}, [x10], #24
> > +        ld3             {v19.8b, v20.8b, v21.8b}, [x10], #24
>
> It's a shame we can't start this load earlier. But as essentially
> everything depends on the input as it is, in v16-v21, we'd pretty much
> need to use different registers here in order to do that.
>
> If you wanted to, you could try loading earlier, into different registers
> (I think v26-v31 are free at this point?), while then doing the uxtl into
> the same registers as before, which shouldn't require any further changes.

Thanks, that also led to a small improvement.

New patch attached.

Ramiro
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v2-0004-swscale-aarch64-rgb2rgb-add-neon-implementation-f.patch
Type: text/x-patch
Size: 8879 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240829/a67b23b9/attachment.bin>


More information about the ffmpeg-devel mailing list