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

Functions

Local static functions
static void bio_putbit (opj_bio_t *bio, int b)
 Write a bit.
 
static int bio_getbit (opj_bio_t *bio)
 Read a bit.
 
static int bio_byteout (opj_bio_t *bio)
 Write a byte.
 
static int bio_bytein (opj_bio_t *bio)
 Read a byte.
 
opj_bio_tbio_create (void)
 Create a new BIO handle.
 
void bio_destroy (opj_bio_t *bio)
 Destroy a previously created BIO handle.
 
int bio_numbytes (opj_bio_t *bio)
 Number of bytes written.
 
void bio_init_enc (opj_bio_t *bio, unsigned char *bp, int len)
 Init encoder.
 
void bio_init_dec (opj_bio_t *bio, unsigned char *bp, int len)
 Init decoder.
 
void bio_write (opj_bio_t *bio, int v, int n)
 Write bits.
 
int bio_read (opj_bio_t *bio, int n)
 Read bits.
 
int bio_flush (opj_bio_t *bio)
 Flush bits.
 
int bio_inalign (opj_bio_t *bio)
 Passes the ending bits (coming from flushing)
 

Function Documentation

◆ bio_bytein()

static int bio_bytein ( opj_bio_t bio)
static

Read a byte.

Parameters
bioBIO handle
Returns
Returns 0 if successful, returns 1 otherwise

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

Referenced by bio_getbit(), and bio_inalign().

◆ bio_byteout()

static int bio_byteout ( opj_bio_t bio)
static

Write a byte.

Parameters
bioBIO handle
Returns
Returns 0 if successful, returns 1 otherwise

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

Referenced by bio_flush(), and bio_putbit().

◆ bio_create()

opj_bio_t * bio_create ( void  )

Create a new BIO handle.

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

References opj_malloc.

Referenced by t2_decode_packet(), and t2_encode_packet().

◆ bio_destroy()

void bio_destroy ( opj_bio_t bio)

Destroy a previously created BIO handle.

Parameters
bioBIO handle to destroy

References opj_free.

Referenced by t2_decode_packet(), and t2_encode_packet().

◆ bio_flush()

int bio_flush ( opj_bio_t bio)

Flush bits.

Parameters
bioBIO handle
Returns
Returns 1 if successful, returns 0 otherwise

References bio_byteout(), and opj_bio::ct.

Referenced by t2_encode_packet().

◆ bio_getbit()

static int bio_getbit ( opj_bio_t bio)
static

Read a bit.

Parameters
bioBIO handle
Returns
Returns the read bit

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

Referenced by bio_read().

◆ bio_inalign()

int bio_inalign ( opj_bio_t bio)

Passes the ending bits (coming from flushing)

Parameters
bioBIO handle
Returns
Returns 1 if successful, returns 0 otherwise

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

Referenced by t2_decode_packet().

◆ bio_init_dec()

void bio_init_dec ( opj_bio_t bio,
unsigned char *  bp,
int  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 t2_decode_packet().

◆ bio_init_enc()

void bio_init_enc ( opj_bio_t bio,
unsigned char *  bp,
int  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 t2_encode_packet().

◆ bio_numbytes()

int 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 t2_decode_packet(), and t2_encode_packet().

◆ bio_putbit()

static void bio_putbit ( opj_bio_t bio,
int  b 
)
static

Write a bit.

Parameters
bioBIO handle
bBit to write (0 or 1)

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

Referenced by bio_write().

◆ bio_read()

int bio_read ( opj_bio_t bio,
int  n 
)

Read bits.

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

References bio_getbit().

Referenced by t2_decode_packet(), t2_getcommacode(), t2_getnumpasses(), and tgt_decode().

◆ bio_write()

void bio_write ( opj_bio_t bio,
int  v,
int  n 
)

Write bits.

Parameters
bioBIO handle
vValue of bits
nNumber of bits to write

References bio_putbit().

Referenced by t2_encode_packet(), t2_putcommacode(), t2_putnumpasses(), and tgt_encode().