Grok  7.6.3
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
grk::CodeStream Struct Reference

#include <CodeStream.h>

Inheritance diagram for grk::CodeStream:
grk::ICodeStream

Public Member Functions

 CodeStream (bool decompress, BufferedStream *stream)
 
 ~CodeStream ()
 
bool read_header (grk_header_info *header_info, grk_image **p_image)
 Main header reading function handler. More...
 
bool decompress (grk_plugin_tile *tile, grk_image *p_image)
 
bool decompress_tile (grk_image *p_image, uint16_t tile_index)
 decompress tile More...
 
bool end_decompress (void)
 Reading function used after code stream if necessary. More...
 
void init_decompress (grk_dparameters *p_param)
 Set up decompressor function handler. More...
 
bool start_compress (void)
 
bool init_compress (grk_cparameters *p_param, grk_image *p_image)
 
bool compress (grk_plugin_tile *tile)
 
bool compress_tile (uint16_t tile_index, uint8_t *p_data, uint64_t data_size)
 
bool end_compress (void)
 
void dump (uint32_t flag, FILE *out_stream)
 
grk_codestream_info_v2get_cstr_info (void)
 
grk_codestream_indexget_cstr_index ()
 
bool isDecodingTilePartHeader ()
 
TileCodingParamsget_current_decode_tcp (void)
 
bool read_marker (void)
 
bool read_short (uint16_t *val)
 
bool process_marker (const marker_handler *marker_handler, uint16_t marker_size)
 
bool set_decompress_window (grk_image *p_image, uint32_t start_x, uint32_t start_y, uint32_t end_x, uint32_t end_y)
 Sets the given area to be decompressed. More...
 
bool alloc_multi_tile_output_data (grk_image *p_output_image)
 Allocate output buffer for multiple tile decompress. More...
 
bool parse_tile_header_markers (bool *can_decode_tile_data)
 
bool init_header_writing (void)
 
bool read_header_procedure (void)
 
bool do_decompress (grk_image *p_image)
 
bool decompress_tile_t2t1 (TileProcessor *tileProcessor, bool multi_tile)
 
bool decompress_tile ()
 
bool decompress_tile_t2 (TileProcessor *tileProcessor)
 
bool decompress_tiles (void)
 
bool decompress_validation (void)
 
bool write_tile_part (TileProcessor *tileProcessor)
 
bool post_write_tile (TileProcessor *tileProcessor)
 
bool get_end_header (void)
 
bool copy_default_tcp (void)
 
bool update_rates (void)
 
bool compress_validation (void)
 
bool exec (std::vector< j2k_procedure > &p_procedure_list)
 Executes the given procedures on the given codec. More...
 
bool need_nb_tile_parts_correction (bool *p_correction_needed)
 Checks for invalid number of tile-parts in SOT marker (TPsot==TNsot). More...
 
bool mct_validation (void)
 
bool read_unk (uint16_t *output_marker)
 Reads an unknown marker. More...
 
int32_t tileIndexToDecode ()
 
TileProcessorallocateProcessor (uint16_t tile_index)
 
TileProcessorcurrentProcessor (void)
 
BufferedStreamgetStream ()
 
- Public Member Functions inherited from grk::ICodeStream
virtual ~ICodeStream ()
 

Public Attributes

DecoderState m_decompressor
 
EncoderState m_encoder
 
grk_imagem_input_image
 internal/private encoded / decompressed image More...
 
grk_imagem_output_image
 
CodingParams m_cp
 Coding parameters. More...
 
std::vector< j2k_procedurem_procedure_list
 the list of procedures to exec More...
 
std::vector< j2k_procedurem_validation_list
 the list of validation procedures to follow to make sure the code is valid More...
 
grk_codestream_indexcstr_index
 helper used to write the index file More...
 
uint16_t m_curr_marker
 Only valid for decoding. More...
 
bool wholeTileDecompress
 
grk_plugin_tilecurrent_plugin_tile
 
bool m_nb_tile_parts_correction_checked
 
uint32_t m_nb_tile_parts_correction
 

Private Member Functions

const marker_handlerget_marker_handler (uint16_t id)
 Reads the lookup table containing all the marker, status and action, and returns the handler associated with the marker value. More...
 

Private Attributes

std::map< uint16_t, marker_handler * > marker_map
 
TileProcessorm_tileProcessor
 current TileProcessor More...
 
BufferedStreamm_stream
 
std::map< uint32_t, TileProcessor * > m_processors
 
int32_t m_tile_ind_to_dec
 index of single tile to decompress; !!! initialized to -1 !!! More...
 
