grk::FileFormatDecompress Class Reference

`#include <FileFormatDecompress.h>`

Inheritance diagram for grk::FileFormatDecompress:

## Public Member Functions

| FileFormatDecompress (BufferedStream *stream)
virtual | ~FileFormatDecompress ()
bool | readHeader (grk_header_info *header_info)
| Main header reading function handler.
GrkImage * | getImage (uint16_t tileIndex)
GrkImage * | getImage (void)
void | init (grk_decompress_core_params *p_param)
| Set up decompressor function handler.
bool | setDecompressRegion (grk_rect_single region)
bool | decompress (grk_plugin_tile *tile)
bool | decompressTile (uint16_t tileIndex)
bool | end (void)
bool | postProcess (void)
bool | preProcess (void)
void | dump (uint32_t flag, FILE *outputFileStream)
Public Member Functions inherited from grk::FileFormat
| FileFormat (void)
virtual | ~FileFormat ()
Public Member Functions inherited from grk::ICodeStreamDecompress
virtual | ~ICodeStreamDecompress ()=default

## Private Member Functions

grk_color * | getColour (void)
uint32_t | read_asoc (AsocBox *parent, uint8_t **header_data, uint32_t *header_data_size, uint32_t asocSize)
bool | readHeaderProcedureImpl (void)
bool | read_box_hdr (FileFormatBox *box, uint32_t *p_number_bytes_read, BufferedStream *stream)
bool | read_ihdr (uint8_t *p_image_header_data, uint32_t image_header_size)
bool | read_xml (uint8_t *p_xml_data, uint32_t xml_size)
bool | read_uuid (uint8_t *headerData, uint32_t header_size)
bool | read_res_box (uint32_t *id, uint32_t *num, uint32_t *den, uint32_t *exponent, uint8_t **p_resolution_data)
bool | read_res (uint8_t *p_resolution_data, uint32_t resolution_size)
double | calc_res (uint16_t num, uint16_t den, uint8_t exponent)
bool | read_bpc (uint8_t *p_bpc_header_data, uint32_t bpc_header_size)
bool | read_channel_definition (uint8_t *p_cdef_header_data, uint32_t cdef_header_size)
bool | read_colr (uint8_t *p_colr_header_data, uint32_t colr_header_size)
bool | read_component_mapping (uint8_t *component_mapping_header_data, uint32_t component_mapping_header_size)
bool | read_palette_clr (uint8_t *p_pclr_header_data, uint32_t pclr_header_size)
const BOX_FUNC | find_handler (uint32_t id)
const BOX_FUNC | img_find_handler (uint32_t id)
| Finds the image execution function related to the given box id.
bool | read_jp (uint8_t *headerData, uint32_t header_size)
| Reads a JPEG 2000 file signature box.
bool | read_ftyp (uint8_t *headerData, uint32_t header_size)
| Reads a a FTYP box - File type box.
bool | read_jp2h (uint8_t *headerData, uint32_t header_size)
| Reads the Jpeg2000 file Header box - JP2 Header box (warning, this is a super box).
bool | read_box (FileFormatBox *box, uint8_t *p_data, uint32_t *p_number_bytes_read, uint64_t p_box_max_size)
bool | read_asoc (uint8_t *header_data, uint32_t header_data_size)
void | serializeAsoc (AsocBox *asoc, grk_asoc *serial_asocs, uint32_t *num_asocs, uint32_t level)

## Private Attributes

std::map< uint32_t, BOX_FUNC > | header
std::map< uint32_t, BOX_FUNC > | img_header
bool | headerError_
AsocBox | root_asoc
CodeStreamDecompress * | codeStream
uint32_t | jp2_state

## Additional Inherited Members

Protected Member Functions inherited from grk::FileFormat
bool | exec (std::vector< PROCEDURE_FUNC > *procs)
Protected Attributes inherited from grk::FileFormat
std::vector< PROCEDURE_FUNC > * | validation_list_
| list of validation procedures
std::vector< PROCEDURE_FUNC > * | procedure_list_
| list of execution procedures
uint32_t | w
uint32_t | h
uint16_t | numcomps
uint8_t | bpc
uint8_t | C
uint8_t | UnkC
uint8_t | IPR
uint8_t | meth
uint8_t | approx
GRK_ENUM_COLOUR_SPACE | enumcs
uint8_t | precedence
uint32_t | brand
uint32_t | minversion
uint32_t | numcl
uint32_t * | cl
ComponentInfo * | comps
bool | has_capture_resolution
double | capture_resolution [2]
bool | has_display_resolution
double | display_resolution [2]
grk_buf8 | xml
UUIDBox | uuids [JP2_MAX_NUM_UUIDS]
uint32_t | numUuids

