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

Anatoly Nenashev anatoly.nenashev
Sat Nov 6 03:10:41 CET 2010


On 06.11.2010 01:50, Michael Niedermayer wrote:
> On Fri, Nov 05, 2010 at 09:50:36PM +0300, Anatoly Nenashev wrote:
>    
>
>> +static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt)
>> +{
>> +    int ret, size;
>> +    MXGContext *mxg = s->priv_data;
>> +
>> +    while (!url_feof(s->pb)&&  !url_ferror(s->pb)) {
>> +        uint8_t data = 0;
>> +        unsigned int current_pad;
>> +
>> +        /* search for start marker - 0xff */
>> +        while (mxg->current_pos + FF_INPUT_BUFFER_PADDING_SIZE<  mxg->buffer_size) {
>> +            data = get_byte(s->pb);
>> +            mxg->buffer[mxg->current_pos++] = data;
>> +            if (data == 0xff) break;
>> +        }
>>      
> you can check 4 bytes at a time with something like:
> (x&~(x+0x01010101))&  0x80808080
> this should be faster
>
>    

Ok, thanks for your improvements, reimplemented this way. Also marker 
segment size parsing is added.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mxg_v12.patch
Type: text/x-patch
Size: 9300 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101106/2d158287/attachment.bin>



More information about the ffmpeg-devel mailing list