Data Structures | Defines | Typedefs

JP2 - JPEG-2000 file format reader/writer

Data Structures

struct  opj_jp2_cdef_info
 Channel description: channel index, type, assocation. More...
struct  opj_jp2_cdef
 Channel descriptions and number of descriptions. More...
struct  opj_jp2_cmap_comp
 Component mappings: channel index, mapping type, palette index. More...
struct  opj_jp2_pclr
 Palette data: table entries, palette columns. More...
struct  opj_jp2_color
 Collector for ICC profile, palette, component mapping, channel description. More...
struct  opj_jp2_comps
 JP2 component. More...
struct  opj_jp2
 JPEG-2000 file format reader/writer. More...
struct  opj_jp2_box
 JP2 Box. More...

Defines

#define JPIP_JPIP   0x6a706970
#define JP2_JP   0x6a502020
 JPEG 2000 signature box.
#define JP2_FTYP   0x66747970
 File type box.
#define JP2_JP2H   0x6a703268
 JP2 header box.
#define JP2_IHDR   0x69686472
 Image header box.
#define JP2_COLR   0x636f6c72
 Colour specification box.
#define JP2_JP2C   0x6a703263
 Contiguous codestream box.
#define JP2_URL   0x75726c20
 URL box.
#define JP2_DTBL   0x6474626c
 Data Reference box.
#define JP2_BPCC   0x62706363
 Bits per component box.
#define JP2_JP2   0x6a703220
 File type fields.
#define JP2_PCLR   0x70636c72
 Palette box.
#define JP2_CMAP   0x636d6170
 Component Mapping box.
#define JP2_CDEF   0x63646566
 Channel Definition box.

Typedefs

typedef struct opj_jp2_cdef_info opj_jp2_cdef_info_t
 Channel description: channel index, type, assocation.
typedef struct opj_jp2_cdef opj_jp2_cdef_t
 Channel descriptions and number of descriptions.
typedef struct opj_jp2_cmap_comp opj_jp2_cmap_comp_t
 Component mappings: channel index, mapping type, palette index.
typedef struct opj_jp2_pclr opj_jp2_pclr_t
 Palette data: table entries, palette columns.
typedef struct opj_jp2_color opj_jp2_color_t
 Collector for ICC profile, palette, component mapping, channel description.
typedef struct opj_jp2_comps opj_jp2_comps_t
 JP2 component.
typedef struct opj_jp2 opj_jp2_t
 JPEG-2000 file format reader/writer.
typedef struct opj_jp2_box opj_jp2_box_t
 JP2 Box.

Local static functions

static bool jp2_read_boxhdr (opj_common_ptr cinfo, opj_cio_t *cio, opj_jp2_box_t *box)
 Read box headers.
static bool jp2_read_ihdr (opj_jp2_t *jp2, opj_cio_t *cio)
 Read the IHDR box - Image Header box.
static void jp2_write_ihdr (opj_jp2_t *jp2, opj_cio_t *cio)
static void jp2_write_bpcc (opj_jp2_t *jp2, opj_cio_t *cio)
static bool jp2_read_bpcc (opj_jp2_t *jp2, opj_cio_t *cio)
static void jp2_write_colr (opj_jp2_t *jp2, opj_cio_t *cio)
static void jp2_write_ftyp (opj_jp2_t *jp2, opj_cio_t *cio)
 Write the FTYP box - File type box.
static bool jp2_read_ftyp (opj_jp2_t *jp2, opj_cio_t *cio)
 Read the FTYP box - File type box.
static int jp2_write_jp2c (opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info)
static bool jp2_read_jp2c (opj_jp2_t *jp2, opj_cio_t *cio, unsigned int *j2k_codestream_length, unsigned int *j2k_codestream_offset)
static void jp2_write_jp (opj_cio_t *cio)
static bool jp2_read_jp (opj_jp2_t *jp2, opj_cio_t *cio)
 Read the JP box - JPEG 2000 signature.
static bool jp2_read_struct (opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_color_t *color)
 Decode the structure of a JP2 file.
static void jp2_apply_pclr (opj_jp2_color_t *color, opj_image_t *image)
 Apply collected palette data.
