openjpeg.h File Reference

#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  opj_event_mgr
 Message handler object used for. More...
struct  opj_poc
 Progression order changes. More...
struct  opj_cparameters
 Compression parameters. More...
struct  opj_dparameters
 Decompression parameters. More...
struct  opj_common_struct
struct  opj_cinfo
 Compression context info. More...
struct  opj_dinfo
 Decompression context info. More...
struct  opj_cio
 Byte input-output stream (CIO). More...
struct  opj_image_comp
 Defines a single image component. More...
struct  opj_image
 Defines image data and characteristics. More...
struct  opj_image_comptparm
 Component parameters structure used by the opj_image_create function. More...
struct  opj_packet_info
 Index structure : Information concerning a packet inside tile. More...
struct  opj_tp_info
 Index structure : Information concerning tile-parts. More...
struct  opj_tile_info
 Index structure : information regarding tiles. More...
struct  opj_marker_info_t
 Marker structure. More...
struct  opj_codestream_info
 Index structure of the codestream. More...

Defines

#define OPENJPEG_VERSION   "1.3.0"
#define OPJ_API
#define OPJ_CALLCONV
#define OPJ_PATH_LEN   4096
 Maximum allowed size for filenames.
#define J2K_MAXRLVLS   33
 Number of maximum resolution level authorized.
#define J2K_MAXBANDS   (3*J2K_MAXRLVLS-2)
 Number of maximum sub-band linked to number of resolution level.
#define JPWL_MAX_NO_TILESPECS   16
 Maximum number of tile parts expected by JPWL: increase at your will.
#define JPWL_MAX_NO_PACKSPECS   16
 Maximum number of packet parts expected by JPWL: increase at your will.
#define JPWL_MAX_NO_MARKERS   512
 Maximum number of JPWL markers: increase at your will.
#define JPWL_PRIVATEINDEX_NAME   "jpwl_index_privatefilename"
 index file name used when JPWL is on
#define JPWL_EXPECTED_COMPONENTS   3
 Expect this number of components, so you'll find better the first EPB.
#define JPWL_MAXIMUM_TILES   8192
 Expect this maximum number of tiles, to avoid some crashes.
#define JPWL_MAXIMUM_HAMMING   2
 Expect this maximum number of bit errors in marker id's.
#define JPWL_MAXIMUM_EPB_ROOM   65450
 Expect this maximum number of bytes for composition of EPBs.
#define opj_common_fields
 Common fields between JPEG-2000 compression and decompression master structs.
#define OPJ_STREAM_READ   0x0001
 The stream was opened for reading.
#define OPJ_STREAM_WRITE   0x0002
 The stream was opened for writing.

Typedefs

typedef enum RSIZ_CAPABILITIES OPJ_RSIZ_CAPABILITIES
 Rsiz Capabilities.
typedef enum CINEMA_MODE OPJ_CINEMA_MODE
 Digital cinema operation mode.
typedef enum PROG_ORDER OPJ_PROG_ORDER
 Progression order.
typedef enum COLOR_SPACE OPJ_COLOR_SPACE
 Supported image color spaces.
typedef enum CODEC_FORMAT OPJ_CODEC_FORMAT
 Supported codec.
typedef enum LIMIT_DECODING OPJ_LIMIT_DECODING
 Limit decoding to certain portions of the codestream.
typedef void(* opj_msg_callback )(const char *msg, void *client_data)
 Callback function prototype for events.
typedef struct opj_event_mgr opj_event_mgr_t
 Message handler object used for.
typedef struct opj_poc opj_poc_t
 Progression order changes.
typedef struct opj_cparameters opj_cparameters_t
 Compression parameters.
typedef struct opj_dparameters opj_dparameters_t
 Decompression parameters.
typedef struct opj_common_struct opj_common_struct_t
typedef opj_common_struct_topj_common_ptr
typedef struct opj_cinfo opj_cinfo_t
 Compression context info.
typedef struct opj_dinfo opj_dinfo_t
 Decompression context info.
