Grok  7.6.3
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...
 
void simulateOutput (bool doSimulate)
 
void putcommacode (int32_t n)
 
void getcommacode (uint32_t *n)
 
void 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 byteout ()
 
bool byteout_stream ()
 
void bytein ()
 

Private Attributes

uint8_t * start
 
size_t offset
 
size_t buf_len
 
uint8_t buf
 
uint8_t ct
 
bool sim_out
 
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().

◆ byteout()

bool grk::BitIO::byteout ( )
private

References buf, buf_len, byteout_stream(), ct, offset, sim_out, start, and stream.

Referenced by flush(), and putbit().

◆ byteout_stream()

bool grk::BitIO::byteout_stream ( )
private

References buf, ct, stream, and grk::IBufferedStream::write_byte().

Referenced by byteout().

◆ flush()

bool grk::BitIO::flush ( )
virtual

Flush bits.

Returns
true if successful, returns false otherwise

Implements grk::IBitIO.

References byteout(), and ct.

◆ 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 ( uint32_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, byteout(), and ct.

Referenced by write().

◆ putcommacode()

void grk::BitIO::putcommacode ( int32_t  n)

References write().

◆ putnumpasses()

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

References write().

◆ 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::decodeValue(), getcommacode(), and getnumpasses().

◆ simulateOutput()

void grk::BitIO::simulateOutput ( bool  doSimulate)
inline

References sim_out.

◆ 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::compress(), putcommacode(), and putnumpasses().

Member Data Documentation

◆ buf

uint8_t grk::BitIO::buf
private

◆ buf_len

size_t grk::BitIO::buf_len
private

Referenced by bytein(), and byteout().

◆ ct

uint8_t grk::BitIO::ct
private

◆ offset

size_t grk::BitIO::offset
private

Referenced by bytein(), byteout(), and numbytes().

◆ read0xFF

bool grk::BitIO::read0xFF
private

Referenced by bytein().

◆ sim_out

bool grk::BitIO::sim_out
private

Referenced by byteout(), and simulateOutput().

◆ start

uint8_t* grk::BitIO::start
private

Referenced by bytein(), and byteout().

◆ stream

IBufferedStream* grk::BitIO::stream
private

Referenced by byteout(), and byteout_stream().


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