OpenJPEG 2.3.0

Data Structures | Macros | Typedefs | Enumerations | Functions
j2k.h File Reference

The JPEG-2000 Codestream Reader/Writer (J2K) More...

Go to the source code of this file.

## Data Structures
struct | opj_stepsize
| Quantization stepsize. More...
struct | opj_tccp
| Tile-component coding parameters. More...
struct | opj_mct_data
| FIXME DOC. More...
struct | opj_simple_mcc_decorrelation_data
| FIXME DOC. More...
struct | opj_ppx_struct
struct | opj_tcp
| Tile coding parameters : this structure is used to store coding/decoding parameters common to all tiles (information like COD, COC in main header) More...
struct | opj_encoding_param
struct | opj_decoding_param
struct | opj_cp
| Coding parameters. More...
struct | opj_j2k_dec
struct | opj_j2k_enc
struct | opj_j2k
| JPEG-2000 codestream reader/writer. More...

## Macros
#define | J2K_CP_CSTY_PRT 0x01
#define | J2K_CP_CSTY_SOP 0x02
#define | J2K_CP_CSTY_EPH 0x04
#define | J2K_CCP_CSTY_PRT 0x01
#define | J2K_CCP_CBLKSTY_LAZY 0x01
| Selective arithmetic coding bypass. More...
#define | J2K_CCP_CBLKSTY_RESET 0x02
| Reset context probabilities on coding pass boundaries. More...
#define | J2K_CCP_CBLKSTY_TERMALL 0x04
| Termination on each coding pass. More...
#define | J2K_CCP_CBLKSTY_VSC 0x08
| Vertically stripe causal context. More...
#define | J2K_CCP_CBLKSTY_PTERM 0x10
| Predictable termination. More...
#define | J2K_CCP_CBLKSTY_SEGSYM 0x20
| Segmentation symbols are used. More...
#define | J2K_CCP_QNTSTY_NOQNT 0
#define | J2K_CCP_QNTSTY_SIQNT 1
#define | J2K_CCP_QNTSTY_SEQNT 2
#define | J2K_MS_SOC 0xff4f
| SOC marker value. More...
#define | J2K_MS_SOT 0xff90
| SOT marker value. More...
#define | J2K_MS_SOD 0xff93
| SOD marker value. More...
#define | J2K_MS_EOC 0xffd9
| EOC marker value. More...
#define | J2K_MS_SIZ 0xff51
| SIZ marker value. More...
#define | J2K_MS_COD 0xff52
| COD marker value. More...
#define | J2K_MS_COC 0xff53
| COC marker value. More...
#define | J2K_MS_RGN 0xff5e
| RGN marker value. More...
#define | J2K_MS_QCD 0xff5c
| QCD marker value. More...
#define | J2K_MS_QCC 0xff5d
| QCC marker value. More...
#define | J2K_MS_POC 0xff5f
| POC marker value. More...
#define | J2K_MS_TLM 0xff55
| TLM marker value. More...
#define | J2K_MS_PLM 0xff57
| PLM marker value. More...
#define | J2K_MS_PLT 0xff58
| PLT marker value. More...
#define | J2K_MS_PPM 0xff60
| PPM marker value. More...
#define | J2K_MS_PPT 0xff61
| PPT marker value. More...
#define | J2K_MS_SOP 0xff91
| SOP marker value. More...
#define | J2K_MS_EPH 0xff92
| EPH marker value. More...
#define | J2K_MS_CRG 0xff63
| CRG marker value. More...
#define | J2K_MS_COM 0xff64
| COM marker value. More...
#define | J2K_MS_CBD 0xff78
| CBD marker value. More...
#define | J2K_MS_MCC 0xff75
| MCC marker value. More...
#define | J2K_MS_MCT 0xff74
| MCT marker value. More...
#define | J2K_MS_MCO 0xff77
| MCO marker value. More...
#define | J2K_MS_UNK 0
| UNKNOWN marker value. More...
#define | J2K_MS_EPC 0xff68
| EPC marker value (Part 11: JPEG 2000 for Wireless) More...
#define | J2K_MS_EPB 0xff66
| EPB marker value (Part 11: JPEG 2000 for Wireless) More...
#define | J2K_MS_ESD 0xff67
| ESD marker value (Part 11: JPEG 2000 for Wireless) More...
#define | J2K_MS_RED 0xff69
| RED marker value (Part 11: JPEG 2000 for Wireless) More...
#define | J2K_MS_SEC 0xff65
| SEC marker value (Part 8: Secure JPEG 2000) More...
#define | J2K_MS_INSEC 0xff94
| INSEC marker value (Part 8: Secure JPEG 2000) More...
#define | J2K_MAX_POCS 32
| Maximum number of POCs. More...

