Grok  7.6.3
T2Decompress.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2021 Grok Image Compression Inc.
3  *
4  * This source code is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Affero General Public License, version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This source code is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Affero General Public License for more details.
12  *
13  * You should have received a copy of the GNU Affero General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  *
17  */
18 
19 #pragma once
20 
21 namespace grk {
22 
23 struct TileProcessor;
24 
28 struct T2Decompress {
29  T2Decompress(TileProcessor *tileProc);
30 
38  bool decompress_packets(uint16_t tileno, ChunkBuffer *src_buf,
39  uint64_t *data_read);
40 
41 private:
52  uint64_t *data_read);
53 
54  bool skip_packet(TileCodingParams *p_tcp, PacketIter *p_pi, ChunkBuffer *src_buf,
55  uint64_t *p_data_read);
56 
58  bool *p_is_data_present, ChunkBuffer *src_buf,
59  uint64_t *p_data_read);
60 
61  bool read_packet_data(Resolution *l_res, PacketIter *p_pi,
62  ChunkBuffer *src_buf, uint64_t *p_data_read);
63 
64  bool skip_packet_data(Resolution *l_res, PacketIter *p_pi,
65  uint64_t *p_data_read, uint64_t max_length);
66 
67  void init_seg(DecompressCodeblock *cblk, uint32_t index, uint8_t cblk_sty,
68  bool first);
69 
70 };
71 
72 }
grk::pi_next
bool pi_next(PacketIter *pi)
Modify the packet iterator to point to the next packet.
Definition: PacketIter.cpp:1425
J2K_MS_EPH
#define J2K_MS_EPH
EPH marker value.
Definition: CodeStream.h:90
grk::T2Decompress::decompress_packet
bool decompress_packet(TileCodingParams *tcp, PacketIter *pi, ChunkBuffer *src_buf, uint64_t *data_read)
Decompress a packet of a tile from a source buffer.
Definition: T2Decompress.cpp:175
grk::default_numbers_segments
const uint32_t default_numbers_segments
Definition: CodeStream.h:57
grk::TileCodingParams::ppt_data
uint8_t * ppt_data
packet header store there for future use in t2_decode_packet
Definition: CodingParams.h:149
GRK_PROG_UNKNOWN
@ GRK_PROG_UNKNOWN
place-holder
Definition: grok.h:290
grk::TileComponentCodingParams::cblk_sty
uint8_t cblk_sty
code-block mode
Definition: CodingParams.h:63
grk::TileComponent::resolutions
Resolution * resolutions
Definition: TileComponent.h:57
grk::tag_tree_uninitialized_node_value
const uint32_t tag_tree_uninitialized_node_value
Definition: TagTree.h:26
grk::max_passes_per_segment
const uint32_t max_passes_per_segment
Definition: CodeStream.h:48
grk::TileProcessor
Tile compressor/decompressor.
Definition: TileProcessor.h:63
grk::TileCodingParams
Tile coding parameters : this structure is used to store coding/decoding parameters common to all til...
Definition: CodingParams.h:121
grk::TileCodingParams::tccps
TileComponentCodingParams * tccps
tile-component coding parameters
Definition: CodingParams.h:163
grk::InvalidMarkerException
Definition: grk_exceptions.h:28
grk::GRK_WARN
void GRK_WARN(const char *fmt,...)
Definition: logger.cpp:49
grk::T2Decompress::T2Decompress
T2Decompress(TileProcessor *tileProc)
Definition: T2Decompress.cpp:29
grk::TileProcessor::tile
grk_tile * tile
info on image tile
Definition: TileProcessor.h:146
grk::T2Decompress
Tier-2 decoding.
Definition: T2Decompress.h:28
grk::TileCodingParams::csty
uint8_t csty
coding style
Definition: CodingParams.h:128
grk::max_precision_jpeg_2000
const uint32_t max_precision_jpeg_2000
Definition: CodeStream.h:46
grk::seg
Definition: t1_common.h:92
grk::T2Decompress::skip_packet_data
bool skip_packet_data(Resolution *l_res, PacketIter *p_pi, uint64_t *p_data_read, uint64_t max_length)
Definition: T2Decompress.cpp:634
testing.h
grk::grk_buf
grk_buffer< uint8_t > grk_buf
Definition: util.h:275
grk::PacketIter
Packet iterator.
Definition: PacketIter.h:59
grk::T2Decompress::read_packet_data
bool read_packet_data(Resolution *l_res, PacketIter *p_pi, ChunkBuffer *src_buf, uint64_t *p_data_read)
Definition: T2Decompress.cpp:528
grk::TileCodingParams::ppt
bool ppt
If ppt == true --> there was a PPT marker for the present tile.
Definition: CodingParams.h:195
grk::TileCodingParams::ppt_len
size_t ppt_len
size of ppt_data
Definition: CodingParams.h:155
J2K_CP_CSTY_EPH
#define J2K_CP_CSTY_EPH
Definition: CodeStream.h:64
grk::grk_tile::comps
TileComponent * comps
Definition: TileProcessor.h:35
grk::PacketIter::layno
uint16_t layno
layer that identify the packet
Definition: PacketIter.h:87
grk::PacketIter::resno
uint8_t resno
resolution that identify the packet
Definition: PacketIter.h:83
grk::Resolution::band
Subband band[BAND_NUM_INDICES]
Definition: T1Structs.h:240
grk::PacketIter::compno
uint16_t compno
component that identify the packet
Definition: PacketIter.h:81
grk::TruncatedPacketHeaderException
Definition: grk_exceptions.h:27
grk
Copyright (C) 2016-2021 Grok Image Compression Inc.
Definition: BitIO.cpp:23
grk::Resolution::numBandWindows
uint32_t numBandWindows
Definition: T1Structs.h:241
grk::DecompressCodeblock
Definition: T1Structs.h:137
grk::PacketLengthMarkers::getInit
void getInit(void)
Definition: LengthMarkers.cpp:450
grk::ChunkBuffer::get_cur_chunk_ptr
uint8_t * get_cur_chunk_ptr(void)
Definition: ChunkBuffer.cpp:198
grk::T2Decompress::decompress_packets
bool decompress_packets(uint16_t tileno, ChunkBuffer *src_buf, uint64_t *data_read)
Decompress the packets of a tile from a source buffer.
Definition: T2Decompress.cpp:33
debugDecompressPackets
const bool debugDecompressPackets
Definition: T2Decompress.cpp:25
grk::T2Decompress::tileProcessor
TileProcessor * tileProcessor
Definition: T2Decompress.h:42
grk::T2Decompress::init_seg
void init_seg(DecompressCodeblock *cblk, uint32_t index, uint8_t cblk_sty, bool first)
Definition: T2Decompress.cpp:199
grk::Subband::getPrecinct
Precinct * getPrecinct(uint64_t precinctIndex)
Definition: T1Structs.cpp:497
grk::BitIO
Definition: BitIO.h:32
grk_includes.h
grk::TileProcessor::m_cp
CodingParams * m_cp
Coding parameters.
Definition: TileProcessor.h:157
grk::pi_destroy
void pi_destroy(PacketIter *p_pi)
Destroys a packet iterator array.
Definition: PacketIter.cpp:1379
GRK_CBLKSTY_LAZY
#define GRK_CBLKSTY_LAZY
Selective arithmetic coding bypass.
Definition: grok.h:95
grk::TileProcessor::m_tile_index
uint16_t m_tile_index
index of tile being currently compressed/decompressed
Definition: TileProcessor.h:122
grk::DecompressCodeblock::numSegmentsAllocated
uint32_t numSegmentsAllocated
Definition: T1Structs.h:153
grk::ChunkBuffer::get_cur_chunk_len
size_t get_cur_chunk_len(void)
Definition: ChunkBuffer.cpp:204
grk::Resolution
Definition: T1Structs.h:231
grk::TileProcessor::plt_markers
PacketLengthMarkers * plt_markers
Definition: TileProcessor.h:154
grk::ChunkBuffer
Definition: ChunkBuffer.h:29
grk::T2Decompress::read_packet_header
bool read_packet_header(TileCodingParams *p_tcp, PacketIter *p_pi, bool *p_is_data_present, ChunkBuffer *src_buf, uint64_t *p_data_read)
Definition: T2Decompress.cpp:234
grk::TileProcessor::current_plugin_tile
grk_plugin_tile * current_plugin_tile
Definition: TileProcessor.h:149
grk::pi_create_decompress
PacketIter * pi_create_decompress(grk_image *p_image, CodingParams *p_cp, uint16_t tile_no, std::vector< uint8_t * > *include)
Create a packet iterator for Decoder.
Definition: PacketIter.cpp:848
grk::T2Decompress::skip_packet
bool skip_packet(TileCodingParams *p_tcp, PacketIter *p_pi, ChunkBuffer *src_buf, uint64_t *p_data_read)
Definition: T2Decompress.cpp:606
grk::TileProcessor::m_corrupt_packet
bool m_corrupt_packet
Definition: TileProcessor.h:163
J2K_MS_SOP
#define J2K_MS_SOP
SOP marker value.
Definition: CodeStream.h:89
grk::Segment
Definition: T1Structs.h:62
grk::ChunkBuffer::incr_cur_chunk_offset
void incr_cur_chunk_offset(size_t offset)
Definition: ChunkBuffer.cpp:156
grk::seg::len
uint32_t len
Definition: t1_common.h:93
grk::seg::numpasses
uint32_t numpasses
Definition: t1_common.h:94
GRK_CBLKSTY_TERMALL
#define GRK_CBLKSTY_TERMALL
Termination on each coding pass.
Definition: grok.h:97
J2K_CP_CSTY_SOP
#define J2K_CP_CSTY_SOP
Definition: CodeStream.h:63
grk::PacketIter::precinctIndex
uint64_t precinctIndex
precinct that identify the packet
Definition: PacketIter.h:85
grk::Precinct::getDecompressedBlockPtr
DecompressCodeblock * getDecompressedBlockPtr(void)
Definition: T1Structs.cpp:96
GRK_J2K_MAXRLVLS
#define GRK_J2K_MAXRLVLS
Maximum number of resolution levels authorized.
Definition: grok.h:82
grk::GRK_INFO
void GRK_INFO(const char *fmt,...)
Definition: logger.cpp:41
grk::GRK_ERROR
void GRK_ERROR(const char *fmt,...)
Definition: logger.cpp:57
grk::DecompressCodeblock::segs
Segment * segs
Definition: T1Structs.h:151
grk::PacketLengthInfo
Definition: T1Structs.h:74
grk::TileProcessor::image
grk_image * image
image header
Definition: TileProcessor.h:148