[FFmpeg-devel] [PATCH] vc1.c: add support for HWAccel (take 2)

Kostya kostya.shishkov
Tue Mar 10 17:21:40 CET 2009


On Fri, Feb 27, 2009 at 11:37:10AM +0100, Gwenole Beauchesne wrote:
> On Wed, 25 Feb 2009, Gwenole Beauchesne wrote:
> 
> >This patch adds AVHWAccel entry-points to VC-1 codec.
> 
> Here is a new revision with ff_hwaccel_pixfmt_list_420[].

> diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
> index 03257b8..bea3b55 100644
> --- a/libavcodec/vc1.c
> +++ b/libavcodec/vc1.c
[...]
> @@ -4187,7 +4188,8 @@ static int vc1_decode_frame(AVCodecContext *avctx,
>                  if(size <= 0) continue;
>                  switch(AV_RB32(start)){
>                  case VC1_CODE_FRAME:
> -                    if (s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
> +                    if (avctx->hwaccel ||
> +                        s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
>                          buf_start = start;
>                      buf_size2 = vc1_unescape_buffer(start + 4, size, buf2);
>                      break;
> @@ -4277,6 +4279,15 @@ static int vc1_decode_frame(AVCodecContext *avctx,
>      s->me.qpel_put= s->dsp.put_qpel_pixels_tab;
>      s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab;
>  
> +    if (avctx->hwaccel) {
> +        if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0)
> +            return -1;
> +        if (avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start) < 0)
> +            return -1;
> +        if (avctx->hwaccel->end_frame(avctx) < 0)
> +            return -1;
> +    }
> +    else

<don't forget proper indent here>

>      if ((CONFIG_VC1_VDPAU_DECODER || CONFIG_WMV3_VDPAU_DECODER)
>          &&s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
>          ff_vdpau_vc1_decode_picture(s, buf_start, (buf + buf_size) - buf_start);

Those two chunks make me a bit uneasy and not because of your changes.

Patch OK in the case you swear to convert VDPAU to hwaccel architecture
(I don't like to have too many special cases).




More information about the ffmpeg-devel mailing list