typedef struct opj_cio opj_cio_t
 Byte input-output stream (CIO).
typedef struct opj_image_comp opj_image_comp_t
 Defines a single image component.
typedef struct opj_image opj_image_t
 Defines image data and characteristics.
typedef struct opj_image_comptparm opj_image_cmptparm_t
 Component parameters structure used by the opj_image_create function.
typedef struct opj_packet_info opj_packet_info_t
 Index structure : Information concerning a packet inside tile.
typedef struct opj_tp_info opj_tp_info_t
 Index structure : Information concerning tile-parts.
typedef struct opj_tile_info opj_tile_info_t
 Index structure : information regarding tiles.
typedef struct opj_marker_info_t opj_marker_info_t
 Marker structure.
typedef struct opj_codestream_info opj_codestream_info_t
 Index structure of the codestream.

Enumerations

enum  RSIZ_CAPABILITIES { STD_RSIZ = 0, CINEMA2K = 3, CINEMA4K = 4 }
 

Rsiz Capabilities.

More...
enum  CINEMA_MODE { OFF = 0, CINEMA2K_24 = 1, CINEMA2K_48 = 2, CINEMA4K_24 = 3 }
 

Digital cinema operation mode.

More...
enum  PROG_ORDER {
  PROG_UNKNOWN = -1, LRCP = 0, RLCP = 1, RPCL = 2,
  PCRL = 3, CPRL = 4
}
 

Progression order.

More...
enum  COLOR_SPACE { CLRSPC_UNKNOWN = -1, CLRSPC_SRGB = 1, CLRSPC_GRAY = 2, CLRSPC_SYCC = 3 }
 

Supported image color spaces.

More...
enum  CODEC_FORMAT { CODEC_UNKNOWN = -1, CODEC_J2K = 0, CODEC_JPT = 1, CODEC_JP2 = 2 }
 

Supported codec.

More...
enum  LIMIT_DECODING { NO_LIMITATION = 0, LIMIT_TO_MAIN_HEADER = 1, DECODE_ALL_BUT_PACKETS = 2 }
 

Limit decoding to certain portions of the codestream.

More...

Functions

OPJ_API const char *OPJ_CALLCONV opj_version (void)
OPJ_API opj_image_t *OPJ_CALLCONV opj_image_create (int numcmpts, opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc)
 Create an image.
OPJ_API void OPJ_CALLCONV opj_image_destroy (opj_image_t *image)
 Deallocate any resources associated with an image.
OPJ_API 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.
OPJ_API void OPJ_CALLCONV opj_cio_close (opj_cio_t *cio)
 Close and free a CIO handle.
OPJ_API int OPJ_CALLCONV cio_tell (opj_cio_t *cio)
 Get position in byte stream.
OPJ_API void OPJ_CALLCONV cio_seek (opj_cio_t *cio, int pos)
 Set position in byte stream.
OPJ_API opj_event_mgr_t
*OPJ_CALLCONV 
opj_set_event_mgr (opj_common_ptr cinfo, opj_event_mgr_t *event_mgr, void *context)
OPJ_API opj_dinfo_t *OPJ_CALLCONV opj_create_decompress (OPJ_CODEC_FORMAT format)
 Creates a J2K/JPT/JP2 decompression structure.
OPJ_API void OPJ_CALLCONV opj_destroy_decompress (opj_dinfo_t *dinfo)
 Destroy a decompressor handle.
OPJ_API void OPJ_CALLCONV opj_set_default_decoder_parameters (opj_dparameters_t *parameters)
 Set decoding parameters to default values.
OPJ_API void OPJ_CALLCONV opj_setup_decoder (opj_dinfo_t *dinfo, opj_dparameters_t *parameters)
 Setup the decoder decoding parameters using user parameters.
OPJ_API opj_image_t *OPJ_CALLCONV opj_decode (opj_dinfo_t *dinfo, opj_cio_t *cio)
 Decode an image from a JPEG-2000 codestream.