## Constructor & Destructor Documentation

## FileFormatDecompress()

grk::FileFormatDecompress::FileFormatDecompress | ( | BufferedStream * | stream | ) |

References grk::grk_read(), header, img_header, JP2_ASOC, JP2_BPCC, JP2_CDEF, JP2_CMAP, JP2_COLR, JP2_FTYP, JP2_IHDR, JP2_JP, JP2_JP2H, JP2_PCLR, JP2_RES, JP2_UUID, JP2_XML, read_asoc(), read_bpc(), read_channel_definition(), read_colr(), read_component_mapping(), read_ftyp(), read_ihdr(), read_jp(), read_jp2h(), read_palette_clr(), read_res(), read_uuid(), and read_xml().

## ~FileFormatDecompress()

grk::FileFormatDecompress::~FileFormatDecompress | ( |  | ) |

virtual

References codeStream.

## Member Function Documentation

## calc_res()

double grk::FileFormatDecompress::calc_res | ( | uint16_t | num,
|  | uint16_t | den,
|  | uint8_t | exponent
| ) |  |

private

References grk::grk_read().

Referenced by read_res().

## decompress()

bool grk::FileFormatDecompress::decompress | ( | grk_plugin_tile * | tile | ) |

virtual

Implements grk::ICodeStreamDecompress.

References codeStream, grk::CodeStreamDecompress::decompress(), and grk::GRK_ERROR().

## decompressTile()

bool grk::FileFormatDecompress::decompressTile | ( | uint16_t | tileIndex | ) |

virtual

Implements grk::ICodeStreamDecompress.

References codeStream, grk::CodeStreamDecompress::decompressTile(), and grk::GRK_ERROR().

## dump()

void grk::FileFormatDecompress::dump | ( | uint32_t | flag,
|  | FILE * | outputFileStream
| ) |  |

virtual

Implements grk::ICodeStreamDecompress.

References codeStream, grk::CodeStreamDecompress::dump(), and grk::grk_read().

## end()

bool grk::FileFormatDecompress::end | ( | void |  | ) |

## find_handler()

const BOX_FUNC grk::FileFormatDecompress::find_handler | ( | uint32_t | id | ) |

private

References grk::grk_read(), and header.

Referenced by readHeaderProcedureImpl().

## getColour()

grk_color * grk::FileFormatDecompress::getColour | ( | void |  | ) |

private

References codeStream, _grk_image_meta::color, grk::CodeStreamDecompress::getHeaderImage(), and _grk_image::meta.

Referenced by preProcess(), read_channel_definition(), read_colr(), read_component_mapping(), read_palette_clr(), and readHeader().

## getImage() [1/2]

GrkImage * grk::FileFormatDecompress::getImage | ( | uint16_t | tileIndex | ) |

virtual

Implements grk::ICodeStreamDecompress.

References codeStream, and grk::CodeStreamDecompress::getImage().

## getImage() [2/2]

GrkImage * grk::FileFormatDecompress::getImage | ( | void |  | ) |

virtual

Implements grk::ICodeStreamDecompress.

References codeStream, and grk::CodeStreamDecompress::getImage().

## img_find_handler()

const BOX_FUNC grk::FileFormatDecompress::img_find_handler | ( | uint32_t | id | ) |

private

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

Parameters

  id | the id of the handler to fetch.

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

References grk::grk_read(), and img_header.

Referenced by read_jp2h(), and readHeaderProcedureImpl().

## init()

void grk::FileFormatDecompress::init | ( | grk_decompress_core_params * | p_param | ) |

virtual

Set up decompressor function handler.

Implements grk::ICodeStreamDecompress.

References codeStream, grk::grk_read(), and grk::CodeStreamDecompress::init().

## postProcess()

bool grk::FileFormatDecompress::postProcess | ( | void |  | ) |

virtual

Implements grk::ICodeStreamDecompress.

References codeStream, and grk::CodeStreamDecompress::postProcess().

## preProcess()

bool grk::FileFormatDecompress::preProcess | ( | void |  | ) |

virtual

Implements grk::ICodeStreamDecompress.

References _grk_color::channel_definition, codeStream, _grk_channel_definition::descriptions, getColour(), grk::CodeStreamDecompress::getCompositeImage(), grk::grk_read(), grk::GRK_WARN(), and _grk_channel_definition::num_channel_descriptions.

