[FFmpeg-devel] [PATCH] HWAccel infrastructure (take 5)

Michael Niedermayer michaelni
Fri Feb 20 15:36:00 CET 2009


On Fri, Feb 20, 2009 at 03:19:22PM +0100, Gwenole Beauchesne wrote:
> Le 20 f?vr. 09 ? 13:51, Michael Niedermayer a ?crit :
> 
> > On Fri, Feb 20, 2009 at 09:51:37AM +0100, Gwenole Beauchesne wrote:
> > [...]
> >> @@ -1692,6 +1704,20 @@ static int mpeg_decode_slice(Mpeg1Context  
> >> *s1, int mb_y,
> >>
> >>     s->mb_x=0;
> >>
> >> +    if (avctx->hwaccel) {
> >> +        const uint8_t *buf_end, *buf_start = *buf - 4; /* include  
> >> start_code */
> >> +        int start_code = -1;
> >> +        buf_end = ff_find_start_code(buf_start + 2, *buf +  
> >> buf_size, &start_code);
> >> +        if (buf_end < *buf + buf_size)
> >> +            buf_end -= 4;
> >> +        s->resync_mb_x = s->mb_x;
> >> +        s->resync_mb_y = s->mb_y = mb_y;
> >> +        if (avctx->hwaccel->decode_slice(avctx, buf_start, buf_end  
> >> - buf_start) < 0)
> >> +            return DECODE_SLICE_ERROR;
> >> +        *buf = buf_end;
> >> +        return DECODE_SLICE_OK;
> >> +    }
> >> +
> >>     for(;;) {
> >>         int code = get_vlc2(&s->gb, mbincr_vlc.table,  
> >> MBINCR_VLC_BITS, 2);
> >>         if (code < 0){
> >
> > i still think this is ugly implemented ...
> 
> Well, I need at least two things: the slice size and mb_y. I preferred  
> regrouping everything into the original mpeg_decode_slice(),  
> otherwise, with a buf temporary, we would have to maintain at least 3  
> locations where we (i) update mb_y, (ii) record current slice  
> position, (iii) early on top do buf-prev_buf to get the size and call  
> hwaccel->decode_slice() and even (iv) for the very last slice.
> 
> What would you suggest?

dunno, lets leave it for now if you dont see a way to improve it
little in the patch depends on how mpeg1/2 is dealt with ...

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

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- 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/20090220/29f09cee/attachment.pgp>



More information about the ffmpeg-devel mailing list