Grok  9.5.0
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
grk::FileFormatDecompress Class Reference

#include <FileFormatDecompress.h>

Inheritance diagram for grk::FileFormatDecompress:
grk::FileFormat grk::ICodeStreamDecompress

Public Member Functions

 FileFormatDecompress (IBufferedStream *stream)
 
virtual ~FileFormatDecompress ()
 
bool readHeader (grk_header_info *header_info)
 Main header reading function handler. More...
 
GrkImagegetImage (uint16_t tileIndex)
 
GrkImagegetImage (void)
 
void initDecompress (grk_dparameters *p_param)
 Set up decompressor function handler. More...
 
bool setDecompressWindow (grkRectU32 window)
 
bool decompress (grk_plugin_tile *tile)
 
bool decompressTile (uint16_t tileIndex)
 
bool endDecompress (void)
 Reading function used after code stream if necessary. More...
 
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
 

Static Public Member Functions

static void free_color (grk_color *color)
 

Private Member Functions

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, IBufferedStream *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)
 
void apply_channel_definition (GrkImage *image, grk_color *color)
 
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 check_color (GrkImage *image, grk_color *color)
 
bool apply_palette_clr (GrkImage *image, grk_color *color)
 
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. More...
 
bool read_jp (uint8_t *headerData, uint32_t header_size)
 Reads a JPEG 2000 file signature box. More...
 
bool read_ftyp (uint8_t *headerData, uint32_t header_size)
 Reads a a FTYP box - File type box. More...
 
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). More...
 
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)
 
void init_end_header_reading (void)
 
bool applyColour (GrkImage *img)
 
bool applyColour (void)
 

Static Private Member Functions

static void alloc_palette (grk_color *color, uint8_t num_channels, uint16_t num_entries)
 
static void free_palette_clr (grk_color *color)
 

Private Attributes

std::map< uint32_t, BOX_FUNCheader
 
std::map< uint32_t, BOX_FUNCimg_header
 
bool m_headerError
 
AsocBox root_asoc
 
CodeStreamDecompresscodeStream
 
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 > * m_validation_list
 list of validation procedures More...
 
std::vector< PROCEDURE_FUNC > * m_procedure_list
 list of execution procedures More...
 
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
 
ComponentInfocomps
 
grk_color color
 
bool has_capture_resolution
 
double capture_resolution [2]
 
bool has_display_resolution
 
double display_resolution [2]
 
grkBufferU8 xml
 
UUIDBox uuids [JP2_MAX_NUM_UUIDS]
 
uint32_t numUuids
 

Constructor & Destructor Documentation

◆ FileFormatDecompress()

grk::FileFormatDecompress::FileFormatDecompress ( IBufferedStream stream)

◆ ~FileFormatDecompress()

grk::FileFormatDecompress::~FileFormatDecompress ( )
virtual

References codeStream.

Member Function Documentation

◆ alloc_palette()

void grk::FileFormatDecompress::alloc_palette ( grk_color color,
uint8_t  num_channels,
uint16_t  num_entries 
)
staticprivate

◆ apply_channel_definition()

void grk::FileFormatDecompress::apply_channel_definition ( GrkImage image,
grk_color color 
)
private

◆ apply_palette_clr()

bool grk::FileFormatDecompress::apply_palette_clr ( GrkImage image,
grk_color color 
)
private

◆ applyColour() [1/2]

bool grk::FileFormatDecompress::applyColour ( GrkImage img)
private

◆ applyColour() [2/2]

bool grk::FileFormatDecompress::applyColour ( void  )
private

◆ calc_res()

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

Referenced by read_res().

◆ check_color()

bool grk::FileFormatDecompress::check_color ( GrkImage image,
grk_color color 
)
private

◆ decompress()

bool grk::FileFormatDecompress::decompress ( grk_plugin_tile tile)
virtual

◆ decompressTile()

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

◆ dump()

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

◆ endDecompress()

bool grk::FileFormatDecompress::endDecompress ( void  )
virtual

◆ find_handler()

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

References header.

Referenced by readHeaderProcedureImpl().

◆ free_color()

void grk::FileFormatDecompress::free_color ( grk_color color)
static

◆ free_palette_clr()

void grk::FileFormatDecompress::free_palette_clr ( grk_color color)
staticprivate

◆ getImage() [1/2]

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

◆ getImage() [2/2]

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

◆ 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
idthe id of the handler to fetch.
Returns
the given handler or nullptr if it could not be found.

References img_header.

Referenced by read_jp2h(), and readHeaderProcedureImpl().

◆ init_end_header_reading()

void grk::FileFormatDecompress::init_end_header_reading ( void  )
private

◆ initDecompress()

void grk::FileFormatDecompress::initDecompress ( grk_dparameters p_param)
virtual

◆ 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

◆ read_asoc() [2/2]

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

◆ 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

◆ read_box_hdr()

bool grk::FileFormatDecompress::read_box_hdr ( FileFormatBox box,
uint32_t *  p_number_bytes_read,
IBufferedStream stream 
)
private

◆ read_bpc()

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

◆ read_channel_definition()

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

◆ read_colr()

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

◆ read_component_mapping()

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

◆ read_ftyp()

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

Reads a a FTYP box - File type box.

Parameters
headerDatathe data contained in the FTYP box.
header_sizethe 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_ERROR(), grk::grkCalloc(), 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

◆ read_jp()

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

Reads a JPEG 2000 file signature box.

Parameters
headerDatathe data contained in the signature box.
header_sizethe size of the data contained in the signature box.
Returns
true if the file signature box is valid.

References grk::GRK_ERROR(), 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
headerDatathe data contained in the file header box.
header_sizethe size of the data contained in the file header box.
Returns
true if the JP2 Header box was successfully recognized.

References grk::GRK_ERROR(), img_find_handler(), JP2_IHDR, jp2_state, grk::JP2_STATE_FILE_TYPE, grk::JP2_STATE_HEADER, grk::FileFormatBox::length, read_box(), and grk::FileFormatBox::type.

Referenced by FileFormatDecompress().

◆ read_palette_clr()

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

◆ read_res()

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

◆ 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

Referenced by read_res().

◆ read_uuid()

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

◆ read_xml()

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

◆ readHeader()

bool grk::FileFormatDecompress::readHeader ( grk_header_info header_info)
virtual

◆ readHeaderProcedureImpl()

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

◆ serializeAsoc()

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

◆ setDecompressWindow()

bool grk::FileFormatDecompress::setDecompressWindow ( grkRectU32  window)
virtual

Member Data Documentation

◆ codeStream

CodeStreamDecompress* grk::FileFormatDecompress::codeStream
private

◆ header

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

◆ img_header

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

◆ jp2_state

uint32_t grk::FileFormatDecompress::jp2_state
private

◆ m_headerError

bool grk::FileFormatDecompress::m_headerError
private

Referenced by readHeader().

◆ 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: