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

Gwenole Beauchesne gbeauchesne
Fri Feb 20 15:19:22 CET 2009


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?

Thanks,
Gwenole.



More information about the ffmpeg-devel mailing list