uint8_t * m_marker_scratch
 
uint16_t m_marker_scratch_size
 

Constructor & Destructor Documentation

◆ CodeStream()

grk::CodeStream::CodeStream ( bool  decompress,
BufferedStream stream 
)

◆ ~CodeStream()

grk::CodeStream::~CodeStream ( )

Member Function Documentation

◆ alloc_multi_tile_output_data()

bool grk::CodeStream::alloc_multi_tile_output_data ( grk_image p_output_image)

Allocate output buffer for multiple tile decompress.

Parameters
p_output_imageoutput image
Returns
true if successful

References _grk_image::comps, grk::GRK_ERROR(), and grk::grk_image_single_component_data_alloc().

◆ allocateProcessor()

TileProcessor * grk::CodeStream::allocateProcessor ( uint16_t  tile_index)

◆ compress()

bool grk::CodeStream::compress ( grk_plugin_tile tile)
virtual

◆ compress_tile()

bool grk::CodeStream::compress_tile ( uint16_t  tile_index,
uint8_t *  p_data,
uint64_t  data_size 
)
virtual

Implements grk::ICodeStream.

References grk::GRK_ERROR().

Referenced by grk::FileFormat::compress_tile().

◆ compress_validation()

bool grk::CodeStream::compress_validation ( void  )

◆ copy_default_tcp()

bool grk::CodeStream::copy_default_tcp ( void  )

References grk::grk_malloc().

Referenced by grk::j2k_copy_default_tcp().

◆ currentProcessor()

TileProcessor * grk::CodeStream::currentProcessor ( void  )

◆ decompress()

bool grk::CodeStream::decompress ( grk_plugin_tile tile,
grk_image p_image 
)
virtual

◆ decompress_tile() [1/2]

bool grk::CodeStream::decompress_tile ( )

◆ decompress_tile() [2/2]

bool grk::CodeStream::decompress_tile ( grk_image p_image,
uint16_t  tile_index 
)
virtual

◆ decompress_tile_t2()

bool grk::CodeStream::decompress_tile_t2 ( TileProcessor tileProcessor)

◆ decompress_tile_t2t1()

bool grk::CodeStream::decompress_tile_t2t1 ( TileProcessor tileProcessor,
bool  multi_tile 
)

◆ decompress_tiles()

bool grk::CodeStream::decompress_tiles ( void  )

◆ decompress_validation()

bool grk::CodeStream::decompress_validation ( void  )

◆ do_decompress()

bool grk::CodeStream::do_decompress ( grk_image p_image)

◆ dump()

void grk::CodeStream::dump ( uint32_t  flag,
FILE *  out_stream 
)
virtual

Implements grk::ICodeStream.

References grk::j2k_dump().

◆ end_compress()

bool grk::CodeStream::end_compress ( void  )
virtual

◆ end_decompress()

bool grk::CodeStream::end_decompress ( void  )
virtual

Reading function used after code stream if necessary.

Implements grk::ICodeStream.

Referenced by grk::FileFormat::end_decompress().

◆ exec()

bool grk::CodeStream::exec ( std::vector< j2k_procedure > &  p_procedure_list)

Executes the given procedures on the given codec.

Parameters
p_procedure_listthe list of procedures to execute
Returns
true if all the procedures were successfully executed.

Referenced by do_decompress(), read_header(), and start_compress().

◆ get_cstr_index()

grk_codestream_index * grk::CodeStream::get_cstr_index ( void  )
virtual

◆ get_cstr_info()

grk_codestream_info_v2 * grk::CodeStream::get_cstr_info ( void  )
virtual

Implements grk::ICodeStream.

References grk::j2k_get_cstr_info().

◆ get_current_decode_tcp()

TileCodingParams * grk::CodeStream::get_current_decode_tcp ( void  )

◆ get_end_header()

bool grk::CodeStream::get_end_header ( void  )

Referenced by grk::j2k_get_end_header().

◆ get_marker_handler()

const marker_handler * grk::CodeStream::get_marker_handler ( uint16_t  id)
private

Reads the lookup table containing all the marker, status and action, and returns the handler associated with the marker value.

Parameters
idMarker value to look up
Returns
the handler associated with the id.

References grk::GRK_WARN().

◆ getStream()

BufferedStream * grk::CodeStream::getStream ( )

◆ init_compress()

bool grk::CodeStream::init_compress ( grk_cparameters p_param,
grk_image p_image 
)
virtual

Implements grk::ICodeStream.