## Typedefs
typedef enum J2K_STATUS | J2K_STATUS
| Values that specify the status of the decoding process when decoding the main header. More...
typedef enum MCT_ELEMENT_TYPE | J2K_MCT_ELEMENT_TYPE
| Type of elements storing in the MCT data. More...
typedef enum MCT_ARRAY_TYPE | J2K_MCT_ARRAY_TYPE
| Type of MCT array. More...
typedef enum T2_MODE | J2K_T2_MODE
| T2 encoding mode. More...
typedef struct opj_stepsize | opj_stepsize_t
| Quantization stepsize. More...
typedef struct opj_tccp | opj_tccp_t
| Tile-component coding parameters. More...
typedef struct opj_mct_data | opj_mct_data_t
| FIXME DOC. More...
typedef struct opj_simple_mcc_decorrelation_data | opj_simple_mcc_decorrelation_data_t
| FIXME DOC. More...
typedef struct opj_ppx_struct | opj_ppx
typedef struct opj_tcp | opj_tcp_t
| Tile coding parameters : this structure is used to store coding/decoding parameters common to all tiles (information like COD, COC in main header) More...
typedef struct opj_encoding_param | opj_encoding_param_t
typedef struct opj_decoding_param | opj_decoding_param_t
typedef struct opj_cp | opj_cp_t
| Coding parameters. More...
typedef struct opj_j2k_dec | opj_j2k_dec_t
typedef struct opj_j2k_enc | opj_j2k_enc_t
typedef struct opj_j2k | opj_j2k_t
| JPEG-2000 codestream reader/writer. More...

## Enumerations
enum | J2K_STATUS { J2K_STATE_NONE = 0x0000, J2K_STATE_MHSOC = 0x0001, J2K_STATE_MHSIZ = 0x0002, J2K_STATE_MH = 0x0004, J2K_STATE_TPHSOT = 0x0008, J2K_STATE_TPH = 0x0010, J2K_STATE_MT = 0x0020, J2K_STATE_NEOC = 0x0040, J2K_STATE_DATA = 0x0080, J2K_STATE_EOC = 0x0100, J2K_STATE_ERR = 0x8000 }
| Values that specify the status of the decoding process when decoding the main header. More...
enum | MCT_ELEMENT_TYPE { MCT_TYPE_INT16 = 0, MCT_TYPE_INT32 = 1, MCT_TYPE_FLOAT = 2, MCT_TYPE_DOUBLE = 3 }
| Type of elements storing in the MCT data. More...
enum | MCT_ARRAY_TYPE { MCT_TYPE_DEPENDENCY = 0, MCT_TYPE_DECORRELATION = 1, MCT_TYPE_OFFSET = 2 }
| Type of MCT array. More...
enum | T2_MODE { THRESH_CALC = 0, FINAL_PASS = 1 }
| T2 encoding mode. More...

## Functions
OPJ_BOOL | opj_j2k_end_decompress (opj_j2k_t *j2k, opj_stream_private_t *p_stream, opj_event_mgr_t *p_manager)
| Ends the decompression procedures and possibiliy add data to be read after the codestream. More...
OPJ_BOOL | opj_j2k_read_header (opj_stream_private_t *p_stream, opj_j2k_t *p_j2k, opj_image_t **p_image, opj_event_mgr_t *p_manager)
| Reads a jpeg2000 codestream header structure. More...
void | opj_j2k_destroy (opj_j2k_t *p_j2k)
| Destroys a jpeg2000 codec. More...
void | j2k_destroy_cstr_index (opj_codestream_index_t *p_cstr_ind)
| Destroys a codestream index structure. More...
OPJ_BOOL | opj_j2k_decode_tile (opj_j2k_t *p_j2k, OPJ_UINT32 p_tile_index, OPJ_BYTE *p_data, OPJ_UINT32 p_data_size, opj_stream_private_t *p_stream, opj_event_mgr_t *p_manager)
| Decode tile data. More...
OPJ_BOOL | opj_j2k_read_tile_header (opj_j2k_t *p_j2k, OPJ_UINT32 *p_tile_index, OPJ_UINT32 *p_data_size, OPJ_INT32 *p_tile_x0, OPJ_INT32 *p_tile_y0, OPJ_INT32 *p_tile_x1, OPJ_INT32 *p_tile_y1, OPJ_UINT32 *p_nb_comps, OPJ_BOOL *p_go_on, opj_stream_private_t *p_stream, opj_event_mgr_t *p_manager)
| Reads a tile header. More...
OPJ_BOOL | opj_j2k_set_decoded_components (opj_j2k_t *p_j2k, OPJ_UINT32 numcomps, const OPJ_UINT32 *comps_indices, opj_event_mgr_t *p_manager)
| Sets the indices of the components to decode. More...
OPJ_BOOL | opj_j2k_set_decode_area (opj_j2k_t *p_j2k, opj_image_t *p_image, OPJ_INT32 p_start_x, OPJ_INT32 p_start_y, OPJ_INT32 p_end_x, OPJ_INT32 p_end_y, opj_event_mgr_t *p_manager)
| Sets the given area to be decoded. More...
opj_j2k_t * | opj_j2k_create_decompress (void)
| Creates a J2K decompression structure. More...
void | j2k_dump (opj_j2k_t *p_j2k, OPJ_INT32 flag, FILE *out_stream)
| Dump some elements from the J2K decompression structure . More...
void | j2k_dump_image_header (opj_image_t *image, OPJ_BOOL dev_dump_flag, FILE *out_stream)
| Dump an image header structure. More...
void | j2k_dump_image_comp_header (opj_image_comp_t *comp, OPJ_BOOL dev_dump_flag, FILE *out_stream)
| Dump a component image header structure. More...
opj_codestream_info_v2_t * | j2k_get_cstr_info (opj_j2k_t *p_j2k)
| Get the codestream info from a JPEG2000 codec. More...
opj_codestream_index_t * | j2k_get_cstr_index (opj_j2k_t *p_j2k)
| Get the codestream index from a JPEG2000 codec. More...
OPJ_BOOL | opj_j2k_decode (opj_j2k_t *j2k, opj_stream_private_t *p_stream, opj_image_t *p_image, opj_event_mgr_t *p_manager)
| Decode an image from a JPEG-2000 codestream. More...
OPJ_BOOL | opj_j2k_get_tile (opj_j2k_t *p_j2k, opj_stream_private_t *p_stream, opj_image_t *p_image, opj_event_mgr_t *p_manager, OPJ_UINT32 tile_index)
OPJ_BOOL | opj_j2k_set_decoded_resolution_factor (opj_j2k_t *p_j2k, OPJ_UINT32 res_factor, opj_event_mgr_t *p_manager)
OPJ_BOOL | opj_j2k_write_tile (opj_j2k_t *p_j2k, OPJ_UINT32 p_tile_index, OPJ_BYTE *p_data, OPJ_UINT32 p_data_size, opj_stream_private_t *p_stream, opj_event_mgr_t *p_manager)
| Writes a tile. More...
OPJ_BOOL | opj_j2k_encode (opj_j2k_t *p_j2k, opj_stream_private_t *cio, opj_event_mgr_t *p_manager)
| Encodes an image into a JPEG-2000 codestream. More...
OPJ_BOOL | opj_j2k_start_compress (opj_j2k_t *p_j2k, opj_stream_private_t *p_stream, opj_image_t *p_image, opj_event_mgr_t *p_manager)
| Starts a compression scheme, i.e. More...
OPJ_BOOL | opj_j2k_end_compress (opj_j2k_t *p_j2k, opj_stream_private_t *cio, opj_event_mgr_t *p_manager)
| Ends the compression procedures and possibiliy add data to be read after the codestream. More...
OPJ_BOOL | opj_j2k_setup_mct_encoding (opj_tcp_t *p_tcp, opj_image_t *p_image)
Exported functions
void | opj_j2k_setup_decoder (opj_j2k_t *j2k, opj_dparameters_t *parameters)
| Setup the decoder decoding parameters using user parameters. More...
OPJ_BOOL | opj_j2k_set_threads (opj_j2k_t *j2k, OPJ_UINT32 num_threads)
opj_j2k_t * | opj_j2k_create_compress (void)
| Creates a J2K compression structure. More...
OPJ_BOOL | opj_j2k_setup_encoder (opj_j2k_t *p_j2k, opj_cparameters_t *parameters, opj_image_t *image, opj_event_mgr_t *p_manager)
const char * | opj_j2k_convert_progression_order (OPJ_PROG_ORDER prg_order)
| Converts an enum type progression order to string type. More...

