Grok  7.6.6
Quantizer.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 #include <cstdint>
25 
26 
27 namespace grk {
28 
29 
30 struct CodeStream;
31 
35 struct grk_stepsize {
36  grk_stepsize() : expn(0), mant(0)
37  {}
39  uint8_t expn;
41  uint16_t mant;
42 };
43 
44 
45 
46 struct CodeStream;
48 struct BufferedStream;
49 struct Subband;
50 struct TileCodingParams;
51 struct TileProcessor;
52 
53 
54 class Quantizer {
55 public:
56 
58  Subband *band,
59  uint32_t resno,
60  uint8_t bandIndex,
62  uint8_t image_precision,
63  bool compress);
64 
65 
66  uint32_t get_SQcd_SQcc_size(CodeStream *codeStream, uint32_t comp_no);
67  bool compare_SQcd_SQcc(CodeStream *codeStream,
68  uint32_t first_comp_no, uint32_t second_comp_no);
69  bool read_SQcd_SQcc(CodeStream *codeStream,bool fromQCC, uint32_t comp_no,
70  uint8_t *p_header_data, uint16_t *header_size);
71  bool write_SQcd_SQcc(CodeStream *codeStream,uint32_t comp_no, BufferedStream *stream);
73 };
74 
75 }
Definition: Quantizer.h:54
uint32_t get_SQcd_SQcc_size(CodeStream *codeStream, uint32_t comp_no)
Definition: Quantizer.cpp:125
bool write_SQcd_SQcc(CodeStream *codeStream, uint32_t comp_no, BufferedStream *stream)
Definition: Quantizer.cpp:88
bool read_SQcd_SQcc(CodeStream *codeStream, bool fromQCC, uint32_t comp_no, uint8_t *p_header_data, uint16_t *header_size)
Definition: Quantizer.cpp:187
bool setBandStepSizeAndBps(TileCodingParams *tcp, Subband *band, uint32_t resno, uint8_t bandIndex, TileComponentCodingParams *tccp, uint8_t image_precision, bool compress)
Definition: Quantizer.cpp:26
void apply_quant(TileComponentCodingParams *src, TileComponentCodingParams *dest)
Definition: Quantizer.cpp:69
bool compare_SQcd_SQcc(CodeStream *codeStream, uint32_t first_comp_no, uint32_t second_comp_no)
Definition: Quantizer.cpp:146
Copyright (C) 2016-2021 Grok Image Compression Inc.
Definition: BitIO.cpp:23
Byte input-output stream.
Definition: BufferedStream.h:38
Definition: CodeStream.h:163
Definition: T1Structs.h:203
Tile coding parameters : this structure is used to store coding/decoding parameters common to all til...
Definition: CodingParams.h:121
Tile-component coding parameters.
Definition: CodingParams.h:49
Tile compressor/decompressor.
Definition: TileProcessor.h:70
Quantization stepsize.
Definition: Quantizer.h:35
uint16_t mant
mantissa -11 bits
Definition: Quantizer.h:41
uint8_t expn
exponent - 5 bits
Definition: Quantizer.h:39
grk_stepsize()
Definition: Quantizer.h:36