[FFmpeg-devel] [PATCH] libavcodec: add h.264 dxva2 decoder to ffmpeg

Hendrik Leppkes h.leppkes at gmail.com
Mon Jan 14 15:08:44 CET 2013

So, i finally found some time to review this a bit more.
At first, i really wanted to do a proper review of the whole code, but
it has big design flaws which need to be addressed first, so here are
the big points:

- You use a static data buffer ("ctx->databuffer") for the decoded
image. This is a very bad idea, imho, especially looking at future
plans for refcounted frames.
Instead, you should simply allocate an image in the same way that any
other decoder works in avcodec (ie.

Additionally, similar to this, avctx->width/height is not the actual
image width, its the image width after cropping. You need to use
avctx->coded_width/height for the actual width/height without
If you use ff_get_buffer, it'll compute a linesize for you, and you
don't have to deal with this, but should still copy the image using

In general, if it wants to be a normal decoder, it should behave like one.

- You named your file "dxva2_h264_dec.c", however it contains a lot of
generic code, and most of it can be reused/refactored for a generic
DXVA2 decoder for H264, MPEG2 and VC-1 in one.

- Your patch contains tabs. Tabs are not allowed in ffmpeg.

More information about the ffmpeg-devel mailing list