libopenjp2 (3) - Linux Manuals
Command to display libopenjp2
manual in Linux: $ man 3 libopenjp2
NAME
libopenjp2 -
a library for reading and writing JPEG2000 image files.
SYNOPSIS
#include <openjpeg.h>
CONVERSION FORMATS
PGX: imagetopgx() /
pgxtoimage()
PXM: imagetopnm() / pnmtoimage()
BMP: imagetobmp() / bmptoimage()
TIF: imagetotif() / tiftoimage()
RAW: imagetoraw() / rawtoimage()
TGA: imagetotga() / tgatoimage()
PNG: imagetopng() / pngtoimage()
YUV: imagetoyuv() / yuvtoimage() (MJ2)
READ
opj_set_default_decoder_parameters(opj_dparameters_t *params);
opj_dinfo_t *opj_create_decompress(OPJ_CODEC_FORMAT format);
opj_event_mgr_t *opj_set_event_mgr(opj_common_ptr info, opj_event_mgr_t *event_mgr, void *context);
void opj_setup_decoder(opj_dinfo_t *dinfo, opj_dparameters_t * params);
opj_cio_t *opj_cio_open(opj_common_ptr info, unsigned char *buf, int buf_len);
opj_image_t *opj_decode(opj_dinfo_t *dinfo, opj_cio_t *cio);
void opj_cio_close(opj_cio_t *cio);
void opj_destroy_decompress(opj_dinfo_t *dinfo);
void opj_image_destroy(opj_image_t *image);
WRITE
void opj_set_default_encoder_parameters(opj_cparameters_t *params);
/*
opj_image_t *FORMATtoimage(const char *fname, opj_cparameters_t *params);
*/
opj_cinfo_t* opj_create_compress(OPJ_CODEC_FORMAT format);
opj_event_mgr_t *opj_set_event_mgr(opj_common_ptr info, opj_event_mgr_t *event_mgr, void *context);
void opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *params, opj_image_t *image);
opj_cio_t *opj_cio_open(opj_common_ptr cinfo, NULL, 0);
bool opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index);
void opj_cio_close(opj_cio_t *cio);
void opj_destroy_compress(opj_cinfo_t *cinfo);
void opj_image_destroy(opj_image_t *image);
GENERAL
void opj_image_create(int numcmpts, opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc);
int cio_tell(opj_cio_t *cio);
void cio_seek(opj_cio_t *cio, int pos);
opj_image_t *opj_decode_with_info(opj_dinfo_t *dinfo, opj_cio_t *cio, opj_codestream_info_t *cstr_info);
bool opj_encode_with_info(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
void opj_destroy_cstr_info(opj_codestream_info_t *cstr_info);
const char *opj_version(void);
OPJ_CODEC_FORMAT
CODEC_J2K or CODEC_JPT or CODEC_JP2
OPJ_COLOR_SPACE
CLRSPC_UNKNOWN or CLRSPC_UNSPECIFIED or CLRSPC_SRGB or CLRSPC_GRAY or CLRSPC_SYCC
DECOMPRESSION PARAMETERS
typedef struct opj_dparameters
{
/*
Set the number of highest resolution levels to be discarded.
The image resolution is effectively divided by 2 to the power
of the number of discarded levels.
The reduce factor is limited by the smallest total number of
decomposition levels among tiles.
if != 0, then original dimension divided by 2^(reduce);
if == 0 or not used, image is decoded to the full resolution
*/
int cp_reduce;
/*
Set the maximum number of quality layers to decode.
If there are less quality layers than the specified number,
all the quality layers are decoded.
if != 0, then only the first "layer" layers are decoded;
if == 0 or not used, all the quality layers are decoded
*/
int cp_layer;
/*command line encoder parameters (not used inside the library) */
/* input file name */
char infile[OPJ_PATH_LEN];
/* output file name */
char outfile[OPJ_PATH_LEN];
/* input file format: see OPJ_CODEC_FORMAT */
int decod_format;
/* output file format */
int cod_format;
/*JPWL decoding parameters */
/* activates the JPWL correction capabilities */
bool jpwl_correct;
/* expected number of components */
int jpwl_exp_comps;
/* maximum number of tiles */
int jpwl_max_tiles;
/*
Specify whether the decoding should be done on the entire
codestream, or be limited to the main header
Limiting the decoding to the main header makes it possible
to extract the characteristics of the codestream
if == NO_LIMITATION, the entire codestream is decoded;
if == LIMIT_TO_MAIN_HEADER, only the main header is decoded;
*/
OPJ_LIMIT_DECODING cp_limit_decoding;
} opj_dparameters_t;
COMPRESSION PARAMETERS
typedef struct opj_cparameters
{
/* size of tile: tile_size_on = false (not in argument)
or tile_size_on = true (in argument) */
bool tile_size_on;
/* XTOsiz */
int cp_tx0;
/* YTOsiz */
int cp_ty0;
/* XTsiz */
int cp_tdx;
/* YTsiz */
int cp_tdy;
/* allocation by rate/distortion */
int cp_disto_alloc;
/* allocation by fixed layer */
int cp_fixed_alloc;
/* add fixed_quality */
int cp_fixed_quality;
/* fixed layer */
int *cp_matrice;
/* comment for coding */
char *cp_comment;
/* coding style */
int csty;
/* progression order:
PROG_UNKNOWN, LRCP(default), RLCP, RPCL, PCRL, CPRL */
OPJ_PROG_ORDER prog_order;
/* progression order changes */
opj_poc_t POC[32];
/* number of progression order changes (POC), default: 0 */
int numpocs;
/* number of layers */
int tcp_numlayers;
/* rates of layers */
float tcp_rates[100];
/* different psnr for successive layers */
float tcp_distoratio[100];
/* number of resolutions */
int numresolution;
/* initial code block width, default: 64 */
int cblockw_init;
/* initial code block height, default: 64 */
int cblockh_init;
/* mode switch (cblk_style) */
/* 1 : use the irreversible DWT 9-7,
0 : use lossless compression (default) */
int irreversible;
/* region of interest: affected component in [0..3],
-1 means no ROI */
int roi_compno;
/* region of interest: upshift value */
int roi_shift;
/* number of precinct size specifications */
int res_spec;
/* initial precinct width */
int prcw_init[J2K_MAXRLVLS];
/* initial precinct height */
int prch_init[J2K_MAXRLVLS];
/*command line encoder parameters (not used inside the library) */
/* input file name */
char infile[OPJ_PATH_LEN];
/*