static bool jp2_read_pclr (opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_box_t *box, opj_jp2_color_t *color)
 Collect palette data.
static bool jp2_read_cmap (opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_box_t *box, opj_jp2_color_t *color)
 Collect component mapping data.
static bool jp2_read_colr (opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_box_t *box, opj_jp2_color_t *color)
 Collect colour specification data.

Exported functions

void jp2_write_jp2h (opj_jp2_t *jp2, opj_cio_t *cio)
 Write the JP2H box - JP2 Header box (used in MJ2)
bool jp2_read_jp2h (opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_color_t *color)
 Read the JP2H box - JP2 Header box (used in MJ2)
opj_jp2_tjp2_create_decompress (opj_common_ptr cinfo)
 Creates a JP2 decompression structure.
void jp2_destroy_decompress (opj_jp2_t *jp2)
 Destroy a JP2 decompressor handle.
void jp2_setup_decoder (opj_jp2_t *jp2, opj_dparameters_t *parameters)
 Setup the decoder decoding parameters using user parameters.
opj_image_tjp2_decode (opj_jp2_t *jp2, opj_cio_t *cio, opj_codestream_info_t *cstr_info)
 Decode an image from a JPEG-2000 file stream.
opj_jp2_tjp2_create_compress (opj_common_ptr cinfo)
 Creates a JP2 compression structure.
void jp2_destroy_compress (opj_jp2_t *jp2)
 Destroy a JP2 compressor handle.
void jp2_setup_encoder (opj_jp2_t *jp2, opj_cparameters_t *parameters, opj_image_t *image)
 Setup the encoder parameters using the current image and using user parameters.
bool jp2_encode (opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info)
 Encode an image into a JPEG-2000 file stream.

Define Documentation

#define JP2_BPCC   0x62706363

Bits per component box.

Referenced by jp2_read_bpcc(), and jp2_write_bpcc().

#define JP2_CDEF   0x63646566

Channel Definition box.

Referenced by jp2_read_jp2h().

#define JP2_CMAP   0x636d6170

Component Mapping box.

Referenced by jp2_read_jp2h().

#define JP2_COLR   0x636f6c72

Colour specification box.

Referenced by jp2_read_jp2h(), and jp2_write_colr().

#define JP2_DTBL   0x6474626c

Data Reference box.

#define JP2_FTYP   0x66747970

File type box.

Referenced by jp2_read_ftyp(), and jp2_write_ftyp().

#define JP2_IHDR   0x69686472

Image header box.

Referenced by jp2_read_ihdr(), and jp2_write_ihdr().

#define JP2_JP   0x6a502020

JPEG 2000 signature box.

Referenced by jp2_read_jp(), and jp2_write_jp().

#define JP2_JP2   0x6a703220

File type fields.

Referenced by jp2_setup_encoder().

#define JP2_JP2C   0x6a703263

Contiguous codestream box.

Referenced by jp2_read_jp2c(), jp2_read_jp2h(), and jp2_write_jp2c().

#define JP2_JP2H   0x6a703268

JP2 header box.

Referenced by jp2_read_jp2h(), and jp2_write_jp2h().

#define JP2_PCLR   0x70636c72

Palette box.

Referenced by jp2_read_jp2h().

#define JP2_URL   0x75726c20

URL box.

#define JPIP_JPIP   0x6a706970

Typedef Documentation

typedef struct opj_jp2_box opj_jp2_box_t

JP2 Box.

Channel description: channel index, type, assocation.

typedef struct opj_jp2_cdef opj_jp2_cdef_t

Channel descriptions and number of descriptions.

Component mappings: channel index, mapping type, palette index.

Collector for ICC profile, palette, component mapping, channel description.

JP2 component.

typedef struct opj_jp2_pclr opj_jp2_pclr_t

Palette data: table entries, palette columns.

typedef struct opj_jp2 opj_jp2_t

JPEG-2000 file format reader/writer.


Function Documentation

static void jp2_apply_pclr ( opj_jp2_color_t color,
opj_image_t image 
) [static]
opj_jp2_t* jp2_create_compress ( opj_common_ptr  cinfo )

Creates a JP2 compression structure.

