Grok 10.0.5
CodeStreamCompress.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2023 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
24namespace grk
25{
26class CodeStream;
27
28class CodeStreamCompress : public CodeStream, public ICodeStreamCompress
29{
30 public:
31 CodeStreamCompress(BufferedStream* stream);
32 virtual ~CodeStreamCompress();
33
34 static char* convertProgressionOrder(GRK_PROG_ORDER prg_order);
35 static uint16_t getPocSize(uint32_t numComponents, uint32_t l_nb_poc);
36
37 bool start(void);
38 bool init(grk_cparameters* p_param, GrkImage* p_image);
39 bool compress(grk_plugin_tile* tile);
40
41 private:
42 bool init_header_writing(void);
43 bool cacheEndOfHeader(void);
44 bool end(void);
45 bool writeTilePart(TileProcessor* tileProcessor);
46 bool writeTileParts(TileProcessor* tileProcessor);
47 bool updateRates(void);
48 bool compressValidation(void);
49 bool mct_validation(void);
50
55 bool write_soc();
56
61 bool write_siz();
62
67 bool write_cap();
68
73 bool write_com();
74
79 bool write_cod();
80
89 bool compare_coc(uint32_t first_comp_no, uint32_t second_comp_no);
90
98 bool write_coc(uint32_t comp_no, BufferedStream* stream);
99
100 bool write_coc(uint32_t comp_no);
101
106 bool write_qcd();
107
116 bool compare_qcc(uint32_t first_comp_no, uint32_t second_comp_no);
117
126 bool write_qcc(uint16_t tileIndex, uint32_t comp_no, BufferedStream* stream);
127
128 bool write_qcc(uint32_t comp_no);
129
134 bool writePoc();
135
140 bool write_tlm_end();
141
146 bool write_tlm_begin();
147
156 bool compare_SPCod_SPCoc(uint32_t first_comp_no, uint32_t second_comp_no);
157
165 bool write_SPCod_SPCoc(uint32_t comp_no);
166
174 uint32_t get_SPCod_SPCoc_size(uint32_t comp_no);
175
184 uint32_t get_SQcd_SQcc_size(uint32_t comp_no);
185
194 bool compare_SQcd_SQcc(uint32_t first_comp_no, uint32_t second_comp_no);
195
202 bool write_SQcd_SQcc(uint32_t comp_no);
203
211 bool write_mct_record(grk_mct_data* p_mct_record, BufferedStream* stream);
212
220 bool write_mcc_record(grk_simple_mcc_decorrelation_data* p_mcc_record, BufferedStream* stream);
221
226 bool write_mco();
227
232 bool write_cbd();
233
238 bool write_all_coc();
239
244 bool write_all_qcc();
245
250 bool write_regions();
251
260 bool write_rgn(uint16_t tile_no, uint32_t comp_no, uint32_t nb_comps);
261
266 bool write_eoc();
267
272 bool write_mct_data_group();
273
284 bool getNumTileParts(uint16_t* p_nb_tile_parts, GrkImage* image);
285
296 uint64_t getNumTilePartsForProgression(uint32_t pino, uint16_t tileno);
297
309 bool validateProgressionOrders(const grk_progression* progressions, uint32_t numProgressions,
310 uint8_t numResolutions, uint16_t numcomps, uint16_t numlayers);
311
312 bool init_mct_encoding(TileCodingParams* p_tcp, GrkImage* p_image);
313
314 CompressorState compressorState_;
315};
316
317} // namespace grk
BufferedStream * stream
Definition BitIO.h:88
CompressorState compressorState_
Definition CodeStreamCompress.h:314
uint16_t numlayers
number of layers
Definition CodingParams.h:138
uint16_t numcomps
Definition FileFormat.h:149
uint16_t tileno
Definition PacketManager.h:96
TileProcessor * tileProcessor
Definition PacketManager.h:100
uint32_t pino
Compression Only Current packet iterator number.
Definition TileProcessor.h:121
enum _GRK_PROG_ORDER GRK_PROG_ORDER
Progression order.
uint8_t * start
pointer to the start of the buffer
Definition mqc.h:56
uint8_t * end
pointer to the end of the buffer
Definition mqc.h:58
Copyright (C) 2016-2023 Grok Image Compression Inc.
Definition ICacheable.h:20
grk_plugin_tile * tile
Definition plugin_interface.h:64
grk_image * image
Definition plugin_interface.h:63
Compress parameters.
Definition grok.h:912
Plugin tile.
Definition grok.h:739
Progression order change.
Definition grok.h:135