[FFmpeg-devel] [PATCH] start code detection for hardware decode in mpeg4/divx streams

anuj mittal am.devel at gmail.com
Mon Oct 22 11:00:56 CEST 2012


On Fri, Oct 19, 2012 at 7:23 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Fri, Oct 19, 2012 at 12:36:53PM +0530, anuj mittal wrote:

>>
>>  void ff_clean_h263_qscales(MpegEncContext *s);
>>  int ff_h263_resync(MpegEncContext *s);
>> -const uint8_t *ff_h263_find_resync_marker(MpegEncContext *s, const uint8_t *p, const uint8_t *end);
>> +const uint8_t *ff_h263_find_marker(MpegEncContext *s, const uint8_t *p, const uint8_t *end);
>
> static h263_find_slice_end()
>
> and the renaming should be in a seperate patch

Attached.

>
>
>>  int ff_h263_get_gob_height(MpegEncContext *s);
>>  void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code);
>>
>> diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
>> index 7141d49..0557fa4 100644
>> --- a/libavcodec/h263dec.c
>> +++ b/libavcodec/h263dec.c
>> @@ -169,10 +169,20 @@ static int decode_slice(MpegEncContext *s){
>>      ff_set_qscale(s, s->qscale);
>>
>>      if (s->avctx->hwaccel) {
>> +        int ret;
>> +
>>          const uint8_t *start= s->gb.buffer + get_bits_count(&s->gb)/8;
>> -        const uint8_t *end  = ff_h263_find_resync_marker(s, start + 1, s->gb.buffer_end);
>> +        const uint8_t *end  = ff_h263_find_marker(s, start + 1, s->gb.buffer_end);
>>          skip_bits_long(&s->gb, 8*(end - start));
>> -        return s->avctx->hwaccel->decode_slice(s->avctx, start, end - start);
>> +        ret = s->avctx->hwaccel->decode_slice(s->avctx, start, end - start);
>> +
>
>> +        /* Next frame detected */
>> +        if (end <= s->gb.buffer_end-2){
>> +            if (!end[0] && !end[1] && (end[2] == 1)){
>> +                s->mb_y = s->mb_height;
>> +            }
>> +        }
>
> that searches for a next startcode not a next frame

Right.. had forgotten to change that comment. Attached is the correct
version. Thank you.

Anuj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Extend-the-start-code-handling-while-decoding-using-.patch
Type: application/octet-stream
Size: 2084 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121022/352e4f73/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Function-name-change.-This-performs-a-more-generic-f.patch
Type: application/octet-stream
Size: 3725 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121022/352e4f73/attachment-0001.obj>


More information about the ffmpeg-devel mailing list