[FFmpeg-devel] [RFC] DXVA2 decoding and FFmpeg

Stefano Sabatini stefasab at gmail.com
Mon Jun 15 11:56:13 CEST 2015


On date Saturday 2015-06-13 14:20:07 +0200, Hendrik Leppkes encoded:
> On Thu, Jun 11, 2015 at 8:54 PM, wm4 <nfxjfg at googlemail.com> wrote:
> > On Thu, 11 Jun 2015 17:24:45 +0200
> > Stefano Sabatini <stefasab at gmail.com> wrote:
> >
> >> Next step would be the use of YASM, but I only want to test if the
> >> general approach is fine (and if the API is not too specific). Also if
> >> someone wants to step up and port it to YASM I'm all for it, since
> >> ASM/YASM is far from being my area of expertise.
> >
> > Personally, I'd probably just
> > 1. export the GPU memcpy function, and
> > 2. export a function to copy AVFrames using this function
> 
> I concur. A basic optimized memcpy with specific constraints (ie.
> requires aligned input/output, always copies in 16-byte chunks, so
> in/out buffers need to be padded appropriately), to keep the required
> ASM code simple.
> These constraints are generally always fulfilled if you have a GPU
> frame on the input, since they will have appropriate strides (and if
> in question, we control allocation of the GPU surfaces as well), and
> we control the output memory buffer anyway.
> 
> On top of that a convenience function that deals with pixel formats,
> strides, planes, and whatnot, and then uses this function.
> A generic C version of the basic copy function shouldn't be needed, we
> could just use memcpy for that.. or a tiny wrapper that calls memcpy,
> anyway.

This is my first attempt, the added function is named av_memcpynt(),
it is using inline assembly which should be replaced by yasm once me
or someone else figures out how to do it.

An av_image_copynt_plane() function can be built on top of that (but
in this case it would be better to inline the av_memcpynt() function).

BTW I dropped the requirement of 16-bits alignment on the size
variable which is required by the VLC code but which looks unnecessary
to me.
-- 
FFmpeg = Furious and Foolish Marvellous Pacific Egregious Ghost
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-lavu-mem-add-av_memcpynt-function-with-x86-optimizat.patch
Type: text/x-diff
Size: 7785 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150615/7299258a/attachment.bin>


More information about the ffmpeg-devel mailing list