OpenJPEG: jp2.c File Reference

OpenJPEG 2.5.4

Macros
jp2.c File Reference
`#include "opj_includes.h"`

## Macros
#define | OPJ_BOX_SIZE 1024
#define | OPJ_UNUSED(x)

## Local static functions
static const opj_jp2_header_handler_t | jp2_header []
static const opj_jp2_header_handler_t | jp2_img_header []
static OPJ_BOOL | opj_jp2_read_ihdr (opj_jp2_t *jp2, OPJ_BYTE *p_image_header_data, OPJ_UINT32 p_image_header_size, opj_event_mgr_t *p_manager)
| Reads a IHDR box - Image Header box.
static OPJ_BYTE * | opj_jp2_write_ihdr (opj_jp2_t *jp2, OPJ_UINT32 *p_nb_bytes_written)
| Writes the Image Header box - Image Header box.
static OPJ_BYTE * | opj_jp2_write_bpcc (opj_jp2_t *jp2, OPJ_UINT32 *p_nb_bytes_written)
| Writes the Bit per Component box.
static OPJ_BOOL | opj_jp2_read_bpcc (opj_jp2_t *jp2, OPJ_BYTE *p_bpc_header_data, OPJ_UINT32 p_bpc_header_size, opj_event_mgr_t *p_manager)
| Reads a Bit per Component box.
static OPJ_BOOL | opj_jp2_read_cdef (opj_jp2_t *jp2, OPJ_BYTE *p_cdef_header_data, OPJ_UINT32 p_cdef_header_size, opj_event_mgr_t *p_manager)
static void | opj_jp2_apply_cdef (opj_image_t *image, opj_jp2_color_t *color, opj_event_mgr_t *)
static OPJ_BYTE * | opj_jp2_write_cdef (opj_jp2_t *jp2, OPJ_UINT32 *p_nb_bytes_written)
| Writes the Channel Definition box.
static OPJ_BYTE * | opj_jp2_write_colr (opj_jp2_t *jp2, OPJ_UINT32 *p_nb_bytes_written)
| Writes the Colour Specification box.
static OPJ_BOOL | opj_jp2_write_ftyp (opj_jp2_t *jp2, opj_stream_private_t *cio, opj_event_mgr_t *p_manager)
| Writes a FTYP box - File type box.
static OPJ_BOOL | opj_jp2_read_ftyp (opj_jp2_t *jp2, OPJ_BYTE *p_header_data, OPJ_UINT32 p_header_size, opj_event_mgr_t *p_manager)
| Reads a a FTYP box - File type box.
static OPJ_BOOL | opj_jp2_skip_jp2c (opj_jp2_t *jp2, opj_stream_private_t *stream, opj_event_mgr_t *p_manager)
static OPJ_BOOL | opj_jp2_read_jp2h (opj_jp2_t *jp2, OPJ_BYTE *p_header_data, OPJ_UINT32 p_header_size, opj_event_mgr_t *p_manager)
| Reads the Jpeg2000 file Header box - JP2 Header box (warning, this is a super box).
static OPJ_BOOL | opj_jp2_write_jp2h (opj_jp2_t *jp2, opj_stream_private_t *stream, opj_event_mgr_t *p_manager)
| Writes the Jpeg2000 file Header box - JP2 Header box (warning, this is a super box).
static OPJ_BOOL | opj_jp2_write_jp2c (opj_jp2_t *jp2, opj_stream_private_t *cio, opj_event_mgr_t *p_manager)
| Writes the Jpeg2000 codestream Header box - JP2C Header box.
static OPJ_BOOL | opj_jp2_read_jp (opj_jp2_t *jp2, OPJ_BYTE *p_header_data, OPJ_UINT32 p_header_size, opj_event_mgr_t *p_manager)
| Reads a jpeg2000 file signature box.
static OPJ_BOOL | opj_jp2_write_jp (opj_jp2_t *jp2, opj_stream_private_t *cio, opj_event_mgr_t *p_manager)
| Writes a jpeg2000 file signature box.
static OPJ_BOOL | opj_jp2_apply_pclr (opj_image_t *image, opj_jp2_color_t *color, opj_event_mgr_t *p_manager)
| Apply collected palette data.
static void | opj_jp2_free_pclr (opj_jp2_color_t *color)
static OPJ_BOOL | opj_jp2_read_pclr (opj_jp2_t *jp2, OPJ_BYTE *p_pclr_header_data, OPJ_UINT32 p_pclr_header_size, opj_event_mgr_t *p_manager)
| Collect palette data.
static OPJ_BOOL | opj_jp2_read_cmap (opj_jp2_t *jp2, OPJ_BYTE *p_cmap_header_data, OPJ_UINT32 p_cmap_header_size, opj_event_mgr_t *p_manager)
| Collect component mapping data.
static OPJ_BOOL | opj_jp2_read_colr (opj_jp2_t *jp2, OPJ_BYTE *p_colr_header_data, OPJ_UINT32 p_colr_header_size, opj_event_mgr_t *p_manager)
| Reads the Color Specification box.
static OPJ_BOOL | opj_jp2_setup_end_header_writing (opj_jp2_t *jp2, opj_event_mgr_t *p_manager)
| Sets up the procedures to do on writing header after the codestream.
static OPJ_BOOL | opj_jp2_setup_end_header_reading (opj_jp2_t *jp2, opj_event_mgr_t *p_manager)
| Sets up the procedures to do on reading header after the codestream.
static OPJ_BOOL | opj_jp2_read_header_procedure (opj_jp2_t *jp2, opj_stream_private_t *stream, opj_event_mgr_t *p_manager)
| Reads a jpeg2000 file header structure.
static OPJ_BOOL | opj_jp2_exec (opj_jp2_t *jp2, opj_procedure_list_t *p_procedure_list, opj_stream_private_t *stream, opj_event_mgr_t *p_manager)
| Executes the given procedures on the given codec.
static OPJ_BOOL | opj_jp2_read_boxhdr (opj_jp2_box_t *box, OPJ_UINT32 *p_number_bytes_read, opj_stream_private_t *cio, opj_event_mgr_t *p_manager)
| Reads a box header.
static OPJ_BOOL | opj_jp2_setup_encoding_validation (opj_jp2_t *jp2, opj_event_mgr_t *p_manager)
| Sets up the validation ,i.e.
static OPJ_BOOL | opj_jp2_setup_header_writing (opj_jp2_t *jp2, opj_event_mgr_t *p_manager)
| Sets up the procedures to do on writing header.
static OPJ_BOOL | opj_jp2_default_validation (opj_jp2_t *jp2, opj_stream_private_t *cio, opj_event_mgr_t *p_manager)
static const opj_jp2_header_handler_t * | opj_jp2_img_find_handler (OPJ_UINT32 p_id)
| Finds the image execution function related to the given box id.
static const opj_jp2_header_handler_t * | opj_jp2_find_handler (OPJ_UINT32 p_id)
| Finds the execution function related to the given box id.
static OPJ_BOOL | opj_jp2_read_boxhdr_char (opj_jp2_box_t *box, OPJ_BYTE *p_data, OPJ_UINT32 *p_number_bytes_read, OPJ_UINT32 p_box_max_size, opj_event_mgr_t *p_manager)
| Reads a box header.
static OPJ_BOOL | opj_jp2_setup_decoding_validation (opj_jp2_t *jp2, opj_event_mgr_t *p_manager)
| Sets up the validation ,i.e.
static OPJ_BOOL | opj_jp2_setup_header_reading (opj_jp2_t *jp2, opj_event_mgr_t *p_manager)
| Sets up the procedures to do on reading header.
static OPJ_BOOL | opj_jp2_check_color (opj_image_t *image, opj_jp2_color_t *color, opj_event_mgr_t *p_manager)
static OPJ_BOOL | opj_jp2_apply_color_postprocessing (opj_jp2_t *jp2, opj_image_t *p_image, opj_event_mgr_t *p_manager)
OPJ_BOOL | opj_jp2_decode (opj_jp2_t *jp2, opj_stream_private_t *p_stream, opj_image_t *p_image, opj_event_mgr_t *p_manager)
| Decode an image from a JPEG-2000 file stream.
void | opj_jp2_setup_decoder (opj_jp2_t *jp2, opj_dparameters_t *parameters)
| Setup the decoder decoding parameters using user parameters.
void | opj_jp2_decoder_set_strict_mode (opj_jp2_t *jp2, OPJ_BOOL strict)
| Set the strict mode parameter.
OPJ_BOOL | opj_jp2_set_threads (opj_jp2_t *jp2, OPJ_UINT32 num_threads)
| Allocates worker threads for the compressor/decompressor.
OPJ_BOOL | opj_jp2_setup_encoder (opj_jp2_t *jp2, opj_cparameters_t *parameters, opj_image_t *image, opj_event_mgr_t *p_manager)
| Setup the encoder parameters using the current image and using user parameters.
OPJ_BOOL | opj_jp2_encode (opj_jp2_t *jp2, opj_stream_private_t *stream, opj_event_mgr_t *p_manager)
| Encode an image into a JPEG-2000 file stream.
OPJ_BOOL | opj_jp2_end_decompress (opj_jp2_t *jp2, opj_stream_private_t *cio, opj_event_mgr_t *p_manager)
| Ends the decompression procedures and possibiliy add data to be read after the codestream.
OPJ_BOOL | opj_jp2_end_compress (opj_jp2_t *jp2, 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.
OPJ_BOOL | opj_jp2_start_compress (opj_jp2_t *jp2, opj_stream_private_t *stream, opj_image_t *p_image, opj_event_mgr_t *p_manager)
| Starts a compression scheme, i.e.
static OPJ_BOOL | opj_jpip_skip_iptr (opj_jp2_t *jp2, opj_stream_private_t *stream, opj_event_mgr_t *p_manager)
OPJ_BOOL | opj_jp2_read_header (opj_stream_private_t *p_stream, opj_jp2_t *jp2, opj_image_t **p_image, opj_event_mgr_t *p_manager)
| Reads a jpeg2000 file header structure.
OPJ_BOOL | opj_jp2_read_tile_header (opj_jp2_t *p_jp2, 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.
OPJ_BOOL | opj_jp2_write_tile (opj_jp2_t *p_jp2, 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.
OPJ_BOOL | opj_jp2_decode_tile (opj_jp2_t *p_jp2, 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.
void | opj_jp2_destroy (opj_jp2_t *jp2)
| Destroy a JP2 decompressor handle.
OPJ_BOOL | opj_jp2_set_decoded_components (opj_jp2_t *p_jp2, OPJ_UINT32 numcomps, const OPJ_UINT32 *comps_indices, opj_event_mgr_t *p_manager)
| Sets the indices of the components to decode.
OPJ_BOOL | opj_jp2_set_decode_area (opj_jp2_t *p_jp2, 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.
OPJ_BOOL | opj_jp2_get_tile (opj_jp2_t *p_jp2, opj_stream_private_t *p_stream, opj_image_t *p_image, opj_event_mgr_t *p_manager, OPJ_UINT32 tile_index)
opj_jp2_t * | opj_jp2_create (OPJ_BOOL p_is_decoder)
| Creates a jpeg2000 file decompressor.
void | jp2_dump (opj_jp2_t *p_jp2, OPJ_INT32 flag, FILE *out_stream)
| Dump some elements from the JP2 decompression structure .
opj_codestream_index_t * | jp2_get_cstr_index (opj_jp2_t *p_jp2)
| Get the codestream index from a JPEG2000 codec.
opj_codestream_info_v2_t * | jp2_get_cstr_info (opj_jp2_t *p_jp2)
| Get the codestream info from a JPEG2000 codec.
OPJ_BOOL | opj_jp2_set_decoded_resolution_factor (opj_jp2_t *p_jp2, OPJ_UINT32 res_factor, opj_event_mgr_t *p_manager)
OPJ_BOOL | opj_jp2_encoder_set_extra_options (opj_jp2_t *p_jp2, const char *const *p_options, opj_event_mgr_t *p_manager)
| Specify extra options for the encoder.

## Macro Definition Documentation

## ◆ OPJ_BOX_SIZE

#define OPJ_BOX_SIZE 1024

Referenced by opj_jp2_read_header_procedure().

## ◆ OPJ_UNUSED

#define OPJ_UNUSED | ( |  | x | ) |

Value:
(void)x

Referenced by opj_dwt_decode_partial_97(), opj_dwt_decode_partial_tile(), opj_dwt_interleave_partial_h(), opj_dwt_interleave_partial_v(), opj_j2k_calculate_tp(), opj_j2k_copy_default_tcp_and_create_tcd(), opj_j2k_create_tcd(), opj_j2k_decoding_validation(), opj_j2k_destroy_header_memory(), opj_j2k_encoding_validation(), opj_j2k_end_encoding(), opj_j2k_get_end_header(), opj_j2k_init_info(), opj_j2k_mct_validation(), opj_j2k_read_com(), opj_j2k_read_crg(), opj_j2k_read_plm(), opj_j2k_read_plt(), opj_j2k_set_imf_parameters(), opj_j2k_update_rates(), opj_j2k_write_epc(), opj_j2k_write_plt_in_memory(), opj_j2k_write_poc_in_memory(), opj_j2k_write_sod(), opj_j2k_write_sot(), opj_jp2_default_validation(), opj_jp2_setup_decoding_validation(), opj_jp2_write_jp(), opj_v8dwt_interleave_partial_h(), and opj_v8dwt_interleave_partial_v().

## Function Documentation

## ◆ jp2_dump()

void jp2_dump | ( | opj_jp2_t * | p_jp2,
|  | OPJ_INT32 | flag,
|  | FILE * | out_stream )

Dump some elements from the JP2 decompression structure .

Parameters

  p_jp2 | the jp2 codec.
  flag | flag to describe what elements are dump.
  out_stream | output stream where dump the elements.

References opj_jp2::j2k, and j2k_dump().

Referenced by opj_create_decompress().

## ◆ jp2_get_cstr_index()

opj_codestream_index_t * jp2_get_cstr_index | ( | opj_jp2_t * | p_jp2 | ) |

Get the codestream index from a JPEG2000 codec.

Parameters

  p_jp2 | jp2 codec.

Returns
  the codestream index extract from the jpg2000 codec

References opj_jp2::j2k, and j2k_get_cstr_index().

Referenced by opj_create_decompress().

## ◆ jp2_get_cstr_info()

opj_codestream_info_v2_t * jp2_get_cstr_info | ( | opj_jp2_t * | p_jp2 | ) |

Get the codestream info from a JPEG2000 codec.

Parameters

  p_jp2 | jp2 codec.

Returns
  the codestream information extract from the jpg2000 codec

References opj_jp2::j2k, and j2k_get_cstr_info().

Referenced by opj_create_decompress().

## ◆ opj_jp2_apply_cdef()

void opj_jp2_apply_cdef | ( | opj_image_t * | image,
|  | opj_jp2_color_t * | color,
|  | opj_event_mgr_t * | manager )
| static

References opj_image_comp::alpha, opj_jp2_cdef_info::asoc, opj_jp2_cdef_info::cn, opj_image::comps, EVT_WARNING, opj_jp2_cdef::info, opj_jp2_color::jp2_cdef, opj_jp2_cdef::n, opj_image::numcomps, opj_event_msg(), opj_free(), and opj_jp2_cdef_info::typ.

Referenced by opj_jp2_apply_color_postprocessing().

## ◆ opj_jp2_apply_color_postprocessing()

OPJ_BOOL opj_jp2_apply_color_postprocessing | ( | opj_jp2_t * | jp2,
|  | opj_image_t * | p_image,
|  | opj_event_mgr_t * | p_manager )
| static

References opj_jp2_pclr::cmap, opj_jp2::color, opj_jp2::ignore_pclr_cmap_cdef, opj_jp2::j2k, opj_jp2_color::jp2_cdef, opj_jp2_color::jp2_pclr, opj_j2k::m_decoder, opj_j2k_dec::m_numcomps_to_decode, opj_j2k::m_specific_param, OPJ_FALSE, opj_jp2_apply_cdef(), opj_jp2_apply_pclr(), opj_jp2_check_color(), opj_jp2_free_pclr(), and OPJ_TRUE.

Referenced by opj_jp2_decode(), and opj_jp2_get_tile().

## ◆ opj_jp2_apply_pclr()

OPJ_BOOL opj_jp2_apply_pclr | ( | opj_image_t * | image,
|  | opj_jp2_color_t * | color,
|  | opj_event_mgr_t * | p_manager )
| static

Apply collected palette data.

Parameters

  image | Image.
  color | Collector for profile, cdef and pclr data.
  p_manager | the user event manager.

Returns
  true in case of success

References opj_jp2_pclr::channel_sign, opj_jp2_pclr::channel_size, opj_jp2_pclr::cmap, opj_jp2_cmap_comp::cmp, opj_image::comps, opj_image_comp::data, opj_jp2_pclr::entries, EVT_ERROR, opj_image_comp::h, opj_jp2_color::jp2_pclr, max(), opj_jp2_pclr::nr_channels, opj_jp2_pclr::nr_entries, opj_image::numcomps, opj_event_msg(), OPJ_FALSE, opj_free(), opj_image_data_alloc(), opj_image_data_free(), opj_malloc(), OPJ_TRUE, opj_jp2_cmap_comp::pcol, opj_image_comp::prec, opj_image_comp::sgnd, and opj_image_comp::w.

Referenced by opj_jp2_apply_color_postprocessing().

## ◆ opj_jp2_check_color()

OPJ_BOOL opj_jp2_check_color | ( | opj_image_t * | image,
|  | opj_jp2_color_t * | color,
|  | opj_event_mgr_t * | p_manager )
| static

References opj_jp2_pclr::cmap, EVT_ERROR, EVT_WARNING, opj_jp2_cdef::info, opj_jp2_color::jp2_cdef, opj_jp2_color::jp2_pclr, opj_jp2_cmap_comp::mtyp, opj_jp2_cdef::n, opj_jp2_pclr::nr_channels, opj_image::numcomps, opj_calloc(), opj_event_msg(), OPJ_FALSE, opj_free(), OPJ_TRUE, and opj_jp2_cmap_comp::pcol.

Referenced by opj_jp2_apply_color_postprocessing().

## ◆ opj_jp2_create()

opj_jp2_t * opj_jp2_create | ( | OPJ_BOOL | p_is_decoder | ) |

Creates a jpeg2000 file decompressor.

Returns
  an empty jpeg2000 file codec.

References opj_jp2::color, opj_jp2_color::icc_profile_buf, opj_jp2_color::icc_profile_len, opj_jp2::j2k, opj_jp2_color::jp2_cdef, opj_jp2_color::jp2_has_colr, opj_jp2_color::jp2_pclr, opj_jp2::m_procedure_list, opj_jp2::m_validation_list, opj_calloc(), opj_j2k_create_compress(), opj_j2k_create_decompress(), opj_jp2_destroy(), and opj_procedure_list_create().

Referenced by opj_create_compress(), and opj_create_decompress().

## ◆ opj_jp2_decode()

OPJ_BOOL opj_jp2_decode | ( | opj_jp2_t * | jp2,
|  | opj_stream_private_t * | p_stream,
|  | opj_image_t * | p_image,
|  | opj_event_mgr_t * | p_manager )

Decode an image from a JPEG-2000 file stream.

Parameters

  jp2 | JP2 decompressor handle
  p_stream | FIXME DOC
  p_image | FIXME DOC
  p_manager | FIXME DOC

Returns
  Returns a decoded image if successful, returns NULL otherwise

References EVT_ERROR, opj_jp2::j2k, opj_event_msg(), OPJ_FALSE, opj_j2k_decode(), and opj_jp2_apply_color_postprocessing().

Referenced by opj_create_decompress().

## ◆ opj_jp2_decode_tile()

OPJ_BOOL opj_jp2_decode_tile | ( | opj_jp2_t * | p_jp2,
|  | 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_jp2 | 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.

Returns
  FIXME DOC

References opj_jp2::j2k, and opj_j2k_decode_tile().

Referenced by opj_create_decompress().

## ◆ opj_jp2_decoder_set_strict_mode()

void opj_jp2_decoder_set_strict_mode | ( | opj_jp2_t * | jp2,
|  | OPJ_BOOL | strict )

Set the strict mode parameter.

When strict mode is enabled, the entire bitstream must be decoded or an error is returned. When it is disabled, the decoder will decode partial bitstreams.

Parameters

  jp2 | JP2 decompressor handle
  strict | OPJ_TRUE for strict mode

References opj_jp2::j2k, and opj_j2k_decoder_set_strict_mode().

Referenced by opj_create_decompress().

## ◆ opj_jp2_default_validation()

OPJ_BOOL opj_jp2_default_validation | ( | opj_jp2_t * | jp2,
|  | opj_stream_private_t * | cio,
|  | opj_event_mgr_t * | p_manager )
| static

References opj_jp2_comps::bpcc, opj_jp2::comps, opj_jp2::h, opj_jp2::j2k, opj_jp2::jp2_img_state, JP2_IMG_STATE_NONE, opj_jp2::jp2_state, JP2_STATE_NONE, opj_jp2::m_procedure_list, opj_jp2::m_validation_list, opj_jp2::meth, opj_jp2::numcl, opj_jp2::numcomps, opj_stream_has_seek(), OPJ_TRUE, OPJ_UNUSED, and opj_jp2::w.

Referenced by opj_jp2_setup_encoding_validation().

## ◆ opj_jp2_destroy()

void opj_jp2_destroy | ( | opj_jp2_t * | jp2 | ) |

Destroy a JP2 decompressor handle.

Parameters

  jp2 | JP2 decompressor handle to destroy

References opj_jp2_pclr::channel_sign, opj_jp2_pclr::channel_size, opj_jp2::cl, opj_jp2_pclr::cmap, opj_jp2::color, opj_jp2::comps, opj_jp2_pclr::entries, opj_jp2_color::icc_profile_buf, opj_jp2_cdef::info, opj_jp2::j2k, opj_jp2_color::jp2_cdef, opj_jp2_color::jp2_pclr, opj_jp2::m_procedure_list, opj_jp2::m_validation_list, opj_free(), opj_j2k_destroy(), and opj_procedure_list_destroy().

Referenced by opj_create_compress(), opj_create_decompress(), and opj_jp2_create().

## ◆ opj_jp2_encode()

OPJ_BOOL opj_jp2_encode | ( | opj_jp2_t * | jp2,
|  | opj_stream_private_t * | stream,
|  | opj_event_mgr_t * | p_manager )

Encode an image into a JPEG-2000 file stream.

Parameters

  jp2 | JP2 compressor handle
  stream | Output buffer stream
  p_manager | event manager

Returns
  Returns true if successful, returns false otherwise

References opj_jp2::j2k, and opj_j2k_encode().

Referenced by opj_create_compress().

## ◆ opj_jp2_encoder_set_extra_options()

OPJ_BOOL opj_jp2_encoder_set_extra_options | ( | opj_jp2_t * | p_jp2,
|  | const char *const * | p_options,
|  | opj_event_mgr_t * | p_manager )

Specify extra options for the encoder.

Parameters

  p_jp2 | the jpeg2000 codec.
  p_options | options
  p_manager | the user event manager

See also
  opj_encoder_set_extra_options() for more details.

References opj_jp2::j2k, and opj_j2k_encoder_set_extra_options().

Referenced by opj_create_compress().

## ◆ opj_jp2_end_compress()

OPJ_BOOL opj_jp2_end_compress | ( | opj_jp2_t * | jp2,
|  | 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_jp2::j2k, opj_jp2::m_procedure_list, OPJ_FALSE, opj_j2k_end_compress(), opj_jp2_exec(), and opj_jp2_setup_end_header_writing().

Referenced by opj_create_compress().

## ◆ opj_jp2_end_decompress()

OPJ_BOOL opj_jp2_end_decompress | ( | opj_jp2_t * | jp2,
|  | opj_stream_private_t * | cio,
|  | opj_event_mgr_t * | p_manager )

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

References opj_jp2::j2k, opj_jp2::m_procedure_list, OPJ_FALSE, opj_j2k_end_decompress(), opj_jp2_exec(), and opj_jp2_setup_end_header_reading().

Referenced by opj_create_decompress().

## ◆ opj_jp2_exec()

OPJ_BOOL opj_jp2_exec | ( | opj_jp2_t * | jp2,
|  | opj_procedure_list_t * | p_procedure_list,
|  | opj_stream_private_t * | stream,
|  | opj_event_mgr_t * | p_manager )
| static

Executes the given procedures on the given codec.

Parameters

  p_procedure_list | the list of procedures to execute
  jp2 | the jpeg2000 file codec to execute the procedures on.
  stream | the stream to execute the procedures on.
  p_manager | the user manager.

Returns
  true if all the procedures were successfully executed.

References opj_procedure_list_clear(), opj_procedure_list_get_first_procedure(), opj_procedure_list_get_nb_procedures(), and OPJ_TRUE.

Referenced by opj_jp2_end_compress(), opj_jp2_end_decompress(), opj_jp2_read_header(), and opj_jp2_start_compress().

## ◆ opj_jp2_find_handler()

const opj_jp2_header_handler_t * opj_jp2_find_handler | ( | OPJ_UINT32 | p_id | ) |
| static

Finds the execution function related to the given box id.

Parameters

  p_id | the id of the handler to fetch.

Returns
  the given handler or NULL if it could not be found.

References jp2_header.

Referenced by opj_jp2_read_header_procedure().

## ◆ opj_jp2_free_pclr()

void opj_jp2_free_pclr | ( | opj_jp2_color_t * | color | ) |
| static

References opj_jp2_pclr::channel_sign, opj_jp2_pclr::channel_size, opj_jp2_pclr::cmap, opj_jp2_pclr::entries, opj_jp2_color::jp2_pclr, and opj_free().

Referenced by opj_jp2_apply_color_postprocessing().

## ◆ opj_jp2_get_tile()

OPJ_BOOL opj_jp2_get_tile | ( | opj_jp2_t * | p_jp2,
|  | opj_stream_private_t * | p_stream,
|  | opj_image_t * | p_image,
|  | opj_event_mgr_t * | p_manager,
|  | OPJ_UINT32 | tile_index )

References EVT_ERROR, EVT_WARNING, opj_jp2::j2k, opj_event_msg(), OPJ_FALSE, opj_j2k_get_tile(), and opj_jp2_apply_color_postprocessing().

Referenced by opj_create_decompress().

## ◆ opj_jp2_img_find_handler()

const opj_jp2_header_handler_t * opj_jp2_img_find_handler | ( | OPJ_UINT32 | p_id | ) |
| static

Finds the image execution function related to the given box id.

Parameters

  p_id | the id of the handler to fetch.

Returns
  the given handler or NULL if it could not be found.

Parameters

  p_id | the id of the handler to fetch.

Returns
  the given handler or 00 if it could not be found.

References jp2_img_header.

Referenced by opj_jp2_read_header_procedure(), and opj_jp2_read_jp2h().

## ◆ opj_jp2_read_boxhdr()

OPJ_BOOL opj_jp2_read_boxhdr | ( | opj_jp2_box_t * | box,
|  | OPJ_UINT32 * | p_number_bytes_read,
|  | opj_stream_private_t * | cio,
|  | opj_event_mgr_t * | p_manager )
| static

Reads a box header.

The box is the way data is packed inside a jpeg2000 file structure.

Parameters

  cio | the input stream to read data from.
  box | the box structure to fill.
  p_number_bytes_read | pointer to an int that will store the number of bytes read from the stream (shoul usually be 2).
  p_manager | user event manager.

Returns
  true if the box is recognized, false otherwise

References EVT_ERROR, opj_jp2_box::length, opj_event_msg(), OPJ_FALSE, opj_read_bytes, opj_stream_get_number_byte_left(), opj_stream_read_data(), OPJ_TRUE, and opj_jp2_box::type.

Referenced by opj_jp2_read_header_procedure().

## ◆ opj_jp2_read_boxhdr_char()

OPJ_BOOL opj_jp2_read_boxhdr_char | ( | opj_jp2_box_t * | box,
|  | OPJ_BYTE * | p_data,
|  | OPJ_UINT32 * | p_number_bytes_read,
|  | OPJ_UINT32 | p_box_max_size,
|  | opj_event_mgr_t * | p_manager )
| static

Reads a box header.

The box is the way data is packed inside a jpeg2000 file structure. Data is read from a character string

Parameters

  box | the box structure to fill.
  p_data | the character string to read data from.
  p_number_bytes_read | pointer to an int that will store the number of bytes read from the stream (shoul usually be 2).
  p_box_max_size | the maximum number of bytes in the box.
  p_manager | FIXME DOC

Returns
  true if the box is recognized, false otherwise

References EVT_ERROR, opj_jp2_box::length, opj_event_msg(), OPJ_FALSE, opj_read_bytes, OPJ_TRUE, and opj_jp2_box::type.

Referenced by opj_jp2_read_jp2h().

## ◆ opj_jp2_read_bpcc()

OPJ_BOOL opj_jp2_read_bpcc | ( | opj_jp2_t * | jp2,
|  | OPJ_BYTE * | p_bpc_header_data,
|  | OPJ_UINT32 | p_bpc_header_size,
|  | opj_event_mgr_t * | p_manager )
| static

Reads a Bit per Component box.

Parameters

  p_bpc_header_data | pointer to actual data (already read from file)
  jp2 | the jpeg2000 file codec.
  p_bpc_header_size | the size of the bpc header
  p_manager | the user event manager.

Returns
  true if the bpc header is valid, false else.

References opj_jp2::bpc, opj_jp2_comps::bpcc, opj_jp2::comps, EVT_ERROR, EVT_WARNING, opj_jp2::numcomps, opj_event_msg(), OPJ_FALSE, opj_read_bytes, and OPJ_TRUE.

## ◆ opj_jp2_read_cdef()

OPJ_BOOL opj_jp2_read_cdef | ( | opj_jp2_t * | jp2,
|  | OPJ_BYTE * | p_cdef_header_data,
|  | OPJ_UINT32 | p_cdef_header_size,
|  | opj_event_mgr_t * | p_manager )
| static

References opj_jp2_cdef_info::asoc, opj_jp2_cdef_info::cn, opj_jp2::color, EVT_ERROR, opj_jp2_cdef::info, opj_jp2_color::jp2_cdef, opj_jp2_cdef::n, opj_event_msg(), OPJ_FALSE, opj_free(), opj_malloc(), opj_read_bytes, OPJ_TRUE, and opj_jp2_cdef_info::typ.

## ◆ opj_jp2_read_cmap()

OPJ_BOOL opj_jp2_read_cmap | ( | opj_jp2_t * | jp2,
|  | OPJ_BYTE * | p_cmap_header_data,
|  | OPJ_UINT32 | p_cmap_header_size,
|  | opj_event_mgr_t * | p_manager )
| static

Collect component mapping data.

Parameters

  jp2 | JP2 handle
  p_cmap_header_data | FIXME DOC
  p_cmap_header_size | FIXME DOC
  p_manager | FIXME DOC

Returns
  Returns true if successful, returns false otherwise

References opj_jp2_pclr::cmap, opj_jp2_cmap_comp::cmp, opj_jp2::color, EVT_ERROR, opj_jp2_color::jp2_pclr, opj_jp2_cmap_comp::mtyp, opj_jp2_pclr::nr_channels, opj_event_msg(), OPJ_FALSE, opj_malloc(), opj_read_bytes, OPJ_TRUE, and opj_jp2_cmap_comp::pcol.

## ◆ opj_jp2_read_colr()

OPJ_BOOL opj_jp2_read_colr | ( | opj_jp2_t * | jp2,
|  | OPJ_BYTE * | p_colr_header_data,
|  | OPJ_UINT32 | p_colr_header_size,
|  | opj_event_mgr_t * | p_manager )
| static

Reads the Color Specification box.

Parameters

  p_colr_header_data | pointer to actual data (already read from file)
  jp2 | the jpeg2000 file codec.
  p_colr_header_size | the size of the color header
  p_manager | the user event manager.

Returns
  true if the bpc header is valid, false else.

References opj_jp2::approx, opj_jp2::color, opj_jp2::enumcs, EVT_ERROR, EVT_INFO, EVT_WARNING, opj_jp2_color::icc_profile_buf, opj_jp2_color::icc_profile_len, opj_jp2_color::jp2_has_colr, opj_jp2::meth, opj_calloc(), opj_event_msg(), OPJ_FALSE, opj_malloc(), opj_read_bytes, OPJ_TRUE, and opj_jp2::precedence.

## ◆ opj_jp2_read_ftyp()

OPJ_BOOL opj_jp2_read_ftyp | ( | opj_jp2_t * | jp2,
|  | OPJ_BYTE * | p_header_data,
|  | OPJ_UINT32 | p_header_size,
|  | opj_event_mgr_t * | p_manager )
| static

Reads a a FTYP box - File type box.

Parameters

  p_header_data | the data contained in the FTYP box.
  jp2 | the jpeg2000 file codec.
  p_header_size | the size of the data contained in the FTYP box.
  p_manager | the user event manager.

Returns
  true if the FTYP box is valid.

References opj_jp2::brand, opj_jp2::cl, EVT_ERROR, opj_jp2::jp2_state, JP2_STATE_FILE_TYPE, JP2_STATE_SIGNATURE, opj_jp2::minversion, opj_jp2::numcl, opj_calloc(), opj_event_msg(), OPJ_FALSE, opj_read_bytes, and OPJ_TRUE.

## ◆ opj_jp2_read_header()

OPJ_BOOL opj_jp2_read_header | ( | opj_stream_private_t * | p_stream,
|  | opj_jp2_t * | jp2,
|  | opj_image_t ** | p_image,
|  | opj_event_mgr_t * | p_manager )

Reads a jpeg2000 file header structure.

Parameters

  p_stream | the stream to read data from.
  jp2 | the jpeg2000 file header structure.
  p_image | FIXME DOC
  p_manager | the user event manager.

Returns
  true if the box is valid.

References opj_jp2::color, opj_jp2::enumcs, EVT_ERROR, opj_jp2::has_ihdr, opj_jp2::has_jp2h, opj_jp2_color::icc_profile_buf, opj_jp2_color::icc_profile_len, opj_jp2::j2k, opj_jp2::m_procedure_list, opj_jp2::m_validation_list, OPJ_CLRSPC_CMYK, OPJ_CLRSPC_EYCC, OPJ_CLRSPC_GRAY, OPJ_CLRSPC_SRGB, OPJ_CLRSPC_SYCC, OPJ_CLRSPC_UNKNOWN, opj_event_msg(), OPJ_FALSE, opj_j2k_read_header(), opj_jp2_exec(), opj_jp2_setup_decoding_validation(), and opj_jp2_setup_header_reading().

Referenced by opj_create_decompress().

## ◆ opj_jp2_read_header_procedure()

OPJ_BOOL opj_jp2_read_header_procedure | ( | opj_jp2_t * | jp2,
|  | opj_stream_private_t * | stream,
|  | opj_event_mgr_t * | p_manager )
| static

Reads a jpeg2000 file header structure.

Parameters

  jp2 | the jpeg2000 file header structure.
  stream | the stream to read data from.
  p_manager | the user event manager.

Returns
  true if the box is valid.

References EVT_ERROR, EVT_WARNING, opj_jp2_header_handler::handler, JP2_JP2C, opj_jp2::jp2_state, JP2_STATE_CODESTREAM, JP2_STATE_FILE_TYPE, JP2_STATE_HEADER, JP2_STATE_SIGNATURE, JP2_STATE_UNKNOWN, opj_jp2_box::length, OPJ_BOX_SIZE, opj_calloc(), opj_event_msg(), OPJ_FALSE, opj_free(), opj_jp2_find_handler(), opj_jp2_img_find_handler(), opj_jp2_read_boxhdr(), opj_realloc(), opj_stream_get_number_byte_left(), opj_stream_read_data(), opj_stream_skip(), OPJ_TRUE, and opj_jp2_box::type.

Referenced by opj_jp2_setup_end_header_reading(), and opj_jp2_setup_header_reading().

## ◆ opj_jp2_read_ihdr()

OPJ_BOOL opj_jp2_read_ihdr | ( | opj_jp2_t * | jp2,
|  | OPJ_BYTE * | p_image_header_data,
|  | OPJ_UINT32 | p_image_header_size,
|  | opj_event_mgr_t * | p_manager )
| static

Reads a IHDR box - Image Header box.

Parameters

  p_image_header_data | pointer to actual data (already read from file)
  jp2 | the jpeg2000 file codec.
  p_image_header_size | the size of the image header
  p_manager | the user event manager.

Returns
  true if the image header is valid, false else.

References opj_cp::allow_different_bit_depth_sign, opj_jp2::bpc, opj_jp2::C, opj_jp2::comps, EVT_ERROR, EVT_INFO, EVT_WARNING, opj_jp2::h, opj_jp2::has_ihdr, opj_j2k::ihdr_h, opj_j2k::ihdr_w, opj_jp2::IPR, opj_jp2::j2k, opj_j2k::m_cp, opj_jp2::numcomps, opj_calloc(), opj_event_msg(), OPJ_FALSE, opj_read_bytes, OPJ_TRUE, opj_jp2::UnkC, and opj_jp2::w.

## ◆ opj_jp2_read_jp()

OPJ_BOOL opj_jp2_read_jp | ( | opj_jp2_t * | jp2,
|  | OPJ_BYTE * | p_header_data,
|  | OPJ_UINT32 | p_header_size,
|  | opj_event_mgr_t * | p_manager )
| static

Reads a jpeg2000 file signature box.

Parameters

  p_header_data | the data contained in the signature box.
  jp2 | the jpeg2000 file codec.
  p_header_size | the size of the data contained in the signature box.
  p_manager | the user event manager.

Returns
  true if the file signature box is valid.

References EVT_ERROR, opj_jp2::jp2_state, JP2_STATE_NONE, JP2_STATE_SIGNATURE, opj_event_msg(), OPJ_FALSE, opj_read_bytes, and OPJ_TRUE.

## ◆ opj_jp2_read_jp2h()

OPJ_BOOL opj_jp2_read_jp2h | ( | opj_jp2_t * | jp2,
|  | OPJ_BYTE * | p_header_data,
|  | OPJ_UINT32 | p_header_size,
|  | opj_event_mgr_t * | p_manager )
| static

Reads the Jpeg2000 file Header box - JP2 Header box (warning, this is a super box).

Parameters

  p_header_data | the data contained in the file header box.
  jp2 | the jpeg2000 file codec.
  p_header_size | the size of the data contained in the file header box.
  p_manager | the user event manager.

Returns
  true if the JP2 Header box was successfully recognized.

References EVT_ERROR, opj_jp2_header_handler::handler, opj_jp2::has_jp2h, JP2_IHDR, opj_jp2::jp2_img_state, JP2_IMG_STATE_NONE, JP2_IMG_STATE_UNKNOWN, opj_jp2::jp2_state, JP2_STATE_FILE_TYPE, JP2_STATE_HEADER, opj_jp2_box::length, opj_event_msg(), OPJ_FALSE, opj_jp2_img_find_handler(), opj_jp2_read_boxhdr_char(), OPJ_TRUE, and opj_jp2_box::type.

## ◆ opj_jp2_read_pclr()

OPJ_BOOL opj_jp2_read_pclr | ( | opj_jp2_t * | jp2,
|  | OPJ_BYTE * | p_pclr_header_data,
|  | OPJ_UINT32 | p_pclr_header_size,
|  | opj_event_mgr_t * | p_manager )
| static

Collect palette data.

Parameters

  jp2 | JP2 handle
  p_pclr_header_data | FIXME DOC
  p_pclr_header_size | FIXME DOC
  p_manager |

Returns
  Returns true if successful, returns false otherwise

References opj_jp2_pclr::channel_sign, opj_jp2_pclr::channel_size, opj_jp2_pclr::cmap, opj_jp2::color, opj_jp2_pclr::entries, EVT_ERROR, opj_jp2_color::jp2_pclr, opj_jp2_pclr::nr_channels, opj_jp2_pclr::nr_entries, opj_event_msg(), OPJ_FALSE, opj_free(), opj_malloc(), opj_read_bytes, and OPJ_TRUE.

## ◆ opj_jp2_read_tile_header()

OPJ_BOOL opj_jp2_read_tile_header | ( | opj_jp2_t * | p_jp2,
|  | 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_jp2 | 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_jp2::j2k, and opj_j2k_read_tile_header().

Referenced by opj_create_decompress().

## ◆ opj_jp2_set_decode_area()

OPJ_BOOL opj_jp2_set_decode_area | ( | opj_jp2_t * | p_jp2,
|  | 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_jp2 | 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_jp2::j2k, and opj_j2k_set_decode_area().

Referenced by opj_create_decompress().

## ◆ opj_jp2_set_decoded_components()

OPJ_BOOL opj_jp2_set_decoded_components | ( | opj_jp2_t * | jp2,
|  | OPJ_UINT32 | numcomps,
|  | const OPJ_UINT32 * | comps_indices,
|  | opj_event_mgr_t * | p_manager )

Sets the indices of the components to decode.

Parameters

  jp2 | JP2 decompressor handle
  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 opj_jp2::j2k, and opj_j2k_set_decoded_components().

Referenced by opj_create_decompress().

## ◆ opj_jp2_set_decoded_resolution_factor()

OPJ_BOOL opj_jp2_set_decoded_resolution_factor | ( | opj_jp2_t * | p_jp2,
|  | OPJ_UINT32 | res_factor,
|  | opj_event_mgr_t * | p_manager )

References opj_jp2::j2k, and opj_j2k_set_decoded_resolution_factor().

Referenced by opj_create_decompress().

## ◆ opj_jp2_set_threads()

OPJ_BOOL opj_jp2_set_threads | ( | opj_jp2_t * | jp2,
|  | OPJ_UINT32 | num_threads )

Allocates worker threads for the compressor/decompressor.

Parameters

  jp2 | JP2 decompressor handle
  num_threads | Number of threads.

Returns
  OPJ_TRUE in case of success.

References opj_jp2::j2k, and opj_j2k_set_threads().

Referenced by opj_create_compress(), and opj_create_decompress().

## ◆ opj_jp2_setup_decoder()

void opj_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

  jp2 | JP2 decompressor handle
  parameters | decompression parameters

References opj_jp2::color, opj_dparameters::flags, opj_jp2::ignore_pclr_cmap_cdef, opj_jp2::j2k, opj_jp2_color::jp2_has_colr, OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG, and opj_j2k_setup_decoder().

Referenced by opj_create_decompress().

## ◆ opj_jp2_setup_decoding_validation()

OPJ_BOOL opj_jp2_setup_decoding_validation | ( | opj_jp2_t * | jp2,
|  | opj_event_mgr_t * | p_manager )
| static

Sets up the validation ,i.e.

adds the procedures to launch to make sure the codec parameters are valid. Developers wanting to extend the library can add their own validation procedures.

References OPJ_TRUE, and OPJ_UNUSED.

Referenced by opj_jp2_read_header().

## ◆ opj_jp2_setup_encoder()

OPJ_BOOL opj_jp2_setup_encoder | ( | opj_jp2_t * | jp2,
|  | opj_cparameters_t * | parameters,
|  | opj_image_t * | image,
|  | opj_event_mgr_t * | p_manager )

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

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

Parameters

  jp2 | JP2 compressor handle
  parameters | compression parameters
  image | input filled image
  p_manager | FIXME DOC

Returns
  OPJ_TRUE if successful, OPJ_FALSE otherwise

References opj_image_comp::alpha, opj_jp2::approx, opj_jp2_cdef_info::asoc, opj_jp2::bpc, opj_jp2_comps::bpcc, opj_jp2::brand, opj_jp2::C, opj_jp2::cl, opj_jp2_cdef_info::cn, opj_jp2::color, opj_image::color_space, opj_image::comps, opj_jp2::comps, opj_jp2::enumcs, EVT_ERROR, EVT_WARNING, opj_jp2::h, opj_image::icc_profile_buf, opj_jp2_color::icc_profile_buf, opj_image::icc_profile_len, opj_jp2_color::icc_profile_len, opj_jp2_cdef::info, opj_jp2::IPR, opj_jp2::j2k, opj_jp2_color::jp2_cdef, JP2_JP2, opj_cparameters::jpip_on, opj_jp2::jpip_on, opj_jp2::meth, opj_jp2::minversion, opj_jp2_cdef::n, opj_jp2::numcl, opj_image::numcomps, opj_jp2::numcomps, OPJ_CLRSPC_CMYK, OPJ_CLRSPC_EYCC, OPJ_CLRSPC_GRAY, OPJ_CLRSPC_SRGB, OPJ_CLRSPC_SYCC, opj_event_msg(), OPJ_FALSE, opj_j2k_setup_encoder(), opj_malloc(), OPJ_TRUE, opj_image_comp::prec, opj_jp2::precedence, opj_image_comp::sgnd, opj_jp2_cdef_info::typ, opj_jp2::UnkC, opj_jp2::w, opj_image::x0, opj_image::x1, opj_image::y0, and opj_image::y1.

Referenced by opj_create_compress().

## ◆ opj_jp2_setup_encoding_validation()

OPJ_BOOL opj_jp2_setup_encoding_validation | ( | opj_jp2_t * | jp2,
|  | opj_event_mgr_t * | p_manager )
| static

Sets up the validation ,i.e.

adds the procedures to launch to make sure the codec parameters are valid. Developers wanting to extend the library can add their own validation procedures.

References opj_jp2::m_validation_list, OPJ_FALSE, opj_jp2_default_validation(), opj_procedure_list_add_procedure(), and OPJ_TRUE.

Referenced by opj_jp2_start_compress().

## ◆ opj_jp2_setup_end_header_reading()

OPJ_BOOL opj_jp2_setup_end_header_reading | ( | opj_jp2_t * | jp2,
|  | opj_event_mgr_t * | p_manager )
| static

Sets up the procedures to do on reading header after the codestream.

Developers wanting to extend the library can add their own writing procedures.

References opj_jp2::m_procedure_list, OPJ_FALSE, opj_jp2_read_header_procedure(), opj_procedure_list_add_procedure(), and OPJ_TRUE.

Referenced by opj_jp2_end_decompress().

## ◆ opj_jp2_setup_end_header_writing()

OPJ_BOOL opj_jp2_setup_end_header_writing | ( | opj_jp2_t * | jp2,
|  | opj_event_mgr_t * | p_manager )
| static

Sets up the procedures to do on writing header after the codestream.

Developers wanting to extend the library can add their own writing procedures.

References opj_jp2::jpip_on, opj_jp2::m_procedure_list, OPJ_FALSE, opj_jp2_write_jp2c(), opj_procedure_list_add_procedure(), and OPJ_TRUE.

Referenced by opj_jp2_end_compress().

## ◆ opj_jp2_setup_header_reading()

OPJ_BOOL opj_jp2_setup_header_reading | ( | opj_jp2_t * | jp2,
|  | opj_event_mgr_t * | p_manager )
| static

Sets up the procedures to do on reading header.

Developers wanting to extend the library can add their own writing procedures.

References opj_jp2::m_procedure_list, OPJ_FALSE, opj_jp2_read_header_procedure(), opj_procedure_list_add_procedure(), and OPJ_TRUE.

Referenced by opj_jp2_read_header().

## ◆ opj_jp2_setup_header_writing()

OPJ_BOOL opj_jp2_setup_header_writing | ( | opj_jp2_t * | jp2,
|  | opj_event_mgr_t * | p_manager )
| static

Sets up the procedures to do on writing header.

Developers wanting to extend the library can add their own writing procedures.

References opj_jp2::jpip_on, opj_jp2::m_procedure_list, OPJ_FALSE, opj_jp2_skip_jp2c(), opj_jp2_write_ftyp(), opj_jp2_write_jp(), opj_jp2_write_jp2h(), opj_jpip_skip_iptr(), opj_procedure_list_add_procedure(), and OPJ_TRUE.

Referenced by opj_jp2_start_compress().

## ◆ opj_jp2_skip_jp2c()

OPJ_BOOL opj_jp2_skip_jp2c | ( | opj_jp2_t * | jp2,
|  | opj_stream_private_t * | stream,
|  | opj_event_mgr_t * | p_manager )
| static

References opj_jp2::j2k_codestream_offset, OPJ_FALSE, opj_stream_skip(), opj_stream_tell(), and OPJ_TRUE.

Referenced by opj_jp2_setup_header_writing().

## ◆ opj_jp2_start_compress()

OPJ_BOOL opj_jp2_start_compress | ( | opj_jp2_t * | jp2,
|  | opj_stream_private_t * | 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

  jp2 | the jpeg2000 file codec.
  stream | the stream object.
  p_image | FIXME DOC
  p_manager | FIXME DOC

Returns
  true if the codec is valid.

References opj_jp2::j2k, opj_jp2::m_procedure_list, opj_jp2::m_validation_list, OPJ_FALSE, opj_j2k_start_compress(), opj_jp2_exec(), opj_jp2_setup_encoding_validation(), and opj_jp2_setup_header_writing().

Referenced by opj_create_compress().

## ◆ opj_jp2_write_bpcc()

OPJ_BYTE * opj_jp2_write_bpcc | ( | opj_jp2_t * | jp2,
|  | OPJ_UINT32 * | p_nb_bytes_written )
| static

Writes the Bit per Component box.

Parameters

  jp2 | jpeg2000 file codec.
  p_nb_bytes_written | pointer to store the nb of bytes written by the function.

Returns
  the data being copied.

References opj_jp2_comps::bpcc, opj_jp2::comps, JP2_BPCC, opj_jp2::numcomps, opj_calloc(), and opj_write_bytes.

Referenced by opj_jp2_write_jp2h().

## ◆ opj_jp2_write_cdef()

OPJ_BYTE * opj_jp2_write_cdef | ( | opj_jp2_t * | jp2,
|  | OPJ_UINT32 * | p_nb_bytes_written )
| static

Writes the Channel Definition box.

Parameters

  jp2 | jpeg2000 file codec.
  p_nb_bytes_written | pointer to store the nb of bytes written by the function.

Returns
  the data being copied.

References opj_jp2_cdef_info::asoc, opj_jp2_cdef_info::cn, opj_jp2::color, opj_jp2_cdef::info, JP2_CDEF, opj_jp2_color::jp2_cdef, opj_jp2_cdef::n, opj_malloc(), opj_write_bytes, and opj_jp2_cdef_info::typ.

Referenced by opj_jp2_write_jp2h().

## ◆ opj_jp2_write_colr()

OPJ_BYTE * opj_jp2_write_colr | ( | opj_jp2_t * | jp2,
|  | OPJ_UINT32 * | p_nb_bytes_written )
| static

Writes the Colour Specification box.

Parameters

  jp2 | jpeg2000 file codec.
  p_nb_bytes_written | pointer to store the nb of bytes written by the function.

Returns
  the data being copied.

References opj_jp2::approx, opj_jp2::color, opj_jp2::enumcs, opj_jp2_color::icc_profile_buf, opj_jp2_color::icc_profile_len, JP2_COLR, opj_jp2::meth, opj_calloc(), opj_write_bytes, and opj_jp2::precedence.

Referenced by opj_jp2_write_jp2h().

## ◆ opj_jp2_write_ftyp()

OPJ_BOOL opj_jp2_write_ftyp | ( | opj_jp2_t * | jp2,
|  | opj_stream_private_t * | cio,
|  | opj_event_mgr_t * | p_manager )
| static

Writes a FTYP box - File type box.

Parameters

  cio | the stream to write data to.
  jp2 | the jpeg2000 file codec.
  p_manager | the user event manager.

Returns
  true if writing was successful.

References opj_jp2::brand, opj_jp2::cl, EVT_ERROR, JP2_FTYP, opj_jp2::minversion, opj_jp2::numcl, opj_calloc(), opj_event_msg(), OPJ_FALSE, opj_free(), opj_stream_write_data(), and opj_write_bytes.

Referenced by opj_jp2_setup_header_writing().

## ◆ opj_jp2_write_ihdr()

OPJ_BYTE * opj_jp2_write_ihdr | ( | opj_jp2_t * | jp2,
|  | OPJ_UINT32 * | p_nb_bytes_written )
| static

Writes the Image Header box - Image Header box.

Parameters

  jp2 | jpeg2000 file codec.
  p_nb_bytes_written | pointer to store the nb of bytes written by the function.

Returns
  the data being copied.

References opj_jp2::bpc, opj_jp2::C, opj_jp2::h, opj_jp2::IPR, JP2_IHDR, opj_jp2::numcomps, opj_calloc(), opj_write_bytes, opj_jp2::UnkC, and opj_jp2::w.

Referenced by opj_jp2_write_jp2h().

## ◆ opj_jp2_write_jp()

OPJ_BOOL opj_jp2_write_jp | ( | opj_jp2_t * | jp2,
|  | opj_stream_private_t * | cio,
|  | opj_event_mgr_t * | p_manager )
| static

Writes a jpeg2000 file signature box.

Parameters

  cio | the stream to write data to.
  jp2 | the jpeg2000 file codec.
  p_manager | the user event manager.

Returns
  true if writing was successful.

References JP2_JP, OPJ_FALSE, opj_stream_write_data(), OPJ_TRUE, OPJ_UNUSED, and opj_write_bytes.

Referenced by opj_jp2_setup_header_writing().

## ◆ opj_jp2_write_jp2c()

OPJ_BOOL opj_jp2_write_jp2c | ( | opj_jp2_t * | jp2,
|  | opj_stream_private_t * | cio,
|  | opj_event_mgr_t * | p_manager )
| static

Writes the Jpeg2000 codestream Header box - JP2C Header box.

This function must be called AFTER the coding has been done.

Parameters

  cio | the stream to write data to.
  jp2 | the jpeg2000 file codec.
  p_manager | user event manager.

Returns
  true if writing was successful.

References EVT_ERROR, opj_jp2::j2k_codestream_offset, JP2_JP2C, opj_event_msg(), OPJ_FALSE, opj_stream_has_seek(), opj_stream_seek(), opj_stream_tell(), opj_stream_write_data(), OPJ_TRUE, and opj_write_bytes.

Referenced by opj_jp2_setup_end_header_writing().

## ◆ opj_jp2_write_jp2h()

OPJ_BOOL opj_jp2_write_jp2h | ( | opj_jp2_t * | jp2,
|  | opj_stream_private_t * | stream,
|  | opj_event_mgr_t * | p_manager )
| static

Writes the Jpeg2000 file Header box - JP2 Header box (warning, this is a super box).

Parameters

  jp2 | the jpeg2000 file codec.
  stream | the stream to write data to.
  p_manager | user event manager.

Returns
  true if writing was successful.

References opj_jp2::bpc, opj_jp2::color, EVT_ERROR, opj_jp2_img_header_writer_handler::handler, opj_jp2_color::jp2_cdef, JP2_JP2H, opj_jp2_img_header_writer_handler::m_data, opj_jp2_img_header_writer_handler::m_size, opj_event_msg(), OPJ_FALSE, opj_free(), opj_jp2_write_bpcc(), opj_jp2_write_cdef(), opj_jp2_write_colr(), opj_jp2_write_ihdr(), opj_stream_write_data(), OPJ_TRUE, and opj_write_bytes.

Referenced by opj_jp2_setup_header_writing().

## ◆ opj_jp2_write_tile()

OPJ_BOOL opj_jp2_write_tile | ( | opj_jp2_t * | p_jp2,
|  | 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_jp2 | 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_jp2::j2k, and opj_j2k_write_tile().

Referenced by opj_create_compress().

## ◆ opj_jpip_skip_iptr()

OPJ_BOOL opj_jpip_skip_iptr | ( | opj_jp2_t * | jp2,
|  | opj_stream_private_t * | stream,
|  | opj_event_mgr_t * | p_manager )
| static

References opj_jp2::jpip_iptr_offset, OPJ_FALSE, opj_stream_skip(), opj_stream_tell(), and OPJ_TRUE.

Referenced by opj_jp2_setup_header_writing().

## Variable Documentation

## ◆ jp2_header

const opj_jp2_header_handler_t jp2_header[]
| static

Initial value:
= {
{JP2_JP, opj_jp2_read_jp},
{JP2_FTYP, opj_jp2_read_ftyp},
{JP2_JP2H, opj_jp2_read_jp2h}
}
opj_jp2_read_jp2h
static OPJ_BOOL opj_jp2_read_jp2h(opj_jp2_t *jp2, OPJ_BYTE *p_header_data, OPJ_UINT32 p_header_size, opj_event_mgr_t *p_manager)
Reads the Jpeg2000 file Header box - JP2 Header box (warning, this is a super box).
Definition jp2.c:2691
opj_jp2_read_ftyp
static OPJ_BOOL opj_jp2_read_ftyp(opj_jp2_t *jp2, OPJ_BYTE *p_header_data, OPJ_UINT32 p_header_size, opj_event_mgr_t *p_manager)
Reads a a FTYP box - File type box.
Definition jp2.c:2586
opj_jp2_read_jp
static OPJ_BOOL opj_jp2_read_jp(opj_jp2_t *jp2, OPJ_BYTE *p_header_data, OPJ_UINT32 p_header_size, opj_event_mgr_t *p_manager)
Reads a jpeg2000 file signature box.
Definition jp2.c:2537
JP2_JP
#define JP2_JP
JPEG 2000 signature box.
Definition jp2.h:49
JP2_JP2H
#define JP2_JP2H
JP2 header box (super-box).
Definition jp2.h:51
JP2_FTYP
#define JP2_FTYP
File type box.
Definition jp2.h:50

Referenced by opj_jp2_find_handler().

## ◆ jp2_img_header

const opj_jp2_header_handler_t jp2_img_header[]
| static

Initial value:
= {
{JP2_IHDR, opj_jp2_read_ihdr},
{JP2_COLR, opj_jp2_read_colr},
{JP2_BPCC, opj_jp2_read_bpcc},
{JP2_PCLR, opj_jp2_read_pclr},
{JP2_CMAP, opj_jp2_read_cmap},
{JP2_CDEF, opj_jp2_read_cdef}
}
opj_jp2_read_ihdr
static OPJ_BOOL opj_jp2_read_ihdr(opj_jp2_t *jp2, OPJ_BYTE *p_image_header_data, OPJ_UINT32 p_image_header_size, opj_event_mgr_t *p_manager)
Reads a IHDR box - Image Header box.
Definition jp2.c:561
opj_jp2_read_bpcc
static OPJ_BOOL opj_jp2_read_bpcc(opj_jp2_t *jp2, OPJ_BYTE *p_bpc_header_data, OPJ_UINT32 p_bpc_header_size, opj_event_mgr_t *p_manager)
Reads a Bit per Component box.
Definition jp2.c:727
opj_jp2_read_cmap
static OPJ_BOOL opj_jp2_read_cmap(opj_jp2_t *jp2, OPJ_BYTE *p_cmap_header_data, OPJ_UINT32 p_cmap_header_size, opj_event_mgr_t *p_manager)
Collect component mapping data.
Definition jp2.c:1266
opj_jp2_read_cdef
static OPJ_BOOL opj_jp2_read_cdef(opj_jp2_t *jp2, OPJ_BYTE *p_cdef_header_data, OPJ_UINT32 p_cdef_header_size, opj_event_mgr_t *p_manager)
Definition jp2.c:1392
opj_jp2_read_colr
static OPJ_BOOL opj_jp2_read_colr(opj_jp2_t *jp2, OPJ_BYTE *p_colr_header_data, OPJ_UINT32 p_colr_header_size, opj_event_mgr_t *p_manager)
Reads the Color Specification box.
Definition jp2.c:1464
opj_jp2_read_pclr
static OPJ_BOOL opj_jp2_read_pclr(opj_jp2_t *jp2, OPJ_BYTE *p_pclr_header_data, OPJ_UINT32 p_pclr_header_size, opj_event_mgr_t *p_manager)
Collect palette data.
Definition jp2.c:1152
JP2_CDEF
#define JP2_CDEF
Channel Definition box.
Definition jp2.h:58
JP2_IHDR
#define JP2_IHDR
Image header box.
Definition jp2.h:52
JP2_CMAP
#define JP2_CMAP
Component Mapping box.
Definition jp2.h:57
JP2_BPCC
#define JP2_BPCC
Bits per component box.
Definition jp2.h:60
JP2_PCLR
#define JP2_PCLR
Palette box.
Definition jp2.h:56
JP2_COLR
#define JP2_COLR
Colour specification box.
Definition jp2.h:53

Referenced by opj_jp2_img_find_handler().