References grk::mct::calculate_norms(), _grk_cparameters::cblk_sty, _grk_cparameters::cblockh_init, _grk_cparameters::cblockw_init, _grk_image::color_space, grk::CodingParams::comment, grk::CodingParams::comment_len, _grk_poc::compno0, _grk_poc::compno1, _grk_image::comps, _grk_cparameters::cp_comment, _grk_cparameters::cp_comment_len, _grk_cparameters::cp_disto_alloc, _grk_cparameters::cp_fixed_quality, _grk_cparameters::cp_is_binary_comment, _grk_cparameters::cp_num_comments, grk::TileComponentCodingParams::csty, grk::TileCodingParams::csty, _grk_cparameters::csty, _grk_image_comp::data, grk::TileCodingParams::distoratio, _grk_image_comp::dx, _grk_image_comp::dy, grk::param_qcd::generate(), GRK_CLRSPC_EYCC, GRK_CLRSPC_SYCC, grk::grk_copy_image_header(), grk::GRK_ERROR(), GRK_EXTENSION_MCT, GRK_EXTENSION_NONE, grk::grk_free(), grk::grk_image_create0(), GRK_IS_BROADCAST, GRK_IS_CINEMA, GRK_IS_IMF, GRK_IS_PART2, GRK_IS_STORAGE, GRK_J2K_MAXRLVLS, GRK_JPH_RSIZ_FLAG, grk::grk_malloc(), GRK_MAX_COMMENT_LENGTH, GRK_PROFILE_CINEMA_S2K, GRK_PROFILE_CINEMA_S4K, GRK_PROFILE_NONE, GRK_PROFILE_PART2, grk_version(), grk::GRK_WARN(), _grk_image_comp::h, _grk_cparameters::irreversible, grk::Profile::is_broadcast_compliant(), grk::Profile::is_cinema_compliant(), grk::Profile::is_imf_compliant(), grk::CodingParams::isBinaryComment, grk::TileCodingParams::isHT, _grk_cparameters::isHT, J2K_CCP_CSTY_PRT, J2K_CCP_QNTSTY_NOQNT, J2K_CCP_QNTSTY_SEQNT, grk::j2k_check_poc_val(), J2K_CP_CSTY_PRT, grk::j2k_init_mct_encoding(), _grk_poc::layno1, grk::CodingParams::m_coding_params, m_cp, grk::TileComponentCodingParams::m_dc_level_shift, grk::EncodingParams::m_disto_alloc, grk::CodingParams::m_enc, grk::EncodingParams::m_fixed_quality, m_input_image, grk::EncodingParams::m_max_comp_size, grk::TileCodingParams::m_mct_coding_matrix, grk::TileCodingParams::m_mct_decoding_matrix, grk::EncodingParams::m_tp_flag, grk::EncodingParams::m_tp_on, grk::matrix_inversion_f(), _grk_cparameters::max_comp_size, _grk_cparameters::max_cs_size, grk::max_num_components, grk::TileCodingParams::mct, _grk_cparameters::mct_data, grk::TileCodingParams::mct_norms, grk::CodingParams::num_comments, _grk_image::numcomps, grk::TileCodingParams::numlayers, grk::TileCodingParams::numpocs, _grk_cparameters::numpocs, _grk_cparameters::numresolution, grk::TileCodingParams::POC, _grk_cparameters::POC, grk::TileCodingParams::pocs, _grk_cparameters::prch_init, _grk_cparameters::prcw_init, _grk_image_comp::prec, grk::TileCodingParams::prg, _grk_poc::prg1, _grk_cparameters::prog_order, grk::param_qcd::pull(), grk::TileCodingParams::qcd, grk::EncodingParams::rateControlAlgorithm, _grk_cparameters::rateControlAlgorithm, grk::TileCodingParams::rates, _grk_cparameters::res_spec, _grk_poc::resno0, _grk_poc::resno1, _grk_cparameters::roi_compno, _grk_cparameters::roi_shift, grk::CodingParams::rsiz, _grk_cparameters::rsiz, grk::Profile::set_broadcast_parameters(), grk::Profile::set_cinema_parameters(), grk::Profile::set_imf_parameters(), _grk_image_comp::sgnd, grk::CodingParams::t_grid_height, grk::CodingParams::t_grid_width, grk::CodingParams::t_height, _grk_cparameters::t_height, grk::CodingParams::t_width, _grk_cparameters::t_width, grk::TileCodingParams::tccps, _grk_cparameters::tcp_distoratio, _grk_cparameters::tcp_mct, _grk_cparameters::tcp_numlayers, _grk_cparameters::tcp_rates, grk::CodingParams::tcps, _grk_poc::tile, _grk_cparameters::tile_size_on, _grk_cparameters::tp_flag, _grk_cparameters::tp_on, grk::CodingParams::tx0, _grk_cparameters::tx0, grk::CodingParams::ty0, _grk_cparameters::ty0, _grk_image_comp::w, grk::EncodingParams::writePLT, _grk_cparameters::writePLT, grk::EncodingParams::writeTLM, _grk_cparameters::writeTLM, _grk_image::x0, _grk_image::x1, _grk_image::y0, and _grk_image::y1.

