OpenJPEG 1.5.1
Functions
cio.c File Reference
#include "opj_includes.h"
#include <assert.h>

Functions

opj_cio_t *OPJ_CALLCONV opj_cio_open (opj_common_ptr cinfo, unsigned char *buffer, int length)
 Open and allocate a memory stream for read / write.
 
void OPJ_CALLCONV opj_cio_close (opj_cio_t *cio)
 Close and free a CIO handle.
 
int OPJ_CALLCONV cio_tell (opj_cio_t *cio)
 Get position in byte stream.
 
void OPJ_CALLCONV cio_seek (opj_cio_t *cio, int pos)
 Set position in byte stream.
 
int cio_numbytesleft (opj_cio_t *cio)
 Number of bytes left before the end of the stream.
 
unsigned char * cio_getbp (opj_cio_t *cio)
 Get pointer to the current position in the stream.
 
opj_bool cio_byteout (opj_cio_t *cio, unsigned char v)
 
unsigned char cio_bytein (opj_cio_t *cio)
 
unsigned int cio_write (opj_cio_t *cio, unsigned int64 v, int n)
 Write some bytes.
 
unsigned int cio_read (opj_cio_t *cio, int n)
 Read some bytes.
 
void cio_skip (opj_cio_t *cio, int n)
 Skip some bytes.
 

Function Documentation

◆ cio_bytein()

unsigned char cio_bytein ( opj_cio_t cio)

◆ cio_byteout()

opj_bool cio_byteout ( opj_cio_t cio,
unsigned char  v 
)

◆ cio_getbp()

unsigned char * cio_getbp ( opj_cio_t cio)

Get pointer to the current position in the stream.

Parameters
cioCIO handle
Returns
Returns a pointer to the current position

References opj_cio::bp.

Referenced by j2k_read_sod(), j2k_read_sot(), j2k_write_sod(), jp2_read_colr(), jpwl_dump_marks(), and jpwl_prepare_marks().

◆ cio_numbytesleft()

int cio_numbytesleft ( opj_cio_t cio)

Number of bytes left before the end of the stream.

Parameters
cioCIO handle
Returns
Returns the number of bytes before the end of the stream

References opj_cio::bp, and opj_cio::end.

Referenced by j2k_decode(), j2k_decode_jpt_stream(), j2k_read_soc(), j2k_read_sod(), j2k_read_sot(), j2k_write_sod(), jp2_read_boxhdr(), jp2_read_ftyp(), and jpwl_epb_correct().

◆ cio_read()

unsigned int cio_read ( opj_cio_t cio,
int  n 
)

◆ cio_seek()

void OPJ_CALLCONV cio_seek ( opj_cio_t cio,
int  pos 
)

◆ cio_skip()

void cio_skip ( opj_cio_t cio,
int  n 
)

◆ cio_tell()

int OPJ_CALLCONV cio_tell ( opj_cio_t cio)

◆ cio_write()

unsigned int cio_write ( opj_cio_t cio,
unsigned int64  v,
int  n 
)

◆ opj_cio_close()

void OPJ_CALLCONV opj_cio_close ( opj_cio_t cio)

Close and free a CIO handle.

Parameters
cioCIO handle to free

References opj_cio::buffer, opj_cio::openmode, opj_free, and OPJ_STREAM_WRITE.

◆ opj_cio_open()

opj_cio_t *OPJ_CALLCONV opj_cio_open ( opj_common_ptr  cinfo,
unsigned char *  buffer,
int  length 
)

Open and allocate a memory stream for read / write.

On reading, the user must provide a buffer containing encoded data. The buffer will be wrapped by the returned CIO handle. On writing, buffer parameters must be set to 0: a buffer will be allocated by the library to contain encoded data.

Parameters
cinfoCodec context info
bufferReading: buffer address. Writing: NULL
lengthReading: buffer length. Writing: 0
Returns
Returns a CIO handle if successful, returns NULL otherwise

References opj_cio::bp, opj_cio::buffer, opj_cio::cinfo, CODEC_J2K, CODEC_JP2, opj_cio::end, EVT_ERROR, opj_cp::img_size, opj_cio::length, opj_cio::openmode, opj_event_msg(), opj_free, opj_malloc, OPJ_STREAM_READ, OPJ_STREAM_WRITE, and opj_cio::start.