Grok  7.6.3
SOTMarker.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  * This source code incorporates work covered by the BSD 2-clause license.
18  * Please see the LICENSE file in the root directory for details.
19  *
20  */
21 
22 #pragma once
23 
24 namespace grk {
25 
26 struct TileProcessor;
27 
28 class SOTMarker {
29 public:
30 
31  SOTMarker(CodeStream *stream);
32 
37  bool write(void);
38 
39  bool write_psot(uint32_t tile_part_bytes_written);
40 
48  bool read(uint8_t *p_header_data,
49  uint16_t header_size);
50 
65  bool get_sot_values(uint8_t *p_header_data, uint32_t header_size,
66  uint16_t *tile_no, uint32_t *p_tot_len, uint8_t *p_current_part,
67  uint8_t *p_num_parts);
68 private:
70  uint64_t m_psot_location;
71 
72 };
73 
74 } /* namespace grk */
75 
_grk_tile_index::nb_tps
uint32_t nb_tps
number of tile parts
Definition: grok.h:1140
grk::grk_marker_length
const uint32_t grk_marker_length
Definition: CodeStream.h:33
grk::DecoderState::m_last_tile_part_in_code_stream
bool m_last_tile_part_in_code_stream
Indicate that the current tile-part is assumed to be the last tile part of the code stream.
Definition: CodingParams.h:341
grk::SOTMarker::SOTMarker
SOTMarker(CodeStream *stream)
Definition: SOTMarker.cpp:26
grk::CodeStream::m_decompressor
DecoderState m_decompressor
Definition: CodeStream.h:299
grk::CodeStream::getStream
BufferedStream * getStream()
Definition: CodeStream.cpp:999
grk::SOTMarker::get_sot_values
bool get_sot_values(uint8_t *p_header_data, uint32_t header_size, uint16_t *tile_no, uint32_t *p_tot_len, uint8_t *p_current_part, uint8_t *p_num_parts)
Reads values from a SOT marker (Start of tile-part)
Definition: SOTMarker.cpp:76
grk::GRK_WARN
void GRK_WARN(const char *fmt,...)
Definition: logger.cpp:49
grk::J2K_DEC_STATE_TPH
@ J2K_DEC_STATE_TPH
the decoding process is in a tile part header
Definition: CodingParams.h:294
grk::grk_calloc
void * grk_calloc(size_t num, size_t size)
Allocate a memory block with elements initialized to 0.
Definition: MemManager.cpp:111
grk::CodeStream::m_nb_tile_parts_correction
uint32_t m_nb_tile_parts_correction
Definition: CodeStream.h:364
_grk_tp_index
Tile part index info.
Definition: grok.h:1124
grk::CodeStream::currentProcessor
TileProcessor * currentProcessor(void)
Definition: CodeStream.cpp:1017
grk::TileProcessor::tile_part_data_length
uint32_t tile_part_data_length
Definition: TileProcessor.h:135
grk::TileCodingParams::m_nb_tile_parts
uint8_t m_nb_tile_parts
number of tile parts for the tile.
Definition: CodingParams.h:169
grk::grk_free
void grk_free(void *ptr)
Deallocates or frees a memory block.
Definition: MemManager.cpp:141
grk::CodeStream::cstr_index
grk_codestream_index * cstr_index
helper used to write the index file
Definition: CodeStream.h:318
grk::SOTMarker::write
bool write(void)
Writes the SOT marker (Start of tile-part)
Definition: SOTMarker.cpp:43
_grk_tile_index::current_tpsno
uint32_t current_tpsno
current tile-part index
Definition: grok.h:1144
grk::DecoderState::m_end_tile_y_index
uint32_t m_end_tile_y_index
Definition: CodingParams.h:331
_grk_tile_index::current_nb_tps
uint32_t current_nb_tps
current nb of tile part (allocated)
Definition: grok.h:1142
_grk_tile_index::tileno
uint16_t tileno
tile index
Definition: grok.h:1138
grk::DecoderState::m_start_tile_y_index
uint32_t m_start_tile_y_index
Definition: CodingParams.h:329
grk::CodeStream
Definition: CodeStream.h:164
grk::BufferedStream::tell
uint64_t tell(void)
Tells byte offset of stream (similar to ftell).
Definition: BufferedStream.cpp:330
grk::CodeStream::m_cp
CodingParams m_cp
Coding parameters.
Definition: CodeStream.h:309
grk::sot_marker_segment_len
const uint32_t sot_marker_segment_len
Definition: CodeStream.h:32
grk::DecoderState::last_tile_part_was_read
bool last_tile_part_was_read
Definition: CodingParams.h:345
J2K_MS_SOT
#define J2K_MS_SOT
SOT marker value.
Definition: CodeStream.h:73
grk::SOTMarker::write_psot
bool write_psot(uint32_t tile_part_bytes_written)
Definition: SOTMarker.cpp:32
grk::SOTMarker::m_psot_location
uint64_t m_psot_location
Definition: SOTMarker.h:70
grk
Copyright (C) 2016-2021 Grok Image Compression Inc.
Definition: BitIO.cpp:23
grk::SOTMarker::read
bool read(uint8_t *p_header_data, uint16_t header_size)
Decompress a SOT marker (Start of tile-part)
Definition: SOTMarker.cpp:110
grk::CodeStream::tileIndexToDecode
int32_t tileIndexToDecode()
Definition: CodeStream.cpp:1003
grk_includes.h
grk::CodingParams::tcps
TileCodingParams * tcps
tile coding parameters
Definition: CodingParams.h:268
grk::SOTMarker::m_codeStream
CodeStream * m_codeStream
Definition: SOTMarker.h:69
grk::TileProcessor::m_tile_index
uint16_t m_tile_index
index of tile being currently compressed/decompressed
Definition: TileProcessor.h:122
grk::grk_realloc
void * grk_realloc(void *ptr, size_t new_size)
Reallocate memory blocks.
Definition: MemManager.cpp:135
grk::DecoderState::m_start_tile_x_index
uint32_t m_start_tile_x_index
Only tile indices in the correct range will be decompressed.
Definition: CodingParams.h:328
grk::CodeStream::allocateProcessor
TileProcessor * allocateProcessor(uint16_t tile_index)
Definition: CodeStream.cpp:1007
grk::DecoderState::m_state
uint16_t m_state
Decoder state: used to indicate in which part of the code stream the decompressor is (main header,...
Definition: CodingParams.h:322
grk::DecoderState::m_skip_tile_data
bool m_skip_tile_data
Definition: CodingParams.h:347
_grk_tile_index::tp_index
grk_tp_index * tp_index
information concerning tile parts
Definition: grok.h:1146
grk::SOTMarker
Definition: SOTMarker.h:28
grk::GRK_ERROR
void GRK_ERROR(const char *fmt,...)
Definition: logger.cpp:57
grk::DecoderState::m_end_tile_x_index
uint32_t m_end_tile_x_index
Definition: CodingParams.h:330
_grk_codestream_index::tile_index
grk_tile_index * tile_index
Definition: grok.h:1172