Grok 10.0.5
BlockExec.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 */
17#pragma once
18#include "grk_includes.h"
19
20namespace grk
21{
22struct BlockExec
23{
24 BlockExec()
26 cblk_sty(0), qmfbid(0), x(0), y(0), k_msbs(0), R_b(0)
27 {}
28 virtual bool open(T1Interface* t1) = 0;
29 virtual ~BlockExec() = default;
30 TileComponent* tilec;
31 uint8_t bandIndex;
32 uint8_t bandNumbps;
33 eBandOrientation bandOrientation;
34 float stepsize;
35 uint8_t cblk_sty;
36 uint8_t qmfbid;
37 /* code block offset in buffer coordinates*/
38 uint32_t x;
39 uint32_t y;
40 // missing bit planes for all blocks in band
41 uint8_t k_msbs;
42 uint8_t R_b;
43};
44struct DecompressBlockExec : public BlockExec
45{
46 DecompressBlockExec() : cblk(nullptr), resno(0), roishift(0) {}
47 bool open(T1Interface* t1)
48 {
49 return t1->decompress(this);
50 }
51 void close(void) {}
52 DecompressCodeblock* cblk;
53 uint8_t resno;
54 uint8_t roishift;
55};
56struct CompressBlockExec : public BlockExec
57{
58 CompressBlockExec()
59 : cblk(nullptr), tile(nullptr), doRateControl(false), distortion(0), tiledp(nullptr),
60 compno(0), resno(0), precinctIndex(0), cblkno(0), inv_step_ht(0), mct_norms(nullptr),
61#ifdef DEBUG_LOSSLESS_T1
62 unencodedData(nullptr),
63#endif
65 {}
66 bool open(T1Interface* t1)
67 {
68 return t1->compress(this);
69 }
70 void close(void) {}
71 CompressCodeblock* cblk;
72 Tile* tile;
74 double distortion;
75 int32_t* tiledp;
76 uint16_t compno;
77 uint8_t resno;
78 uint64_t precinctIndex;
79 uint64_t cblkno;
81 const double* mct_norms;
82#ifdef DEBUG_LOSSLESS_T1
83 int32_t* unencodedData;
84#endif
85 uint16_t mct_numcomps;
86};
87
88} // namespace grk
uint64_t precinctIndex
Definition BlockExec.h:78
float inv_step_ht
Definition BlockExec.h:80
bool doRateControl
Definition BlockExec.h:73
uint8_t resno
Definition BlockExec.h:53
float stepsize
Definition BlockExec.h:34
uint16_t mct_numcomps
Definition BlockExec.h:85
uint32_t y
Definition BlockExec.h:39
uint64_t cblkno
Definition BlockExec.h:79
uint32_t x
Definition BlockExec.h:38
uint8_t bandNumbps
Definition BlockExec.h:32
uint8_t k_msbs
Definition BlockExec.h:41
eBandOrientation bandOrientation
Definition BlockExec.h:33
uint8_t bandIndex
Definition BlockExec.h:31
uint8_t R_b
Definition BlockExec.h:42
int32_t * tiledp
Definition BlockExec.h:75
DecompressCodeblock * cblk
Definition BlockExec.h:52
TileComponent * tilec
Definition BlockExec.h:30
double distortion[maxCompressLayersGRK]
fixed_quality
Definition CodingParams.h:161
uint8_t roishift
Region Of Interest shift.
Definition CodingParams.h:83
double * mct_norms
compressing norms
Definition CodingParams.h:179
uint8_t cblk_sty
code-block mode
Definition CodingParams.h:64
uint8_t qmfbid
discrete wavelet transform identifier
Definition CodingParams.h:66
@ BAND_ORIENT_LL
Definition TileCache.h:25
Copyright (C) 2016-2023 Grok Image Compression Inc.
Definition ICacheable.h:20
grk_plugin_tile * tile
Definition plugin_interface.h:64
uint16_t compno
Definition plugin_interface.h:43