Grok  7.6.3
T2Compress.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 
31 struct T2Compress {
32  T2Compress(TileProcessor *tileProc);
33 
34  /*
35  Encode the packets of a tile to a destination buffer
36  @param tileno number of the tile encoded
37  @param maxlayers maximum number of layers
38  @param dest the destination buffer
39  @param p_data_written amount of data written
40  @param first_poc_tile_part true if first POC tile part, otherwise false
41  @param tppos The position of the tile part flag in the progression order
42  @param pino packet iterator number
43  */
44  bool compress_packets(uint16_t tileno, uint16_t maxlayers,
45  BufferedStream *stream, uint32_t *p_data_written,
46  bool first_poc_tile_part, uint32_t tppos,
47  uint32_t pino);
48 
58  bool compress_packets_simulate(uint16_t tileno, uint16_t maxlayers,
59  uint32_t *p_data_written, uint32_t max_len, uint32_t tppos,
60  PacketLengthMarkers *markers);
61 
62 private:
64 
74  BufferedStream *stream, uint32_t *p_data_written);
75 
86  uint32_t *p_data_written, uint32_t len,
87  PacketLengthMarkers *markers);
88 
89 };
90 
91 }
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::BufferedStream::write_byte
bool write_byte(uint8_t value)
Definition: BufferedStream.cpp:182
GRK_PROG_UNKNOWN
@ GRK_PROG_UNKNOWN
place-holder
Definition: grok.h:290
grk::TileProcessor::m_packetTracker
PacketTracker m_packetTracker
Definition: TileProcessor.h:161
grk::T2Compress::T2Compress
T2Compress(TileProcessor *tileProc)
Definition: T2Compress.cpp:31
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::grk_buffer< uint8_t >
grk::FINAL_PASS
@ FINAL_PASS
Function called in rate allocation process.
Definition: PacketIter.h:34
GRK_PROFILE_CINEMA_4K
#define GRK_PROFILE_CINEMA_4K
Definition: grok.h:127
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::BufferedStream
Byte input-output stream.
Definition: BufferedStream.h:38
grk::GRK_WARN
void GRK_WARN(const char *fmt,...)
Definition: logger.cpp:49
grk::TileProcessor::tile
grk_tile * tile
info on image tile
Definition: TileProcessor.h:146
grk::TileCodingParams::csty
uint8_t csty
coding style
Definition: CodingParams.h:128
grk::PacketTracker::packet_encoded
void packet_encoded(uint32_t comps, uint32_t res, uint64_t prec, uint32_t layer)
Definition: TileProcessor.cpp:1548
_grk_image::numcomps
uint16_t numcomps
number of components in the image
Definition: grok.h:902
grk::PacketTracker::is_packet_encoded
bool is_packet_encoded(uint32_t comps, uint32_t res, uint64_t prec, uint32_t layer)
Definition: TileProcessor.cpp:1567
testing.h
grk::PacketIter
Packet iterator.
Definition: PacketIter.h:59
grk::THRESH_CALC
@ THRESH_CALC
Definition: PacketIter.h:33
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::T2Compress::compress_packet
bool compress_packet(TileCodingParams *tcp, PacketIter *pi, BufferedStream *stream, uint32_t *p_data_written)
Encode a packet of a tile to a destination buffer.
Definition: T2Compress.cpp:140
grk::T2Compress::tileProcessor
TileProcessor * tileProcessor
Definition: T2Compress.h:63
grk::PacketLengthMarkers::writeNext
void writeNext(uint32_t len)
Definition: LengthMarkers.cpp:286
grk::PacketTracker::clear
void clear(void)
Definition: TileProcessor.cpp:1534
grk::BufferedStream::tell
uint64_t tell(void)
Tells byte offset of stream (similar to ftell).
Definition: BufferedStream.cpp:330
grk::PacketIter::resno
uint8_t resno
resolution that identify the packet
Definition: PacketIter.h:83
grk::T2Compress::compress_packets_simulate
bool compress_packets_simulate(uint16_t tileno, uint16_t maxlayers, uint32_t *p_data_written, uint32_t max_len, uint32_t tppos, PacketLengthMarkers *markers)
Simulate compressing packets of a tile to a destination buffer.
Definition: T2Compress.cpp:74
grk::Layer
Definition: T1Structs.h:93
grk::Layer::numpasses
uint32_t numpasses
Definition: T1Structs.h:95
grk::PacketIter::compno
uint16_t compno
component that identify the packet
Definition: PacketIter.h:81
grk::T2Compress
Tier-2 coding.
Definition: T2Compress.h:31
grk
Copyright (C) 2016-2021 Grok Image Compression Inc.
Definition: BitIO.cpp:23
grk::BitIO
Definition: BitIO.h:32
grk_includes.h
grk::TileProcessor::m_cp
CodingParams * m_cp
Coding parameters.
Definition: TileProcessor.h:157
grk::Layer::len
uint32_t len
Definition: T1Structs.h:96
grk::pi_destroy
void pi_destroy(PacketIter *p_pi)
Destroys a packet iterator array.
Definition: PacketIter.cpp:1379
grk::pi_create_compress
PacketIter * pi_create_compress(const grk_image *p_image, CodingParams *p_cp, uint16_t tile_no, J2K_T2_MODE p_t2_mode, std::vector< uint8_t * > *include)
Creates a packet iterator for compressing.
Definition: PacketIter.cpp:971
grk::ChunkBuffer
Definition: ChunkBuffer.h:29
grk::PacketLengthMarkers
Definition: LengthMarkers.h:88
grk::T2Compress::compress_packets
bool compress_packets(uint16_t tileno, uint16_t maxlayers, BufferedStream *stream, uint32_t *p_data_written, bool first_poc_tile_part, uint32_t tppos, uint32_t pino)
Definition: T2Compress.cpp:36
grk::BufferedStream::write_bytes
size_t write_bytes(const uint8_t *p_buffer, size_t p_size)
Write bytes to stream (no correction for endian!).
Definition: BufferedStream.cpp:222
J2K_MS_SOP
#define J2K_MS_SOP
SOP marker value.
Definition: CodeStream.h:89
grk::T2Compress::compress_packet_simulate
bool compress_packet_simulate(TileCodingParams *tcp, PacketIter *pi, uint32_t *p_data_written, uint32_t len, PacketLengthMarkers *markers)
Encode a packet of a tile to a destination buffer.
Definition: T2Compress.cpp:563
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::GRK_INFO
void GRK_INFO(const char *fmt,...)
Definition: logger.cpp:41
grk::pi_enable_tile_part_generation
void pi_enable_tile_part_generation(PacketIter *pi, CodingParams *cp, uint16_t tileno, uint32_t pino, bool first_poc_tile_part, uint32_t tppos, J2K_T2_MODE t2_mode)
Modify the packet iterator for enabling tile part generation.
Definition: PacketIter.cpp:1105
grk::GRK_ERROR
void GRK_ERROR(const char *fmt,...)
Definition: logger.cpp:57
grk::PacketLengthInfo
Definition: T1Structs.h:74
grk::TileProcessor::image
grk_image * image
image header
Definition: TileProcessor.h:148