## read_asoc() [1/2]

uint32_t grk::FileFormatDecompress::read_asoc | ( | AsocBox * | parent,
|  | uint8_t ** | header_data,
|  | uint32_t * | header_data_size,
|  | uint32_t | asocSize
| ) |  |

private

References grk::AsocBox::children, grk::GRK_ERROR(), grk::grk_read(), JP2_ASOC, JP2_LBL, JP2_XML, and read_asoc().

Referenced by FileFormatDecompress(), read_asoc(), and read_asoc().

## read_asoc() [2/2]

bool grk::FileFormatDecompress::read_asoc | ( | uint8_t * | header_data,
|  | uint32_t | header_data_size
| ) |  |

private

References grk::GRK_ERROR(), grk::grk_read(), read_asoc(), and root_asoc.

## read_box()

bool grk::FileFormatDecompress::read_box | ( | FileFormatBox * | box,
|  | uint8_t * | p_data,
|  | uint32_t * | p_number_bytes_read,
|  | uint64_t | p_box_max_size
| ) |  |

private

References grk::GRK_ERROR(), and grk::grk_read().

Referenced by read_jp2h().

## read_box_hdr()

bool grk::FileFormatDecompress::read_box_hdr | ( | FileFormatBox * | box,
|  | uint32_t * | p_number_bytes_read,
|  | BufferedStream * | stream
| ) |  |

private

References grk::GRK_ERROR(), grk::grk_read(), grk::BufferedStream::numBytesLeft(), and grk::BufferedStream::read().

Referenced by readHeaderProcedureImpl().

## read_bpc()

bool grk::FileFormatDecompress::read_bpc | ( | uint8_t * | p_bpc_header_data,
|  | uint32_t | bpc_header_size
| ) |  |

private

References grk::FileFormat::bpc, grk::FileFormat::comps, grk::GRK_ERROR(), grk::grk_read(), grk::GRK_WARN(), and grk::FileFormat::numcomps.

Referenced by FileFormatDecompress().

## read_channel_definition()

bool grk::FileFormatDecompress::read_channel_definition | ( | uint8_t * | p_cdef_header_data,
|  | uint32_t | cdef_header_size
| ) |  |

private

References getColour(), GRK_CHANNEL_ASSOC_UNASSOCIATED, GRK_CHANNEL_TYPE_UNSPECIFIED, grk::GRK_ERROR(), and grk::grk_read().

Referenced by FileFormatDecompress().

## read_colr()

bool grk::FileFormatDecompress::read_colr | ( | uint8_t * | p_colr_header_data,
|  | uint32_t | colr_header_size
| ) |  |

private

References grk::FileFormat::approx, grk::FileFormat::enumcs, getColour(), GRK_CUSTOM_CIELAB_SPACE, GRK_DEFAULT_CIELAB_SPACE, GRK_ENUM_CLRSPC_CIE, GRK_ENUM_CLRSPC_CMYK, GRK_ENUM_CLRSPC_EYCC, GRK_ENUM_CLRSPC_GRAY, GRK_ENUM_CLRSPC_SRGB, GRK_ENUM_CLRSPC_SYCC, GRK_ENUM_CLRSPC_UNKNOWN, grk::GRK_ERROR(), grk::grk_read(), grk::GRK_WARN(), grk::FileFormat::meth, and grk::FileFormat::precedence.

Referenced by FileFormatDecompress().

## read_component_mapping()

bool grk::FileFormatDecompress::read_component_mapping | ( | uint8_t * | component_mapping_header_data,
|  | uint32_t | component_mapping_header_size
| ) |  |

private

References _grk_palette_data::component_mapping, getColour(), grk::GRK_ERROR(), grk::grk_read(), _grk_palette_data::num_channels, and _grk_color::palette.

Referenced by FileFormatDecompress().

## read_ftyp()

bool grk::FileFormatDecompress::read_ftyp | ( | uint8_t * | headerData,
|  | uint32_t | header_size
| ) |  |

private

Reads a a FTYP box - File type box.

Parameters

  headerData | the data contained in the FTYP box.
  header_size | the size of the data contained in the FTYP box.

Returns
  true if the FTYP box is valid.

References grk::FileFormat::brand, grk::FileFormat::cl, grk::grk_calloc(), grk::GRK_ERROR(), grk::grk_read(), jp2_state, grk::JP2_STATE_FILE_TYPE, grk::JP2_STATE_SIGNATURE, grk::FileFormat::minversion, and grk::FileFormat::numcl.

Referenced by FileFormatDecompress().

