[Ffmpeg-devel] [PATCH] flash screen video codec

Michael Niedermayer michaelni
Thu May 18 11:18:04 CEST 2006


Hi

On Thu, May 18, 2006 at 12:26:02AM +0200, Benjamin Larsson wrote:
[...]
>     /* start to parse the bitstream */
>     s->block_width = (((buf[0]&0xf0)>>4)+1)* 16; // 4 bits
>     s->image_width = (buf[0]&0xf)<<8|(buf[1]); // 12 bits
>     s->block_height = (((buf[2]&0xf0)>>4)+1)* 16; // 4 bits
>     s->image_height = (buf[2]&0xf)<<8|(buf[3]); // 12 bits

may i suggest that you use the bitstream reader?

s->block_width = 16* get_bits(gb, 4);
s->image_width =     get_bits(gb,12);
s->block_height= 16* get_bits(gb, 4);
s->image_height=     get_bits(gb,12);

looks alot more readable

[...]
>             /* get the size of the compressed zlib chunk */
>             int size = buf[buf_pos++];
>             size = (size<<8) | buf[buf_pos++];

get_bits(gb, 16);

[...]
>                 buf_pos += size;

skip_bits(gb, 8*size);

[...]

-- 
Michael

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is





More information about the ffmpeg-devel mailing list