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

Gwenole Beauchesne gbeauchesne
Tue Feb 24 20:03:39 CET 2009


Le 24 f?vr. 09 ? 19:40, Michael Niedermayer a ?crit :

>> @@ -160,8 +170,12 @@ static int decode_slice(MpegEncContext *s){
>>
>>     ff_set_qscale(s, s->qscale);
>>
>> -    if (s->avctx->hwaccel)
>> -        return 0;
>> +    if (s->avctx->hwaccel) {
>> +        const uint8_t *start, *end;
>> +        start = s->gb.buffer + get_bits_count(&s->gb)/8;
>> +        end   = ff_h263_find_resync_marker(start + 1, s- 
>> >gb.buffer_end);
>> +        return s->avctx->hwaccel->decode_slice(s->avctx, start,  
>> end - start);
>> +    }
>>
>>     if(s->partitioned_frame){
>>         const int qscale= s->qscale;
>
> rejected, this does a useless double scan also its more messy than  
> needed.

Would it be OK to skip_bits(slice_size * 8)? Or what is your suggested  
way?

>> @@ -616,6 +630,11 @@ retry:
>>     if(MPV_frame_start(s, avctx) < 0)
>>         return -1;
>>
>> +    if (avctx->hwaccel) {
>> +        if (avctx->hwaccel->start_frame(avctx, s->gb.buffer, s- 
>> >gb.size_in_bits/8) < 0)
>> +            return -1;
>> +    }
>> +
>> #ifdef DEBUG
>>     av_log(avctx, AV_LOG_DEBUG, "qscale=%d\n", s->qscale);
>> #endif
>
> its buf/buf_size

even when we get here again through the retry: label?

>> @@ -1644,6 +1654,12 @@ static int mpeg_field_start(MpegEncContext  
>> *s){
>>                 }
>>             }
>>     }
>> +
>> +    if (avctx->hwaccel) {
>> +        if (avctx->hwaccel->start_frame(avctx, NULL, 0) < 0)
>> +            return -1;
>> +    }
>> +
>> // MPV_frame_start will call this function too,
>> // but we need to call it on every field
>>     if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
>
> NULL, 0 looks wrong

There is not that much info available otherwise. If I move down the  
start_frame() back into decode_chunks(), are we guaranteed that the  
buf/buf_size is complete frame? decode_chunks() can be called from  
extradata buffer.

Thanks for applying some hunks.



More information about the ffmpeg-devel mailing list