## Detailed Description

The JPEG-2000 Codestream Reader/Writer (J2K)

The functions in J2K.C have for goal to read/write the several parts of the codestream: markers and data.

## Function Documentation

## ◆ j2k_destroy_cstr_index()

void j2k_destroy_cstr_index | ( | opj_codestream_index_t * | p_cstr_ind | ) |

Destroys a codestream index structure.

Parameters

  p_cstr_ind | the codestream index parameter to destroy.

References opj_tile_index::marker, opj_codestream_index::marker, opj_codestream_index::nb_of_tiles, opj_free(), opj_tile_index::packet_index, opj_codestream_index::tile_index, and opj_tile_index::tp_index.

Referenced by opj_destroy_cstr_index(), and opj_j2k_destroy().

## ◆ j2k_dump()

void j2k_dump | ( | opj_j2k_t * | p_j2k,
|  | OPJ_INT32 | flag,
|  | FILE * | out_stream
| ) |  |

Dump some elements from the J2K decompression structure .

Parameters

  p_j2k | the jpeg2000 codec.
  flag | flag to describe what elements are dump.
  out_stream | output stream where dump the elements.

References j2k_dump_image_header(), opj_j2k::m_cp, opj_j2k::m_private_image, opj_image::numcomps, OPJ_IMG_INFO, opj_j2k_dump_MH_index(), opj_j2k_dump_MH_info(), opj_j2k_dump_tile_info(), OPJ_J2K_MH_IND, OPJ_J2K_MH_INFO, OPJ_J2K_TCH_INFO, OPJ_J2K_TH_IND, OPJ_J2K_TH_INFO, OPJ_JP2_IND, OPJ_JP2_INFO, opj_cp::tcps, opj_cp::th, and opj_cp::tw.

Referenced by jp2_dump(), and opj_create_decompress().

## ◆ j2k_dump_image_comp_header()

void j2k_dump_image_comp_header | ( | opj_image_comp_t * | comp,
|  | OPJ_BOOL | dev_dump_flag,
|  | FILE * | out_stream
| ) |  |

Dump a component image header structure.

Parameters

  comp | the component image header to dump.
  dev_dump_flag | flag to describe if we are in the case of this function is use outside j2k_dump function
  out_stream | output stream where dump the elements.

References opj_image_comp::dx, opj_image_comp::dy, opj_image_comp::prec, and opj_image_comp::sgnd.