OPJ_API opj_image_t *OPJ_CALLCONV opj_decode_with_info (opj_dinfo_t *dinfo, opj_cio_t *cio, opj_codestream_info_t *cstr_info)
 Decode an image from a JPEG-2000 codestream and extract the codestream information.
OPJ_API opj_cinfo_t *OPJ_CALLCONV opj_create_compress (OPJ_CODEC_FORMAT format)
 Creates a J2K/JP2 compression structure.
OPJ_API void OPJ_CALLCONV opj_destroy_compress (opj_cinfo_t *cinfo)
 Destroy a compressor handle.
OPJ_API void OPJ_CALLCONV opj_set_default_encoder_parameters (opj_cparameters_t *parameters)
 Set encoding parameters to default values, that means :
OPJ_API void OPJ_CALLCONV opj_setup_encoder (opj_cinfo_t *cinfo, opj_cparameters_t *parameters, opj_image_t *image)
 Setup the encoder parameters using the current image and using user parameters.
OPJ_API bool OPJ_CALLCONV opj_encode (opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index)
 Encode an image into a JPEG-2000 codestream.
OPJ_API bool OPJ_CALLCONV opj_encode_with_info (opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info)
 Encode an image into a JPEG-2000 codestream and extract the codestream information.
OPJ_API void OPJ_CALLCONV opj_destroy_cstr_info (opj_codestream_info_t *cstr_info)
 Destroy Codestream information after compression or decompression.

Define Documentation

#define J2K_MAXBANDS   (3*J2K_MAXRLVLS-2)

Number of maximum sub-band linked to number of resolution level.

Referenced by j2k_read_qcx().

#define J2K_MAXRLVLS   33

Number of maximum resolution level authorized.

#define JPWL_EXPECTED_COMPONENTS   3

Expect this number of components, so you'll find better the first EPB.

Referenced by opj_set_default_decoder_parameters().

#define JPWL_MAX_NO_MARKERS   512

Maximum number of JPWL markers: increase at your will.

Referenced by jpwl_encode(), jpwl_epbs_add(), and jpwl_prepare_marks().

#define JPWL_MAX_NO_PACKSPECS   16

Maximum number of packet parts expected by JPWL: increase at your will.

Referenced by j2k_setup_encoder(), jpwl_prepare_marks(), and opj_set_default_encoder_parameters().

#define JPWL_MAX_NO_TILESPECS   16

Maximum number of tile parts expected by JPWL: increase at your will.

Referenced by j2k_setup_encoder(), jpwl_prepare_marks(), and opj_set_default_encoder_parameters().

#define JPWL_MAXIMUM_EPB_ROOM   65450

Expect this maximum number of bytes for composition of EPBs.

Referenced by jpwl_epbs_add().

#define JPWL_MAXIMUM_HAMMING   2

Expect this maximum number of bit errors in marker id's.

Referenced by j2k_read_unk().

#define JPWL_MAXIMUM_TILES   8192

Expect this maximum number of tiles, to avoid some crashes.

Referenced by opj_set_default_decoder_parameters().

#define JPWL_PRIVATEINDEX_NAME   "jpwl_index_privatefilename"

index file name used when JPWL is on

#define OPENJPEG_VERSION   "1.3.0"

Referenced by opj_version().

#define OPJ_API
#define OPJ_CALLCONV
#define opj_common_fields
Value:
opj_event_mgr_t *event_mgr;     \
        void * client_data;                     \
        bool is_decompressor;           \
        OPJ_CODEC_FORMAT codec_format;  \
        void *j2k_handle;                       \
        void *jp2_handle;                       \
        void *mj2_handle

Common fields between JPEG-2000 compression and decompression master structs.

pointer to the event manager Available for use by application So common code can tell which is which selected codec pointer to the J2K codec pointer to the JP2 codec pointer to the MJ2 codec

#define OPJ_PATH_LEN   4096

Maximum allowed size for filenames.

#define OPJ_STREAM_READ   0x0001

The stream was opened for reading.

Referenced by opj_cio_open().

#define OPJ_STREAM_WRITE   0x0002

The stream was opened for writing.

Referenced by opj_cio_close(), and opj_cio_open().


