[FFmpeg-devel] [PATCH]VDPAU patch for MPEG1/2 decoding, round 1

Reimar Döffinger Reimar.Doeffinger
Mon Jan 5 16:57:32 CET 2009


> @@ -1212,6 +1213,28 @@
>      }
>  }
>  
> +static void mpeg_set_pixelformat(AVCodecContext *avctx){
> +    Mpeg1Context *s1 = avctx->priv_data;
> +    MpegEncContext *s = &s1->mpeg_enc_ctx;
> +
> +    if(avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU){

IMO CODEC_CAP_HWACCEL_VDPAU should not be used at all, checking codec_id
seems like the sanest way to me currently.

> +        avctx->idct_algo = FF_IDCT_SIMPLE;
> +        if(avctx->sub_id == 1)
> +            avctx->pix_fmt = PIX_FMT_VDPAU_MPEG1;
> +        else
> +            avctx->pix_fmt = PIX_FMT_VDPAU_MPEG2;
> +    }else if(avctx->xvmc_acceleration)
> +        avctx->pix_fmt = avctx->get_format(avctx,pixfmt_xvmc_mpg2_420);
> +    else{
> +        if(s->chroma_format <  2)
> +            avctx->pix_fmt = PIX_FMT_YUV420P; //avctx->get_format(avctx,pixfmt_yuv_420);
> +        else if(s->chroma_format == 2)
> +            avctx->pix_fmt = PIX_FMT_YUV422P; //avctx->get_format(avctx,pixfmt_yuv_422);
> +        else if(s->chroma_format >  2)
> +            avctx->pix_fmt = PIX_FMT_YUV444P; //avctx->get_format(avctx,pixfmt_yuv_444);
> +    }
> +}    

Also this should either be factored out before or after adding VDPAU
support, but not in the same patch.
Also the IDCT should be set at the same place and in the same way as for
XVMC.

> Index: libavcodec/vdpau_render.h
> ===================================================================
> --- libavcodec/vdpau_render.h	(revision 16437)
> +++ libavcodec/vdpau_render.h	(working copy)
> @@ -70,6 +70,7 @@
>  
>      /** picture parameter information for all supported codecs */
>      union VdpPictureInfo {
> +        VdpPictureInfoMPEG1Or2 mpeg;

What is 10r2 supposed to mean?





More information about the ffmpeg-devel mailing list