Parameters:
cinfoCodec context info
Returns:
Returns a handle to a JP2 compressor if successful, returns NULL otherwise

References opj_jp2::cinfo, opj_jp2::j2k, j2k_create_compress(), jp2_destroy_compress(), and opj_malloc.

Referenced by opj_create_compress().

opj_jp2_t* jp2_create_decompress ( opj_common_ptr  cinfo )

Creates a JP2 decompression structure.

Parameters:
cinfoCodec context info
Returns:
Returns a handle to a JP2 decompressor if successful, returns NULL otherwise

References opj_jp2::cinfo, opj_jp2::j2k, j2k_create_decompress(), jp2_destroy_decompress(), and opj_calloc.

Referenced by opj_create_decompress().

opj_image_t* jp2_decode ( opj_jp2_t jp2,
opj_cio_t cio,
opj_codestream_info_t cstr_info 
)

Decode an image from a JPEG-2000 file stream.

Parameters:
jp2JP2 decompressor handle
cioInput buffer stream
cstr_infoCodestream information structure if required, NULL otherwise
Returns:
Returns a decoded image if successful, returns NULL otherwise

References opj_jp2::cinfo, CLRSPC_GRAY, CLRSPC_SRGB, CLRSPC_SYCC, CLRSPC_UNKNOWN, opj_jp2_pclr::cmap, opj_image::color_space, opj_jp2::enumcs, EVT_ERROR, free_color_data(), opj_image::icc_profile_buf, opj_jp2_color::icc_profile_buf, opj_jp2_color::icc_profile_len, opj_image::icc_profile_len, opj_jp2::j2k, j2k_decode(), jp2_apply_cdef(), jp2_apply_pclr(), opj_jp2_color::jp2_cdef, jp2_free_pclr(), opj_jp2_color::jp2_pclr, jp2_read_struct(), and opj_event_msg().

Referenced by opj_decode_with_info().

void jp2_destroy_compress ( opj_jp2_t jp2 )

Destroy a JP2 compressor handle.

Parameters:
jp2JP2 compressor handle to destroy

References opj_jp2::cl, opj_jp2::comps, opj_jp2::j2k, j2k_destroy_compress(), and opj_free.

Referenced by jp2_create_compress(), and opj_destroy_compress().

void jp2_destroy_decompress ( opj_jp2_t jp2 )

Destroy a JP2 decompressor handle.

Parameters:
jp2JP2 decompressor handle to destroy

References opj_jp2::cl, opj_jp2::comps, opj_jp2::j2k, j2k_destroy_decompress(), and opj_free.

Referenced by jp2_create_decompress(), and opj_destroy_decompress().

bool jp2_encode ( opj_jp2_t jp2,
opj_cio_t cio,
opj_image_t image,
opj_codestream_info_t cstr_info 
)

Encode an image into a JPEG-2000 file stream.

Parameters:
jp2JP2 compressor handle
cioOutput buffer stream
imageImage to encode
cstr_infoCodestream information structure if required, NULL otherwise
Returns:
Returns true if successful, returns false otherwise

References opj_jp2::cinfo, EVT_ERROR, jp2_write_ftyp(), jp2_write_jp(), jp2_write_jp2c(), jp2_write_jp2h(), and opj_event_msg().

Referenced by opj_encode_with_info().

static bool jp2_read_boxhdr ( opj_common_ptr  cinfo,
opj_cio_t cio,
opj_jp2_box_t box 
) [static]

Read box headers.

Parameters:
cinfoCodec context info
cioInput stream
box
Returns:
Returns true if successful, returns false otherwise

References cio_numbytesleft(), cio_read(), cio_tell(), EVT_ERROR, opj_jp2_box::init_pos, opj_jp2_box::length, opj_event_msg(), and opj_jp2_box::type.

Referenced by jp2_read_bpcc(), jp2_read_ftyp(), jp2_read_ihdr(), jp2_read_jp(), jp2_read_jp2c(), and jp2_read_jp2h().

static bool jp2_read_bpcc ( opj_jp2_t jp2,
opj_cio_t cio 
) [static]
static bool jp2_read_cmap ( opj_jp2_t jp2,
opj_cio_t cio,
opj_jp2_box_t box,
opj_jp2_color_t color 
) [static]

