Grok 10.0.5
Precinct.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2023 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#pragma once
17#include "grk_includes.h"
18
19namespace grk
20{
21template<typename T, typename P>
22class BlockCache : public SparseCache<T>
23{
24 public:
28 virtual ~BlockCache() = default;
29
30 protected:
31 virtual T* create(uint64_t index) override
32 {
33 auto item = new T(numLayers_);
34 blockInitializer_->initCodeBlock(item, index);
35 return item;
36 }
37
38 private:
41};
42
94
95} // namespace grk
Definition Precinct.h:23
virtual T * create(uint64_t index) override
Definition Precinct.h:31
BlockCache(uint16_t numLayers, uint64_t maxChunkSize, P *blockInitializer)
Definition Precinct.h:25
uint16_t numLayers_
Definition Precinct.h:40
virtual ~BlockCache()=default
P * blockInitializer_
Definition Precinct.h:39
Definition SparseCache.h:25
Tag tree.
Definition TagTree.h:47
Copyright (C) 2016-2023 Grok Image Compression Inc.
Definition ICacheable.h:20
void grk_read(const uint8_t *buffer, TYPE *value, uint32_t numBytes)
Definition BufferedStream.h:239
Definition Codeblock.h:142
Definition Codeblock.h:201
Definition Precinct.h:66
grk_pt32 cblk_expn_
Definition Precinct.h:87
uint32_t getCblkGridHeight(void)
Definition Precinct.cpp:165
uint16_t numLayers_
Definition Precinct.h:83
uint64_t getNumCblks(void)
Definition Precinct.cpp:173
TagTreeU16 * getInclTree(void)
Definition Precinct.cpp:153
PrecinctImpl * impl
Definition Precinct.h:86
TagTreeU8 * getImsbTree(void)
Definition Precinct.cpp:157
uint32_t getNominalBlockSize(void)
Definition Precinct.cpp:169
virtual ~Precinct()
Definition Precinct.cpp:141
DecompressCodeblock * getDecompressedBlockPtr(uint64_t cblkno)
Definition Precinct.cpp:181
CompressCodeblock * getCompressedBlockPtr(uint64_t cblkno)
Definition Precinct.cpp:177
DecompressCodeblock * tryGetDecompressedBlockPtr(uint64_t cblkno)
Definition Precinct.cpp:185
uint64_t precinctIndex
Definition Precinct.h:82
grk_rect32 getCblkGrid(void)
Definition Precinct.cpp:193
void deleteTagTrees()
Definition Precinct.cpp:145
uint32_t getCblkGridwidth(void)
Definition Precinct.cpp:161
grk_pt32 getCblkExpn(void)
Definition Precinct.cpp:189
grk_rect32 getCodeBlockBounds(uint64_t cblkno)
Definition Precinct.cpp:149
PrecinctImpl * getImpl(void)
Definition Precinct.h:88
Definition Precinct.h:44
TagTreeU16 * getIncludeTagTree(void)
Definition Precinct.cpp:84
grk_rect32 bounds_
Definition Precinct.h:57
grk_pt32 cblk_expn_
Definition Precinct.h:58
TagTreeU8 * imsbtree
Definition Precinct.h:63
bool initCodeBlocks(uint16_t numLayers, grk_rect32 *bounds)
Definition Precinct.cpp:51
bool isCompressor_
Definition Precinct.h:59
grk_rect32 cblk_grid_
Definition Precinct.h:56
grk_rect32 getCodeBlockBounds(uint64_t cblkno)
Definition Precinct.cpp:41
BlockCache< CompressCodeblock, PrecinctImpl > * enc
Definition Precinct.h:54
bool initCodeBlock(T *block, uint64_t cblkno)
Definition Precinct.cpp:67
void deleteTagTrees()
Definition Precinct.cpp:77
TagTreeU16 * incltree
Definition Precinct.h:62
BlockCache< DecompressCodeblock, PrecinctImpl > * dec
Definition Precinct.h:55
~PrecinctImpl(void)
Definition Precinct.cpp:35
TagTreeU8 * getIMsbTagTree(void)
Definition Precinct.cpp:109
Definition TileProcessor.h:78