[FFmpeg-devel] [PATCH] h264.c: add HW acceleration hooks

Michael Niedermayer michaelni
Wed Feb 25 23:45:03 CET 2009


On Wed, Feb 25, 2009 at 11:01:12PM +0100, Gwenole Beauchesne wrote:
> Le 25 f?vr. 09 ? 20:43, Michael Niedermayer a ?crit :
> 
> >> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
> >> index 344cee5..b1ee0e4 100644
> >> --- a/libavcodec/h264.c
> >> +++ b/libavcodec/h264.c
> >> @@ -4034,6 +4034,11 @@ static int decode_slice_header(H264Context  
> >> *h, H264Context *h0){
> >>         slice_group_change_cycle= get_bits(&s->gb, ?);
> >> #endif
> >>
> >> +    if (s->avctx->hwaccel && h0->current_slice == 0) {
> >> +        if (s->avctx->hwaccel->start_frame(s->avctx, NULL, 0) < 0)
> >> +            return -1;
> >> +    }
> >> +
> >>     h0->last_slice_type = slice_type;
> >>     h->slice_num = ++h0->current_slice;
> >>     if(h->slice_num >= MAX_SLICES){
> >
> > outside of decode_slice_header() seems a nicer place ...
> 
> decode_nal_units()::NAL_SLICE case after the call to  
> decode_slice_header()? It cannot really be earlier. 

> Is using  
> current_slice==1 ok

yes, if it works


>  or the same mpeg12.c machinery desired (s- 
>  >first_slice)?
> 
> >> @@ -7706,6 +7718,11 @@ static int decode_frame(AVCodecContext *avctx,
> >>         h->prev_frame_num_offset= h->frame_num_offset;
> >>         h->prev_frame_num= h->frame_num;
> >>
> >> +        if (avctx->hwaccel) {
> >> +            if (avctx->hwaccel->end_frame(avctx) < 0)
> >> +                return -1;
> >> +        }
> >> +
> >>         if (CONFIG_H264_VDPAU_DECODER && s->avctx->codec- 
> >> >capabilities&CODEC_CAP_HWACCEL_VDPAU)
> >>             ff_vdpau_h264_picture_complete(s);
> >>
> >
> > this seems the only code that does a return -1 there ...
> > what is the intent of that? besides what is the meaning of
> > end_frame() failing?
> 
> Generally, actually all cases, AVHWAccel::end_frame() is sending the  
> control blocks to the accelerator, and does the actual decoding. We  
> could ignore errors as the original VDPAU code though.

iam not asking to ignore them but rather asking what exactly
the return -1 at that point is supposed to achive?

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
-------------- 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/20090225/008dad19/attachment.pgp>



More information about the ffmpeg-devel mailing list