## read_ihdr()

bool grk::FileFormatDecompress::read_ihdr | ( | uint8_t * | p_image_header_data,
|  | uint32_t | image_header_size
| ) |  |

private

References grk::FileFormat::bpc, grk::FileFormat::C, grk::FileFormat::comps, GRK_ENUM_CLRSPC_CIE, grk::GRK_ERROR(), GRK_MAX_SUPPORTED_IMAGE_PRECISION, grk::grk_read(), grk::GRK_WARN(), grk::FileFormat::h, grk::FileFormat::IPR, grk::maxNumComponentsJ2K, grk::FileFormat::numcomps, grk::FileFormat::UnkC, and grk::FileFormat::w.

Referenced by FileFormatDecompress().

## read_jp()

bool grk::FileFormatDecompress::read_jp | ( | uint8_t * | headerData,
|  | uint32_t | header_size
| ) |  |

private

Reads a JPEG 2000 file signature box.

Parameters

  headerData | the data contained in the signature box.
  header_size | the size of the data contained in the signature box.

Returns
  true if the file signature box is valid.

References grk::GRK_ERROR(), grk::grk_read(), jp2_state, grk::JP2_STATE_NONE, and grk::JP2_STATE_SIGNATURE.

Referenced by FileFormatDecompress().

## read_jp2h()

bool grk::FileFormatDecompress::read_jp2h | ( | uint8_t * | headerData,
|  | uint32_t | header_size
| ) |  |

private

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

Parameters

  headerData | the data contained in the file header box.
  header_size | the size of the data contained in the file header box.

Returns
  true if the JP2 Header box was successfully recognized.

References grk::GRK_ERROR(), grk::grk_read(), img_find_handler(), JP2_IHDR, jp2_state, grk::JP2_STATE_FILE_TYPE, grk::JP2_STATE_HEADER, and read_box().

Referenced by FileFormatDecompress().

## read_palette_clr()

bool grk::FileFormatDecompress::read_palette_clr | ( | uint8_t * | p_pclr_header_data,
|  | uint32_t | pclr_header_size
| ) |  |

private

References grk::GrkImage::allocPalette(), codeStream, getColour(), grk::CodeStreamDecompress::getHeaderImage(), grk::GRK_ERROR(), GRK_MAX_SUPPORTED_IMAGE_PRECISION, grk::grk_read(), and _grk_color::palette.

Referenced by FileFormatDecompress().

## read_res()

bool grk::FileFormatDecompress::read_res | ( | uint8_t * | p_resolution_data,
|  | uint32_t | resolution_size
| ) |  |

private

References calc_res(), grk::FileFormat::capture_resolution, grk::FileFormat::display_resolution, grk::GRK_ERROR(), grk::grk_read(), GRK_RESOLUTION_BOX_SIZE, grk::FileFormat::has_capture_resolution, grk::FileFormat::has_display_resolution, JP2_CAPTURE_RES, JP2_DISPLAY_RES, and read_res_box().

Referenced by FileFormatDecompress().

## read_res_box()

bool grk::FileFormatDecompress::read_res_box | ( | uint32_t * | id,
|  | uint32_t * | num,
|  | uint32_t * | den,
|  | uint32_t * | exponent,
|  | uint8_t ** | p_resolution_data
| ) |  |

private

References grk::grk_read().

Referenced by read_res().

## read_uuid()

bool grk::FileFormatDecompress::read_uuid | ( | uint8_t * | headerData,
|  | uint32_t | header_size
| ) |  |

private

References grk::grk_read(), grk::GRK_WARN(), JP2_MAX_NUM_UUIDS, grk::FileFormat::numUuids, and grk::FileFormat::uuids.

Referenced by FileFormatDecompress().

## read_xml()

bool grk::FileFormatDecompress::read_xml | ( | uint8_t * | p_xml_data,
|  | uint32_t | xml_size
| ) |  |

private

References grk::grk_buf< T, A >::alloc(), grk::grk_buf< T, A >::buf, grk::grk_read(), grk::grk_buf< T, A >::len, and grk::FileFormat::xml.

Referenced by FileFormatDecompress().

## readHeader()

bool grk::FileFormatDecompress::readHeader | ( | grk_header_info * | header_info | ) |

virtual

Main header reading function handler.

Implements grk::ICodeStreamDecompress.

