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

Michael Niedermayer michaelni
Sat Jan 10 00:23:46 CET 2009


On Fri, Jan 09, 2009 at 11:37:27AM -0800, Stephen Warren wrote:
> 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, 

ok, makes sense ...


> 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).

do you remember which issue? if not i would suggest we try this and
see what happens ...

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

Democracy is the form of government in which you can choose your dictator
-------------- 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/20090110/f4d24c0e/attachment.pgp>



More information about the ffmpeg-devel mailing list