Collect component mapping data.

Parameters:
jp2JP2 handle
cioInput buffer stream
box
colorCollector for profile, cdef and pclr data
Returns:
Returns true if successful, returns false otherwise

References cio_read(), opj_jp2_pclr::cmap, opj_jp2_cmap_comp::cmp, opj_jp2_color::jp2_pclr, opj_jp2_cmap_comp::mtyp, opj_jp2_pclr::nr_channels, opj_malloc, and opj_jp2_cmap_comp::pcol.

Referenced by jp2_read_jp2h().

static bool jp2_read_colr ( opj_jp2_t jp2,
opj_cio_t cio,
opj_jp2_box_t box,
opj_jp2_color_t color 
) [static]

Collect colour specification data.

Parameters:
jp2JP2 handle
cioInput buffer stream
box
colorCollector for profile, cdef and pclr data
Returns:
Returns true if successful, returns false otherwise

References opj_jp2::approx, opj_jp2::cinfo, cio_getbp(), cio_read(), cio_skip(), cio_tell(), opj_jp2::enumcs, EVT_ERROR, opj_jp2_color::icc_profile_buf, opj_jp2_color::icc_profile_len, opj_jp2_box::init_pos, opj_jp2_color::jp2_has_colr, opj_jp2_box::length, opj_jp2::meth, opj_event_msg(), opj_malloc, and opj_jp2::precedence.

Referenced by jp2_read_jp2h().

static bool jp2_read_ftyp ( opj_jp2_t jp2,
opj_cio_t cio 
) [static]

Read the FTYP box - File type box.

Parameters:
jp2JP2 handle
cioInput buffer stream
Returns:
Returns true if successful, returns false otherwise

References opj_jp2::brand, opj_jp2::cinfo, cio_read(), cio_tell(), opj_jp2::cl, EVT_ERROR, opj_jp2_box::init_pos, JP2_FTYP, jp2_read_boxhdr(), opj_jp2_box::length, opj_jp2::minversion, opj_jp2::numcl, opj_event_msg(), opj_malloc, and opj_jp2_box::type.

Referenced by jp2_read_struct().

static bool jp2_read_ihdr ( opj_jp2_t jp2,
opj_cio_t cio 
) [static]

Read the IHDR box - Image Header box.

Parameters:
jp2JP2 handle
cioInput buffer stream
Returns:
Returns true if successful, returns false otherwise

References opj_jp2::bpc, opj_jp2::C, opj_jp2::cinfo, cio_read(), cio_tell(), opj_jp2::comps, EVT_ERROR, opj_jp2::h, opj_jp2_box::init_pos, opj_jp2::IPR, JP2_IHDR, jp2_read_boxhdr(), opj_jp2_box::length, opj_jp2::numcomps, opj_event_msg(), opj_malloc, opj_jp2_box::type, opj_jp2::UnkC, and opj_jp2::w.

Referenced by jp2_read_jp2h().

static bool jp2_read_jp ( opj_jp2_t jp2,
opj_cio_t cio 
) [static]

Read the JP box - JPEG 2000 signature.

Parameters:
jp2JP2 handle
cioInput buffer stream
Returns:
Returns true if successful, returns false otherwise

References opj_jp2::cinfo, cio_read(), cio_tell(), EVT_ERROR, opj_jp2_box::init_pos, JP2_JP, jp2_read_boxhdr(), opj_jp2_box::length, opj_event_msg(), and opj_jp2_box::type.

Referenced by jp2_read_struct().

static bool jp2_read_jp2c ( opj_jp2_t jp2,
opj_cio_t cio,
unsigned int *  j2k_codestream_length,
unsigned int *  j2k_codestream_offset 
) [static]
bool jp2_read_jp2h ( opj_jp2_t jp2,
opj_cio_t cio,
opj_jp2_color_t color 
)

Read the JP2H box - JP2 Header box (used in MJ2)

Parameters:
jp2JP2 handle
cioInput buffer stream
extCollector for profile, cdef and pclr data
Returns:
Returns true if successful, returns false otherwise

