xoreos
0.0.5
|
A template implementing a bit stream for different data memory layouts. More...
#include <bitstream.h>
Public Member Functions | |
BitStreamImpl (SeekableReadStream *stream, bool disposeAfterUse=false) | |
Create a bit stream using this input data stream and optionally delete it on destruction. More... | |
BitStreamImpl (SeekableReadStream &stream) | |
Create a bit stream using this input data stream. More... | |
~BitStreamImpl () | |
uint32 | getBit () |
Read a bit from the bit stream. More... | |
uint32 | getBits (size_t n) |
Read a multi-bit value from the bit stream. More... | |
void | addBit (uint32 &x, size_t n) |
Add a bit to the n-bit value x, making it an (n+1)-bit value. More... | |
void | rewind () |
Rewind the bit stream back to the start. More... | |
void | skip (size_t n) |
Skip the specified amount of bits. More... | |
size_t | pos () const |
Return the stream position in bits. More... | |
size_t | size () const |
Return the stream size in bits. More... | |
bool | eos () const |
Has the end of the stream been reached? More... | |
Public Member Functions inherited from Common::BitStream | |
virtual | ~BitStream () |
Private Member Functions | |
uint64 | readData () |
Read a data value. More... | |
void | readValue () |
Read the next data value. More... | |
Private Attributes | |
DisposablePtr< SeekableReadStream > | _stream |
The input stream. More... | |
uint64 | _value |
Current value. More... | |
uint8 | _inValue |
Position within the current value. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Common::BitStream | |
BitStream () | |
A template implementing a bit stream for different data memory layouts.
Such a bit stream reads a 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 32bit little-endian values from the data stream and hands out the bits in the order of LSB to MSB.
Definition at line 85 of file bitstream.h.
|
inline |
Create a bit stream using this input data stream and optionally delete it on destruction.
Definition at line 132 of file bitstream.h.
References Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::_stream.
|
inline |
Create a bit stream using this input data stream.
Definition at line 142 of file bitstream.h.
|
inline |
Definition at line 149 of file bitstream.h.
|
inlinevirtual |
Add a bit to the n-bit value x, making it an (n+1)-bit value.
Implements Common::BitStream.
Definition at line 202 of file bitstream.h.
References Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::getBit().
|
inlinevirtual |
Has the end of the stream been reached?
Implements Common::BitStream.
Definition at line 240 of file bitstream.h.
References Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::_stream, Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::pos(), and Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::size().
|
inlinevirtual |
Read a bit from the bit stream.
Implements Common::BitStream.
Definition at line 153 of file bitstream.h.
References Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::_inValue, Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::_value, and Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::readValue().
Referenced by Aurora::ActionScript::ASBuffer::actionDefineFunction2(), Aurora::ActionScript::ASBuffer::actionGetURL2(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::addBit(), Sound::WwRIFFVorbisStream::generateHeaderSetup(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::getBits(), Aurora::GFXFile::readDefineEditText(), Aurora::GFXFile::readDefineFont(), Aurora::GFXFile::readMatrix(), Aurora::GFXFile::readPlaceObject(), and Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::skip().
|
inlinevirtual |
Read a multi-bit value from the bit stream.
Implements Common::BitStream.
Definition at line 178 of file bitstream.h.
References Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::getBit().
Referenced by Aurora::ActionScript::ASBuffer::actionDefineFunction2(), Aurora::ActionScript::ASBuffer::actionGetURL2(), Sound::WMACodec::decodeSuperFrame(), Sound::WwRIFFVorbisStream::generateHeaderSetup(), Aurora::GFXFile::readRectangle(), and Aurora::GFXFile::readShape().
|
inlinevirtual |
Return the stream position in bits.
Implements Common::BitStream.
Definition at line 227 of file bitstream.h.
References Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::_inValue, and Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::_stream.
Referenced by Video::Bink::BinkAudioTrack::decodeAudio(), Sound::WMACodec::decodeSuperFrame(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::eos(), Sound::WwRIFFVorbisStream::generateHeaderSetup(), and Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::readValue().
|
inlineprivate |
Read a data value.
Definition at line 93 of file bitstream.h.
References Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::_stream.
Referenced by Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::readValue().
|
inlineprivate |
Read the next data value.
Definition at line 119 of file bitstream.h.
References Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::_value, Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::pos(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::readData(), and Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::size().
Referenced by Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::getBit().
|
inlinevirtual |
Rewind the bit stream back to the start.
Implements Common::BitStream.
Definition at line 213 of file bitstream.h.
References Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::_inValue, Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::_stream, and Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::_value.
|
inlinevirtual |
Return the stream size in bits.
Implements Common::BitStream.
Definition at line 236 of file bitstream.h.
References Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::_stream.
Referenced by Video::Bink::BinkAudioTrack::decodeAudio(), Sound::WMACodec::decodeSuperFrame(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::eos(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::readValue(), and Sound::CodebookLibrary::rebuild().
|
inlinevirtual |
Skip the specified amount of bits.
Implements Common::BitStream.
Definition at line 221 of file bitstream.h.
References Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::getBit().
Referenced by Video::Bink::BinkAudioTrack::decodeAudio(), Sound::WMACodec::decodeSuperFrame(), and Aurora::GFXFile::readFileAttributes().
|
private |
Position within the current value.
Definition at line 90 of file bitstream.h.
Referenced by Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::getBit(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::pos(), and Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::rewind().
|
private |
The input stream.
Definition at line 87 of file bitstream.h.
Referenced by Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::BitStreamImpl(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::eos(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::pos(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::readData(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::rewind(), and Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::size().
|
private |
Current value.
Definition at line 89 of file bitstream.h.
Referenced by Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::getBit(), Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::readValue(), and Common::BitStreamImpl< valueBits, isLE, isMSB2LSB >::rewind().