Grok 20.3.2
Quantizer.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2026 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
18#pragma once
19
20#include "IStreamWriter.h"
21
22namespace grk
23{
28{
29 grk_stepsize() : expn(0), mant(0) {}
31 uint8_t expn;
33 uint16_t mant;
34};
35
37{
38public:
39 Quantizer(bool reversible, uint8_t guard_bits);
40 virtual ~Quantizer() = default;
41 // for compress
42 void pull(grk_stepsize* stepptr);
43 // for decompress
44 void push(grk_stepsize* stepptr);
45 virtual void generate(uint8_t decomps, uint8_t max_bit_depth, bool color_transform,
46 bool is_signed);
47 virtual bool write(t1_t2::IStreamWriter* stream);
48
49protected:
50 uint32_t get_num_guard_bits() const;
51 uint8_t Sqcd;
52 union
53 {
54 uint8_t u8_SPqcd[97];
55 uint16_t u16_SPqcd[97];
56 };
57 uint32_t num_decomps;
59};
60
61} // namespace grk
ResWindow.
Definition CompressedChunkCache.h:36
uint32_t num_decomps
Definition Quantizer.h:57
Quantizer(bool reversible, uint8_t guard_bits)
Definition Quantizer.cpp:23
virtual ~Quantizer()=default
uint8_t Sqcd
Definition Quantizer.h:51
void pull(grk_stepsize *stepptr)
Note:
Definition Quantizer.cpp:47
uint32_t get_num_guard_bits() const
Definition Quantizer.cpp:30
virtual bool write(t1_t2::IStreamWriter *stream)
Definition Quantizer.cpp:110
uint8_t u8_SPqcd[97]
Definition Quantizer.h:54
virtual void generate(uint8_t decomps, uint8_t max_bit_depth, bool color_transform, bool is_signed)
Definition Quantizer.cpp:77
void push(grk_stepsize *stepptr)
Definition Quantizer.cpp:65
uint16_t u16_SPqcd[97]
Definition Quantizer.h:55
bool isReversible
Definition Quantizer.h:58
Quantization stepsize.
Definition Quantizer.h:28
uint16_t mant
mantissa -11 bits
Definition Quantizer.h:33
uint8_t expn
exponent - 5 bits
Definition Quantizer.h:31
grk_stepsize()
Definition Quantizer.h:29
Definition IStreamWriter.h:9