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

Stephen Warren swarren
Fri Jan 9 20:37:27 CET 2009


Michael Niedermayer wrote:
>
> ===================================================================
> > --- 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() ?

There's a reason we originally captured the reference frame data while
parsing slice data instead of at the end of picture processing.

If I recall correctly, there was information that is placed into VDPAU's
reference frame array that is no longer available (or rather has been
updated to be relevant to the next frame) by the time that
ff_vdpau_h264_picture_complete is called (at least where that function
was called in our version of the patches). I think this happened as part
of executing execute_ref_pic_marking, so perhaps if the call to
ff_vdpau_h264_picture_complete were moved before the call to
execute_ref_pic_marking, then ff_vdpau_h264_set_reference_frames
could be merged into ff_vdpau_h264_picture_complete (although I vaguely
recall trying that, and hitting some other issue).

-- 
nvpublic





More information about the ffmpeg-devel mailing list