Difference between revisions of "Cine/Specifications"

Jump to navigation Jump to search
1,130 bytes added ,  17:07, 16 June 2008
Added info about how to parse the source stream into bits.
(Clarification about commands' parameters.)
(Added info about how to parse the source stream into bits.)
Line 136: Line 136:


===Bit sequences in the compressed stream===
===Bit sequences in the compressed stream===
The whole packed data consists of commands and their parameters.
The source stream is read as a bit stream. Behind the scenes it is read in one
unsigned big endian 32-bit integer value at a time and when such a chunk becomes
depleted of bits then another chunk is read in etc. Each chunk's least significant
bit is the first bit read from it, the most significant bit is the last bit read from it etc.
Because of the way the Delphine's decompressor routine handled the bit stream the first
chunk acts in a sort a peculiar way. All other chunks in the source stream always contain
full 32 bits but the first chunk contains only 0 to 31 bits. If the first chunk is zero,
then we simply discard it and read another chunk. If the first chunk is not zero, then it
contains as many source bits as its highest set bit's position is (e.g. 100b contains 2 bits
because its highest set bit is at bit position 2, 110101b contains 5 bits, 1b contains 0 bits etc).
So all the less significant bits than the first chunk's highest set bit are valid source stream
bits (That means the highest set bit in the first chunk is always discarded).


First bit of a command always tells how many bits the whole command takes.
First bit of a command always tells how many bits the whole command takes.
417

edits

Navigation menu