[FFmpeg-devel] [PATCH]VDPAU patch for h264 decoding, round 7

Michael Niedermayer michaelni
Sun Jan 4 03:38:15 CET 2009


On Sun, Jan 04, 2009 at 02:59:55AM +0100, Carl Eugen Hoyos wrote:
> Hi!
>
> Attached is a hopefully acceptable version of the libavcodec (and 
> libavutil) part of the H264_VDPAU decoding patch.

[...]
> Index: libavcodec/h264.c
> ===================================================================
> --- libavcodec/h264.c	(revision 16408)
> +++ libavcodec/h264.c	(working copy)

> @@ -72,6 +72,10 @@
>  static VLC_TYPE run7_vlc_table[96][2];
>  static const int run7_vlc_table_size = 96;
>  
> +void ff_VDPAU_h264_add_data_chunk(H264Context *h, const uint8_t *buf,
> +                                  int buf_size);
> +void ff_VDPAU_h264_picture_complete(H264Context *h);
> +
>  static void svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp);
>  static void svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc);
>  static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize);

i think these should be in som header


[...]
> Index: libavcodec/vdpauvideo.c
> ===================================================================
> --- libavcodec/vdpauvideo.c	(revision 0)
> +++ libavcodec/vdpauvideo.c	(revision 0)
[...]
> +void ff_VDPAU_h264_add_data_chunk(H264Context *h, const uint8_t *buf, int buf_size)
> +{
> +    MpegEncContext * s = &h->s;
> +    struct vdpau_render_state * render;
> +
> +    render = (struct vdpau_render_state*)s->current_picture_ptr->data[2];
> +    assert(render);
> +
> +    if (!render->bitstreamBuffersUsed)
> +        VDPAU_h264_set_reference_frames(h);
> +

> +    VDPAU_ensure_has_buffers(render, render->bitstreamBuffersUsed + 1);

render->bitstreamBuffers= av_fast_realloc(
    render->bitstreamBuffers,
    &render->bitstreamBuffersAlloced.
    sizeof(*render->bitstreamBuffers)*(render->bitstreamBuffersUsed + 1)
);


[...]
> Index: libavcodec/mpegvideo.c
> ===================================================================
> --- libavcodec/mpegvideo.c	(revision 16408)
> +++ libavcodec/mpegvideo.c	(working copy)
> @@ -957,7 +957,11 @@
>          XVMC_field_end(s);
>      }else
>  #endif
> -    if(s->unrestricted_mv && s->current_picture.reference && !s->intra_only && !(s->flags&CODEC_FLAG_EMU_EDGE)) {

> +    if(!(s->avctx->codec->capabilities|CODEC_CAP_HWACCEL_VDPAU)

| -> & ?


[...]
> Index: libavcodec/vdpau_render.h
> ===================================================================
> --- libavcodec/vdpau_render.h	(revision 0)
> +++ libavcodec/vdpau_render.h	(revision 0)
[...]
> +/**
> + * \brief The videoSurface is used for render.
> + */
> +#define MP_VDPAU_STATE_USED_FOR_RENDER 1
> +
> +/**
> + * \brief The videoSurface is needed for reference/prediction,
> + * codec manipulates this.
> + */
> +#define MP_VDPAU_STATE_USED_FOR_REFERENCE 2

MP ?
Military police ;)


[...]
> +/* @}*/
> +/* @}*/

is it intended to be there twice?
also doesnt it need /** (no i did not test so i may be wrong ...) ?


> +
> +#endif /* AVCODEC_VDPAU_RENDER_H */
> Index: libavcodec/avcodec.h
> ===================================================================
> --- libavcodec/avcodec.h	(revision 16408)
> +++ libavcodec/avcodec.h	(working copy)
> @@ -191,6 +191,9 @@
>      CODEC_ID_TGV,
>      CODEC_ID_TGQ,
>  
> +    /* "codecs" for HW decoding with VDPAU */
> +    CODEC_ID_H264_VDPAU= 0x9000,
> +
>      /* various PCM "codecs" */
>      CODEC_ID_PCM_S16LE= 0x10000,
>      CODEC_ID_PCM_S16BE,
> @@ -526,6 +529,10 @@
>   * This can be used to prevent truncation of the last audio samples.
>   */
>  #define CODEC_CAP_SMALL_LAST_FRAME 0x0040
> +/**


> + * Codec can export data for HW decoding (VDPAU). 

trailing whitespace


[...]
> Index: libavutil/avutil.h
> ===================================================================
> --- libavutil/avutil.h	(revision 16408)
> +++ libavutil/avutil.h	(working copy)
> @@ -121,6 +121,7 @@
>      PIX_FMT_YUV440P,   ///< Planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
>      PIX_FMT_YUVJ440P,  ///< Planar YUV 4:4:0 full scale (jpeg)
>      PIX_FMT_YUVA420P,  ///< Planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)

> +    PIX_FMT_VDPAU_H264,///< H264 HW decoding with VDPAU

I would describe what is in data[123] because thats the purpose of pix_fmt.


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090104/a478880e/attachment.pgp>



More information about the ffmpeg-devel mailing list