Referenced by j2k_dump_image_header().

## ◆ j2k_dump_image_header()

void j2k_dump_image_header | ( | opj_image_t * | image,
|  | OPJ_BOOL | dev_dump_flag,
|  | FILE * | out_stream
| ) |  |

Dump an image header structure.

Parameters

  image | the image header to dump.
  dev_dump_flag | flag to describe if we are in the case of this function is use outside j2k_dump function
  out_stream | output stream where dump the elements.

References opj_image::comps, j2k_dump_image_comp_header(), opj_image::numcomps, opj_image::x0, opj_image::x1, opj_image::y0, and opj_image::y1.

Referenced by j2k_dump().

## ◆ j2k_get_cstr_index()

opj_codestream_index_t* j2k_get_cstr_index | ( | opj_j2k_t * | p_j2k | ) |

Get the codestream index from a JPEG2000 codec.

Parameters

  p_j2k | the component image header to dump.

Returns
  the codestream index extract from the jpg2000 codec

References opj_codestream_index::codestream_size, opj_j2k::cstr_index, opj_codestream_index::main_head_end, opj_codestream_index::main_head_start, opj_tile_index::marker, opj_codestream_index::marker, opj_tile_index::marknum, opj_codestream_index::marknum, opj_codestream_index::nb_of_tiles, opj_tile_index::nb_packet, opj_tile_index::nb_tps, opj_calloc(), opj_free(), opj_malloc(), opj_tile_index::packet_index, opj_codestream_index::tile_index, and opj_tile_index::tp_index.

Referenced by jp2_get_cstr_index(), and opj_create_decompress().

## ◆ j2k_get_cstr_info()

opj_codestream_info_v2_t* j2k_get_cstr_info | ( | opj_j2k_t * | p_j2k | ) |

Get the codestream info from a JPEG2000 codec.

Parameters

  p_j2k | the component image header to dump.

Returns
  the codestream information extract from the jpg2000 codec

References opj_tccp::cblkh, opj_tccp_info::cblkh, opj_tccp::cblksty, opj_tccp_info::cblksty, opj_tccp::cblkw, opj_tccp_info::cblkw, opj_tccp::csty, opj_tcp::csty, opj_tccp_info::csty, opj_tile_v2_info::csty, opj_stepsize::expn, J2K_CCP_QNTSTY_SIQNT, opj_j2k::m_cp, opj_j2k::m_decoder, opj_j2k_dec::m_default_tcp, opj_codestream_info_v2::m_default_tile_info, opj_j2k::m_private_image, opj_j2k::m_specific_param, opj_stepsize::mant, opj_tcp::mct, opj_tile_v2_info::mct, opj_codestream_info_v2::nbcomps, opj_image::numcomps, opj_tccp::numgbits, opj_tccp_info::numgbits, opj_tcp::numlayers, opj_tile_v2_info::numlayers, opj_tccp::numresolutions, opj_tccp_info::numresolutions, opj_calloc(), opj_destroy_cstr_info(), OPJ_J2K_MAXBANDS, OPJ_J2K_MAXRLVLS, opj_tccp::prch, opj_tccp_info::prch, opj_tccp::prcw, opj_tccp_info::prcw, opj_tcp::prg, opj_tile_v2_info::prg, opj_tccp::qmfbid, opj_tccp_info::qmfbid, opj_tccp::qntsty, opj_tccp_info::qntsty, opj_tccp::roishift, opj_tccp_info::roishift, opj_tccp::stepsizes, opj_tccp_info::stepsizes_expn, opj_tccp_info::stepsizes_mant, opj_tile_v2_info::tccp_info, opj_tcp::tccps, opj_cp::tdx, opj_codestream_info_v2::tdx, opj_cp::tdy, opj_codestream_info_v2::tdy, opj_cp::th, opj_codestream_info_v2::th, opj_codestream_info_v2::tile_info, opj_cp::tw, opj_codestream_info_v2::tw, opj_cp::tx0, opj_codestream_info_v2::tx0, opj_cp::ty0, and opj_codestream_info_v2::ty0.

Referenced by jp2_get_cstr_info(), and opj_create_decompress().

## ◆ opj_j2k_create_decompress()

opj_j2k_t* opj_j2k_create_decompress | ( | void |  | ) |

Creates a J2K decompression structure.

Returns
  a handle to a J2K decompressor if successful, NULL otherwise.

References opj_cp::allow_different_bit_depth_sign, opj_j2k::cstr_index, opj_j2k::m_cp, opj_j2k::m_decoder, opj_j2k_dec::m_default_tcp, opj_j2k_dec::m_header_data, opj_j2k_dec::m_header_data_size, opj_cp::m_is_decoder, opj_j2k::m_is_decoder, opj_j2k_dec::m_last_sot_read_pos, opj_j2k_dec::m_nb_tile_parts_correction_checked, opj_j2k::m_procedure_list, opj_j2k::m_specific_param, opj_j2k_dec::m_tile_ind_to_dec, opj_j2k::m_tp, opj_j2k::m_validation_list, opj_calloc(), opj_j2k_create_cstr_index(), OPJ_J2K_DEFAULT_HEADER_SIZE, opj_j2k_destroy(), opj_j2k_get_default_thread_count(), opj_procedure_list_create(), and opj_thread_pool_create().

