Grok 20.3.2
Subband.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 <unordered_map>
21
22namespace grk
23{
24
30struct Subband : public Rect32
31{
36 Subband() = default;
37
43 Subband(const Subband& rhs);
44
49 virtual ~Subband() = default;
50
57 Subband& operator=(const Subband& rhs);
58
59 void print() const override;
60
67 bool empty();
68
75 Precinct* tryGetPrecinct(uint64_t precinctIndex);
76
86 Rect32_16 generateBandPrecinctBounds(uint64_t precinctIndex, Rect32 bandPrecinctPartition,
87 Point8 bandPrecinctExpn, uint32_t precinctGridWidth);
88
100 Precinct* createPrecinct(bool isCompressor, uint16_t numLayers, uint64_t precinctIndex,
101 Rect32 bandPrecinctPartition, Point8 bandPrecinctExpn,
102 uint32_t precinctGridWidth, Point8 cblk_expn);
103
109
114 std::vector<Precinct*> precincts_;
115
120 std::unordered_map<uint64_t, uint64_t> precinctMap_;
121
126 uint8_t maxBitPlanes_ = 0;
127
132 float stepsize_ = 0;
133};
134
135} // namespace grk
eBandOrientation
Definition t1_common.h:28
@ BAND_ORIENT_LL
Definition t1_common.h:29
ResWindow.
Definition CompressedChunkCache.h:36
Rect< uint32_t > Rect32
Definition geometry.h:64
Point< uint8_t > Point8
Definition geometry.h:44
Lightweight precinct struct storing only bounds, some book-keeping variables and a pointer to the Pre...
Definition Precinct.h:32
Definition geometry.h:105
Subband()=default
Construct a new Subband object.
std::unordered_map< uint64_t, uint64_t > precinctMap_
maps global precinct index to precincts vector index
Definition Subband.h:120
void print() const override
Definition Subband.cpp:42
float stepsize_
quantization step size
Definition Subband.h:132
t1::eBandOrientation orientation_
band orientation
Definition Subband.h:108
bool empty()
Returns true if this subband is empty i.e.
Definition Subband.cpp:46
std::vector< Precinct * > precincts_
flat vector of precincts
Definition Subband.h:114
virtual ~Subband()=default
Destroys a Subband object.
Subband & operator=(const Subband &rhs)
operator=
Definition Subband.cpp:34
uint8_t maxBitPlanes_
band max number of bit planes
Definition Subband.h:126
Precinct * createPrecinct(bool isCompressor, uint16_t numLayers, uint64_t precinctIndex, Rect32 bandPrecinctPartition, Point8 bandPrecinctExpn, uint32_t precinctGridWidth, Point8 cblk_expn)
Creates a Precinct.
Definition Subband.cpp:79
Rect32_16 generateBandPrecinctBounds(uint64_t precinctIndex, Rect32 bandPrecinctPartition, Point8 bandPrecinctExpn, uint32_t precinctGridWidth)
Generates band precinct bounds (canvas coordinates).
Definition Subband.cpp:66
Precinct * tryGetPrecinct(uint64_t precinctIndex)
Gets a ref Precinct if it has already been created, otherwise returns nullptr.
Definition Subband.cpp:50