[FFmpeg-devel] [PATCH]Remove call to vdpau_h264_set_reference_frames from add_data_chunk

Michael Niedermayer michaelni
Fri Jan 9 19:37:02 CET 2009


On Fri, Jan 09, 2009 at 06:41:54PM +0100, Carl Eugen Hoyos wrote:
> Hi!
>
> To be able to reuse ff_vdpau_(h264_)add_data_chunk for vc1 and mpeg1/2, it 
> is necessary to remove the call to vdpau_h264_set_reference_frames.
>
> Please comment, Carl Eugen

> Index: libavcodec/vdpau_internal.h
> ===================================================================
> --- libavcodec/vdpau_internal.h	(revision 16492)
> +++ libavcodec/vdpau_internal.h	(working copy)
> @@ -27,6 +27,7 @@
>  #include <stdint.h>
>  #include "h264.h"
>  
> +void ff_vdpau_h264_set_reference_frames(H264Context *h);
>  void ff_vdpau_h264_add_data_chunk(H264Context *h, const uint8_t *buf,
>                                    int buf_size);
>  void ff_vdpau_h264_picture_complete(H264Context *h);
> Index: libavcodec/h264.c
> ===================================================================
> --- libavcodec/h264.c	(revision 16492)
> +++ libavcodec/h264.c	(working copy)
> @@ -7424,6 +7424,7 @@
>                 && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
>                 && avctx->skip_frame < AVDISCARD_ALL){
>                  if(ENABLE_H264_VDPAU_DECODER && avctx->codec_id == CODEC_ID_H264_VDPAU){
> +                    ff_vdpau_h264_set_reference_frames(h);
>                      static const uint8_t start_code[] = {0x00, 0x00, 0x01};
>                      ff_vdpau_h264_add_data_chunk(h, start_code, sizeof(start_code));
>                      ff_vdpau_h264_add_data_chunk(h, &buf[buf_index - consumed], consumed );
> Index: libavcodec/vdpauvideo.c
> ===================================================================
> --- libavcodec/vdpauvideo.c	(revision 16492)
> +++ libavcodec/vdpauvideo.c	(working copy)
> @@ -37,7 +37,7 @@
>   * @{
>   */
>  
> -static void vdpau_h264_set_reference_frames(H264Context *h)
> +void ff_vdpau_h264_set_reference_frames(H264Context *h)
>  {
>      MpegEncContext * s = &h->s;
>      struct vdpau_render_state * render, * render_ref;
> @@ -48,6 +48,9 @@
>      render = (struct vdpau_render_state*)s->current_picture_ptr->data[0];
>      assert(render);
>  
> +    if (render->bitstream_buffers_used)
> +        return;
> +
>      rf = &render->info.h264.referenceFrames[0];
>  #define H264_RF_COUNT FF_ARRAY_ELEMS(render->info.h264.referenceFrames)

this is ugly, the call should not happen for each slice
cant it be called from ff_vdpau_h264_picture_complete() ?

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

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato
-------------- 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/20090109/3a0a0b5a/attachment.pgp>



More information about the ffmpeg-devel mailing list