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

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().

opj_codestream_info::tw
int tw
number of tiles in X
Definition: openjpeg.h:694
opj_free
#define opj_free(m)
Deallocates or frees a memory block.
Definition: opj_malloc.h:152
opj_tile_info::marker
opj_marker_info_t * marker
list of markers
Definition: openjpeg.h:660
opj_jp2_box::type
int type
Definition: jp2.h:152
opj_tp_info::tp_end_header
int tp_end_header
end position of tile part header
Definition: openjpeg.h:620
opj_marker_info_t
Marker structure.
Definition: openjpeg.h:603
JPIP_THIX
#define JPIP_THIX
Definition: indexbox_manager.h:49
MAX
#define MAX(a, b)
Definition: tpix_manager.c:39
JPIP_MHIX
#define JPIP_MHIX
Definition: indexbox_manager.h:47
write_tpixfaix
int write_tpixfaix(int coff, int compno, opj_codestream_info_t cstr_info, int j2klen, opj_cio_t *cio)
Definition: tpix_manager.c:81
opj_calloc
#define opj_calloc(num, size)
Allocate a memory block with elements initialized to 0.
Definition: opj_malloc.h:63
cio_write
unsigned int cio_write(opj_cio_t *cio, unsigned int64 v, int n)
Write some bytes.
Definition: cio.c:167
opj_includes.h
opj_cio
Byte input-output stream (CIO)
Definition: openjpeg.h:475
opj_tp_info::tp_start_pos
int tp_start_pos
start position of tile part
Definition: openjpeg.h:618
opj_tp_info
Index structure : Information concerning tile-parts.
Definition: openjpeg.h:616
opj_jp2_box
JP2 Box.
Definition: jp2.h:150
cio_tell
int OPJ_CALLCONV cio_tell(opj_cio_t *cio)
Get position in byte stream.
Definition: cio.c:100
opj_tile_info::num_tps
int num_tps
number of tile parts
Definition: openjpeg.h:664
write_tilemhix
int write_tilemhix(int coff, opj_codestream_info_t cstr_info, int tileno, opj_cio_t *cio)
Definition: thix_manager.c:86
write_thix
int write_thix(int coff, opj_codestream_info_t cstr_info, opj_cio_t *cio)
Definition: thix_manager.c:52
cio_skip
void cio_skip(opj_cio_t *cio, int n)
Skip some bytes.
Definition: cio.c:198
write_manf
void write_manf(int second, int v, opj_jp2_box_t *box, opj_cio_t *cio)
Definition: cidx_manager.c:143
JPIP_TPIX
#define JPIP_TPIX
Definition: indexbox_manager.h:48
write_tpix
int write_tpix(int coff, opj_codestream_info_t cstr_info, int j2klen, opj_cio_t *cio)
Definition: tpix_manager.c:55
opj_tile_info::marknum
int marknum
number of markers
Definition: openjpeg.h:658
cio_seek
void OPJ_CALLCONV cio_seek(opj_cio_t *cio, int pos)
Set position in byte stream.
Definition: cio.c:109
opj_codestream_info::tile
opj_tile_info_t * tile
information regarding tiles inside image
Definition: openjpeg.h:718
opj_codestream_info
Index structure of the codestream.
Definition: openjpeg.h:672
opj_tile_info::tp
opj_tp_info_t * tp
information concerning tile parts
Definition: openjpeg.h:666
opj_tile_info
Index structure : information regarding tiles.
Definition: openjpeg.h:632
opj_jp2_box::length
int length
Definition: jp2.h:151
JPIP_FAIX
#define JPIP_FAIX
Definition: indexbox_manager.h:46
opj_codestream_info::numdecompos
int * numdecompos
number of decomposition for each component
Definition: openjpeg.h:702
opj_codestream_info::th
int th
number of tiles in Y
Definition: openjpeg.h:696
opj_tp_info::tp_end_pos
int tp_end_pos
end position of tile part
Definition: openjpeg.h:622
get_num_max_tile_parts
int get_num_max_tile_parts(opj_codestream_info_t cstr_info)
Definition: tpix_manager.c:145