Typedef Documentation

Digital cinema operation mode.

typedef struct opj_cinfo opj_cinfo_t

Compression context info.

typedef struct opj_cio opj_cio_t

Byte input-output stream (CIO).

Supported codec.

Index structure of the codestream.

Supported image color spaces.

Compression parameters.

typedef struct opj_dinfo opj_dinfo_t

Decompression context info.

Decompression parameters.

Message handler object used for.

  • Error messages Warning messages Debugging messages

Component parameters structure used by the opj_image_create function.

Defines a single image component.

typedef struct opj_image opj_image_t

Defines image data and characteristics.

Limit decoding to certain portions of the codestream.

Marker structure.

typedef void(* opj_msg_callback)(const char *msg, void *client_data)

Callback function prototype for events.

Parameters:
msg Event message
Parameters:
client_data 

Index structure : Information concerning a packet inside tile.

typedef struct opj_poc opj_poc_t

Progression order changes.

typedef enum PROG_ORDER OPJ_PROG_ORDER

Progression order.

Rsiz Capabilities.

Index structure : information regarding tiles.

typedef struct opj_tp_info opj_tp_info_t

Index structure : Information concerning tile-parts.


Enumeration Type Documentation

Digital cinema operation mode.

Enumerator:
OFF 
CINEMA2K_24 

Not Digital Cinema.

CINEMA2K_48 

2K Digital Cinema at 24 fps

CINEMA4K_24 

2K Digital Cinema at 48 fps

Supported codec.

Enumerator:
CODEC_UNKNOWN 

place-holder

CODEC_J2K 

JPEG-2000 codestream : read/write.

CODEC_JPT 

JPT-stream (JPEG 2000, JPIP) : read only.

CODEC_JP2 

JPEG-2000 file format : read/write.

Supported image color spaces.

Enumerator:
CLRSPC_UNKNOWN 

place-holder

CLRSPC_SRGB 

sRGB

CLRSPC_GRAY 

grayscale

CLRSPC_SYCC 

YUV.

Limit decoding to certain portions of the codestream.

Enumerator:
NO_LIMITATION 

No limitation for the decoding.

The entire codestream will de decoded

LIMIT_TO_MAIN_HEADER 

The decoding is limited to the Main Header.

DECODE_ALL_BUT_PACKETS 

Decode everything except the JPEG 2000 packets.

enum PROG_ORDER

Progression order.

Enumerator:
PROG_UNKNOWN 

place-holder

LRCP 

layer-resolution-component-precinct order

RLCP 

resolution-layer-component-precinct order

RPCL 

resolution-precinct-component-layer order

PCRL 

precinct-component-resolution-layer order

CPRL 

component-precinct-resolution-layer order

Rsiz Capabilities.

Enumerator:
STD_RSIZ 
CINEMA2K 

Standard JPEG2000 profile.

CINEMA4K 

Profile name for a 2K image.


Function Documentation

OPJ_API void OPJ_CALLCONV cio_seek ( opj_cio_t cio,
int  pos 
)
OPJ_API int OPJ_CALLCONV cio_tell ( opj_cio_t cio  ) 
OPJ_API void OPJ_CALLCONV opj_cio_close ( opj_cio_t cio  ) 

Close and free a CIO handle.

Parameters:
cio CIO handle to free

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

OPJ_API 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:
cinfo Codec context info
Parameters:
buffer Reading: buffer address. Writing: NULL
Parameters:
length Reading: 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.

OPJ_API opj_cinfo_t* OPJ_CALLCONV opj_create_compress ( OPJ_CODEC_FORMAT  format  ) 

Creates a J2K/JP2 compression structure.

Parameters:
format Coder to select
Returns:
Returns a handle to a compressor if successful, returns NULL otherwise

References CODEC_J2K, CODEC_JP2, CODEC_JPT, CODEC_UNKNOWN, j2k_create_compress(), jp2_create_compress(), opj_free, and opj_malloc.

OPJ_API opj_dinfo_t* OPJ_CALLCONV opj_create_decompress ( OPJ_CODEC_FORMAT  format  ) 