Referenced by opj_create_decompress(), and opj_jp2_create().

## ◆ opj_j2k_decode()

OPJ_BOOL opj_j2k_decode | ( | opj_j2k_t * | j2k,
|  | opj_stream_private_t * | p_stream,
|  | opj_image_t * | p_image,
|  | opj_event_mgr_t * | p_manager
| ) |  |

Decode an image from a JPEG-2000 codestream.

Parameters

  j2k | J2K decompressor handle
  p_stream | FIXME DOC
  p_image | FIXME DOC
  p_manager | FIXME DOC

Returns
  FIXME DOC

References opj_image::comps, opj_image_comp::data, opj_image_comp::factor, opj_j2k::m_cp, opj_cp::m_dec, opj_j2k::m_output_image, opj_j2k::m_private_image, opj_j2k::m_procedure_list, opj_decoding_param::m_reduce, opj_cp::m_specific_param, opj_image::numcomps, opj_copy_image_header(), OPJ_FALSE, opj_image_create0(), opj_image_destroy(), opj_j2k_exec(), opj_j2k_move_data_from_codec_to_output_image(), opj_j2k_setup_decoding(), and opj_j2k_update_image_dimensions().

Referenced by opj_create_decompress(), and opj_jp2_decode().

## ◆ opj_j2k_decode_tile()

OPJ_BOOL opj_j2k_decode_tile | ( | opj_j2k_t * | p_j2k,
|  | OPJ_UINT32 | p_tile_index,
|  | OPJ_BYTE * | p_data,
|  | OPJ_UINT32 | p_data_size,
|  | opj_stream_private_t * | p_stream,
|  | opj_event_mgr_t * | p_manager
| ) |  |

Decode tile data.

Parameters

  p_j2k | the jpeg2000 codec.
  p_tile_index |
  p_data | FIXME DOC
  p_data_size | FIXME DOC
  p_stream | the stream to write data to.
  p_manager | the user event manager.

References opj_j2k::cstr_index, EVT_ERROR, EVT_WARNING, J2K_MS_EOC, J2K_MS_SOT, J2K_STATE_DATA, J2K_STATE_EOC, J2K_STATE_ERR, J2K_STATE_NEOC, opj_j2k_dec::m_can_decode, opj_j2k_dec::m_comps_indices_to_decode, opj_j2k::m_cp, opj_j2k::m_current_tile_number, opj_tcp::m_data, opj_tcp::m_data_size, opj_j2k::m_decoder, opj_j2k_dec::m_numcomps_to_decode, opj_j2k::m_output_image, opj_j2k::m_private_image, opj_j2k::m_specific_param, opj_j2k_dec::m_state, opj_j2k::m_tcd, opj_event_msg(), OPJ_FALSE, opj_j2k_tcp_data_destroy(), opj_j2k_tcp_destroy(), opj_read_bytes, opj_stream_get_number_byte_left(), opj_stream_read_data(), opj_tcd_decode_tile(), opj_tcd_update_tile_data(), OPJ_TRUE, opj_cp::tcps, opj_image::x0, opj_image::x1, opj_image::y0, and opj_image::y1.

Referenced by opj_create_decompress(), opj_j2k_decode_one_tile(), opj_j2k_decode_tiles(), and opj_jp2_decode_tile().

## ◆ opj_j2k_destroy()

void opj_j2k_destroy | ( | opj_j2k_t * | p_j2k | ) |

Destroys a jpeg2000 codec.

Parameters

  p_j2k | the jpeg20000 structure to destroy.

References opj_j2k::cstr_index, j2k_destroy_cstr_index(), opj_j2k_dec::m_comps_indices_to_decode, opj_j2k::m_cp, opj_j2k::m_decoder, opj_j2k_dec::m_default_tcp, opj_j2k_enc::m_encoded_tile_data, opj_j2k::m_encoder, opj_j2k_dec::m_header_data, opj_j2k_dec::m_header_data_size, opj_j2k_enc::m_header_tile_data, opj_j2k_enc::m_header_tile_data_size, opj_j2k::m_is_decoder, opj_j2k_dec::m_numcomps_to_decode, opj_j2k::m_output_image, opj_j2k::m_private_image, opj_j2k::m_procedure_list, opj_j2k::m_specific_param, opj_j2k::m_tcd, opj_j2k_enc::m_tlm_sot_offsets_buffer, opj_j2k_enc::m_tlm_sot_offsets_current, opj_j2k::m_tp, opj_j2k::m_validation_list, opj_free(), opj_image_destroy(), opj_j2k_cp_destroy(), opj_j2k_tcp_destroy(), opj_procedure_list_destroy(), opj_tcd_destroy(), and opj_thread_pool_destroy().

Referenced by opj_create_compress(), opj_create_decompress(), opj_j2k_create_compress(), opj_j2k_create_decompress(), and opj_jp2_destroy().

## ◆ opj_j2k_encode()

OPJ_BOOL opj_j2k_encode | ( | opj_j2k_t * | p_j2k,
|  | opj_stream_private_t * | cio,
|  | opj_event_mgr_t * | p_manager
| ) |  |

Encodes an image into a JPEG-2000 codestream.

