Grok 20.3.2
grk::FileFormatJP2Family Class Referenceabstract

JPEG 2000 file format reader/writer. More...

#include <FileFormatJP2Family.h>

Inheritance diagram for grk::FileFormatJP2Family:
grk::FileFormatJP2Compress grk::FileFormatJP2Decompress grk::FileFormatMJ2 grk::FileFormatMJ2Compress grk::FileFormatMJ2Decompress

Public Member Functions

 FileFormatJP2Family (IStream *stream)
virtual ~FileFormatJP2Family ()
 FileFormatJP2Family (const FileFormatJP2Family &)=delete
FileFormatJP2Familyoperator= (const FileFormatJP2Family &)=delete

Protected Member Functions

void init (grk_decompress_parameters *param)
bool readHeaderProcedure ()
bool readHeader (grk_header_info *header_info, GrkImage *headerImage)
virtual GrkImagegetHeaderImage (void)=0
grk_colorgetColour (void)
std::string getBoxName (const Box &box)
const FindHandlerInfo img_find_handler (uint32_t id)
 Finds the BOX_FUNC related to given box id.
uint32_t read_asoc (AsocBox *parent, uint8_t **header_data, uint32_t *header_data_size, uint32_t asocSize)
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)
bool read_box_header (Box *box, IStream *stream, uint32_t *bytesRead, bool codeStreamBoxWasRead)
bool read_box_header (Box *box, uint8_t *p_data, uint32_t *bytesRead, uint64_t availableBytes)
uint8_t * write_buffer (uint32_t boxId, Buffer8 *buffer, uint32_t *p_nb_bytes_written)
bool write_ftyp (IStream *stream, uint32_t file_type)
bool write_signature (IStream *stream, uint32_t sig)
bool exec (std::vector< PROCEDURE_FUNC > *procs)
bool read_jp2h (uint8_t *headerData, uint32_t headerSize)
 Reads the Jpeg2000 file Header box - JP2 Header box.
void skip (uint8_t **headerData, uint32_t *headerSize, uint32_t skip)

Protected Attributes

std::vector< PROCEDURE_FUNC > * procedure_list_
 list of execution procedures
uint32_t brand
uint32_t minversion
uint32_t numcl
uint32_t * cl
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
ComponentInfocomps
bool has_capture_resolution
double capture_resolution [2]
bool has_display_resolution
double display_resolution [2]
Buffer8 xml
Buffer8 xml_boxes [JP2_MAX_NUM_XML_BOXES]
uint32_t numXmlBoxes
bool io_xml_
std::string xml_outfile_
Buffer8 ipr
UUIDBox uuids [JP2_MAX_NUM_UUIDS]
uint32_t numUuids
std::unordered_map< uint32_t, BOX_FUNCheader
AsocBox root_asoc
uint32_t jp2_state
bool headerError_
bool headerRead_
std::stack< BoxsuperBoxes_
std::unordered_map< uint32_t, BOX_FUNCimg_header
IStreamstream_

Private Member Functions

double calc_res (uint16_t num, uint16_t den, uint8_t exponent)
bool read_ihdr (uint8_t *p_image_header_data, uint32_t image_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)
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)
bool read_signature (uint8_t *headerData, uint32_t headerSize)
 Reads a JPEG 2000 file signature box.
bool read_ftyp (uint8_t *headerData, uint32_t headerSize)
 Reads a FTYP box - File type box.
const FindHandlerInfo find_handler (uint32_t id)
void updateSuperBoxes (uint64_t boxBytes)

Detailed Description

JPEG 2000 file format reader/writer.

Constructor & Destructor Documentation

◆ FileFormatJP2Family() [1/2]

◆ ~FileFormatJP2Family()

grk::FileFormatJP2Family::~FileFormatJP2Family ( )
virtual

◆ FileFormatJP2Family() [2/2]

grk::FileFormatJP2Family::FileFormatJP2Family ( const FileFormatJP2Family & )
delete

References FileFormatJP2Family().

Member Function Documentation

◆ calc_res()

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

Referenced by read_res().

◆ exec()

bool grk::FileFormatJP2Family::exec ( std::vector< PROCEDURE_FUNC > * procs)
protected

◆ find_handler()

const FindHandlerInfo grk::FileFormatJP2Family::find_handler ( uint32_t id)
private

References header.

Referenced by readHeaderProcedure().

◆ getBoxName()

std::string grk::FileFormatJP2Family::getBoxName ( const Box & box)
protected

◆ getColour()

grk_color * grk::FileFormatJP2Family::getColour ( void )
protected

◆ getHeaderImage()

virtual GrkImage * grk::FileFormatJP2Family::getHeaderImage ( void )
protectedpure virtual

◆ img_find_handler()

const FindHandlerInfo grk::FileFormatJP2Family::img_find_handler ( uint32_t id)
protected

Finds the BOX_FUNC related to given box id.

Parameters
idthe id of the handler to fetch.
Returns
see FindHandlerInfo

References img_header.

Referenced by read_jp2h(), and readHeaderProcedure().

◆ init()

void grk::FileFormatJP2Family::init ( grk_decompress_parameters * param)
protected

◆ operator=()

FileFormatJP2Family & grk::FileFormatJP2Family::operator= ( const FileFormatJP2Family & )
delete

References FileFormatJP2Family().

◆ read_asoc() [1/2]

uint32_t grk::FileFormatJP2Family::read_asoc ( AsocBox * parent,
uint8_t ** header_data,
uint32_t * header_data_size,
uint32_t asocSize )
protected

◆ read_asoc() [2/2]

