62 #define MS_BIT (1 << (CHAR_BIT - 1)) 66 #define BIT_IN_CHAR(bit) (1 << bit) 80 ByteIO(
bool new_stream=
true);
98 { dirac_byte_stats.
Clear(); }
103 virtual const std::string
GetBytes();
152 inline void SetBits(
unsigned char& c,
unsigned char bits)
const { c |= bits; }
240 for(
int i=0; i < byte_size; ++i)
260 for(
int index=0; index < count; ++index)
295 mp_stream->seekg(std::max(cur_pos,0), std::ios_base::beg);
327 for(
int i=length-1; i >=0 ; --i)
329 unsigned char cp = (value>>(i*8))&0xff;
341 inline void SeekGet(
const int offset, std::ios_base::seekdir dir)
int ReadSint()
Reads a signed integer in interleaved exp-Golomb format return Signed integer read.
virtual ~ByteIO()
Destructor.
void ByteAlignOutput()
Sync input for byte-alignment.
unsigned int ReadNBits(int count)
Reads next 'count' bits.
void OutputBytes(const std::string &bytes)
Outputs a series of bytes.
Definition: byteio.h:290
Definition: band_vlc.h:55
unsigned int ReadUintB()
Reads an unsigned integer in interleaved exp Golomb format from bounded input.
void InputBytes(char *data, int count)
Reads from stream.
Definition: byteio.h:192
void WriteSint(int val)
Outputs an integer in Golomb signed integer format.
unsigned int ReadUintLit(const int byte_size)
Reads a fixed length unsigned integer from the stream in big endian.
Definition: byteio.h:238
std::string InputUnString(const int count)
Reads a series of bytes from a stream.
Definition: byteio.h:257
void ByteAlignInput()
Sync input for byte-alignment.
unsigned int ReadUint()
Reads an unsigned integer in interleaved exp Golomb format.
void FlushInputB()
Flushes the bounde input.
bool ReadBool()
Reads boolean value.
int ReadBitB()
Reads next bit - bounded i/o.
void RemoveRedundantBytes(const int count)
Removes portion of byte-stream no longer required.
unsigned char InputUnByte()
Reads a byte from the stream.
Definition: byteio.h:252
int m_num_bytes
Number of bytes processed.
Definition: byteio.h:377
void WriteUintLit(const unsigned int &value, const int &length)
Output unsigned int value in big endian format.
Definition: byteio.h:325
void SeekGet(const int offset, std::ios_base::seekdir dir)
Definition: byteio.h:341
int ReadSintB()
Reads a signed integer in interleaved exp-Golomb format from bounded input return Signed integer read...
#define BIT_IN_CHAR(bit)
Definition: byteio.h:66
void SetBit(unsigned char &c, int pos) const
Definition: byteio.h:150
int m_bits_left
num bits left to read
Definition: byteio.h:387
void OutputCurrentByte()
Outputs current byte contents.
Definition: byteio.h:301
virtual const std::string GetBytes()
Get bytes in Dirac-bytestream format.
virtual void CollateByteStats(DiracByteStats &dirac_byte_stats)
Gathers byte-stream statistics.
Definition: byteio.h:97
void SetBitsLeft(int left_bits)
Sets input size in bits.
Definition: byteio.h:137
int ReadBit()
Reads next bit.
int WriteNBits(unsigned int val)
Outputs an unsigned integer.
int GetReadBytePosition() const
Get position of read stream pointer.
Definition: byteio.h:108
Class DiracByteStats - for collecting statistics on aspects of the Dirac byte-stream.
Definition: dirac_byte_stats.h:70
std::stringstream * mp_stream
Input/output steam.
Definition: byteio.h:349
bool GetBit(unsigned char &c, int pos) const
Definition: byteio.h:148
void WriteUint(unsigned int value)
Ouputs an unsigned integer in interleaved exp Golomb format.
unsigned char m_current_byte
Char used for temporary storage of op data bits.
Definition: byteio.h:367
Definition of class SequenceHeaderByteIO.
Definition: accessunit_byteio.h:51
virtual int GetSize() const
Gets size (in bytes)
int m_current_pos
Used to set individual bit within the current header byte.
Definition: byteio.h:372
bool CanRead() const
Definition: byteio.h:146
bool m_new_stream
stream alloc flag
Definition: byteio.h:382
void SetByteParams(const ByteIO &byte_io)
Copies stream source/destination info.
Class ByteIO - top-level class for reading/writing bytes to a stream.
Definition: byteio.h:72
bool ReadBoolB()
Reads boolean value - bounded i/o.
ByteIO(bool new_stream=true)
Default constructor.
Definition: arith_codec.h:95
void WriteBit(const bool &bit)
Outputs a bit.
int BitsLeft(void)
Sets input size in bits.
Definition: byteio.h:142
void SetBits(unsigned char &c, unsigned char bits) const
Definition: byteio.h:152