References opj_tcd_tile::comps, opj_image::comps, opj_tcd_tilecomp::data, opj_image_comp::data, EVT_ERROR, opj_tcd::image, opj_j2k::m_cp, opj_j2k::m_tcd, opj_image::numcomps, opj_alloc_tile_component_data(), opj_event_msg(), OPJ_FALSE, opj_free(), opj_j2k_get_tile_data(), opj_j2k_post_write_tile(), opj_j2k_pre_write_tile(), opj_realloc(), opj_tcd_copy_tile_data(), opj_tcd_get_encoded_tile_size(), OPJ_TRUE, opj_tcd_tilecomp::ownsData, opj_tcd::tcd_image, opj_cp::th, opj_tcd_image::tiles, and opj_cp::tw.

Referenced by opj_create_compress(), and opj_jp2_encode().

## ◆ opj_j2k_end_compress()

OPJ_BOOL opj_j2k_end_compress | ( | opj_j2k_t * | p_j2k,
|  | opj_stream_private_t * | cio,
|  | opj_event_mgr_t * | p_manager
| ) |  |

Ends the compression procedures and possibiliy add data to be read after the codestream.

References opj_j2k::m_procedure_list, OPJ_FALSE, opj_j2k_exec(), opj_j2k_setup_end_compress(), and OPJ_TRUE.

Referenced by opj_create_compress(), and opj_jp2_end_compress().

## ◆ opj_j2k_end_decompress()

OPJ_BOOL opj_j2k_end_decompress | ( | opj_j2k_t * | j2k,
|  | opj_stream_private_t * | p_stream,
|  | opj_event_mgr_t * | p_manager
| ) |  |

Ends the decompression procedures and possibiliy add data to be read after the codestream.

References OPJ_TRUE.

Referenced by opj_create_decompress(), and opj_jp2_end_decompress().

## ◆ opj_j2k_get_tile()

OPJ_BOOL opj_j2k_get_tile | ( | opj_j2k_t * | p_j2k,
|  | opj_stream_private_t * | p_stream,
|  | opj_image_t * | p_image,
|  | opj_event_mgr_t * | p_manager,
|  | OPJ_UINT32 | tile_index
| ) |  |

References opj_image::comps, opj_image_comp::data, opj_image_comp::dx, opj_image_comp::dy, EVT_ERROR, opj_image_comp::factor, opj_image_comp::h, opj_j2k::m_cp, opj_j2k::m_decoder, opj_j2k::m_output_image, opj_j2k::m_private_image, opj_j2k::m_procedure_list, opj_j2k::m_specific_param, opj_j2k_dec::m_tile_ind_to_dec, opj_image::numcomps, opj_copy_image_header(), opj_event_msg(), OPJ_FALSE, opj_image_create0(), opj_image_data_free(), opj_image_destroy(), opj_int_ceildiv(), opj_int_ceildivpow2(), opj_j2k_exec(), opj_j2k_move_data_from_codec_to_output_image(), opj_j2k_setup_decoding_tile(), opj_cp::tdx, opj_cp::tdy, opj_cp::th, opj_cp::tw, opj_cp::tx0, opj_cp::ty0, opj_image_comp::w, opj_image_comp::x0, opj_image::x0, opj_image::x1, opj_image_comp::y0, opj_image::y0, and opj_image::y1.

Referenced by opj_create_decompress(), and opj_jp2_get_tile().

## ◆ opj_j2k_read_header()

OPJ_BOOL opj_j2k_read_header | ( | opj_stream_private_t * | p_stream,
|  | opj_j2k_t * | p_j2k,
|  | opj_image_t ** | p_image,
|  | opj_event_mgr_t * | p_manager
| ) |  |

Reads a jpeg2000 codestream header structure.

Parameters

  p_stream | the stream to read data from.
  p_j2k | the jpeg2000 codec.
  p_image | FIXME DOC
  p_manager | the user event manager.

Returns
  true if the box is valid.

References opj_j2k::m_private_image, opj_j2k::m_procedure_list, opj_j2k::m_validation_list, opj_copy_image_header(), OPJ_FALSE, opj_image_create0(), opj_image_destroy(), opj_j2k_allocate_tile_element_cstr_index(), opj_j2k_exec(), opj_j2k_setup_decoding_validation(), opj_j2k_setup_header_reading(), and OPJ_TRUE.

Referenced by opj_create_decompress(), and opj_jp2_read_header().

## ◆ opj_j2k_read_tile_header()

OPJ_BOOL opj_j2k_read_tile_header | ( | opj_j2k_t * | p_j2k,
|  | OPJ_UINT32 * | p_tile_index,
|  | OPJ_UINT32 * | p_data_size,
|  | OPJ_INT32 * | p_tile_x0,
|  | OPJ_INT32 * | p_tile_y0,
|  | OPJ_INT32 * | p_tile_x1,
|  | OPJ_INT32 * | p_tile_y1,
|  | OPJ_UINT32 * | p_nb_comps,
|  | OPJ_BOOL * | p_go_on,
|  | opj_stream_private_t * | p_stream,
|  | opj_event_mgr_t * | p_manager
| ) |  |

Reads a tile header.

