Grok  7.6.2
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 res_window {
30 
31  res_window(uint8_t numresolutions,
32  uint8_t resno,
33  grk_buffer_2d<T> *top,
34  Resolution *full_res,
35  Resolution *lower_full_res,
36  grk_rect_u32 bounds,
37  grk_rect_u32 unreduced_bounds,
38  uint32_t HORIZ_PASS_HEIGHT,
39  uint32_t FILTER_WIDTH) : allocated(false),
40  fullRes(full_res),
41  fullResLower(lower_full_res),
42  resWindow(new grk_buffer_2d<T>(bounds.width(), bounds.height())),
43  resWindowTopLevel(top),
44  filterWidth(FILTER_WIDTH)
45  {
46  for (uint32_t i = 0; i < SPLIT_NUM_ORIENTATIONS; ++i)
47  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 = getBandWindowRect(numresolutions, resno, orient,unreduced_bounds);
52  paddedTileBandWindow.push_back(temp.grow(FILTER_WIDTH,FILTER_WIDTH));
53  }
54 
55  if (fullResLower) {
56 
57  // 1. set up windows for horizontal and vertical passes
58  grk_rect_u32 bandWindowRect[BAND_NUM_ORIENTATIONS];
59  bandWindowRect[BAND_ORIENT_LL] = getBandWindowRect(numresolutions,resno,BAND_ORIENT_LL,unreduced_bounds);
60  bandWindowRect[BAND_ORIENT_LL] = bandWindowRect[BAND_ORIENT_LL].pan(-(int64_t)fullRes->band[BAND_INDEX_LH].x0, -(int64_t)fullRes->band[BAND_INDEX_HL].y0);
61  bandWindowRect[BAND_ORIENT_LL].grow(FILTER_WIDTH, fullResLower->width(), fullResLower->height());
62  bandWindow.push_back(new grk_buffer_2d<T>(bandWindowRect[BAND_ORIENT_LL]));
63 
64 
65  bandWindowRect[BAND_ORIENT_HL] = getBandWindowRect(numresolutions,resno,BAND_ORIENT_HL,unreduced_bounds);
66  bandWindowRect[BAND_ORIENT_HL] = bandWindowRect[BAND_ORIENT_HL].pan(-(int64_t)fullRes->band[BAND_INDEX_HL].x0, -(int64_t)fullRes->band[BAND_INDEX_HL].y0);
67  bandWindowRect[BAND_ORIENT_HL].grow(FILTER_WIDTH, fullRes->width() - fullResLower->width(), fullResLower->height());
68  bandWindow.push_back(new grk_buffer_2d<T>(bandWindowRect[BAND_ORIENT_HL]));
69 
70  bandWindowRect[BAND_ORIENT_LH] = getBandWindowRect(numresolutions,resno,BAND_ORIENT_LH,unreduced_bounds);
71  bandWindowRect[BAND_ORIENT_LH] = bandWindowRect[BAND_ORIENT_LH].pan(-(int64_t)fullRes->band[BAND_INDEX_LH].x0, -(int64_t)fullRes->band[BAND_INDEX_LH].y0);
72  bandWindowRect[BAND_ORIENT_LH].grow(FILTER_WIDTH, fullResLower->width(), fullRes->height() - fullResLower->height());
73  bandWindow.push_back(new grk_buffer_2d<T>(bandWindowRect[BAND_ORIENT_LH]));
74 
75  bandWindowRect[BAND_ORIENT_HH] = getBandWindowRect(numresolutions,resno,BAND_ORIENT_HH,unreduced_bounds);
76  bandWindowRect[BAND_ORIENT_HH] = bandWindowRect[BAND_ORIENT_HH].pan(-(int64_t)fullRes->band[BAND_INDEX_HH].x0, -(int64_t)fullRes->band[BAND_INDEX_HH].y0);
77  bandWindowRect[BAND_ORIENT_HH].grow(FILTER_WIDTH, fullRes->width() - fullResLower->width(), fullRes->height() - fullResLower->height());
78  bandWindow.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  resWindow->x0 = min<uint32_t>(2 * win_low.x0, 2 * bandWindowRect[BAND_ORIENT_HL].x0);
83  resWindow->x1 = min<uint32_t>(max<uint32_t>(2 * win_low.x1, 2 * win_high.x1), fullRes->width());
84  win_low = bandWindowRect[BAND_ORIENT_LL];
85  win_high = bandWindowRect[BAND_ORIENT_LH];
86  resWindow->y0 = min<uint32_t>(2 * win_low.y0, 2 * win_high.y0);
87  resWindow->y1 = min<uint32_t>(max<uint32_t>(2 * win_low.y1, 2 * win_high.y1), fullRes->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(resWindow->x0,
92  sat_sub<uint32_t>(bandWindowRect[BAND_ORIENT_LL].y0, HORIZ_PASS_HEIGHT),
93  resWindow->x1,
94  bandWindowRect[BAND_ORIENT_LL].y1);
95  splitWindow[SPLIT_L] = new grk_buffer_2d<T>(splitWindowRect[SPLIT_L]);
96 
97  splitWindowRect[SPLIT_H] = grk_rect_u32(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 + fullResLower->height(), fullRes->height()),HORIZ_PASS_HEIGHT)),
101  resWindow->x1,
102  min<uint32_t>(bandWindowRect[BAND_ORIENT_LH].y1 + fullResLower->height(), fullRes->height()));
103  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  bandWindow.push_back( new grk_buffer_2d<T>( 0,0) );
109  assert(full_res->numBandWindows == 3 || !lower_full_res);
110  if (lower_full_res) {
111  for (uint32_t i = 0; i < full_res->numBandWindows; ++i)
112  bandWindow.push_back( new grk_buffer_2d<T>(full_res->band[i].width(),full_res->band[i].height() ) );
113  for (uint32_t i = 0; i < SPLIT_NUM_ORIENTATIONS; ++i)
114  splitWindow[i] = new grk_buffer_2d<T>(bounds.width(), bounds.height());
115  splitWindow[SPLIT_L]->y1 = bounds.y0 + lower_full_res->height();
117  }
118 
119  }
120  }
122  delete resWindow;
123  for (auto &b : bandWindow)
124  delete b;
125  for (uint32_t i = 0; i < SPLIT_NUM_ORIENTATIONS; ++i)
126  delete splitWindow[i];
127  }
128 
129  bool alloc(bool clear){
130  if (allocated)
131  return true;
132 
133  // if top level window is present, then all buffers attach to this window
134  if (resWindowTopLevel) {
135  // ensure that top level window is allocated
136  if (!resWindowTopLevel->alloc(clear))
137  return false;
138 
139  // for now, we don't allocate bandWindows for windowed decode
140  if (filterWidth)
141  return true;
142 
143  // attach to top level window
145  resWindow->attach(resWindowTopLevel->data, resWindowTopLevel->stride);
146 
147  // fullResLower is null for lowest resolution
148  if (fullResLower) {
149  for (uint8_t orientation = 0; orientation < bandWindow.size(); ++orientation){
150  switch(orientation){
151  case BAND_ORIENT_HL:
152  bandWindow[orientation]->attach(resWindowTopLevel->data + fullResLower->width(),
153  resWindowTopLevel->stride);
154  break;
155  case BAND_ORIENT_LH:
156  bandWindow[orientation]->attach(resWindowTopLevel->data + fullResLower->height() * resWindowTopLevel->stride,
157  resWindowTopLevel->stride);
158  break;
159  case BAND_ORIENT_HH:
160  bandWindow[orientation]->attach(resWindowTopLevel->data + fullResLower->width() +
162  resWindowTopLevel->stride);
163  break;
164  default:
165  break;
166  }
167  }
168  splitWindow[SPLIT_L]->attach(resWindowTopLevel->data, resWindowTopLevel->stride);
170  resWindowTopLevel->stride);
171  }
172  } else {
173  // resolution window is always allocated
174  if (!resWindow->alloc(clear))
175  return false;
176  // for now, we don't allocate bandWindows for windowed decode
177  if (filterWidth)
178  return true;
179 
180  // band windows are allocated if present
181  for (auto &b : bandWindow){
182  if (!b->alloc(clear))
183  return false;
184  }
185  if (fullResLower){
186  splitWindow[SPLIT_L]->attach(resWindow->data, resWindow->stride);
187  splitWindow[SPLIT_H]->attach(resWindow->data + fullResLower->height() * resWindow->stride,resWindow->stride);
188  }
189  }
190  allocated = true;
191 
192  return true;
193  }
194 
195 
200  static grk_rect_u32 getBandWindowRect(uint8_t num_res,
201  uint8_t resno,
202  uint8_t orientation,
203  grk_rect_u32 unreduced_window){
204  /* Compute number of decomposition for this band. See table F-1 */
205  assert(orientation < BAND_NUM_ORIENTATIONS);
206  assert(resno > 0 || orientation == 0);
207 
208  uint32_t nb = (resno == 0) ? num_res - 1 :num_res - resno;
209 
210  uint32_t tcx0 = unreduced_window.x0;
211  uint32_t tcy0 = unreduced_window.y0;
212  uint32_t tcx1 = unreduced_window.x1;
213  uint32_t tcy1 = unreduced_window.y1;
214  /* Map above tile-based coordinates to sub-band-based coordinates per */
215  /* equation B-15 of the standard */
216  uint32_t x0b = orientation & 1;
217  uint32_t y0b = orientation >> 1;
218  uint32_t tbx0 = (nb == 0) ? tcx0 :
219  (tcx0 <= (1U << (nb - 1)) * x0b) ? 0 :
220  ceildivpow2<uint32_t>(tcx0 - (1U << (nb - 1)) * x0b, nb);
221 
222  uint32_t tby0 = (nb == 0) ? tcy0 :
223  (tcy0 <= (1U << (nb - 1)) * y0b) ? 0 :
224  ceildivpow2<uint32_t>(tcy0 - (1U << (nb - 1)) * y0b, nb);
225 
226  uint32_t tbx1 = (nb == 0) ? tcx1 :
227  (tcx1 <= (1U << (nb - 1)) * x0b) ? 0 :
228  ceildivpow2<uint32_t>(tcx1 - (1U << (nb - 1)) * x0b, nb);
229 
230  uint32_t tby1 = (nb == 0) ? tcy1 :
231  (tcy1 <= (1U << (nb - 1)) * y0b) ? 0 :
232  ceildivpow2<uint32_t>(tcy1 - (1U << (nb - 1)) * y0b, nb);
233 
234 
235  return grk_rect_u32(tbx0,tby0,tbx1,tby1);
236  }
237 
238  bool allocated;
239  // fullRes triggers creation of bandWindow buffers
241  // fullResLower is null for lowest resolution
243  std::vector< grk_buffer_2d<T>* > bandWindow;
244  std::vector< grk_rect_u32 > paddedTileBandWindow;
245  // intermediate buffers for DWT
249  uint32_t filterWidth;
250 };
251 
252 
253 /*
254  Note: various coordinate systems are used to describe regions in the tile buffer.
255 
256  1) Canvas coordinate system: JPEG 2000 global image coordinates, independent of sub-sampling
257 
258  2) Tile coordinate system: coordinates relative to a tile's top left hand corner, with
259  sub-sampling accounted for
260 
261  3) Resolution coordinate system: coordinates relative to a resolution's top left hand corner
262 
263  4) Sub-band coordinate system: coordinates relative to a particular sub-band's top left hand corner
264 
265 */
266 template<typename T> struct TileComponentWindowBuffer {
267  TileComponentWindowBuffer(bool isCompressor,
268  bool lossless,
269  bool wholeTileDecompress,
270  grk_rect_u32 unreduced_tile_dim,
271  grk_rect_u32 reduced_tile_dim,
272  grk_rect_u32 unreduced_window_dim,
273  Resolution *tile_comp_resolutions,
274  uint8_t numresolutions,
275  uint8_t reduced_num_resolutions) :
276  m_unreduced_bounds(unreduced_tile_dim),
277  m_bounds(reduced_tile_dim),
278  num_resolutions(numresolutions),
279  m_compress(isCompressor),
281  {
282  if (!m_compress) {
283  m_bounds = unreduced_window_dim.rectceildivpow2(num_resolutions - reduced_num_resolutions);
284  m_bounds = m_bounds.intersection(reduced_tile_dim);
285  assert(m_bounds.is_valid());
286 
287  m_unreduced_bounds = unreduced_window_dim.intersection(unreduced_tile_dim);
288  assert(m_unreduced_bounds.is_valid());
289  }
290 
291  // fill resolutions vector
292  assert(reduced_num_resolutions>0);
293  for (uint32_t resno = 0; resno < reduced_num_resolutions; ++resno)
294  resolutions.push_back(tile_comp_resolutions+resno);
295 
296  auto fullRes = tile_comp_resolutions+reduced_num_resolutions-1;
297  auto fullResLower = reduced_num_resolutions > 1 ?
298  tile_comp_resolutions+reduced_num_resolutions-2 : nullptr;
299 
300  // create resolution buffers
301  auto topLevel = new res_window<T>(numresolutions,
302  reduced_num_resolutions-1,
303  nullptr,
304  fullRes,
305  fullResLower,
306  m_bounds,
308  wholeTileDecompress ? 0 : getHorizontalPassHeight<uint32_t>(lossless),
309  wholeTileDecompress ? 0 : getFilterWidth<uint32_t>(lossless));
310  // setting top level blocks allocation of bandWindow buffers
311  if (!use_band_windows())
312  topLevel->resWindowTopLevel = topLevel->resWindow;
313  for (uint8_t resno = 0; resno < reduced_num_resolutions-1; ++resno){
314  // resolution window == next resolution band window at orientation 0
316  (uint8_t)(resno+1),
317  0,
318  unreduced_window_dim);
319  res_windows.push_back(new res_window<T>(numresolutions,
320  resno,
321  use_band_windows() ? nullptr : topLevel->resWindow,
322  tile_comp_resolutions+resno,
323  resno > 0 ? tile_comp_resolutions+resno-1 : nullptr,
324  res_dims,
326  wholeTileDecompress ? 0 : getHorizontalPassHeight<uint32_t>(lossless),
327  wholeTileDecompress ? 0 : getFilterWidth<uint32_t>(lossless)) );
328  }
329  res_windows.push_back(topLevel);
330  }
332  for (auto& b : res_windows)
333  delete b;
334  }
335 
345  void transform(uint8_t resno,eBandOrientation orientation, uint32_t &offsetx, uint32_t &offsety) const {
346  assert(resno < resolutions.size());
347 
348  auto res = resolutions[resno];
349  auto band = res->band + getBandIndex(resno,orientation);
350 
351  uint32_t x = offsetx;
352  uint32_t y = offsety;
353 
354  // get offset relative to band
355  x -= band->x0;
356  y -= band->y0;
357 
358  if (global_code_block_offset() && resno > 0){
359  auto resLower = resolutions[ resno - 1];
360 
361  if (orientation & 1)
362  x += resLower->width();
363  if (orientation & 2)
364  y += resLower->height();
365  }
366  offsetx = x;
367  offsety = y;
368  }
369 
377  const grk_buffer_2d<T>* getCodeBlockDestWindow(uint8_t resno,eBandOrientation orientation) const {
378  return (global_code_block_offset()) ? tile_buf() : band_window(resno,orientation);
379  }
380 
388  const grk_buffer_2d<T>* getWindow(uint8_t resno,eBandOrientation orientation) const{
389  return band_window(resno,orientation);
390  }
391 
392  const grk_rect_u32 getPaddedTileBandWindow(uint8_t resno,eBandOrientation orientation) const{
393  if (res_windows[resno]->paddedTileBandWindow.empty())
394  return grk_rect_u32();
395  return res_windows[resno]->paddedTileBandWindow[orientation];
396  }
397 
398  /*
399  * Get intermediate split window.
400  *
401  * @param orientation 0 for upper split window, and 1 for lower split window
402  */
403  const grk_buffer_2d<T>* getSplitWindow(uint8_t resno,eSplitOrientation orientation) const{
404  assert(resno > 0 && resno < resolutions.size());
405 
406  return res_windows[resno]->splitWindow[orientation];
407  }
408 
415  const grk_buffer_2d<T>* getWindow(uint32_t resno) const{
416  return res_windows[resno]->resWindow;
417  }
418 
424  const grk_buffer_2d<T>* getWindow(void) const{
425  return tile_buf();
426  }
427 
428  bool alloc(){
429  for (auto& b : res_windows) {
430  if (!b->alloc(!m_compress))
431  return false;
432  }
433 
434  return true;
435  }
436 
443  return m_bounds;
444  }
445 
447  return m_unreduced_bounds;
448  }
449 
450  uint64_t strided_area(void) const{
451  return tile_buf()->stride * m_bounds.height();
452  }
453 
454  // set data to buf without owning it
455  void attach(T* buffer,uint32_t stride){
456  tile_buf()->attach(buffer,stride);
457  }
458  // transfer data to buf, and cease owning it
459  void transfer(T** buffer, bool* owns, uint32_t *stride){
460  tile_buf()->transfer(buffer,owns,stride);
461  }
462 
463 
464 private:
465 
466  bool use_band_windows() const{
467  //return !m_compress && wholeTileDecompress;
468  return false;
469  }
470 
472  return m_compress || !wholeTileDecompress;
473  }
474 
475  uint8_t getBandIndex(uint8_t resno, eBandOrientation orientation) const{
476  uint8_t index = 0;
477  if (resno > 0) {
478  index = (uint8_t)orientation;
479  index--;
480  }
481  return index;
482  }
483 
487  grk_buffer_2d<T>* band_window(uint8_t resno,eBandOrientation orientation) const{
488  assert(resno < resolutions.size());
489 
490  return resno > 0 ? res_windows[resno]->bandWindow[orientation] : res_windows[resno]->resWindow;
491  }
492 
493  // top-level buffer
495  return res_windows.back()->resWindow;
496  }
497 
499 
500  // decompress: reduced tile component coordinates of window
501  // compress: unreduced tile component coordinates of entire tile
503 
504  // full boundsband
505  std::vector<Resolution*> resolutions;
506 
507  // windowed bounds for windowed decompress, otherwise full bounds
508  std::vector<res_window<T>* > res_windows;
509 
510  // unreduced number of resolutions
512 
515 };
516 
517 
518 }
grk::res_window::bandWindow
std::vector< grk_buffer_2d< T > * > bandWindow
Definition: TileComponentWindowBuffer.h:243
grk::BAND_INDEX_LH
@ BAND_INDEX_LH
Definition: T1Structs.h:53
grk::TileComponentWindowBuffer::global_code_block_offset
bool global_code_block_offset() const
Definition: TileComponentWindowBuffer.h:471
grk::TileComponentWindowBuffer::m_unreduced_bounds
grk_rect_u32 m_unreduced_bounds
Definition: TileComponentWindowBuffer.h:498
grk::TileComponentWindowBuffer::res_windows
std::vector< res_window< T > * > res_windows
Definition: TileComponentWindowBuffer.h:508
grk::SPLIT_NUM_ORIENTATIONS
@ SPLIT_NUM_ORIENTATIONS
Definition: T1Structs.h:32
grk::grk_rectangle
Definition: util.h:75
grk::grk_rectangle::height
T height() const
Definition: util.h:165
grk::TileComponentWindowBuffer::m_bounds
grk_rect_u32 m_bounds
Definition: TileComponentWindowBuffer.h:502
grk::BAND_NUM_ORIENTATIONS
@ BAND_NUM_ORIENTATIONS
Definition: T1Structs.h:41
grk::TileComponentWindowBuffer::tile_buf
grk_buffer_2d< T > * tile_buf() const
Definition: TileComponentWindowBuffer.h:494
grk::grk_rectangle::pan
grk_rectangle< T > pan(int64_t x, int64_t y) const
Definition: util.h:169
grk::res_window::resWindowTopLevel
grk_buffer_2d< T > * resWindowTopLevel
Definition: TileComponentWindowBuffer.h:248
grk::res_window::filterWidth
uint32_t filterWidth
Definition: TileComponentWindowBuffer.h:249
grk::res_window::fullRes
Resolution * fullRes
Definition: TileComponentWindowBuffer.h:240
grk::grk_rectangle::x1
T x1
Definition: util.h:76
grk::grk_rectangle::is_valid
bool is_valid(void) const
Definition: util.h:91
grk::TileComponentWindowBuffer::wholeTileDecompress
bool wholeTileDecompress
Definition: TileComponentWindowBuffer.h:514
grk::TileComponentWindowBuffer::getBandIndex
uint8_t getBandIndex(uint8_t resno, eBandOrientation orientation) const
Definition: TileComponentWindowBuffer.h:475
grk::TileComponentWindowBuffer::strided_area
uint64_t strided_area(void) const
Definition: TileComponentWindowBuffer.h:450
grk::res_window::resWindow
grk_buffer_2d< T > * resWindow
Definition: TileComponentWindowBuffer.h:247
grk::TileComponentWindowBuffer::getPaddedTileBandWindow
const grk_rect_u32 getPaddedTileBandWindow(uint8_t resno, eBandOrientation orientation) const
Definition: TileComponentWindowBuffer.h:392
grk::TileComponentWindowBuffer::unreduced_bounds
grk_rect_u32 unreduced_bounds() const
Definition: TileComponentWindowBuffer.h:446
grk::TileComponentWindowBuffer
Definition: TileComponentWindowBuffer.h:266
grk::res_window::~res_window
~res_window()
Definition: TileComponentWindowBuffer.h:121
grk::BAND_ORIENT_HL
@ BAND_ORIENT_HL
Definition: T1Structs.h:38
grk::grk_rectangle::grow
grk_rectangle< T > & grow(T boundary)
Definition: util.h:175
grk::TileComponentWindowBuffer::getWindow
const grk_buffer_2d< T > * getWindow(uint32_t resno) const
Get resolution window.
Definition: TileComponentWindowBuffer.h:415
grk::BAND_ORIENT_LH
@ BAND_ORIENT_LH
Definition: T1Structs.h:39
grk::TileComponentWindowBuffer::TileComponentWindowBuffer
TileComponentWindowBuffer(bool isCompressor, bool lossless, bool wholeTileDecompress, grk_rect_u32 unreduced_tile_dim, grk_rect_u32 reduced_tile_dim, grk_rect_u32 unreduced_window_dim, Resolution *tile_comp_resolutions, uint8_t numresolutions, uint8_t reduced_num_resolutions)
Definition: TileComponentWindowBuffer.h:267
grk::grk_rectangle::width
T width() const
Definition: util.h:162
grk::TileComponentWindowBuffer::getWindow
const grk_buffer_2d< T > * getWindow(void) const
Get tile window.
Definition: TileComponentWindowBuffer.h:424
grk::TileComponentWindowBuffer::getWindow
const grk_buffer_2d< T > * getWindow(uint8_t resno, eBandOrientation orientation) const
Get non-LL band window.
Definition: TileComponentWindowBuffer.h:388
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:331
grk::res_window::alloc
bool alloc(bool clear)
Definition: TileComponentWindowBuffer.h:129
grk::res_window::allocated
bool allocated
Definition: TileComponentWindowBuffer.h:238
grk::TileComponentWindowBuffer::transfer
void transfer(T **buffer, bool *owns, uint32_t *stride)
Definition: TileComponentWindowBuffer.h:459
grk::TileComponentWindowBuffer::transform
void transform(uint8_t resno, eBandOrientation orientation, uint32_t &offsetx, uint32_t &offsety) const
Tranform code block offsets.
Definition: TileComponentWindowBuffer.h:345
grk::grk_buffer_2d
Definition: util.h:271
grk
Copyright (C) 2016-2020 Grok Image Compression Inc.
Definition: BitIO.cpp:23
grk::Resolution::numBandWindows
uint32_t numBandWindows
Definition: T1Structs.h:241
grk::TileComponentWindowBuffer::num_resolutions
uint8_t num_resolutions
Definition: TileComponentWindowBuffer.h:511
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::res_window::fullResLower
Resolution * fullResLower
Definition: TileComponentWindowBuffer.h:242
grk::grk_rectangle::intersection
grk_rectangle< T > intersection(const grk_rectangle< T > rhs) const
Definition: util.h:137
grk::res_window::getBandWindowRect
static grk_rect_u32 getBandWindowRect(uint8_t num_res, uint8_t resno, uint8_t orientation, grk_rect_u32 unreduced_window)
Note: for 0th resolution, band window (and there is only one) is equal to resolution window.
Definition: TileComponentWindowBuffer.h:200
grk::TileComponentWindowBuffer::alloc
bool alloc()
Definition: TileComponentWindowBuffer.h:428
grk::TileComponentWindowBuffer::getCodeBlockDestWindow
const grk_buffer_2d< T > * getCodeBlockDestWindow(uint8_t resno, eBandOrientation orientation) const
Get code block destination window.
Definition: TileComponentWindowBuffer.h:377
grk::res_window::paddedTileBandWindow
std::vector< grk_rect_u32 > paddedTileBandWindow
Definition: TileComponentWindowBuffer.h:244
grk::Resolution
Definition: T1Structs.h:231
grk::TileComponentWindowBuffer::resolutions
std::vector< Resolution * > resolutions
Definition: TileComponentWindowBuffer.h:505
grk::grk_rectangle::rectceildivpow2
grk_rectangle< T > rectceildivpow2(uint32_t power) const
Definition: util.h:125
grk::res_window::splitWindow
grk_buffer_2d< T > * splitWindow[SPLIT_NUM_ORIENTATIONS]
Definition: TileComponentWindowBuffer.h:246
grk::eBandOrientation
eBandOrientation
Definition: T1Structs.h:36
grk::BAND_INDEX_HL
@ BAND_INDEX_HL
Definition: T1Structs.h:54
grk::grk_rectangle::x0
T x0
Definition: util.h:76
grk::TileComponentWindowBuffer::use_band_windows
bool use_band_windows() const
Definition: TileComponentWindowBuffer.h:466
grk::eSplitOrientation
eSplitOrientation
Definition: T1Structs.h:29
grk::grk_rectangle::y1
T y1
Definition: util.h:76
grk::BAND_INDEX_HH
@ BAND_INDEX_HH
Definition: T1Structs.h:55
grk::res_window
Class to manage multiple buffers needed to perform DWT transform.
Definition: TileComponentWindowBuffer.h:29
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:442
grk::TileComponentWindowBuffer::band_window
grk_buffer_2d< T > * band_window(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:487
grk::TileComponentWindowBuffer::m_compress
bool m_compress
Definition: TileComponentWindowBuffer.h:513
grk::TileComponentWindowBuffer::getSplitWindow
const grk_buffer_2d< T > * getSplitWindow(uint8_t resno, eSplitOrientation orientation) const
Definition: TileComponentWindowBuffer.h:403
grk::res_window::res_window
res_window(uint8_t numresolutions, uint8_t resno, grk_buffer_2d< T > *top, Resolution *full_res, Resolution *lower_full_res, grk_rect_u32 bounds, grk_rect_u32 unreduced_bounds, uint32_t HORIZ_PASS_HEIGHT, uint32_t FILTER_WIDTH)
Definition: TileComponentWindowBuffer.h:31
grk::SPLIT_H
@ SPLIT_H
Definition: T1Structs.h:31
grk::grk_rectangle::y0
T y0
Definition: util.h:76
grk::BAND_ORIENT_LL
@ BAND_ORIENT_LL
Definition: T1Structs.h:37
grk::TileComponentWindowBuffer::attach
void attach(T *buffer, uint32_t stride)
Definition: TileComponentWindowBuffer.h:455