Grok  7.6.0
T1Interface.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2020 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 "grok_includes.h"
21 #include "testing.h"
22 
23 namespace grk {
24 
27  tilec(nullptr),
28  tiledp(nullptr),
29  stride(0),
30  cblk(nullptr),
31  resno(0),
32  bandno(0),
33  stepsize(0),
34  roishift(0),
35  cblk_sty(0),
36  qmfbid(0),
37  x(0),
38  y(0),
39  k_msbs(0)
40  { }
42  int32_t *tiledp;
43  uint32_t stride;
45  uint32_t resno;
46  uint32_t bandno;
47  float stepsize;
48  uint32_t roishift;
49  uint32_t cblk_sty;
50  uint32_t qmfbid;
51  /* relative code block offset */
52  uint32_t x;
53  uint32_t y;
54  // missing bit planes for all blocks in band
55  uint8_t k_msbs;
56 };
57 
59  encodeBlockInfo() : tiledp(nullptr),
60  cblk(nullptr),
61  compno(0),
62  resno(0),
63  bandno(0),
64  precno(0),
65  cblkno(0),
66  inv_step(0),
67  inv_step_ht(0),
68  stepsize(0),
69  cblk_sty(0),
70  qmfbid(0),
71  x(0),
72  y(0),
73  mct_norms(nullptr),
74 #ifdef DEBUG_LOSSLESS_T1
75  unencodedData(nullptr),
76 #endif
77  mct_numcomps(0),
78  k_msbs(0)
79  {
80  }
81  int32_t *tiledp;
83  uint32_t compno;
84  uint32_t resno;
85  uint8_t bandno;
86  uint64_t precno;
87  uint64_t cblkno;
88  // inverse step size in 13 bit fixed point
89  int32_t inv_step;
90  float inv_step_ht;
91  float stepsize;
92  uint8_t cblk_sty;
93  uint8_t qmfbid;
94  uint32_t x, y; /* relative code block offset */
95  const double *mct_norms;
96 #ifdef DEBUG_LOSSLESS_T1
97  int32_t* unencodedData;
98 #endif
99  uint32_t mct_numcomps;
100  uint8_t k_msbs;
101 };
102 
103 class T1Interface {
104 public:
105  virtual ~T1Interface() {
106  }
107 
108  virtual void preEncode(encodeBlockInfo *block, grk_tile *tile,
109  uint32_t &max) = 0;
110  virtual double compress(encodeBlockInfo *block, grk_tile *tile,
111  uint32_t max, bool doRateControl)=0;
112 
113  virtual bool decompress(decodeBlockInfo *block)=0;
114  virtual void postDecode(decodeBlockInfo *block)=0;
115 };
116 
117 }
grk::decodeBlockInfo::stepsize
float stepsize
Definition: T1Interface.h:47
grk::encodeBlockInfo::y
uint32_t y
Definition: T1Interface.h:94
grk::encodeBlockInfo::inv_step
int32_t inv_step
Definition: T1Interface.h:89
grk::decodeBlockInfo::tiledp
int32_t * tiledp
Definition: T1Interface.h:42
grk::encodeBlockInfo::cblk
grk_cblk_enc * cblk
Definition: T1Interface.h:82
grk::decodeBlockInfo::qmfbid
uint32_t qmfbid
Definition: T1Interface.h:50
grk::decodeBlockInfo::roishift
uint32_t roishift
Definition: T1Interface.h:48
grok_includes.h
grk::T1Interface::decompress
virtual bool decompress(decodeBlockInfo *block)=0
grk::decodeBlockInfo::cblk
grk_cblk_dec * cblk
Definition: T1Interface.h:44
grk::encodeBlockInfo::x
uint32_t x
Definition: T1Interface.h:94
testing.h
grk::decodeBlockInfo::x
uint32_t x
Definition: T1Interface.h:52
grk::grk_cblk_dec
Definition: TileProcessor.h:109
grk::encodeBlockInfo::k_msbs
uint8_t k_msbs
Definition: T1Interface.h:100
grk::decodeBlockInfo::resno
uint32_t resno
Definition: T1Interface.h:45
grk::encodeBlockInfo::mct_norms
const double * mct_norms
Definition: T1Interface.h:95
grk::decodeBlockInfo::k_msbs
uint8_t k_msbs
Definition: T1Interface.h:55
grk::encodeBlockInfo::inv_step_ht
float inv_step_ht
Definition: T1Interface.h:90
grk::encodeBlockInfo::precno
uint64_t precno
Definition: T1Interface.h:86
grk::decodeBlockInfo::cblk_sty
uint32_t cblk_sty
Definition: T1Interface.h:49
grk::decodeBlockInfo::decodeBlockInfo
decodeBlockInfo()
Definition: T1Interface.h:26
grk::T1Interface::preEncode
virtual void preEncode(encodeBlockInfo *block, grk_tile *tile, uint32_t &max)=0
grk::encodeBlockInfo::bandno
uint8_t bandno
Definition: T1Interface.h:85
grk::encodeBlockInfo::qmfbid
uint8_t qmfbid
Definition: T1Interface.h:93
grk::encodeBlockInfo::stepsize
float stepsize
Definition: T1Interface.h:91
grk::decodeBlockInfo
Definition: T1Interface.h:25
grk::encodeBlockInfo::cblk_sty
uint8_t cblk_sty
Definition: T1Interface.h:92
grk
Copyright (C) 2016-2020 Grok Image Compression Inc.
Definition: BitIO.h:27
grk::encodeBlockInfo::encodeBlockInfo
encodeBlockInfo()
Definition: T1Interface.h:59
grk::TileComponent
Definition: TileComponent.h:31
grk::grk_tile
Definition: TileProcessor.h:180
grk::encodeBlockInfo::mct_numcomps
uint32_t mct_numcomps
Definition: T1Interface.h:99
grk::T1Interface::~T1Interface
virtual ~T1Interface()
Definition: T1Interface.h:105
grk::encodeBlockInfo::cblkno
uint64_t cblkno
Definition: T1Interface.h:87
grk::grk_cblk_enc
Definition: TileProcessor.h:91
grk::decodeBlockInfo::y
uint32_t y
Definition: T1Interface.h:53
grk::decodeBlockInfo::bandno
uint32_t bandno
Definition: T1Interface.h:46
grk::encodeBlockInfo::tiledp
int32_t * tiledp
Definition: T1Interface.h:81
grk::T1Interface
Definition: T1Interface.h:103
grk::T1Interface::postDecode
virtual void postDecode(decodeBlockInfo *block)=0
grk::decodeBlockInfo::tilec
TileComponent * tilec
Definition: T1Interface.h:41
grk::T1Interface::compress
virtual double compress(encodeBlockInfo *block, grk_tile *tile, uint32_t max, bool doRateControl)=0
grk::encodeBlockInfo
Definition: T1Interface.h:58
grk::decodeBlockInfo::stride
uint32_t stride
Definition: T1Interface.h:43
grk::encodeBlockInfo::compno
uint32_t compno
Definition: T1Interface.h:83
grk::encodeBlockInfo::resno
uint32_t resno
Definition: T1Interface.h:84