References _grk_header_info::asocs, grk::grk_buf< T, A >::buf, grk::FileFormat::capture_resolution, grk::AsocBox::children, codeStream, grk::FileFormat::display_resolution, grk::FileFormat::enumcs, grk::FileFormat::exec(), getColour(), grk::CodeStreamDecompress::getCompositeImage(), GRK_CLRSPC_CMYK, GRK_CLRSPC_CUSTOM_CIE, GRK_CLRSPC_DEFAULT_CIE, GRK_CLRSPC_EYCC, GRK_CLRSPC_GRAY, GRK_CLRSPC_SRGB, GRK_CLRSPC_SYCC, GRK_CLRSPC_UNKNOWN, GRK_DEFAULT_CIELAB_SPACE, GRK_ENUM_CLRSPC_CIE, GRK_ENUM_CLRSPC_CMYK, GRK_ENUM_CLRSPC_EYCC, GRK_ENUM_CLRSPC_GRAY, GRK_ENUM_CLRSPC_SRGB, GRK_ENUM_CLRSPC_SYCC, grk::GRK_ERROR(), grk::grk_read(), grk::GRK_WARN(), grk::FileFormat::has_capture_resolution, _grk_image::has_capture_resolution, grk::FileFormat::has_display_resolution, headerError_, grk::IPTC_UUID, grk::grk_buf< T, A >::len, grk::CodeStreamDecompress::needsHeaderRead(), _grk_header_info::num_asocs, grk::FileFormat::numUuids, grk::FileFormat::procedure_list_, grk::CodeStreamDecompress::readHeader(), readHeaderProcedureImpl(), root_asoc, serializeAsoc(), grk::FileFormat::uuids, grk::FileFormat::validation_list_, grk::FileFormat::xml, _grk_header_info::xml_data, _grk_header_info::xml_data_len, and grk::XMP_UUID.

## readHeaderProcedureImpl()

bool grk::FileFormatDecompress::readHeaderProcedureImpl | ( | void |  | ) |

private

References codeStream, find_handler(), grk::CodeStream::getStream(), GRK_BOX_SIZE, grk::grk_calloc(), grk::GRK_ERROR(), grk::grk_free(), grk::grk_read(), grk::grk_realloc(), grk::GRK_WARN(), img_find_handler(), JP2_JP2C, jp2_state, grk::JP2_STATE_CODESTREAM, grk::JP2_STATE_FILE_TYPE, grk::JP2_STATE_HEADER, grk::JP2_STATE_SIGNATURE, grk::JP2_STATE_UNKNOWN, and read_box_hdr().

Referenced by readHeader().

## serializeAsoc()

void grk::FileFormatDecompress::serializeAsoc | ( | AsocBox * | asoc,
|  | grk_asoc * | serial_asocs,
|  | uint32_t * | num_asocs,
|  | uint32_t | level
| ) |  |

private

References grk::grk_buf< T, A >::buf, grk::AsocBox::children, GRK_NUM_ASOC_BOXES_SUPPORTED, grk::grk_read(), grk::GRK_WARN(), grk::AsocBox::label, grk::grk_buf< T, A >::len, and serializeAsoc().

Referenced by readHeader(), and serializeAsoc().

## setDecompressRegion()

bool grk::FileFormatDecompress::setDecompressRegion | ( | grk_rect_single | region | ) |

virtual

Implements grk::ICodeStreamDecompress.

References codeStream, grk::grk_read(), and grk::CodeStreamDecompress::setDecompressRegion().

## Member Data Documentation

## codeStream

CodeStreamDecompress* grk::FileFormatDecompress::codeStream

private

Referenced by decompress(), decompressTile(), dump(), getColour(), getImage(), getImage(), init(), postProcess(), preProcess(), read_palette_clr(), readHeader(), readHeaderProcedureImpl(), setDecompressRegion(), and ~FileFormatDecompress().

## header

std::map<uint32_t, BOX_FUNC> grk::FileFormatDecompress::header

private

Referenced by FileFormatDecompress(), and find_handler().

## headerError_

bool grk::FileFormatDecompress::headerError_

private

Referenced by readHeader().

## img_header

std::map<uint32_t, BOX_FUNC> grk::FileFormatDecompress::img_header

private

Referenced by FileFormatDecompress(), and img_find_handler().

## jp2_state

uint32_t grk::FileFormatDecompress::jp2_state

private

Referenced by read_ftyp(), read_jp(), read_jp2h(), and readHeaderProcedureImpl().

## root_asoc

AsocBox grk::FileFormatDecompress::root_asoc

private

Referenced by read_asoc(), and readHeader().

The documentation for this class was generated from the following files:

- FileFormatDecompress.h
- FileFormatDecompress.cpp