Grok  7.6.3
TileComponentWindowBuffer.h
Go to the documentation of this file.
1 
17 #pragma once
18 
19 #include "grk_includes.h"
20 #include <stdexcept>
21 
22 namespace grk {
23 
29 template<typename T> struct ResWindow {
30 
31  ResWindow(uint8_t numresolutions,
32  uint8_t resno,
33  grk_buffer_2d<T> *top,
34  Resolution *tileCompFullRes,
35  Resolution *tileCompFullResLower,
36  grk_rect_u32 tileCompWindowBounds,
37  grk_rect_u32 tileCompWindowUnreducedBounds,
38  uint32_t HORIZ_PASS_HEIGHT,
39  uint32_t FILTER_WIDTH) : m_allocated(false),
40  m_tileCompFullRes(tileCompFullRes),
41  m_tileCompFullResLower(tileCompFullResLower),
42  m_resWindow(new grk_buffer_2d<T>(tileCompWindowBounds.width(), tileCompWindowBounds.height())),
44  m_filterWidth(FILTER_WIDTH)
45  {
46  for (uint32_t i = 0; i < SPLIT_NUM_ORIENTATIONS; ++i)
47  m_splitWindow[i] = nullptr;
48  if (FILTER_WIDTH) {
49 
50  for (uint8_t orient = 0; orient < ( (resno) > 0 ? BAND_NUM_ORIENTATIONS : 1); orient++) {
51  grk_rect_u32 temp = getTileCompBandWindow(numresolutions, resno, orient,tileCompWindowUnreducedBounds);
52  m_paddedBandWindows.push_back(temp.grow(FILTER_WIDTH,FILTER_WIDTH));
53  }
54 
56 
57  // 1. set up windows for horizontal and vertical passes
58  grk_rect_u32 bandWindowRect[BAND_NUM_ORIENTATIONS];
59  bandWindowRect[BAND_ORIENT_LL] = getTileCompBandWindow(numresolutions,resno,BAND_ORIENT_LL,tileCompWindowUnreducedBounds);
60  bandWindowRect[BAND_ORIENT_LL] = bandWindowRect[BAND_ORIENT_LL].pan(-(int64_t)m_tileCompFullRes->band[BAND_INDEX_LH].x0, -(int64_t)m_tileCompFullRes->band[BAND_INDEX_HL].y0);
61  bandWindowRect[BAND_ORIENT_LL].grow(FILTER_WIDTH, m_tileCompFullResLower->width(), m_tileCompFullResLower->height());
62  m_bandWindows.push_back(new grk_buffer_2d<T>(bandWindowRect[BAND_ORIENT_LL]));
63 
64 
65  bandWindowRect[BAND_ORIENT_HL] = getTileCompBandWindow(numresolutions,resno,BAND_ORIENT_HL,tileCompWindowUnreducedBounds);
66  bandWindowRect[BAND_ORIENT_HL] = bandWindowRect[BAND_ORIENT_HL].pan(-(int64_t)m_tileCompFullRes->band[BAND_INDEX_HL].x0, -(int64_t)m_tileCompFullRes->band[BAND_INDEX_HL].y0);
68  m_bandWindows.push_back(new grk_buffer_2d<T>(bandWindowRect[BAND_ORIENT_HL]));
69 
70  bandWindowRect[BAND_ORIENT_LH] = getTileCompBandWindow(numresolutions,resno,BAND_ORIENT_LH,tileCompWindowUnreducedBounds);
71  bandWindowRect[BAND_ORIENT_LH] = bandWindowRect[BAND_ORIENT_LH].pan(-(int64_t)m_tileCompFullRes->band[BAND_INDEX_LH].x0, -(int64_t)m_tileCompFullRes->band[BAND_INDEX_LH].y0);
73  m_bandWindows.push_back(new grk_buffer_2d<T>(bandWindowRect[BAND_ORIENT_LH]));
74 
75  bandWindowRect[BAND_ORIENT_HH] = getTileCompBandWindow(numresolutions,resno,BAND_ORIENT_HH,tileCompWindowUnreducedBounds);
76  bandWindowRect[BAND_ORIENT_HH] = bandWindowRect[BAND_ORIENT_HH].pan(-(int64_t)m_tileCompFullRes->band[BAND_INDEX_HH].x0, -(int64_t)m_tileCompFullRes->band[BAND_INDEX_HH].y0);
78  m_bandWindows.push_back(new grk_buffer_2d<T>(bandWindowRect[BAND_ORIENT_HH]));
79 
80  auto win_low = bandWindowRect[BAND_ORIENT_LL];
81  auto win_high = bandWindowRect[BAND_ORIENT_HL];
82  m_resWindow->x0 = min<uint32_t>(2 * win_low.x0, 2 * bandWindowRect[BAND_ORIENT_HL].x0);
83  m_resWindow->x1 = min<uint32_t>(max<uint32_t>(2 * win_low.x1, 2 * win_high.x1), m_tileCompFullRes->width());
84  win_low = bandWindowRect[BAND_ORIENT_LL];
85  win_high = bandWindowRect[BAND_ORIENT_LH];
86  m_resWindow->y0 = min<uint32_t>(2 * win_low.y0, 2 * win_high.y0);
87  m_resWindow->y1 = min<uint32_t>(max<uint32_t>(2 * win_low.y1, 2 * win_high.y1), m_tileCompFullRes->height());
88 
89  // two windows formed by horizontal pass and used as input for vertical pass
90  grk_rect_u32 splitWindowRect[SPLIT_NUM_ORIENTATIONS];
91  splitWindowRect[SPLIT_L] = grk_rect_u32(m_resWindow->x0,
92  sat_sub<uint32_t>(bandWindowRect[BAND_ORIENT_LL].y0, HORIZ_PASS_HEIGHT),
93  m_resWindow->x1,
94  bandWindowRect[BAND_ORIENT_LL].y1);
95  m_splitWindow[SPLIT_L] = new grk_buffer_2d<T>(splitWindowRect[SPLIT_L]);
96 
97  splitWindowRect[SPLIT_H] = grk_rect_u32(m_resWindow->x0,
98  // note: max is used to avoid vertical overlap between the two intermediate windows
99  max<uint32_t>(bandWindowRect[BAND_ORIENT_LL].y1,
100  sat_sub<uint32_t>(min<uint32_t>(bandWindowRect[BAND_ORIENT_LH].y0 + m_tileCompFullResLower->height(), m_tileCompFullRes->height()),HORIZ_PASS_HEIGHT)),
101  m_resWindow->x1,
102  min<uint32_t>(bandWindowRect[BAND_ORIENT_LH].y1 + m_tileCompFullResLower->height(), m_tileCompFullRes->height()));
103  m_splitWindow[SPLIT_H] = new grk_buffer_2d<T>(splitWindowRect[SPLIT_H]);
104  }
105  } else {
106  // (NOTE: we use relative coordinates)
107  // dummy LL band window
108  m_bandWindows.push_back( new grk_buffer_2d<T>( 0,0) );
109  assert(tileCompFullRes->numBandWindows == 3 || !tileCompFullResLower);
110  if (tileCompFullResLower) {
111  for (uint32_t i = 0; i < tileCompFullRes->numBandWindows; ++i)
112  m_bandWindows.push_back( new grk_buffer_2d<T>(tileCompFullRes->band[i].width(),tileCompFullRes->band[i].height() ) );
113  for (uint32_t i = 0; i < SPLIT_NUM_ORIENTATIONS; ++i)
114  m_splitWindow[i] = new grk_buffer_2d<T>(tileCompWindowBounds.width(), tileCompWindowBounds.height());
115  m_splitWindow[SPLIT_L]->y1 = tileCompWindowBounds.y0 + tileCompFullResLower->height();
117  }
118 
119  }
120  }
122  delete m_resWindow;
123  for (auto &b : m_bandWindows)
124  delete b;
125  for (uint32_t i = 0; i < SPLIT_NUM_ORIENTATIONS; ++i)
126  delete m_splitWindow[i];
127  }
128 
129  bool alloc(bool clear){
130  if (m_allocated)
131  return true;
132 
133  // if top level window is present, then all buffers attach to this window
134  if (m_resWindowTopLevel) {
135  // ensure that top level window is allocated
136  if (!m_resWindowTopLevel->alloc(clear))
137  return false;
138 
139  // for now, we don't allocate bandWindows for windowed decode
140  if (m_filterWidth)
141  return true;
142 
143  // attach to top level window
145  m_resWindow->attach(m_resWindowTopLevel->data, m_resWindowTopLevel->stride);
146 
147  // m_tileCompFullResLower is null for lowest resolution
149  for (uint8_t orientation = 0; orientation < m_bandWindows.size(); ++orientation){
150  switch(orientation){
151  case BAND_ORIENT_HL:
152  m_bandWindows[orientation]->attach(m_resWindowTopLevel->data + m_tileCompFullResLower->width(),
153  m_resWindowTopLevel->stride);
154  break;
155  case BAND_ORIENT_LH:
156  m_bandWindows[orientation]->attach(m_resWindowTopLevel->data + m_tileCompFullResLower->height() * m_resWindowTopLevel->stride,
157  m_resWindowTopLevel->stride);
158  break;
159  case BAND_ORIENT_HH:
160  m_bandWindows[orientation]->attach(m_resWindowTopLevel->data + m_tileCompFullResLower->width() +
162  m_resWindowTopLevel->stride);
163  break;
164  default:
165  break;
166  }
167  }
170  m_resWindowTopLevel->stride);
171  }
172  } else {
173  // resolution window is always allocated
174  if (!m_resWindow->alloc(clear))
175  return false;
176  // for now, we don't allocate bandWindows for windowed decode
177  if (m_filterWidth)
178  return true;
179 
180  // band windows are allocated if present
181  for (auto &b : m_bandWindows){
182  if (!b->alloc(clear))
183  return false;
184  }
186  m_splitWindow[SPLIT_L]->attach(m_resWindow->data, m_resWindow->stride);
188  }
189  }
190  m_allocated = true;
191 
192  return true;
193  }
194 
195 
203  static grk_rect_u32 getTileCompBandWindow(uint8_t num_res,
204  uint8_t resno,
205  uint8_t orientation,
206  grk_rect_u32 unreducedTileCompBandWindow){
207  /* Compute number of decomposition for this band. See table F-1 */
208  assert(orientation < BAND_NUM_ORIENTATIONS);
209  assert(resno > 0 || orientation == 0);
210 
211  uint32_t nb = (resno == 0) ? num_res - 1 :num_res - resno;
212 
213  uint32_t tcx0 = unreducedTileCompBandWindow.x0;
214  uint32_t tcy0 = unreducedTileCompBandWindow.y0;
215  uint32_t tcx1 = unreducedTileCompBandWindow.x1;
216  uint32_t tcy1 = unreducedTileCompBandWindow.y1;
217  /* Map above tile-based coordinates to sub-band-based coordinates per */
218  /* equation B-15 of the standard */
219  uint32_t x0b = orientation & 1;
220  uint32_t y0b = orientation >> 1;
221  uint32_t tbx0 = (nb == 0) ? tcx0 :
222  (tcx0 <= (1U << (nb - 1)) * x0b) ? 0 :
223  ceildivpow2<uint32_t>(tcx0 - (1U << (nb - 1)) * x0b, nb);
224 
225  uint32_t tby0 = (nb == 0) ? tcy0 :
226  (tcy0 <= (1U << (nb - 1)) * y0b) ? 0 :
227  ceildivpow2<uint32_t>(tcy0 - (1U << (nb - 1)) * y0b, nb);
228 
229  uint32_t tbx1 = (nb == 0) ? tcx1 :
230  (tcx1 <= (1U << (nb - 1)) * x0b) ? 0 :
231  ceildivpow2<uint32_t>(tcx1 - (1U << (nb - 1)) * x0b, nb);
232 
233  uint32_t tby1 = (nb == 0) ? tcy1 :
234  (tcy1 <= (1U << (nb - 1)) * y0b) ? 0 :
235  ceildivpow2<uint32_t>(tcy1 - (1U << (nb - 1)) * y0b, nb);
236 
237 
238  return grk_rect_u32(tbx0,tby0,tbx1,tby1);
239  }
240 
242  // note: non-null m_tileCompFullRes triggers creation of band window buffers
244  // note: m_tileCompFullResLower is null for lowest resolution
246  std::vector< grk_buffer_2d<T>* > m_bandWindows; // sub-band coords
247  std::vector< grk_rect_u32 > m_paddedBandWindows; // sub-band coords
249  grk_buffer_2d<T> *m_resWindow; // resolution coords
250  grk_buffer_2d<T> *m_resWindowTopLevel; // resolution coords
251  uint32_t m_filterWidth;
252 };
253 
254 
255 /*
256  Various coordinate systems are used to describe windows in the tile component buffer.
257 
258  1) Canvas coordinate system: JPEG 2000 global image coordinates, independent of sub-sampling
259 
260  2) Tile coordinate system: transformed from canvas coordinates, with sub-sampling accounted for
261 
262  3) Resolution coordinate system: coordinates relative to a particular resolution's top left hand corner
263 
264  4) Sub-band coordinate system: coordinates relative to a particular sub-band's top left hand corner
265 
266  */
267 template<typename T> struct TileComponentWindowBuffer {
268  TileComponentWindowBuffer(bool isCompressor,
269  bool lossless,
270  bool wholeTileDecompress,
271  grk_rect_u32 unreducedTileCompDim,
272  grk_rect_u32 reducedTileCompDim,
273  grk_rect_u32 unreducedTileWindowDim,
274  Resolution *tileCompResolutions,
275  uint8_t numresolutions,
276  uint8_t reducedNumResolutions) : m_unreducedBounds(unreducedTileCompDim),
277  m_bounds(reducedTileCompDim),
278  m_numResolutions(numresolutions),
279  m_compress(isCompressor),
280  m_wholeTileDecompress(wholeTileDecompress) {
281  if (!m_compress) {
282  m_bounds = unreducedTileWindowDim.rectceildivpow2(m_numResolutions - reducedNumResolutions);
283  m_bounds = m_bounds.intersection(reducedTileCompDim);
284  assert(m_bounds.is_valid());
285 
286  m_unreducedBounds = unreducedTileWindowDim.intersection(
287  unreducedTileCompDim);
288  assert(m_unreducedBounds.is_valid());
289  }
290  // fill resolutions vector
291  assert(reducedNumResolutions > 0);
292  for (uint32_t resno = 0; resno < reducedNumResolutions; ++resno)
293  m_tileCompResolutions.push_back(tileCompResolutions + resno);
294  auto canvasFullRes = tileCompResolutions + reducedNumResolutions - 1;
295  auto canvasFullResLower =
296  reducedNumResolutions > 1 ?
297  tileCompResolutions + reducedNumResolutions - 2 : nullptr;
298  // create resolution buffers
299  auto topLevel = new ResWindow<T>(numresolutions, reducedNumResolutions - 1,
300  nullptr, canvasFullRes, canvasFullResLower, m_bounds,
302  wholeTileDecompress ?
303  0 : getHorizontalPassHeight<uint32_t>(lossless),
304  wholeTileDecompress ? 0 : getFilterWidth<uint32_t>(lossless));
305  // setting top level blocks allocation of tileCompBandWindows buffers
306  if (!useBandWindows())
307  topLevel->m_resWindowTopLevel = topLevel->m_resWindow;
308 
309  for (uint8_t resno = 0; resno < reducedNumResolutions - 1; ++resno) {
310  // resolution window == next resolution band window at orientation 0
312  m_numResolutions, (uint8_t) ((resno + 1)), 0,
313  unreducedTileWindowDim);
314  m_resWindows.push_back(
315  new ResWindow<T>(numresolutions, resno,
316  useBandWindows() ? nullptr : topLevel->m_resWindow,
317  tileCompResolutions + resno,
318  resno > 0 ? tileCompResolutions + resno - 1 : nullptr,
319  res_dims, m_unreducedBounds,
320  wholeTileDecompress ?
321  0 : getHorizontalPassHeight<uint32_t>(lossless),
322  wholeTileDecompress ?
323  0 : getFilterWidth<uint32_t>(lossless)));
324  }
325  m_resWindows.push_back(topLevel);
326  }
327 
329  for (auto& b : m_resWindows)
330  delete b;
331  }
332 
342  void transform(uint8_t resno,eBandOrientation orientation, uint32_t &offsetx, uint32_t &offsety) const {
343  assert(resno < m_tileCompResolutions.size());
344 
345  auto res = m_tileCompResolutions[resno];
346  auto band = res->band + getBandIndex(resno,orientation);
347 
348  uint32_t x = offsetx;
349  uint32_t y = offsety;
350 
351  // get offset relative to band
352  x -= band->x0;
353  y -= band->y0;
354 
355  if (useResCoordsForCodeBlock() && resno > 0){
356  auto resLower = m_tileCompResolutions[ resno - 1];
357 
358  if (orientation & 1)
359  x += resLower->width();
360  if (orientation & 2)
361  y += resLower->height();
362  }
363  offsetx = x;
364  offsety = y;
365  }
366 
374  const grk_buffer_2d<T>* getCodeBlockDestWindow(uint8_t resno,eBandOrientation orientation) const {
375  return (useResCoordsForCodeBlock()) ? getTileBuf() : getBandWindow(resno,orientation);
376  }
377 
385  const grk_buffer_2d<T>* getWindow(uint8_t resno,eBandOrientation orientation) const{
386  return getBandWindow(resno,orientation);
387  }
388 
389  const grk_rect_u32 getPaddedTileBandWindow(uint8_t resno,eBandOrientation orientation) const{
390  if (m_resWindows[resno]->m_paddedBandWindows.empty())
391  return grk_rect_u32();
392  return m_resWindows[resno]->m_paddedBandWindows[orientation];
393  }
394 
395  /*
396  * Get intermediate split window.
397  *
398  * @param orientation 0 for upper split window, and 1 for lower split window
399  */
400  const grk_buffer_2d<T>* getSplitWindow(uint8_t resno,eSplitOrientation orientation) const{
401  assert(resno > 0 && resno < m_tileCompResolutions.size());
402 
403  return m_resWindows[resno]->m_splitWindow[orientation];
404  }
405 
412  const grk_buffer_2d<T>* getWindow(uint32_t resno) const{
413  return m_resWindows[resno]->m_resWindow;
414  }
415 
421  const grk_buffer_2d<T>* getWindow(void) const{
422  return getTileBuf();
423  }
424 
425  bool alloc(){
426  for (auto& b : m_resWindows) {
427  if (!b->alloc(!m_compress))
428  return false;
429  }
430 
431  return true;
432  }
433 
440  return m_bounds;
441  }
442 
444  return m_unreducedBounds;
445  }
446 
447  uint64_t strided_area(void) const{
448  return getTileBuf()->stride * m_bounds.height();
449  }
450 
451  // set data to buf without owning it
452  void attach(T* buffer,uint32_t stride){
453  getTileBuf()->attach(buffer,stride);
454  }
455  // transfer data to buf, and cease owning it
456  void transfer(T** buffer, bool* owns, uint32_t *stride){
457  getTileBuf()->transfer(buffer,owns,stride);
458  }
459 
460 
461 private:
462 
463  bool useBandWindows() const{
464  //return !m_compress && wholeTileDecompress;
465  return false;
466  }
467 
470  }
471 
472  uint8_t getBandIndex(uint8_t resno, eBandOrientation orientation) const{
473  uint8_t index = 0;
474  if (resno > 0) {
475  index = (uint8_t)orientation;
476  index--;
477  }
478  return index;
479  }
480 
484  grk_buffer_2d<T>* getBandWindow(uint8_t resno,eBandOrientation orientation) const{
485  assert(resno < m_tileCompResolutions.size());
486 
487  return resno > 0 ? m_resWindows[resno]->m_bandWindows[orientation] : m_resWindows[0]->m_resWindow;
488  }
489 
490  // top-level buffer
492  return m_resWindows.back()->m_resWindow;
493  }
494 
496 
497  // decompress: reduced tile component coordinates of window
498  // compress: unreduced tile component coordinates of entire tile
500 
501  // tile component coords
502  std::vector<Resolution*> m_tileCompResolutions;
503 
504  // windowed bounds for windowed decompress, otherwise full bounds
505  std::vector<ResWindow<T>* > m_resWindows;
506 
507  // unreduced number of resolutions
509 
512 };
513 
514 }
grk::BAND_INDEX_LH
@ BAND_INDEX_LH
Definition: T1Structs.h:53
grk::TileComponentWindowBuffer::useBandWindows
bool useBandWindows() const
Definition: TileComponentWindowBuffer.h:463
grk::SPLIT_NUM_ORIENTATIONS
@ SPLIT_NUM_ORIENTATIONS
Definition: T1Structs.h:32
grk::grk_rectangle
Definition: util.h:76
grk::grk_rectangle::height
T height() const
Definition: util.h:172
grk::TileComponentWindowBuffer::m_bounds
grk_rect_u32 m_bounds
Definition: TileComponentWindowBuffer.h:499
grk::BAND_NUM_ORIENTATIONS
@ BAND_NUM_ORIENTATIONS
Definition: T1Structs.h:41
grk::ResWindow::m_allocated
bool m_allocated
Definition: TileComponentWindowBuffer.h:241
grk::ResWindow::~ResWindow
~ResWindow()
Definition: TileComponentWindowBuffer.h:121
grk::grk_rectangle::pan
grk_rectangle< T > pan(int64_t x, int64_t y) const
Definition: util.h:176
grk::ResWindow::m_paddedBandWindows
std::vector< grk_rect_u32 > m_paddedBandWindows
Definition: TileComponentWindowBuffer.h:247
grk::TileComponentWindowBuffer::m_wholeTileDecompress
bool m_wholeTileDecompress
Definition: TileComponentWindowBuffer.h:511
grk::grk_rectangle::x1
T x1
Definition: util.h:77
grk::grk_rectangle::is_valid
bool is_valid(void) const
Definition: util.h:92
grk::TileComponentWindowBuffer::getBandIndex
uint8_t getBandIndex(uint8_t resno, eBandOrientation orientation) const
Definition: TileComponentWindowBuffer.h:472
grk::TileComponentWindowBuffer::useResCoordsForCodeBlock
bool useResCoordsForCodeBlock() const
Definition: TileComponentWindowBuffer.h:468
grk::TileComponentWindowBuffer::strided_area
uint64_t strided_area(void) const
Definition: TileComponentWindowBuffer.h:447
grk::TileComponentWindowBuffer::getPaddedTileBandWindow
const grk_rect_u32 getPaddedTileBandWindow(uint8_t resno, eBandOrientation orientation) const
Definition: TileComponentWindowBuffer.h:389
grk::TileComponentWindowBuffer::unreduced_bounds
grk_rect_u32 unreduced_bounds() const
Definition: TileComponentWindowBuffer.h:443
grk::TileComponentWindowBuffer
Definition: TileComponentWindowBuffer.h:267
grk::BAND_ORIENT_HL
@ BAND_ORIENT_HL
Definition: T1Structs.h:38
grk::TileComponentWindowBuffer::getTileBuf
grk_buffer_2d< T > * getTileBuf() const
Definition: TileComponentWindowBuffer.h:491
grk::ResWindow::m_resWindowTopLevel
grk_buffer_2d< T > * m_resWindowTopLevel
Definition: TileComponentWindowBuffer.h:250
grk::grk_rectangle::grow
grk_rectangle< T > & grow(T boundary)
Definition: util.h:182
grk::TileComponentWindowBuffer::getWindow
const grk_buffer_2d< T > * getWindow(uint32_t resno) const
Get resolution window.
Definition: TileComponentWindowBuffer.h:412
grk::BAND_ORIENT_LH
@ BAND_ORIENT_LH
Definition: T1Structs.h:39
grk::ResWindow::m_filterWidth
uint32_t m_filterWidth
Definition: TileComponentWindowBuffer.h:251
grk::ResWindow::m_tileCompFullResLower
Resolution * m_tileCompFullResLower
Definition: TileComponentWindowBuffer.h:245
grk::TileComponentWindowBuffer::m_unreducedBounds
grk_rect_u32 m_unreducedBounds
Definition: TileComponentWindowBuffer.h:495
grk::grk_rectangle::width
T width() const
Definition: util.h:169
grk::TileComponentWindowBuffer::getWindow
const grk_buffer_2d< T > * getWindow(void) const
Get tile window.
Definition: TileComponentWindowBuffer.h:421
grk::TileComponentWindowBuffer::getWindow
const grk_buffer_2d< T > * getWindow(uint8_t resno, eBandOrientation orientation) const
Get non-LL band window.
Definition: TileComponentWindowBuffer.h:385
grk::ResWindow
Class to manage multiple buffers needed to perform DWT transform.
Definition: TileComponentWindowBuffer.h:29
grk::Resolution::band
Subband band[BAND_NUM_INDICES]
Definition: T1Structs.h:240
grk::SPLIT_L
@ SPLIT_L
Definition: T1Structs.h:30
grk::TileComponentWindowBuffer::~TileComponentWindowBuffer
~TileComponentWindowBuffer()
Definition: TileComponentWindowBuffer.h:328
grk::TileComponentWindowBuffer::getBandWindow
grk_buffer_2d< T > * getBandWindow(uint8_t resno, eBandOrientation orientation) const
If resno is > 0, return HL,LH or HH band window, otherwise return LL resolution window.
Definition: TileComponentWindowBuffer.h:484
grk::TileComponentWindowBuffer::transfer
void transfer(T **buffer, bool *owns, uint32_t *stride)
Definition: TileComponentWindowBuffer.h:456
grk::TileComponentWindowBuffer::transform
void transform(uint8_t resno, eBandOrientation orientation, uint32_t &offsetx, uint32_t &offsety) const
Tranform code block offsets to either band coordinates or resolution coordinates.
Definition: TileComponentWindowBuffer.h:342
grk::grk_buffer_2d
Definition: util.h:278
grk
Copyright (C) 2016-2021 Grok Image Compression Inc.
Definition: BitIO.cpp:23
grk::Resolution::numBandWindows
uint32_t numBandWindows
Definition: T1Structs.h:241
grk::BAND_ORIENT_HH
@ BAND_ORIENT_HH
Definition: T1Structs.h:40
grk_includes.h
grk::grk_rect_u32
grk_rectangle< uint32_t > grk_rect_u32
Definition: util.h:48
grk::TileComponentWindowBuffer::m_tileCompResolutions
std::vector< Resolution * > m_tileCompResolutions
Definition: TileComponentWindowBuffer.h:502
grk::ResWindow::m_tileCompFullRes
Resolution * m_tileCompFullRes
Definition: TileComponentWindowBuffer.h:243
grk::grk_rectangle::intersection
grk_rectangle< T > intersection(const grk_rectangle< T > rhs) const
Definition: util.h:144
grk::ResWindow::m_resWindow
grk_buffer_2d< T > * m_resWindow
Definition: TileComponentWindowBuffer.h:249
grk::TileComponentWindowBuffer::alloc
bool alloc()
Definition: TileComponentWindowBuffer.h:425
grk::TileComponentWindowBuffer::getCodeBlockDestWindow
const grk_buffer_2d< T > * getCodeBlockDestWindow(uint8_t resno, eBandOrientation orientation) const
Get code block destination window.
Definition: TileComponentWindowBuffer.h:374
grk::TileComponentWindowBuffer::m_resWindows
std::vector< ResWindow< T > * > m_resWindows
Definition: TileComponentWindowBuffer.h:505
grk::Resolution
Definition: T1Structs.h:231
grk::grk_rectangle::rectceildivpow2
grk_rectangle< T > rectceildivpow2(uint32_t power) const
Definition: util.h:126
grk::ResWindow::m_splitWindow
grk_buffer_2d< T > * m_splitWindow[SPLIT_NUM_ORIENTATIONS]
Definition: TileComponentWindowBuffer.h:248
grk::TileComponentWindowBuffer::TileComponentWindowBuffer
TileComponentWindowBuffer(bool isCompressor, bool lossless, bool wholeTileDecompress, grk_rect_u32 unreducedTileCompDim, grk_rect_u32 reducedTileCompDim, grk_rect_u32 unreducedTileWindowDim, Resolution *tileCompResolutions, uint8_t numresolutions, uint8_t reducedNumResolutions)
Definition: TileComponentWindowBuffer.h:268
grk::eBandOrientation
eBandOrientation
Definition: T1Structs.h:36
grk::BAND_INDEX_HL
@ BAND_INDEX_HL
Definition: T1Structs.h:54
grk::ResWindow::alloc
bool alloc(bool clear)
Definition: TileComponentWindowBuffer.h:129
grk::grk_rectangle::x0
T x0
Definition: util.h:77
grk::ResWindow::m_bandWindows
std::vector< grk_buffer_2d< T > * > m_bandWindows
Definition: TileComponentWindowBuffer.h:246
grk::eSplitOrientation
eSplitOrientation
Definition: T1Structs.h:29
grk::grk_rectangle::y1
T y1
Definition: util.h:77
grk::BAND_INDEX_HH
@ BAND_INDEX_HH
Definition: T1Structs.h:55
grk::TileComponentWindowBuffer::bounds
grk_rect_u32 bounds() const
Get bounds of tile component decompress: reduced tile component coordinates of window compress: unred...
Definition: TileComponentWindowBuffer.h:439
grk::ResWindow::ResWindow
ResWindow(uint8_t numresolutions, uint8_t resno, grk_buffer_2d< T > *top, Resolution *tileCompFullRes, Resolution *tileCompFullResLower, grk_rect_u32 tileCompWindowBounds, grk_rect_u32 tileCompWindowUnreducedBounds, uint32_t HORIZ_PASS_HEIGHT, uint32_t FILTER_WIDTH)
Definition: TileComponentWindowBuffer.h:31
grk::TileComponentWindowBuffer::m_compress
bool m_compress
Definition: TileComponentWindowBuffer.h:510
grk::TileComponentWindowBuffer::getSplitWindow
const grk_buffer_2d< T > * getSplitWindow(uint8_t resno, eSplitOrientation orientation) const
Definition: TileComponentWindowBuffer.h:400
grk::TileComponentWindowBuffer::m_numResolutions
uint8_t m_numResolutions
Definition: TileComponentWindowBuffer.h:508
grk::SPLIT_H
@ SPLIT_H
Definition: T1Structs.h:31
grk::grk_rectangle::y0
T y0
Definition: util.h:77
grk::ResWindow::getTileCompBandWindow
static grk_rect_u32 getTileCompBandWindow(uint8_t num_res, uint8_t resno, uint8_t orientation, grk_rect_u32 unreducedTileCompBandWindow)
Get band window in tile component coordinates for specified resolution and band orientation.
Definition: TileComponentWindowBuffer.h:203
grk::BAND_ORIENT_LL
@ BAND_ORIENT_LL
Definition: T1Structs.h:37
grk::TileComponentWindowBuffer::attach
void attach(T *buffer, uint32_t stride)
Definition: TileComponentWindowBuffer.h:452