template<class STREAM, typename CONTAINER, int valueBits, bool isLE, bool MSB2LSB>
class Common::BitStreamImpl< STREAM, CONTAINER, valueBits, isLE, MSB2LSB >
A template implementing a bit stream for different data memory layouts.
Such a bit stream reads valueBits-wide values from the data stream and gives access to their bits, one at a time.
For example, a bit stream with the layout parameters 32, true, false for valueBits, isLE and isMSB2LSB, reads 32-bit little-endian values from the data stream and hands out the bits in the order of LSB to MSB.
template<class STREAM , typename CONTAINER , int valueBits, bool isLE, bool MSB2LSB>
template<int n>
Read a multi-bit value from the bit stream, without changing the stream's position.
The bit order is the same as in getBits().
template<class STREAM , typename CONTAINER , int valueBits, bool isLE, bool MSB2LSB>
template<int n>
Read a multi-bit value from the bit stream.
The value is read as if just taken as a whole from the bit stream.
For example: Reading a 4-bit value from an 8-bit bit stream with the contents 01010011: If the bit stream is MSB2LSB, the 4-bit value would be 0101. If the bit stream is LSB2MSB, the 4-bit value would be 0011.
template<class STREAM , typename CONTAINER , int valueBits, bool isLE, bool MSB2LSB>
Read a multi-bit value from the bit stream, without changing the stream's position.
The bit order is the same as in getBits().
template<class STREAM , typename CONTAINER , int valueBits, bool isLE, bool MSB2LSB>
Read a multi-bit value from the bit stream.
The value is read as if just taken as a whole from the bit stream.
For example: Reading a 4-bit value from an 8-bit bit stream with the contents 01010011: If the bit stream is MSB2LSB, the 4-bit value would be 0101. If the bit stream is LSB2MSB, the 4-bit value would be 0011.
template<class STREAM , typename CONTAINER , int valueBits, bool isLE, bool MSB2LSB>
void Common::BitStreamImpl< STREAM, CONTAINER, valueBits, isLE, MSB2LSB >::addBit |
( |
uint32 & |
x, |
|
|
uint32 |
n |
|
) |
| |
|
inline |
Add a bit to the value x, making it an n+1-bit value.
The current value is shifted and the bit is added to the appropriate place, depending on the stream's bit order.
For example: A bit y is added to the value 00001100 with size 4. If the stream's bit order is MSB2LSB, the resulting value is 0001100y. If the stream's bit order is LSB2MSB, the resulting value is 000y1100.