Creates a J2K/JPT/JP2 decompression structure.

Parameters:
format Decoder to select
Returns:
Returns a handle to a decompressor if successful, returns NULL otherwise

References CODEC_J2K, CODEC_JP2, CODEC_JPT, CODEC_UNKNOWN, j2k_create_decompress(), jp2_create_decompress(), opj_free, and opj_malloc.

OPJ_API opj_image_t* OPJ_CALLCONV opj_decode ( opj_dinfo_t dinfo,
opj_cio_t cio 
)

Decode an image from a JPEG-2000 codestream.

Parameters:
dinfo decompressor handle
Parameters:
cio Input buffer stream
Returns:
Returns a decoded image if successful, returns NULL otherwise

References opj_decode_with_info().

OPJ_API opj_image_t* OPJ_CALLCONV opj_decode_with_info ( opj_dinfo_t dinfo,
opj_cio_t cio,
opj_codestream_info_t cstr_info 
)

Decode an image from a JPEG-2000 codestream and extract the codestream information.

Parameters:
dinfo decompressor handle
Parameters:
cio Input buffer stream
Parameters:
cstr_info Codestream information structure if needed afterwards, NULL otherwise
Returns:
Returns a decoded image if successful, returns NULL otherwise

References CODEC_J2K, CODEC_JP2, CODEC_JPT, CODEC_UNKNOWN, j2k_decode(), j2k_decode_jpt_stream(), and jp2_decode().

Referenced by opj_decode().

OPJ_API void OPJ_CALLCONV opj_destroy_compress ( opj_cinfo_t cinfo  ) 

Destroy a compressor handle.

Parameters:
cinfo compressor handle to destroy

References CODEC_J2K, CODEC_JP2, CODEC_JPT, CODEC_UNKNOWN, j2k_destroy_compress(), jp2_destroy_compress(), and opj_free.

OPJ_API void OPJ_CALLCONV opj_destroy_cstr_info ( opj_codestream_info_t cstr_info  ) 

Destroy Codestream information after compression or decompression.

Parameters:
cstr_info Codestream information structure

References opj_codestream_info::marker, opj_free, opj_tile_info::packet, opj_codestream_info::th, opj_tile_info::thresh, opj_codestream_info::tile, opj_tile_info::tp, and opj_codestream_info::tw.

OPJ_API void OPJ_CALLCONV opj_destroy_decompress ( opj_dinfo_t dinfo  ) 

Destroy a decompressor handle.

Parameters:
dinfo decompressor handle to destroy

References CODEC_J2K, CODEC_JP2, CODEC_JPT, CODEC_UNKNOWN, j2k_destroy_decompress(), jp2_destroy_decompress(), and opj_free.

OPJ_API bool OPJ_CALLCONV opj_encode ( opj_cinfo_t cinfo,
opj_cio_t cio,
opj_image_t image,
char *  index 
)

Encode an image into a JPEG-2000 codestream.

Parameters:
cinfo compressor handle
Parameters:
cio Output buffer stream
Parameters:
image Image to encode
Parameters:
index Depreacted -> Set to NULL. To extract index, used opj_encode_wci()
Returns:
Returns true if successful, returns false otherwise

References EVT_WARNING, opj_encode_with_info(), and opj_event_msg().

OPJ_API bool OPJ_CALLCONV opj_encode_with_info ( opj_cinfo_t cinfo,
opj_cio_t cio,
opj_image_t image,
opj_codestream_info_t cstr_info 
)

Encode an image into a JPEG-2000 codestream and extract the codestream information.

Parameters:
cinfo compressor handle
Parameters:
cio Output buffer stream
Parameters:
image Image to encode
Parameters:
cstr_info Codestream information structure if needed afterwards, NULL otherwise
Returns:
Returns true if successful, returns false otherwise

References CODEC_J2K, CODEC_JP2, CODEC_JPT, CODEC_UNKNOWN, j2k_encode(), and jp2_encode().

Referenced by opj_encode().