Referenced by grk::FileFormat::init_compress().

◆ init_decompress()

void grk::CodeStream::init_decompress ( grk_dparameters p_param)
virtual

◆ init_header_writing()

bool grk::CodeStream::init_header_writing ( void  )

◆ isDecodingTilePartHeader()

bool grk::CodeStream::isDecodingTilePartHeader ( )

◆ mct_validation()

bool grk::CodeStream::mct_validation ( void  )

Referenced by grk::j2k_mct_validation().

◆ need_nb_tile_parts_correction()

bool grk::CodeStream::need_nb_tile_parts_correction ( bool *  p_correction_needed)

Checks for invalid number of tile-parts in SOT marker (TPsot==TNsot).

See issue 254.

Parameters
p_correction_neededoutput value. if true, nonconformant code stream needs TNsot correction.
Returns
true if the function was successful, false otherwise.

References grk::SOTMarker::get_sot_values(), grk::GRK_ERROR(), J2K_MS_SOT, and grk::sot_marker_segment_len.

◆ parse_tile_header_markers()

bool grk::CodeStream::parse_tile_header_markers ( bool *  can_decode_tile_data)

◆ post_write_tile()

bool grk::CodeStream::post_write_tile ( TileProcessor tileProcessor)

◆ process_marker()

bool grk::CodeStream::process_marker ( const marker_handler marker_handler,
uint16_t  marker_size 
)

◆ read_header()

bool grk::CodeStream::read_header ( grk_header_info header_info,
grk_image **  p_image 
)
virtual

Main header reading function handler.

Implements grk::ICodeStream.

References grk::TileComponentCodingParams::cblk_sty, _grk_header_info::cblk_sty, grk::TileComponentCodingParams::cblkh, grk::TileComponentCodingParams::cblkw, _grk_header_info::cblockh_init, _grk_header_info::cblockw_init, grk::CodingParams::comment, _grk_header_info::comment, grk::CodingParams::comment_len, _grk_header_info::comment_len, cstr_index, grk::TileComponentCodingParams::csty, _grk_header_info::csty, exec(), grk::grk_copy_image_header(), grk::grk_image_create0(), _grk_header_info::irreversible, grk::CodingParams::isBinaryComment, _grk_header_info::isBinaryComment, grk::j2k_allocate_tile_element_cstr_index(), grk::j2k_copy_default_tcp(), grk::j2k_decompress_validation(), grk::j2k_read_header_procedure(), m_cp, m_decompressor, grk::DecoderState::m_default_tcp, m_input_image, m_procedure_list, m_validation_list, grk::TileCodingParams::mct, _grk_header_info::mct, grk::CodingParams::num_comments, _grk_header_info::num_comments, grk::TileCodingParams::numlayers, grk::TileComponentCodingParams::numresolutions, _grk_header_info::numresolutions, grk::TileComponentCodingParams::prch, _grk_header_info::prch_init, grk::TileComponentCodingParams::prcw, _grk_header_info::prcw_init, grk::TileComponentCodingParams::qmfbid, grk::CodingParams::rsiz, _grk_header_info::rsiz, grk::CodingParams::t_grid_height, _grk_header_info::t_grid_height, grk::CodingParams::t_grid_width, _grk_header_info::t_grid_width, grk::CodingParams::t_height, _grk_header_info::t_height, grk::CodingParams::t_width, _grk_header_info::t_width, grk::TileCodingParams::tccps, _grk_header_info::tcp_numlayers, grk::CodingParams::tx0, _grk_header_info::tx0, grk::CodingParams::ty0, and _grk_header_info::ty0.

Referenced by grk::FileFormat::read_header().

◆ read_header_procedure()

bool grk::CodeStream::read_header_procedure ( void  )

◆ read_marker()

bool grk::CodeStream::read_marker ( void  )

◆ read_short()

bool grk::CodeStream::read_short ( uint16_t *  val)

◆ read_unk()

