Grok 20.3.2
Precinct.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
20namespace grk
21{
22
23struct PrecinctImpl;
24
31struct Precinct : public Rect32_16
32{
40 Precinct(uint16_t numLayers, const Rect32_16& bounds, Point8 cblk_expn);
41
46 virtual ~Precinct();
47
52 void deleteTagTrees();
53
60 Rect32_16 getCodeBlockBounds(uint32_t cblkno);
61
68
75
81 uint16_t getNominalBlockSize(void);
82
88 uint32_t getNumCblks(void);
89
99
109
118
124 Point8 getCblkExpn(void);
125
132
133protected:
134 uint16_t numLayers_;
135
136private:
137 PrecinctImpl* impl_ = nullptr;
138 PrecinctImpl* getImpl(void);
139 virtual PrecinctImpl* makeImpl(void) = 0;
141};
142
144{
145 using Precinct::Precinct;
146
147private:
148 PrecinctImpl* makeImpl(void) override;
149};
150
152{
153 using Precinct::Precinct;
154
155private:
156 PrecinctImpl* makeImpl(void) override;
157};
158
159} // namespace grk
ResWindow.
Definition CompressedChunkCache.h:36
TagTree< uint8_t > TagTreeU8
Definition TagTree.h:254
TagTree< uint16_t > TagTreeU16
Definition TagTree.h:255
Point< uint8_t > Point8
Definition geometry.h:44
Definition Precinct.h:144
Precinct(uint16_t numLayers, const Rect32_16 &bounds, Point8 cblk_expn)
Constructs a new Precinct object.
Definition Precinct.cpp:30
PrecinctImpl * makeImpl(void) override
Definition Precinct.cpp:90
Definition Precinct.h:152
Precinct(uint16_t numLayers, const Rect32_16 &bounds, Point8 cblk_expn)
Constructs a new Precinct object.
Definition Precinct.cpp:30
PrecinctImpl * makeImpl(void) override
Definition Precinct.cpp:94
uint16_t numLayers_
Definition Precinct.h:134
Point8 getCblkExpn(void)
Gets log2 of nominal code block dimensions.
Definition Precinct.cpp:74
Precinct(uint16_t numLayers, const Rect32_16 &bounds, Point8 cblk_expn)
Constructs a new Precinct object.
Definition Precinct.cpp:30
TagTreeU16 * getInclTree(void)
Gets inclusion TagTreeU16.
Definition Precinct.cpp:46
Point8 cblk_expn_
Definition Precinct.h:140
Rect32_16 getCblkGrid(void)
Gets the code block grid.
Definition Precinct.cpp:78
TagTreeU8 * getImsbTree(void)
Get msb TagTreeU8.
Definition Precinct.cpp:50
virtual PrecinctImpl * makeImpl(void)=0
t1::CodeblockDecompress * getDecompressBlock(uint32_t cblkno)
Gets CodeblockDecompress for a code block A CodeBlockDecompress will be created if it hasn't been cre...
Definition Precinct.cpp:66
t1::CodeblockCompress * getCompressBlock(uint32_t cblkno)
Gets CodeblockCompress for a code block A CodeblockCompress will be created if it hasn't already been...
Definition Precinct.cpp:62
virtual ~Precinct()
Destroys the Precinct object.
Definition Precinct.cpp:34
t1::CodeblockDecompress * tryGetDecompressBlock(uint32_t cblkno)
Gets a CodeblockDecompress if it exists, otherwise returns nullptr.
Definition Precinct.cpp:70
uint32_t getNumCblks(void)
Gets the number of code blocks in the precinct.
Definition Precinct.cpp:58
Rect32_16 getCodeBlockBounds(uint32_t cblkno)
Gets code block bounds.
Definition Precinct.cpp:42
uint16_t getNominalBlockSize(void)
Gets nominal size (area) of code block.
Definition Precinct.cpp:54
void deleteTagTrees()
Deletes tag trees.
Definition Precinct.cpp:38
PrecinctImpl * impl_
Definition Precinct.h:137
PrecinctImpl * getImpl(void)
Definition Precinct.cpp:83
Stores tag trees and code blocks belonging to a Precinct A reference to the Precinct is also stored.
Definition PrecinctImpl.h:31
Rect32_16(uint32_t x0, uint32_t y0, uint16_t w, uint16_t h)
Definition geometry.h:106
Stores information about compression code block.
Definition CodeblockCompress.h:31
Definition CodeblockDecompress.h:27