Parameters

  p_j2k | the jpeg2000 codec.
  p_tile_index | FIXME DOC
  p_data_size | FIXME DOC
  p_tile_x0 | FIXME DOC
  p_tile_y0 | FIXME DOC
  p_tile_x1 | FIXME DOC
  p_tile_y1 | FIXME DOC
  p_nb_comps | FIXME DOC
  p_go_on | FIXME DOC
  p_stream | the stream to write data to.
  p_manager | the user event manager.

References opj_j2k::cstr_index, EVT_ERROR, EVT_INFO, EVT_WARNING, opj_dec_memory_marker_handler::handler, opj_dec_memory_marker_handler::id, J2K_MS_EOC, J2K_MS_SOD, J2K_MS_SOT, J2K_STATE_DATA, J2K_STATE_EOC, J2K_STATE_NEOC, J2K_STATE_TPH, J2K_STATE_TPHSOT, opj_j2k_dec::m_can_decode, opj_j2k::m_cp, opj_j2k::m_current_tile_number, opj_tcp::m_data, opj_j2k::m_decoder, opj_j2k_dec::m_header_data, opj_j2k_dec::m_header_data_size, opj_j2k_dec::m_last_sot_read_pos, opj_tcp::m_nb_tile_parts, opj_j2k_dec::m_nb_tile_parts_correction, opj_j2k_dec::m_nb_tile_parts_correction_checked, opj_j2k_dec::m_skip_data, opj_j2k_dec::m_sot_length, opj_j2k::m_specific_param, opj_j2k_dec::m_state, opj_j2k::m_tcd, opj_tcd_tile::numcomps, opj_event_msg(), OPJ_FALSE, opj_free(), opj_j2k_add_tlmarker(), opj_j2k_get_marker_handler(), opj_j2k_merge_ppt(), opj_j2k_need_nb_tile_parts_correction(), opj_j2k_read_sod(), opj_read_bytes, opj_realloc(), opj_stream_get_number_byte_left(), opj_stream_read_data(), opj_stream_skip(), opj_stream_tell(), opj_tcd_get_decoded_tile_size(), opj_tcd_init_decode_tile(), OPJ_TRUE, opj_dec_memory_marker_handler::states, opj_tcd::tcd_image, opj_cp::tcps, opj_cp::th, opj_tcd_image::tiles, opj_cp::tw, opj_tcd_tile::x0, opj_tcd_tile::x1, opj_tcd_tile::y0, and opj_tcd_tile::y1.

Referenced by opj_create_decompress(), opj_j2k_decode_one_tile(), opj_j2k_decode_tiles(), and opj_jp2_read_tile_header().

## ◆ opj_j2k_set_decode_area()

OPJ_BOOL opj_j2k_set_decode_area | ( | opj_j2k_t * | p_j2k,
|  | opj_image_t * | p_image,
|  | OPJ_INT32 | p_start_x,
|  | OPJ_INT32 | p_start_y,
|  | OPJ_INT32 | p_end_x,
|  | OPJ_INT32 | p_end_y,
|  | opj_event_mgr_t * | p_manager
| ) |  |

Sets the given area to be decoded.

This function should be called right after opj_read_header and before any tile header reading.

Parameters

  p_j2k | the jpeg2000 codec.
  p_image | FIXME DOC
  p_start_x | the left position of the rectangle to decode (in image coordinates).
  p_start_y | the up position of the rectangle to decode (in image coordinates).
  p_end_x | the right position of the rectangle to decode (in image coordinates).
  p_end_y | the bottom position of the rectangle to decode (in image coordinates).
  p_manager | the user event manager

Returns
  true if the area could be set.

References opj_image::comps, EVT_ERROR, EVT_INFO, EVT_WARNING, opj_image_comp::factor, J2K_STATE_TPHSOT, opj_j2k::m_cp, opj_tcp::m_data, opj_cp::m_dec, opj_j2k::m_decoder, opj_j2k_dec::m_discard_tiles, opj_j2k_dec::m_end_tile_x, opj_j2k_dec::m_end_tile_y, opj_j2k::m_private_image, opj_decoding_param::m_reduce, opj_cp::m_specific_param, opj_j2k::m_specific_param, opj_j2k_dec::m_start_tile_x, opj_j2k_dec::m_start_tile_y, opj_j2k_dec::m_state, opj_image::numcomps, opj_event_msg(), OPJ_FALSE, opj_int_ceildiv(), opj_j2k_update_image_dimensions(), opj_cp::tcps, opj_cp::tdx, opj_cp::tdy, opj_cp::th, opj_cp::tw, opj_cp::tx0, opj_cp::ty0, opj_image::x0, opj_image::x1, opj_image::y0, and opj_image::y1.

Referenced by opj_create_decompress(), and opj_jp2_set_decode_area().

## ◆ opj_j2k_set_decoded_components()

OPJ_BOOL opj_j2k_set_decoded_components | ( | opj_j2k_t * | p_j2k,
|  | OPJ_UINT32 | numcomps,
|  | const OPJ_UINT32 * | comps_indices,
|  | opj_event_mgr_t * | p_manager
| ) |  |

Sets the indices of the components to decode.

Parameters

  p_j2k | the jpeg2000 codec.
  numcomps | Number of components to decode.
  comps_indices | Array of num_compts indices (numbering starting at 0) corresponding to the components to decode.
  p_manager | Event manager

Returns
  OPJ_TRUE in case of success.

