Grok  9.5.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
grk::BitIO Class Reference

#include <BitIO.h>

Inheritance diagram for grk::BitIO:
grk::IBitIO

Public Member Functions

 BitIO (uint8_t *bp, uint64_t len, bool isCompressor)
 
 BitIO (IBufferedStream *stream, bool isCompressor)
 
size_t numBytes ()
 Number of bytes written. More...
 
bool write (uint32_t v, uint32_t n)
 Write bits. More...
 
void read (uint32_t *bits, uint32_t n)
 Read bits. More...
 
bool flush ()
 Flush bits. More...
 
void inalign ()
 Passes the ending bits (coming from flushing) More...
 
bool putcommacode (uint8_t n)
 
void getcommacode (uint8_t *n)
 
bool putnumpasses (uint32_t n)
 
void getnumpasses (uint32_t *numpasses)
 
- Public Member Functions inherited from grk::IBitIO
virtual ~IBitIO ()
 

Private Member Functions

bool putbit (uint8_t b)
 
void getbit (uint32_t *bits, uint8_t pos)
 
bool writeByte ()
 
void bytein ()
 

Private Attributes

uint8_t * start
 
size_t offset
 
size_t buf_len
 
uint8_t buf
 
uint8_t ct
 
IBufferedStreamstream
 
bool read0xFF
 

Constructor & Destructor Documentation

◆ BitIO() [1/2]

grk::BitIO::BitIO ( uint8_t *  bp,
uint64_t  len,
bool  isCompressor 
)

◆ BitIO() [2/2]

grk::BitIO::BitIO ( IBufferedStream stream,
bool  isCompressor 
)

Member Function Documentation

◆ bytein()

void grk::BitIO::bytein ( )
private

References buf, buf_len, ct, grk::GRK_ERROR(), J2K_MS_EPH, J2K_MS_SOP, offset, read0xFF, and start.

Referenced by getbit(), and inalign().

◆ flush()

bool grk::BitIO::flush ( )
virtual

Flush bits.

Returns
true if successful, returns false otherwise

Implements grk::IBitIO.

References ct, and writeByte().

Referenced by grk::T2Compress::compressHeader().

◆ getbit()

void grk::BitIO::getbit ( uint32_t *  bits,
uint8_t  pos 
)
private

References buf, bytein(), and ct.

Referenced by read().

◆ getcommacode()

void grk::BitIO::getcommacode ( uint8_t *  n)

References read().

◆ getnumpasses()

void grk::BitIO::getnumpasses ( uint32_t *  numpasses)

References read().

◆ inalign()

void grk::BitIO::inalign ( )
virtual

Passes the ending bits (coming from flushing)

Implements grk::IBitIO.

References buf, bytein(), and ct.

◆ numBytes()

size_t grk::BitIO::numBytes ( )
virtual

Number of bytes written.

Returns
the number of bytes written

Implements grk::IBitIO.

References offset.

◆ putbit()

bool grk::BitIO::putbit ( uint8_t  b)
private

References buf, ct, and writeByte().

Referenced by write().

◆ putcommacode()

bool grk::BitIO::putcommacode ( uint8_t  n)

References write().

Referenced by grk::T2Compress::compressHeader().

◆ putnumpasses()

bool grk::BitIO::putnumpasses ( uint32_t  n)

References write().

Referenced by grk::T2Compress::compressHeader().

◆ read()

void grk::BitIO::read ( uint32_t *  bits,
uint32_t  n 
)
virtual

Read bits.

Parameters
bitspointer to bits buffer
nNumber of bits to read

Implements grk::IBitIO.

References getbit().

Referenced by grk::TagTree< T >::decodeValue(), getcommacode(), and getnumpasses().

◆ write()

bool grk::BitIO::write ( uint32_t  v,
uint32_t  n 
)
virtual

Write bits.

Parameters
vValue of bits
nNumber of bits to write

Implements grk::IBitIO.

References putbit().

Referenced by grk::TagTree< T >::compress(), grk::T2Compress::compressHeader(), putcommacode(), and putnumpasses().

◆ writeByte()

bool grk::BitIO::writeByte ( )
private

References buf, buf_len, ct, offset, stream, and grk::IBufferedStream::writeByte().

Referenced by flush(), and putbit().

Member Data Documentation

◆ buf

uint8_t grk::BitIO::buf
private

◆ buf_len

size_t grk::BitIO::buf_len
private

Referenced by bytein(), and writeByte().

◆ ct

uint8_t grk::BitIO::ct
private

◆ offset

size_t grk::BitIO::offset
private

Referenced by bytein(), numBytes(), and writeByte().

◆ read0xFF

bool grk::BitIO::read0xFF
private

Referenced by bytein().

◆ start

uint8_t* grk::BitIO::start
private

Referenced by bytein().

◆ stream

IBufferedStream* grk::BitIO::stream
private

Referenced by writeByte().


The documentation for this class was generated from the following files: