OpenJPEG 2.5.3
bio.c File Reference
#include "opj_includes.h"

Functions

Local static functions
static OPJ_UINT32 opj_bio_getbit (opj_bio_t *bio)
 Read a bit.
 
static OPJ_BOOL opj_bio_byteout (opj_bio_t *bio)
 Write a byte.
 
static OPJ_BOOL opj_bio_bytein (opj_bio_t *bio)
 Read a byte.
 
opj_bio_topj_bio_create (void)
 Create a new BIO handle.
 
void opj_bio_destroy (opj_bio_t *bio)
 Destroy a previously created BIO handle.
 
ptrdiff_t opj_bio_numbytes (opj_bio_t *bio)
 Number of bytes written.
 
void opj_bio_init_enc (opj_bio_t *bio, OPJ_BYTE *bp, OPJ_UINT32 len)
 Init encoder.
 
void opj_bio_init_dec (opj_bio_t *bio, OPJ_BYTE *bp, OPJ_UINT32 len)
 Init decoder.
 
void opj_bio_putbit (opj_bio_t *bio, OPJ_UINT32 b)
 Write a bit.
 
void opj_bio_write (opj_bio_t *bio, OPJ_UINT32 v, OPJ_UINT32 n)
 Write bits.
 
OPJ_UINT32 opj_bio_read (opj_bio_t *bio, OPJ_UINT32 n)
 Read bits.
 
OPJ_BOOL opj_bio_flush (opj_bio_t *bio)
 Flush bits.
 
OPJ_BOOL opj_bio_inalign (opj_bio_t *bio)
 Passes the ending bits (coming from flushing)
 

Function Documentation

◆ opj_bio_bytein()

static OPJ_BOOL opj_bio_bytein ( opj_bio_t * bio)
static

Read a byte.

Parameters
bioBIO handle
Returns
Returns OPJ_TRUE if successful, returns OPJ_FALSE otherwise

References opj_bio::bp, opj_bio::buf, opj_bio::ct, opj_bio::end, OPJ_FALSE, and OPJ_TRUE.

Referenced by opj_bio_getbit(), and opj_bio_inalign().

◆ opj_bio_byteout()

static OPJ_BOOL opj_bio_byteout ( opj_bio_t * bio)
static

Write a byte.

Parameters
bioBIO handle
Returns
Returns OPJ_TRUE if successful, returns OPJ_FALSE otherwise

References opj_bio::bp, opj_bio::buf, opj_bio::ct, opj_bio::end, OPJ_FALSE, and OPJ_TRUE.

Referenced by opj_bio_flush(), and opj_bio_putbit().

◆ opj_bio_create()

opj_bio_t * opj_bio_create ( void )

Create a new BIO handle.

Returns
Returns a new BIO handle if successful, returns NULL otherwise

References opj_malloc().

Referenced by opj_t2_encode_packet(), and opj_t2_read_packet_header().

◆ opj_bio_destroy()

void opj_bio_destroy ( opj_bio_t * bio)

Destroy a previously created BIO handle.

Parameters
bioBIO handle to destroy

References opj_free().

Referenced by opj_t2_encode_packet(), and opj_t2_read_packet_header().

◆ opj_bio_flush()

OPJ_BOOL opj_bio_flush ( opj_bio_t * bio)

Flush bits.

Parameters
bioBIO handle
Returns
Returns OPJ_TRUE if successful, returns OPJ_FALSE otherwise

References opj_bio::ct, opj_bio_byteout(), OPJ_FALSE, and OPJ_TRUE.

Referenced by opj_t2_encode_packet().

◆ opj_bio_getbit()

static OPJ_UINT32 opj_bio_getbit ( opj_bio_t * bio)
static

Read a bit.

Parameters
bioBIO handle
Returns
Returns the read bit

References opj_bio::buf, opj_bio::ct, and opj_bio_bytein().

Referenced by opj_bio_read().

◆ opj_bio_inalign()

OPJ_BOOL opj_bio_inalign ( opj_bio_t * bio)

Passes the ending bits (coming from flushing)

Parameters
bioBIO handle
Returns
Returns OPJ_TRUE if successful, returns OPJ_FALSE otherwise

References opj_bio::buf, opj_bio::ct, opj_bio_bytein(), OPJ_FALSE, and OPJ_TRUE.

Referenced by opj_t2_read_packet_header().

◆ opj_bio_init_dec()

void opj_bio_init_dec ( opj_bio_t * bio,
OPJ_BYTE * bp,
OPJ_UINT32 len )

Init decoder.

Parameters
bioBIO handle
bpInput buffer
lenInput buffer length

References opj_bio::bp, opj_bio::buf, opj_bio::ct, opj_bio::end, and opj_bio::start.

Referenced by opj_t2_read_packet_header().

◆ opj_bio_init_enc()

void opj_bio_init_enc ( opj_bio_t * bio,
OPJ_BYTE * bp,
OPJ_UINT32 len )

Init encoder.

Parameters
bioBIO handle
bpOutput buffer
lenOutput buffer length

References opj_bio::bp, opj_bio::buf, opj_bio::ct, opj_bio::end, and opj_bio::start.

Referenced by opj_t2_encode_packet().

◆ opj_bio_numbytes()

ptrdiff_t opj_bio_numbytes ( opj_bio_t * bio)

Number of bytes written.

Parameters
bioBIO handle
Returns
Returns the number of bytes written

References opj_bio::bp, and opj_bio::start.

Referenced by opj_t2_encode_packet(), and opj_t2_read_packet_header().

◆ opj_bio_putbit()

void opj_bio_putbit ( opj_bio_t * bio,
OPJ_UINT32 b )

Write a bit.

Parameters
bioBIO handle
bBit to write (0 or 1)

References opj_bio::buf, opj_bio::ct, and opj_bio_byteout().

Referenced by opj_bio_write(), opj_t2_encode_packet(), opj_t2_putcommacode(), opj_t2_putnumpasses(), and opj_tgt_encode().

◆ opj_bio_read()

OPJ_UINT32 opj_bio_read ( opj_bio_t * bio,
OPJ_UINT32 n )

Read bits.

Parameters
bioBIO handle
nNumber of bits to read
Returns
Returns the corresponding read number

References opj_bio_getbit().

Referenced by opj_t2_getcommacode(), opj_t2_getnumpasses(), opj_t2_read_packet_header(), and opj_tgt_decode().

◆ opj_bio_write()

void opj_bio_write ( opj_bio_t * bio,
OPJ_UINT32 v,
OPJ_UINT32 n )

Write bits.

Parameters
bioBIO handle
vValue of bits
nNumber of bits to write

References opj_bio_putbit().

Referenced by opj_t2_encode_packet(), and opj_t2_putnumpasses().