References EVT_ERROR, opj_j2k_dec::m_comps_indices_to_decode, opj_j2k::m_decoder, opj_j2k_dec::m_numcomps_to_decode, opj_j2k::m_private_image, opj_j2k::m_specific_param, opj_image::numcomps, opj_calloc(), opj_event_msg(), OPJ_FALSE, opj_free(), opj_malloc(), and OPJ_TRUE.

Referenced by opj_create_decompress(), and opj_jp2_set_decoded_components().

## ◆ opj_j2k_set_decoded_resolution_factor()

OPJ_BOOL opj_j2k_set_decoded_resolution_factor | ( | opj_j2k_t * | p_j2k,
|  | OPJ_UINT32 | res_factor,
|  | opj_event_mgr_t * | p_manager
| ) |  |

References opj_image::comps, EVT_ERROR, opj_image_comp::factor, opj_j2k::m_cp, opj_cp::m_dec, opj_j2k::m_decoder, opj_j2k_dec::m_default_tcp, opj_j2k::m_private_image, opj_decoding_param::m_reduce, opj_cp::m_specific_param, opj_j2k::m_specific_param, opj_image::numcomps, opj_tccp::numresolutions, opj_event_msg(), OPJ_FALSE, OPJ_TRUE, and opj_tcp::tccps.

Referenced by opj_create_decompress(), and opj_jp2_set_decoded_resolution_factor().

## ◆ opj_j2k_setup_mct_encoding()

OPJ_BOOL opj_j2k_setup_mct_encoding | ( | opj_tcp_t * | p_tcp,
|  | opj_image_t * | p_image
| ) |  |

References j2k_mct_write_functions_from_float, opj_mct_data::m_array_type, opj_mct_data::m_data, opj_mct_data::m_data_size, opj_tccp::m_dc_level_shift, opj_simple_mcc_decorrelation_data::m_decorrelation_array, opj_mct_data::m_element_type, opj_mct_data::m_index, opj_simple_mcc_decorrelation_data::m_index, opj_simple_mcc_decorrelation_data::m_is_irreversible, opj_tcp::m_mcc_records, opj_tcp::m_mct_decoding_matrix, opj_tcp::m_mct_records, opj_simple_mcc_decorrelation_data::m_nb_comps, opj_tcp::m_nb_max_mcc_records, opj_tcp::m_nb_max_mct_records, opj_tcp::m_nb_mcc_records, opj_tcp::m_nb_mct_records, opj_simple_mcc_decorrelation_data::m_offset_array, opj_tcp::mct, MCT_ELEMENT_SIZE, MCT_TYPE_DECORRELATION, MCT_TYPE_FLOAT, MCT_TYPE_OFFSET, opj_image::numcomps, OPJ_FALSE, opj_free(), OPJ_J2K_MCT_DEFAULT_NB_RECORDS, opj_malloc(), opj_realloc(), OPJ_TRUE, and opj_tcp::tccps.

Referenced by opj_j2k_setup_encoder().

## ◆ opj_j2k_start_compress()

OPJ_BOOL opj_j2k_start_compress | ( | opj_j2k_t * | p_j2k,
|  | opj_stream_private_t * | p_stream,
|  | opj_image_t * | p_image,
|  | opj_event_mgr_t * | p_manager
| ) |  |

Starts a compression scheme, i.e.

validates the codec parameters, writes the header.

Parameters

  p_j2k | the jpeg2000 codec.
  p_stream | the stream object.
  p_image | FIXME DOC
  p_manager | the user event manager.

Returns
  true if the codec is valid.

References opj_image::comps, opj_image_comp::data, EVT_ERROR, opj_j2k::m_private_image, opj_j2k::m_procedure_list, opj_j2k::m_validation_list, opj_image::numcomps, opj_copy_image_header(), opj_event_msg(), OPJ_FALSE, opj_image_create0(), opj_j2k_exec(), opj_j2k_setup_encoding_validation(), opj_j2k_setup_header_writing(), and OPJ_TRUE.

Referenced by opj_create_compress(), and opj_jp2_start_compress().

## ◆ opj_j2k_write_tile()

OPJ_BOOL opj_j2k_write_tile | ( | opj_j2k_t * | p_j2k,
|  | OPJ_UINT32 | p_tile_index,
|  | OPJ_BYTE * | p_data,
|  | OPJ_UINT32 | p_data_size,
|  | opj_stream_private_t * | p_stream,
|  | opj_event_mgr_t * | p_manager
| ) |  |

Writes a tile.

Parameters

  p_j2k | the jpeg2000 codec.
  p_tile_index | FIXME DOC
  p_data | FIXME DOC
  p_data_size | FIXME DOC
  p_stream | the stream to write data to.
  p_manager | the user event manager.

References opj_tcd_tile::comps, EVT_ERROR, opj_tcd::image, opj_j2k::m_tcd, opj_image::numcomps, opj_alloc_tile_component_data(), opj_event_msg(), OPJ_FALSE, opj_j2k_post_write_tile(), opj_j2k_pre_write_tile(), opj_tcd_copy_tile_data(), OPJ_TRUE, opj_tcd::tcd_image, and opj_tcd_image::tiles.

Referenced by opj_create_compress(), and opj_jp2_write_tile().