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

Gwenole Beauchesne gbeauchesne
Wed Feb 25 22:47:31 CET 2009


Le 25 f?vr. 09 ? 20:17, Michael Niedermayer a ?crit :

>> @@ -1697,6 +1703,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){
>
> iam still investigating the need for this mess

(i) determine the end of the slice (and thus its size), (ii) slice  
vertical position. Granted, for (ii), only s->mb_y = mb_y; is useful.  
Would the hunk be ok with the others ripped off?



More information about the ffmpeg-devel mailing list