OPJ_API opj_image_t* OPJ_CALLCONV opj_image_create ( int  numcmpts,
opj_image_cmptparm_t cmptparms,
OPJ_COLOR_SPACE  clrspc 
)
OPJ_API void OPJ_CALLCONV opj_image_destroy ( opj_image_t image  ) 

Deallocate any resources associated with an image.

Parameters:
image image to be destroyed

References opj_image::comps, opj_image_comp::data, opj_image::numcomps, and opj_free.

Referenced by j2k_decode(), j2k_decode_jpt_stream(), and opj_image_create().

OPJ_API void OPJ_CALLCONV opj_set_default_decoder_parameters ( opj_dparameters_t parameters  ) 
OPJ_API void OPJ_CALLCONV opj_set_default_encoder_parameters ( opj_cparameters_t parameters  ) 

Set encoding parameters to default values, that means :

  • Lossless 1 tile Size of precinct : 2^15 x 2^15 (means 1 precinct) Size of code-block : 64 x 64 Number of resolutions: 6 No SOP marker in the codestream No EPH marker in the codestream No sub-sampling in x or y direction No mode switch activated Progression order: LRCP No index file No ROI upshifted No offset of the origin of the image No offset of the origin of the tiles Reversible DWT 5-3
    Parameters:
    parameters Compression parameters

References opj_cparameters::cblockh_init, opj_cparameters::cblockw_init, opj_cparameters::cod_format, opj_cparameters::cp_cinema, opj_cparameters::cp_rsiz, opj_cparameters::decod_format, opj_cparameters::jpwl_epc_on, opj_cparameters::jpwl_hprot_MH, opj_cparameters::jpwl_hprot_TPH, opj_cparameters::jpwl_hprot_TPH_tileno, JPWL_MAX_NO_PACKSPECS, JPWL_MAX_NO_TILESPECS, opj_cparameters::jpwl_pprot, opj_cparameters::jpwl_pprot_packno, opj_cparameters::jpwl_pprot_tileno, opj_cparameters::jpwl_sens_addr, opj_cparameters::jpwl_sens_MH, opj_cparameters::jpwl_sens_range, opj_cparameters::jpwl_sens_size, opj_cparameters::jpwl_sens_TPH, opj_cparameters::jpwl_sens_TPH_tileno, LRCP, opj_cparameters::max_comp_size, opj_cparameters::numresolution, OFF, opj_cparameters::prog_order, opj_cparameters::roi_compno, STD_RSIZ, opj_cparameters::subsampling_dx, opj_cparameters::subsampling_dy, and opj_cparameters::tp_on.

OPJ_API opj_event_mgr_t* OPJ_CALLCONV opj_set_event_mgr ( opj_common_ptr  cinfo,
opj_event_mgr_t event_mgr,
void *  context 
)
OPJ_API void OPJ_CALLCONV opj_setup_decoder ( opj_dinfo_t dinfo,
opj_dparameters_t parameters 
)

Setup the decoder decoding parameters using user parameters.

Decoding parameters are returned in j2k->cp.

Parameters:
dinfo decompressor handle
Parameters:
parameters decompression parameters

References CODEC_J2K, CODEC_JP2, CODEC_JPT, CODEC_UNKNOWN, j2k_setup_decoder(), and jp2_setup_decoder().

OPJ_API void OPJ_CALLCONV opj_setup_encoder ( opj_cinfo_t cinfo,
opj_cparameters_t parameters,
opj_image_t image 
)

Setup the encoder parameters using the current image and using user parameters.

Parameters:
cinfo Compressor handle
Parameters:
parameters Compression parameters
Parameters:
image Input filled image

References CODEC_J2K, CODEC_JP2, CODEC_JPT, CODEC_UNKNOWN, j2k_setup_encoder(), and jp2_setup_encoder().

OPJ_API const char* OPJ_CALLCONV opj_version ( void   ) 

References OPENJPEG_VERSION.

Generated on Sat Jan 22 13:22:59 2011 for OpenJPEG by  doxygen 1.6.3