Grok 10.0.5
FileFormatCompress.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#pragma once
22
23namespace grk
24{
25class FileFormatCompress : public FileFormat, public ICodeStreamCompress
26{
27 public:
28 FileFormatCompress(BufferedStream* stream);
29 virtual ~FileFormatCompress();
30
31 bool init(grk_cparameters* p_param, GrkImage* p_image);
32 bool start(void);
33 bool compress(grk_plugin_tile* tile);
34
35 private:
36 bool end(void);
37 grk_color* getColour(void);
38 void find_cf(double x, uint16_t* num, uint16_t* den);
39 void write_res_box(double resx, double resy, uint32_t box_id, uint8_t** current_res_ptr);
40 uint8_t* write_res(uint32_t* p_nb_bytes_written);
41 uint8_t* write_bpc(uint32_t* p_nb_bytes_written);
42 uint8_t* write_colr(uint32_t* p_nb_bytes_written);
43 uint8_t* write_component_mapping(uint32_t* p_nb_bytes_written);
44 uint8_t* write_palette_clr(uint32_t* p_nb_bytes_written);
45 uint8_t* write_channel_definition(uint32_t* p_nb_bytes_written);
46 bool write_jp2h(void);
47 uint8_t* write_ihdr(uint32_t* p_nb_bytes_written);
48 uint8_t* write_buffer(uint32_t boxId, grk_buf8* buffer, uint32_t* p_nb_bytes_written);
49 bool write_uuids(void);
50 bool write_ftyp(void);
51 bool write_jp2c(void);
52 bool write_jp(void);
53 bool default_validation(void);
54 void init_header_writing();
55 void init_end_header_writing(void);
56 void init_compressValidation(void);
57 uint8_t* write_xml(uint32_t* p_nb_bytes_written);
58 bool skip_jp2c(void);
59
60 CodeStreamCompress* codeStream;
63 GrkImage* inputImage_;
64};
65
66} // namespace grk
BufferedStream * stream
Definition BitIO.h:88
uint32_t x
Definition BlockExec.h:38
uint64_t j2k_codestream_offset
Definition FileFormatCompress.h:62
CodeStreamCompress * codeStream
Definition FileFormatCompress.h:60
GrkImage * inputImage_
Definition FileFormatCompress.h:63
bool needs_xl_jp2c_box_length
Definition FileFormatCompress.h:61
uint8_t * buffer
packet header storage original buffer
Definition PPMMarker.h:64
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
ICC profile, palette, channel definition.
Definition grok.h:319
Compress parameters.
Definition grok.h:912
Plugin tile.
Definition grok.h:739