References opj_cio::bp, opj_jp2::bpc, opj_jp2::cinfo, cio_seek(), cio_skip(), cio_tell(), opj_cio::end, EVT_ERROR, opj_jp2_box::init_pos, JP2_CDEF, JP2_CMAP, JP2_COLR, opj_jp2_color::jp2_has_colr, JP2_JP2C, JP2_JP2H, JP2_PCLR, jp2_read_boxhdr(), jp2_read_bpcc(), jp2_read_cdef(), jp2_read_cmap(), jp2_read_colr(), jp2_read_ihdr(), jp2_read_pclr(), opj_jp2_box::length, opj_event_msg(), and opj_jp2_box::type.

Referenced by jp2_read_struct().

static bool jp2_read_pclr ( opj_jp2_t jp2,
opj_cio_t cio,
opj_jp2_box_t box,
opj_jp2_color_t color 
) [static]

Collect palette data.

Parameters:
jp2JP2 handle
cioInput buffer stream
box
colorCollector for profile, cdef and pclr data
Returns:
Returns true if successful, returns false otherwise

References opj_jp2_pclr::channel_sign, opj_jp2_pclr::channel_size, cio_read(), opj_jp2_pclr::cmap, opj_jp2_pclr::entries, opj_jp2_color::jp2_pclr, opj_jp2_pclr::nr_channels, opj_jp2_pclr::nr_entries, and opj_malloc.

Referenced by jp2_read_jp2h().

static bool jp2_read_struct ( opj_jp2_t jp2,
opj_cio_t cio,
opj_jp2_color_t color 
) [static]

Decode the structure of a JP2 file.

Parameters:
jp2JP2 handle
cioInput buffer stream
colorCollector for profile, cdef and pclr data
Returns:
Returns true if successful, returns false otherwise

References opj_jp2::j2k_codestream_length, opj_jp2::j2k_codestream_offset, jp2_read_ftyp(), jp2_read_jp(), jp2_read_jp2c(), and jp2_read_jp2h().

Referenced by jp2_decode().

void jp2_setup_decoder ( opj_jp2_t jp2,
opj_dparameters_t parameters 
)

Setup the decoder decoding parameters using user parameters.

Decoding parameters are returned in jp2->j2k->cp.

Parameters:
jp2JP2 decompressor handle
parametersdecompression parameters

References opj_jp2::j2k, and j2k_setup_decoder().

Referenced by opj_setup_decoder().

void jp2_setup_encoder ( opj_jp2_t jp2,
opj_cparameters_t parameters,
opj_image_t image 
)
static void jp2_write_bpcc ( opj_jp2_t jp2,
opj_cio_t cio 
) [static]
static void jp2_write_colr ( opj_jp2_t jp2,
opj_cio_t cio 
) [static]
static void jp2_write_ftyp ( opj_jp2_t jp2,
opj_cio_t cio 
) [static]

Write the FTYP box - File type box.

Parameters:
jp2JP2 handle
cioOutput buffer stream

References opj_jp2::brand, cio_seek(), cio_skip(), cio_tell(), cio_write(), opj_jp2::cl, opj_jp2_box::init_pos, JP2_FTYP, opj_jp2_box::length, opj_jp2::minversion, and opj_jp2::numcl.

Referenced by jp2_encode().

static void jp2_write_ihdr ( opj_jp2_t jp2,
opj_cio_t cio 
) [static]
static void jp2_write_jp ( opj_cio_t cio ) [static]
static int jp2_write_jp2c ( opj_jp2_t jp2,
opj_cio_t cio,
opj_image_t image,
opj_codestream_info_t cstr_info 
) [static]
void jp2_write_jp2h ( opj_jp2_t jp2,
opj_cio_t cio 
)

Write the JP2H box - JP2 Header box (used in MJ2)

Parameters:
jp2JP2 handle
cioOutput buffer stream

References opj_jp2::bpc, cio_seek(), cio_skip(), cio_tell(), cio_write(), opj_jp2_box::init_pos, JP2_JP2H, jp2_write_bpcc(), jp2_write_colr(), jp2_write_ihdr(), and opj_jp2_box::length.

Referenced by jp2_encode().