bool grk::CodeStream::read_unk ( uint16_t *  output_marker)

Reads an unknown marker.

Parameters
output_markermarker value
Returns
true if the marker could be read

References grk::GRK_ERROR(), grk::marker_handler::id, grk::j2k_add_mhmarker(), J2K_MS_SOT, J2K_MS_UNK, and grk::marker_handler::states.

◆ set_decompress_window()

bool grk::CodeStream::set_decompress_window ( grk_image p_image,
uint32_t  start_x,
uint32_t  start_y,
uint32_t  end_x,
uint32_t  end_y 
)
virtual

Sets the given area to be decompressed.

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

Parameters
p_imageimage
start_xthe left position of the rectangle to decompress (in image coordinates).
start_ythe up position of the rectangle to decompress (in image coordinates).
end_xthe right position of the rectangle to decompress (in image coordinates).
end_ythe bottom position of the rectangle to decompress (in image coordinates).
Returns
true if the area could be set.

Implements grk::ICodeStream.

References grk::GRK_ERROR(), grk::GRK_INFO(), grk::GRK_WARN(), grk::J2K_DEC_STATE_TPH_SOT, grk::update_image_dimensions(), _grk_image::x0, _grk_image::x1, _grk_image::y0, and _grk_image::y1.

Referenced by grk::FileFormat::set_decompress_window().

◆ start_compress()

bool grk::CodeStream::start_compress ( void  )
virtual

◆ tileIndexToDecode()

int32_t grk::CodeStream::tileIndexToDecode ( )

References m_tile_ind_to_dec.

Referenced by grk::SOTMarker::read().

◆ update_rates()

bool grk::CodeStream::update_rates ( void  )

Referenced by grk::j2k_update_rates().

◆ write_tile_part()

bool grk::CodeStream::write_tile_part ( TileProcessor tileProcessor)

Member Data Documentation

◆ cstr_index

grk_codestream_index* grk::CodeStream::cstr_index

◆ current_plugin_tile

grk_plugin_tile* grk::CodeStream::current_plugin_tile

Referenced by decompress().

◆ m_cp

CodingParams grk::CodeStream::m_cp

◆ m_curr_marker

uint16_t grk::CodeStream::m_curr_marker

Only valid for decoding.

Whether the whole tile is decompressed, or just the window in win_x0/win_y0/win_x1/win_y1

Referenced by grk::DecoderState::findNextTile().

◆ m_decompressor

DecoderState grk::CodeStream::m_decompressor

◆ m_encoder

EncoderState grk::CodeStream::m_encoder

◆ m_input_image

grk_image* grk::CodeStream::m_input_image

◆ m_marker_scratch

uint8_t* grk::CodeStream::m_marker_scratch
private

Referenced by ~CodeStream().

◆ m_marker_scratch_size

uint16_t grk::CodeStream::m_marker_scratch_size
private

◆ m_nb_tile_parts_correction

uint32_t grk::CodeStream::m_nb_tile_parts_correction

Referenced by grk::SOTMarker::read().

◆ m_nb_tile_parts_correction_checked

bool grk::CodeStream::m_nb_tile_parts_correction_checked

◆ m_output_image

grk_image* grk::CodeStream::m_output_image

◆ m_procedure_list

std::vector<j2k_procedure> grk::CodeStream::m_procedure_list

the list of procedures to exec

Referenced by decompress(), decompress_tile(), do_decompress(), read_header(), and start_compress().

◆ m_processors

std::map<uint32_t, TileProcessor*> grk::CodeStream::m_processors
private

Referenced by allocateProcessor(), and ~CodeStream().

◆ m_stream

BufferedStream* grk::CodeStream::m_stream
private

Referenced by allocateProcessor(), and getStream().

◆ m_tile_ind_to_dec

int32_t grk::CodeStream::m_tile_ind_to_dec
private

index of single tile to decompress; !!! initialized to -1 !!!

Referenced by decompress_tile(), and tileIndexToDecode().

◆ m_tileProcessor

TileProcessor* grk::CodeStream::m_tileProcessor
private

◆ m_validation_list

std::vector<j2k_procedure> grk::CodeStream::m_validation_list

the list of validation procedures to follow to make sure the code is valid

Referenced by read_header(), and start_compress().

◆ marker_map

std::map<uint16_t, marker_handler*> grk::CodeStream::marker_map
private

Referenced by CodeStream(), and ~CodeStream().

◆ wholeTileDecompress

bool grk::CodeStream::wholeTileDecompress

Referenced by grk::SIZMarker::read().


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