FileFormatCompress.h
Go to the documentation of this file.
/*
* Copyright (C) 2016-2023 Grok Image Compression Inc.
*
* This source code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This source code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* This source code incorporates work covered by the BSD 2-clause license.
* Please see the LICENSE file in the root directory for details.
*
*/
#pragma once
namespace grk
{
class FileFormatCompress : public FileFormat, public ICodeStreamCompress
{
public:
FileFormatCompress(BufferedStream* stream);
virtual ~FileFormatCompress();
bool init(grk_cparameters* p_param, GrkImage* p_image);
bool start(void);
bool compress(grk_plugin_tile* tile);
private:
bool end(void);
grk_color* getColour(void);
void find_cf(double x, uint16_t* num, uint16_t* den);
void write_res_box(double resx, double resy, uint32_t box_id, uint8_t** current_res_ptr);
uint8_t* write_res(uint32_t* p_nb_bytes_written);
uint8_t* write_bpc(uint32_t* p_nb_bytes_written);
uint8_t* write_colr(uint32_t* p_nb_bytes_written);
uint8_t* write_component_mapping(uint32_t* p_nb_bytes_written);
uint8_t* write_palette_clr(uint32_t* p_nb_bytes_written);
uint8_t* write_channel_definition(uint32_t* p_nb_bytes_written);
bool write_jp2h(void);
uint8_t* write_ihdr(uint32_t* p_nb_bytes_written);
uint8_t* write_buffer(uint32_t boxId, grk_buf8* buffer, uint32_t* p_nb_bytes_written);
bool write_uuids(void);
bool write_ftyp(void);
bool write_jp2c(void);
bool write_jp(void);
bool default_validation(void);
void init_header_writing();
void init_end_header_writing(void);
void init_compressValidation(void);
uint8_t* write_xml(uint32_t* p_nb_bytes_written);
bool skip_jp2c(void);
CodeStreamCompress* codeStream;
bool needs_xl_jp2c_box_length;
uint64_t j2k_codestream_offset;
GrkImage* inputImage_;
};
} // namespace grk
grk::CodeStreamCompress
Definition CodeStreamCompress.h:29
grk::FileFormatCompress
Definition FileFormatCompress.h:26
grk::FileFormatCompress::write_channel_definition
uint8_t * write_channel_definition(uint32_t *p_nb_bytes_written)
Definition FileFormatCompress.cpp:421
grk::FileFormatCompress::write_colr
uint8_t * write_colr(uint32_t *p_nb_bytes_written)
Definition FileFormatCompress.cpp:361
grk::FileFormatCompress::write_res_box
void write_res_box(double resx, double resy, uint32_t box_id, uint8_t **current_res_ptr)
Definition FileFormatCompress.cpp:566
grk::FileFormatCompress::codeStream
CodeStreamCompress * codeStream
Definition FileFormatCompress.h:60
grk::FileFormatCompress::write_bpc
uint8_t * write_bpc(uint32_t *p_nb_bytes_written)
Definition FileFormatCompress.cpp:469
grk::FileFormatCompress::write_ihdr
uint8_t * write_ihdr(uint32_t *p_nb_bytes_written)
Definition FileFormatCompress.cpp:656
grk::FileFormatCompress::getColour
grk_color * getColour(void)
Definition FileFormatCompress.cpp:53
grk::FileFormatCompress::j2k_codestream_offset
uint64_t j2k_codestream_offset
Definition FileFormatCompress.h:62
grk::FileFormatCompress::write_res
uint8_t * write_res(uint32_t *p_nb_bytes_written)
Definition FileFormatCompress.cpp:497
grk::FileFormatCompress::skip_jp2c
bool skip_jp2c(void)
Definition FileFormatCompress.cpp:949
grk::FileFormatCompress::init
bool init(grk_cparameters *p_param, GrkImage *p_image)
Definition FileFormatCompress.cpp:731
grk::FileFormatCompress::inputImage_
GrkImage * inputImage_
Definition FileFormatCompress.h:63
grk::FileFormatCompress::write_uuids
bool write_uuids(void)
Definition FileFormatCompress.cpp:165
grk::FileFormatCompress::end
bool end(void)
Definition FileFormatCompress.cpp:926
grk::FileFormatCompress::compress
bool compress(grk_plugin_tile *tile)
Definition FileFormatCompress.cpp:918
grk::FileFormatCompress::write_jp2c
bool write_jp2c(void)
Definition FileFormatCompress.cpp:76
grk::FileFormatCompress::write_buffer
uint8_t * write_buffer(uint32_t boxId, grk_buf8 *buffer, uint32_t *p_nb_bytes_written)
Definition FileFormatCompress.cpp:628
grk::FileFormatCompress::write_palette_clr
uint8_t * write_palette_clr(uint32_t *p_nb_bytes_written)
Definition FileFormatCompress.cpp:282
grk::FileFormatCompress::default_validation
bool default_validation(void)
Definition FileFormatCompress.cpp:959
grk::FileFormatCompress::write_jp2h
bool write_jp2h(void)
Definition FileFormatCompress.cpp:191
grk::FileFormatCompress::start
bool start(void)
Definition FileFormatCompress.cpp:703
grk::FileFormatCompress::needs_xl_jp2c_box_length
bool needs_xl_jp2c_box_length
Definition FileFormatCompress.h:61
grk::FileFormatCompress::write_ftyp
bool write_ftyp(void)
Definition FileFormatCompress.cpp:120
grk::FileFormatCompress::write_jp
bool write_jp(void)
Definition FileFormatCompress.cpp:60
grk::FileFormatCompress::write_xml
uint8_t * write_xml(uint32_t *p_nb_bytes_written)
Definition FileFormatCompress.cpp:624
grk::FileFormatCompress::write_component_mapping
uint8_t * write_component_mapping(uint32_t *p_nb_bytes_written)
Definition FileFormatCompress.cpp:332
grk::FileFormatCompress::~FileFormatCompress
virtual ~FileFormatCompress()
Definition FileFormatCompress.cpp:46
grk::FileFormatCompress::init_header_writing
void init_header_writing()
Definition FileFormatCompress.cpp:941
grk::FileFormatCompress::init_end_header_writing
void init_end_header_writing(void)
Definition FileFormatCompress.cpp:933
grk::FileFormatCompress::find_cf
void find_cf(double x, uint16_t *num, uint16_t *den)
Definition FileFormatCompress.cpp:536
grk::FileFormatCompress::init_compressValidation
void init_compressValidation(void)
Definition FileFormatCompress.cpp:937
grk::FileFormat
JPEG 2000 file format reader/writer.
Definition FileFormat.h:132
grk::GrkImage
Definition GrkImage.h:25
grk
Copyright (C) 2016-2023 Grok Image Compression Inc.
Definition ICacheable.h:20
grk::grk_read
void grk_read(const uint8_t *buffer, TYPE *value, uint32_t numBytes)
Definition BufferedStream.h:239
_grk_color
ICC profile, palette, channel definition.
Definition grok.h:319
_grk_cparameters
Compress parameters.
Definition grok.h:912
_grk_plugin_tile
Plugin tile.
Definition grok.h:739
grk::BufferedStream
Definition BufferedStream.h:35
grk::ICodeStreamCompress
Definition CodeStream.h:107
grk::grk_buf< uint8_t, AllocatorVanilla >