[FFmpeg-devel] [PATCH] H264 DXVA2 implementation

Benoit Fouet benoit.fouet
Thu Jan 7 11:59:31 CET 2010


Hi Laurent,

On Wed, 6 Jan 2010 21:51:36 +0100 Laurent Aimar wrote:
> Hi,
> 
>  The attached path allows VLD H264 decoding using DXVA2 (GPU assisted
> decoding API under VISTA and Windows 7).
>  It is implemented by using AVHWAccel API. It has been tested successfully
> for some time in VLC using an nvidia card on Windows 7.
> 
>  To compile it, you need to have the system header dxva2api.h (either from
> microsoft or using http://downloads.videolan.org/pub/videolan/testing/contrib/dxva2api.h)
>  The generated libavcodec.dll does not depend directly on any new lib as
> the necessary objects are given by the application using FFmpeg.
> 

> Index: libavcodec/dxva2_h264.c
> ===================================================================
> --- libavcodec/dxva2_h264.c	(revision 0)
> +++ libavcodec/dxva2_h264.c	(revision 0)
> @@ -0,0 +1,559 @@

[...]

> +static void *get_surface(const Picture *picture)
> +{
> +    return (void*)picture->data[3];

useless cast

> +}
> +static unsigned get_surface_index(const struct dxva_context *ctx,
> +                                  const Picture *picture)
> +{
> +    void *surface = get_surface(picture);
> +    unsigned i;
> +
> +    for (i = 0; i < ctx->surface_count; i++) {
> +        if (ctx->surface[i] == surface)
> +            return i;
> +    }
> +    return 0;

that looks weird: if this can happen, why is it not handled as an
error, instead of "defaulting" to surface index 0 ?

Ben



More information about the ffmpeg-devel mailing list