Grok
7.6.2
|
Tile compressor/decompressor. More...
#include <TileProcessor.h>
Public Member Functions | |
TileProcessor (CodeStream *codeStream, BufferedStream *stream) | |
~TileProcessor () | |
bool | init (grk_image *output_image, bool isCompressor) |
Initializes tile processor (no buffer memory is allocated) More... | |
bool | pre_write_tile (void) |
bool | compress_tile_part (uint32_t *tile_bytes_written) |
Compress tile part. More... | |
bool | pre_compress_first_tile_part (void) |
bool | do_compress (void) |
Compress tile. More... | |
bool | decompress_tile_t1 (void) |
T1 decompress. More... | |
bool | decompress_tile_t2 (ChunkBuffer *src_buf) |
T2 decompress. More... | |
bool | copy_uncompressed_data_to_tile (uint8_t *p_src, uint64_t src_length) |
Copies tile data from the given memory block onto the system. More... | |
bool | needs_rate_control () |
bool | copy_decompressed_tile_to_output_image (grk_image *p_output_image) |
tile_data stores only the decompressed resolutions, in the actual precision of the decompressed image. More... | |
void | copy_image_to_tile () |
bool | prepare_sod_decoding (CodeStream *codeStream) |
Public Attributes | |
uint16_t | m_tile_index |
index of tile being currently compressed/decompressed More... | |
bool | m_first_poc_tile_part |
Compressing Only true for first POC tile part, otherwise false. More... | |
uint8_t | m_tile_part_index |
Compressing Only index of tile part being currently coding. More... | |
uint32_t | tile_part_data_length |
uint8_t | totnum_tp |
Compressing Only Total number of tile parts of the tile. More... | |
uint32_t | pino |
Compressing Only Current packet iterator number. More... | |
grk_tile * | tile |
info on image tile More... | |
grk_image * | image |
image header More... | |
grk_plugin_tile * | current_plugin_tile |
bool | wholeTileDecompress |
PacketLengthMarkers * | plt_markers |
CodingParams * | m_cp |
Coding parameters. More... | |
PacketTracker | m_packetTracker |
BufferedStream * | m_stream |
bool | m_corrupt_packet |
Private Member Functions | |
bool | t2_decompress (ChunkBuffer *src_buf, uint64_t *p_data_read) |
bool | is_whole_tilecomp_decoding (uint32_t compno) |
Returns whether a tile component should be fully decompressed, taking into account win_* members. More... | |
bool | need_mct_decompress (uint32_t compno) |
bool | mct_decompress () |
bool | dc_level_shift_decompress () |
bool | dc_level_shift_encode () |
bool | mct_encode () |
bool | dwt_encode () |
void | t1_encode () |
bool | t2_encode (uint32_t *packet_bytes_written) |
bool | rate_allocate (void) |
bool | layer_needs_rate_control (uint32_t layno) |
bool | make_single_lossless_layer () |
void | makelayer_final (uint32_t layno) |
bool | pcrd_bisect_simple (uint32_t *p_data_written) |
void | make_layer_simple (uint32_t layno, double thresh, bool final) |
bool | pcrd_bisect_feasible (uint32_t *p_data_written) |
void | makelayer_feasible (uint32_t layno, uint16_t thresh, bool final) |
Private Attributes | |
uint32_t | tp_pos |
position of the tile part flag in progression order More... | |
TileCodingParams * | m_tcp |
Tile compressor/decompressor.
|
explicit |
grk::TileProcessor::~TileProcessor | ( | ) |
References plt_markers, and tile.
bool grk::TileProcessor::compress_tile_part | ( | uint32_t * | tile_bytes_written | ) |
Compress tile part.
tile_bytes_written | number of bytes written to stream |
References J2K_MS_SOD, m_stream, m_tile_part_index, plt_markers, t2_encode(), grk::PacketLengthMarkers::write(), and grk::BufferedStream::write_short().
Referenced by grk::CodeStream::write_tile_part().
bool grk::TileProcessor::copy_decompressed_tile_to_output_image | ( | grk_image * | p_output_image | ) |
tile_data stores only the decompressed resolutions, in the actual precision of the decompressed image.
This method copies a sub-region of this region into p_output_image (which stores data in 32 bit precision)
p_output_image |
References _grk_image::comps, grk::grk_tile::comps, grk::grk_rectangle< T >::height(), image, grk::CodingParams::m_coding_params, m_cp, grk::CodingParams::m_dec, grk::DecodingParams::m_reduce, tile, grk::grk_rectangle< T >::width(), grk::grk_rectangle< T >::x0, grk::grk_rectangle< T >::x1, grk::grk_rectangle< T >::y0, and grk::grk_rectangle< T >::y1.
Referenced by grk::CodeStream::decompress_tile_t2t1().
void grk::TileProcessor::copy_image_to_tile | ( | ) |
References _grk_image::comps, grk::grk_tile::comps, image, _grk_image::numcomps, tile, _grk_image::x0, and _grk_image::y0.
Referenced by pre_write_tile().
bool grk::TileProcessor::copy_uncompressed_data_to_tile | ( | uint8_t * | p_src, |
uint64_t | src_length | ||
) |
Copies tile data from the given memory block onto the system.
References _grk_image::comps, grk::grk_tile::comps, _grk_image_comp::data, image, _grk_image::numcomps, and tile.
|
private |
|
private |
References grk::grk_tile::comps, grk::TileComponentCodingParams::m_dc_level_shift, m_tcp, grk::grk_tile::numcomps, grk::TileCodingParams::tccps, and tile.
Referenced by do_compress().
bool grk::TileProcessor::decompress_tile_t1 | ( | void | ) |
T1 decompress.
References grk::TileComponentCodingParams::cblkh, grk::TileComponentCodingParams::cblkw, grk::grk_tile::comps, current_plugin_tile, dc_level_shift_decompress(), grk::WaveletReverse::decompress(), _grk_plugin_tile::decompress_flags, GRK_DECODE_POST_T1, GRK_DECODE_T1, grk::GRK_ERROR(), m_tcp, mct_decompress(), grk::grk_tile::numcomps, grk::TileCodingParams::tccps, tile, and wholeTileDecompress.
Referenced by grk::CodeStream::decompress_tile_t2t1().
bool grk::TileProcessor::decompress_tile_t2 | ( | ChunkBuffer * | src_buf | ) |
T2 decompress.
src_buf | Source buffer |
References current_plugin_tile, _grk_plugin_tile::decompress_flags, grk::decompress_synch_plugin_with_host(), GRK_DECODE_T2, image, is_whole_tilecomp_decoding(), m_cp, m_tcp, m_tile_index, _grk_image::numcomps, t2_decompress(), grk::CodingParams::tcps, and wholeTileDecompress.
Referenced by grk::CodeStream::decompress_tile_t2t1().
bool grk::TileProcessor::do_compress | ( | void | ) |
Compress tile.
References current_plugin_tile, dc_level_shift_encode(), dwt_encode(), grk::GRK_ERROR(), grk_plugin_get_debug_state(), GRK_PLUGIN_STATE_DEBUG, GRK_PLUGIN_STATE_MCT_ONLY, m_cp, m_tcp, m_tile_index, mct_encode(), pre_compress_first_tile_part(), grk::set_context_stream(), t1_encode(), and grk::CodingParams::tcps.
|
private |
References grk::WaveletFwdImpl::compress(), grk::grk_tile::comps, m_tcp, grk::grk_tile::numcomps, grk::TileCodingParams::tccps, and tile.
Referenced by do_compress().
bool grk::TileProcessor::init | ( | grk_image * | output_image, |
bool | isCompressor | ||
) |
Initializes tile processor (no buffer memory is allocated)
output_image | output image (for decompress) |
isCompressor | true if tile will be compressed, otherwise false |
References _grk_image::comps, grk::grk_tile::comps, current_plugin_tile, grk::GRK_ERROR(), grk_plugin_get_debug_state(), GRK_PLUGIN_STATE_DEBUG, grk::GRK_WARN(), image, grk::PacketTracker::init(), m_cp, m_packetTracker, m_tile_index, _grk_image::numcomps, grk::grk_tile::numcomps, grk::TileComponent::numresolutions, grk::grk_tile::packno, grk::TileComponent::resolutions, grk::CodingParams::t_grid_width, grk::CodingParams::t_height, grk::CodingParams::t_width, grk::CodingParams::tcps, tile, grk::tile_equals(), grk::CodingParams::tx0, grk::CodingParams::ty0, wholeTileDecompress, _grk_image::x0, grk::grk_rectangle< T >::x0, _grk_image::x1, grk::grk_rectangle< T >::x1, _grk_image::y0, grk::grk_rectangle< T >::y0, _grk_image::y1, and grk::grk_rectangle< T >::y1.
Referenced by pre_write_tile().
|
private |
Returns whether a tile component should be fully decompressed, taking into account win_* members.
compno | Component number |
References grk::TileComponentWindowBuffer< T >::bounds(), grk::grk_tile::comps, grk::TileComponent::getBuffer(), grk::grk_rectangle< T >::intersection(), grk::shift, and tile.
Referenced by decompress_tile_t2().
|
private |
|
private |
|
private |
References layer_needs_rate_control(), m_tcp, makelayer_final(), and grk::TileCodingParams::numlayers.
Referenced by pcrd_bisect_feasible(), and pcrd_bisect_simple().
|
private |
References grk::Resolution::band, grk::grk_tile::comps, grk::grk_tile::distolayer, grk::grk_tile::numcomps, grk::TileComponent::resolutions, and tile.
Referenced by pcrd_bisect_feasible().
|
private |
|
private |
References _grk_image::comps, grk::grk_tile::comps, grk::mct::decompress_custom(), grk::mct::decompress_irrev(), grk::mct::decompress_rev(), grk::TileComponent::getBuffer(), grk::TileComponentWindowBuffer< T >::getWindow(), image, grk::TileCodingParams::m_mct_decoding_matrix, m_tcp, grk::TileCodingParams::mct, need_mct_decompress(), grk::grk_tile::numcomps, grk::TileComponentCodingParams::qmfbid, _grk_image_comp::sgnd, grk::TileComponentWindowBuffer< T >::strided_area(), grk::TileCodingParams::tccps, and tile.
Referenced by decompress_tile_t1().
|
private |
References grk::mct::compress_custom(), grk::mct::compress_irrev(), grk::mct::compress_rev(), _grk_image::comps, grk::grk_tile::comps, grk::TileComponent::getBuffer(), grk::TileComponentWindowBuffer< T >::getWindow(), image, grk::TileCodingParams::m_mct_coding_matrix, m_tcp, grk::TileCodingParams::mct, grk::grk_tile::numcomps, grk::TileComponentCodingParams::qmfbid, _grk_image_comp::sgnd, grk::TileComponentWindowBuffer< T >::strided_area(), grk::TileCodingParams::tccps, and tile.
Referenced by do_compress().
|
private |
References grk::grk_tile::comps, grk::TileComponent::getBuffer(), grk::GRK_WARN(), grk::TileCodingParams::m_mct_decoding_matrix, m_tcp, grk::TileCodingParams::mct, grk::grk_tile::numcomps, grk::TileComponentWindowBuffer< T >::strided_area(), and tile.
Referenced by dc_level_shift_decompress(), and mct_decompress().
bool grk::TileProcessor::needs_rate_control | ( | ) |
References layer_needs_rate_control(), m_tcp, and grk::TileCodingParams::numlayers.
Referenced by grk::compress_synch_with_plugin(), pre_compress_first_tile_part(), and t1_encode().
|
private |
References grk::grk_rectangle< T >::area(), grk::Resolution::band, grk::compress_synch_with_plugin(), _grk_image::comps, grk::grk_tile::comps, grk::RateControl::convexHull(), grk::grk_tile::distolayer, grk::grk_tile::distotile, grk::RateInfo::getMinimumThresh(), grk_plugin_get_debug_state(), GRK_PLUGIN_STATE_PRE_TR1, image, grk::K, layer_needs_rate_control(), grk::CodingParams::m_coding_params, m_cp, grk::CodingParams::m_enc, grk::EncodingParams::m_fixed_quality, m_tcp, m_tile_index, make_single_lossless_layer(), makelayer_feasible(), makelayer_final(), grk::grk_tile::numcomps, plt_markers, _grk_image_comp::prec, grk::TileComponent::resolutions, grk::RateInfo::synch(), tile, and tp_pos.
Referenced by rate_allocate().
|
private |
References grk::grk_rectangle< T >::area(), grk::Resolution::band, grk::compress_synch_with_plugin(), _grk_image::comps, grk::grk_tile::comps, grk::grk_tile::distolayer, grk::TileCodingParams::distoratio, grk::CodePass::distortiondec, grk::grk_tile::distotile, grk_plugin_get_debug_state(), GRK_PLUGIN_STATE_PRE_TR1, image, grk::K, layer_needs_rate_control(), grk::CodingParams::m_coding_params, m_cp, grk::CodingParams::m_enc, grk::EncodingParams::m_fixed_quality, m_tcp, m_tile_index, make_layer_simple(), make_single_lossless_layer(), makelayer_final(), grk::grk_tile::numcomps, grk::TileCodingParams::numlayers, plt_markers, _grk_image_comp::prec, grk::CodePass::rate, grk::TileCodingParams::rates, grk::TileComponent::resolutions, tile, and tp_pos.
Referenced by rate_allocate().
bool grk::TileProcessor::pre_compress_first_tile_part | ( | void | ) |
bool grk::TileProcessor::pre_write_tile | ( | void | ) |
References _grk_image::comps, grk::grk_tile::comps, copy_image_to_tile(), grk::GRK_ERROR(), image, init(), m_cp, m_first_poc_tile_part, grk::TileCodingParams::m_nb_tile_parts, m_tile_index, m_tile_part_index, _grk_image::numcomps, grk::CodingParams::t_grid_height, grk::CodingParams::t_grid_width, grk::CodingParams::tcps, tile, and totnum_tp.
bool grk::TileProcessor::prepare_sod_decoding | ( | CodeStream * | codeStream | ) |
References grk::TileLengthMarkers::add_to_index(), grk::CodeStream::cstr_index, _grk_tile_index::current_tpsno, _grk_tp_index::end_header, _grk_tp_index::end_pos, grk::CodeStream::get_current_decode_tcp(), grk::BufferedStream::get_number_byte_left(), grk::BufferedStream::getCurrentPtr(), grk::GRK_ERROR(), grk::GRK_WARN(), grk::J2K_DEC_STATE_NO_EOC, grk::J2K_DEC_STATE_TPH_SOT, J2K_MS_SOD, grk::CodeStream::m_decompressor, grk::DecoderState::m_last_tile_part_in_code_stream, grk::DecoderState::m_state, m_stream, m_tile_index, grk::BufferedStream::read(), grk::BufferedStream::supportsZeroCopy(), grk::BufferedStream::tell(), _grk_codestream_index::tile_index, tile_part_data_length, and _grk_tile_index::tp_index.
|
private |
|
private |
References grk::mct::get_norms_irrev(), grk::mct::get_norms_rev(), image, m_tcp, needs_rate_control(), _grk_image::numcomps, and tile.
Referenced by do_compress().
|
private |
References m_tile_index.
Referenced by decompress_tile_t2().
|
private |
grk_plugin_tile* grk::TileProcessor::current_plugin_tile |
Referenced by grk::compress_synch_with_plugin(), grk::decompress_synch_plugin_with_host(), decompress_tile_t1(), decompress_tile_t2(), grk::CodeStream::decompress_tile_t2(), grk::CodeStream::decompress_tile_t2t1(), do_compress(), init(), grk::T2Decompress::read_packet_header(), and grk::set_context_stream().
grk_image* grk::TileProcessor::image |
image header
Referenced by grk::T2Compress::compress_packets(), grk::T2Compress::compress_packets_simulate(), copy_decompressed_tile_to_output_image(), copy_image_to_tile(), copy_uncompressed_data_to_tile(), dc_level_shift_decompress(), grk::T2Decompress::decompress_packets(), grk::decompress_synch_plugin_with_host(), decompress_tile_t2(), init(), mct_decompress(), mct_encode(), pcrd_bisect_feasible(), pcrd_bisect_simple(), pre_write_tile(), t1_encode(), and TileProcessor().
bool grk::TileProcessor::m_corrupt_packet |
Referenced by grk::CodeStream::decompress_tile_t2t1(), and grk::T2Decompress::read_packet_header().
CodingParams* grk::TileProcessor::m_cp |
Coding parameters.
Referenced by grk::T2Compress::compress_packets(), grk::T2Compress::compress_packets_simulate(), copy_decompressed_tile_to_output_image(), grk::T2Decompress::decompress_packets(), decompress_tile_t2(), do_compress(), init(), layer_needs_rate_control(), pcrd_bisect_feasible(), pcrd_bisect_simple(), pre_compress_first_tile_part(), pre_write_tile(), rate_allocate(), grk::T2Decompress::read_packet_header(), and TileProcessor().
bool grk::TileProcessor::m_first_poc_tile_part |
Compressing Only true for first POC tile part, otherwise false.
Referenced by grk::CodeStream::post_write_tile(), pre_write_tile(), and t2_encode().
PacketTracker grk::TileProcessor::m_packetTracker |
BufferedStream* grk::TileProcessor::m_stream |
Referenced by compress_tile_part(), pre_compress_first_tile_part(), prepare_sod_decoding(), and t2_encode().
|
private |
Referenced by dc_level_shift_decompress(), dc_level_shift_encode(), decompress_tile_t1(), decompress_tile_t2(), do_compress(), dwt_encode(), layer_needs_rate_control(), make_single_lossless_layer(), mct_decompress(), mct_encode(), need_mct_decompress(), needs_rate_control(), pcrd_bisect_feasible(), pcrd_bisect_simple(), t1_encode(), and t2_encode().
uint16_t grk::TileProcessor::m_tile_index |
index of tile being currently compressed/decompressed
Referenced by grk::CodeStream::allocateProcessor(), grk::CodeStream::decompress_tile(), decompress_tile_t2(), grk::CodeStream::decompress_tile_t2(), grk::CodeStream::decompress_tile_t2t1(), do_compress(), init(), pcrd_bisect_feasible(), pcrd_bisect_simple(), grk::CodeStream::post_write_tile(), pre_write_tile(), prepare_sod_decoding(), grk::SOTMarker::read(), grk::T2Decompress::read_packet_header(), t2_decompress(), t2_encode(), and grk::CodeStream::write_tile_part().
uint8_t grk::TileProcessor::m_tile_part_index |
Compressing Only index of tile part being currently coding.
m_tile_part_index holds the total number of tile parts encoded thus far while the compressor is compressing the current tile part.
Referenced by compress_tile_part(), grk::CodeStream::post_write_tile(), pre_compress_first_tile_part(), pre_write_tile(), and grk::CodeStream::write_tile_part().
uint32_t grk::TileProcessor::pino |
Compressing Only Current packet iterator number.
Referenced by grk::CodeStream::post_write_tile(), and t2_encode().
PacketLengthMarkers* grk::TileProcessor::plt_markers |
grk_tile* grk::TileProcessor::tile |
info on image tile
Referenced by grk::T2Compress::compress_packet(), grk::T2Compress::compress_packet_simulate(), grk::T2Compress::compress_packets(), copy_decompressed_tile_to_output_image(), copy_image_to_tile(), copy_uncompressed_data_to_tile(), dc_level_shift_decompress(), dc_level_shift_encode(), grk::T2Decompress::decompress_packet(), grk::T2Decompress::decompress_packets(), grk::decompress_synch_plugin_with_host(), decompress_tile_t1(), grk::CodeStream::decompress_tile_t2t1(), dwt_encode(), init(), is_whole_tilecomp_decoding(), make_layer_simple(), makelayer_feasible(), makelayer_final(), mct_decompress(), mct_encode(), need_mct_decompress(), pcrd_bisect_feasible(), pcrd_bisect_simple(), pre_write_tile(), grk::T2Decompress::read_packet_header(), grk::set_context_stream(), t1_encode(), TileProcessor(), grk::CodeStream::write_tile_part(), and ~TileProcessor().
uint32_t grk::TileProcessor::tile_part_data_length |
Referenced by prepare_sod_decoding(), and grk::SOTMarker::read().
uint8_t grk::TileProcessor::totnum_tp |
Compressing Only Total number of tile parts of the tile.
Referenced by pre_write_tile().
|
private |
position of the tile part flag in progression order
Referenced by pcrd_bisect_feasible(), pcrd_bisect_simple(), t2_encode(), and TileProcessor().
bool grk::TileProcessor::wholeTileDecompress |