bool grk::FileFormatJP2Family::read_asoc ( uint8_t * header_data,
uint32_t header_data_size )
protected

References grk::grklog, read_asoc(), and root_asoc.

◆ read_box_header() [1/2]

◆ read_box_header() [2/2]

bool grk::FileFormatJP2Family::read_box_header ( Box * box,
uint8_t * p_data,
uint32_t * bytesRead,
uint64_t availableBytes )
protected

◆ read_bpc()

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

References bpc, comps, grk::grk_read(), grk::grklog, and numcomps.

Referenced by FileFormatJP2Family().

◆ read_channel_definition()

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

◆ read_colr()

◆ read_component_mapping()

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

◆ read_ftyp()

bool grk::FileFormatJP2Family::read_ftyp ( uint8_t * headerData,
uint32_t headerSize )
private

Reads a FTYP box - File type box.

Parameters
headerDatathe data contained in the FTYP box.
headerSizethe size of the data contained in the FTYP box.
Returns
true if the FTYP box is valid.

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

Referenced by FileFormatJP2Family().

◆ read_ihdr()

bool grk::FileFormatJP2Family::read_ihdr ( uint8_t * p_image_header_data,
uint32_t image_header_size )
private

◆ read_jp2h()

bool grk::FileFormatJP2Family::read_jp2h ( uint8_t * headerData,
uint32_t headerSize )
protected

Reads the Jpeg2000 file Header box - JP2 Header box.

(warning, this is a super box).

Parameters
headerDatathe data contained in the file header box.
headerSizethe size of the data contained in the file header box.
Returns
true if the JP2 Header box was successfully recognized.

References debugBoxes, getBoxName(), grk::grklog, img_find_handler(), grk::JP2_IHDR, jp2_state, grk::JP2_STATE_FILE_TYPE, grk::JP2_STATE_HEADER, grk::Box::length, read_box_header(), and grk::Box::type.

Referenced by grk::FileFormatJP2Decompress::FileFormatJP2Decompress(), and grk::FileFormatMJ2Decompress::read_smj2().

◆ read_palette_clr()

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

◆ read_res()

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

◆ read_res_box()

bool grk::FileFormatJP2Family::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(), and grk::grklog.

Referenced by read_res().

◆ read_signature()

bool grk::FileFormatJP2Family::read_signature ( uint8_t * headerData,
uint32_t headerSize )
private

Reads a JPEG 2000 file signature box.

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

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

Referenced by FileFormatJP2Family().

◆ readHeader()

◆ readHeaderProcedure()

◆ serializeAsoc()

void grk::FileFormatJP2Family::serializeAsoc ( AsocBox * asoc,
grk_asoc * serial_asocs,
uint32_t * num_asocs,
uint32_t level )
protected

◆ skip()

void grk::FileFormatJP2Family::skip ( uint8_t ** headerData,
uint32_t * headerSize,
uint32_t skip )
protected

◆ updateSuperBoxes()

void grk::FileFormatJP2Family::updateSuperBoxes ( uint64_t boxBytes)
private

References grk::Box::byteCount, and superBoxes_.

Referenced by readHeaderProcedure().

◆ write_buffer()

uint8_t * grk::FileFormatJP2Family::write_buffer ( uint32_t boxId,
Buffer8 * buffer,
uint32_t * p_nb_bytes_written )
protected

◆ write_ftyp()

bool grk::FileFormatJP2Family::write_ftyp ( IStream * stream,
uint32_t file_type )
protected

◆ write_signature()

bool grk::FileFormatJP2Family::write_signature ( IStream * stream,
uint32_t sig )
protected

Member Data Documentation

◆ approx

uint8_t grk::FileFormatJP2Family::approx
protected

◆ bpc

◆ brand

uint32_t grk::FileFormatJP2Family::brand
protected

◆ C

uint8_t grk::FileFormatJP2Family::C
protected

◆ capture_resolution

◆ cl

◆ comps

◆ display_resolution

◆ enumcs

◆ h

uint32_t grk::FileFormatJP2Family::h
protected

◆ has_capture_resolution

bool grk::FileFormatJP2Family::has_capture_resolution
protected

◆ has_display_resolution

bool grk::FileFormatJP2Family::has_display_resolution
protected

◆ header

◆ headerError_

bool grk::FileFormatJP2Family::headerError_
protected

◆ headerRead_

bool grk::FileFormatJP2Family::headerRead_
protected

◆ img_header

std::unordered_map<uint32_t, BOX_FUNC> grk::FileFormatJP2Family::img_header
protected

◆ io_xml_

bool grk::FileFormatJP2Family::io_xml_
protected

◆ IPR

uint8_t grk::FileFormatJP2Family::IPR
protected

◆ ipr

◆ jp2_state

uint32_t grk::FileFormatJP2Family::jp2_state
protected

◆ meth

◆ minversion

uint32_t grk::FileFormatJP2Family::minversion
protected

◆ numcl

uint32_t grk::FileFormatJP2Family::numcl
protected

◆ numcomps

◆ numUuids

◆ numXmlBoxes

◆ precedence

uint8_t grk::FileFormatJP2Family::precedence
protected

◆ procedure_list_

◆ root_asoc

◆ stream_

◆ superBoxes_

std::stack<Box> grk::FileFormatJP2Family::superBoxes_
protected

◆ UnkC

uint8_t grk::FileFormatJP2Family::UnkC
protected

◆ uuids

◆ w

uint32_t grk::FileFormatJP2Family::w
protected

◆ xml

◆ xml_boxes

◆ xml_outfile_

std::string grk::FileFormatJP2Family::xml_outfile_
protected

Referenced by init(), and readHeader().


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