[FFmpeg-devel] [PATCH 2/2] MxPEG decoder

Anatoly Nenashev anatoly.nenashev
Mon Nov 8 15:27:18 CET 2010


On 07.11.2010 16:28, Michael Niedermayer wrote:
> On Sat, Nov 06, 2010 at 05:10:41AM +0300, Anatoly Nenashev wrote:
>    
> [...]
>> +        /* search for start marker - 0xff */
>> +        while (mxg->current_pos + FF_INPUT_BUFFER_PADDING_SIZE<  mxg->buffer_size) {
>> +            uint32_t x;
>> +            uint8_t *p = mxg->buffer + mxg->current_pos;
>> +
>> +            ret = get_partial_buffer(s->pb, p, 4);
>>      
> calling this every 4 bytes is slow
>
>
>    

Replaced by 4-times get_byte calls.

>> +            if (ret<  0)
>> +                return ret;
>> +
>> +            x = *(uint32_t*)p;
>> +            if (x&  (~(x+0x01010101))&  0x80808080) {
>> +                if (p[0] == 0xff&&  ret>  0) {
>> +                    mxg->current_pos += 1;
>> +                    url_fseek(s->pb, 1 - ret, SEEK_CUR);
>>      
> these seek back calls can fail
>
>
>    

Reimplemented without url_fseek() calls.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: mxg_v13.patch
Type: text/x-patch
Size: 10555 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101108/b7bc858e/attachment.bin>



More information about the ffmpeg-devel mailing list