53 return lossless ? 1 : 2;
72 uint32_t FILTER_WIDTH)
86 (resno == 0) ? (uint32_t)(numresolutions - 1U) : (uint32_t)(numresolutions - resno);
94 auto padded =
getBandWindow(numDecomps, orient, tileCompWindowUnreduced,
95 tileCompUnreduced, 2 * FILTER_WIDTH);
104 auto bandWindow =
getBandWindow(numDecomps, orient, tileCompWindowUnreduced,
105 tileCompUnreduced, 2 * FILTER_WIDTH);
109 bandWindow.
pan(-(int64_t)bandFull.x0, -(int64_t)bandFull.y0);
156 auto b = tileCompAtRes->
tileBand + i;
247 if(!b->alloc2d(clear))
280 return tileCompWindowUnreduced;
282 uint32_t tcx0 = tileCompWindowUnreduced.
x0;
283 uint32_t tcy0 = tileCompWindowUnreduced.
y0;
284 uint32_t tcx1 = tileCompWindowUnreduced.
x1;
285 uint32_t tcy1 = tileCompWindowUnreduced.
y1;
289 uint32_t bx0 = orientation & 1;
290 uint32_t by0 = (uint32_t)(orientation >> 1U);
292 uint32_t bx0Shift = (1U << (numDecomps - 1)) * bx0;
293 uint32_t by0Shift = (1U << (numDecomps - 1)) * by0;
296 (tcx0 <= bx0Shift) ? 0 : ceildivpow2<uint32_t>(tcx0 - bx0Shift, numDecomps),
297 (tcy0 <= by0Shift) ? 0 : ceildivpow2<uint32_t>(tcy0 - by0Shift, numDecomps),
298 (tcx1 <= bx0Shift) ? 0 : ceildivpow2<uint32_t>(tcx1 - bx0Shift, numDecomps),
299 (tcy1 <= by0Shift) ? 0 : ceildivpow2<uint32_t>(tcy1 - by0Shift, numDecomps));
310 grk_rect32 unreducedTileComp, uint32_t padding)
315 assert(orientation == 0);
318 auto oneLessDecompWindow = unreducedTileCompWindow;
319 auto oneLessDecompTile = unreducedTileComp;
322 oneLessDecompWindow =
getBandWindow(numDecomps - 1, 0, unreducedTileCompWindow);
323 oneLessDecompTile =
getBandWindow(numDecomps - 1, 0, unreducedTileComp);
328 oneLessDecompWindow.growIPL(2 * padding).intersection(&oneLessDecompTile));
352 grk_rect32 unreducedTileCompOrImageCompWindow,
353 Resolution* tileCompResolution, uint8_t numresolutions,
354 uint8_t reducedNumResolutions)
362 auto unreducedImageCompWindow = unreducedTileCompOrImageCompWindow;
371 assert(reducedNumResolutions > 0);
372 for(uint32_t resno = 0; resno < reducedNumResolutions; ++resno)
375 auto tileCompAtRes = tileCompResolution + reducedNumResolutions - 1;
376 auto tileCompAtLowerRes =
377 reducedNumResolutions > 1 ? tileCompResolution + reducedNumResolutions - 2 :
nullptr;
380 numresolutions, (uint8_t)(reducedNumResolutions - 1U),
nullptr, tileCompAtRes,
382 wholeTileDecompress ? 0 : getFilterPad<uint32_t>(lossless));
385 topLevel->resWindowBufferTopLevelREL_ = topLevel->resWindowBufferREL_;
387 for(uint8_t resno = 0; resno < reducedNumResolutions - 1; ++resno)
393 numresolutions, resno,
useBandWindows() ?
nullptr : topLevel->resWindowBufferREL_,
394 tileCompResolution + resno, resno > 0 ? tileCompResolution + resno - 1 :
nullptr,
396 wholeTileDecompress ? 0 : getFilterPad<uint32_t>(lossless)));
418 uint32_t& offsety)
const
423 auto band = res->tileBand +
getBandIndex(resno, orientation);
425 uint32_t x = offsetx;
426 uint32_t y = offsety;
437 x += resLower->width();
439 y += resLower->height();
581 index = (uint8_t)orientation;
Copyright (C) 2016-2022 Grok Image Compression Inc.
Definition: ICacheable.h:20
eSplitOrientation
Definition: TileComponentWindowBuffer.h:44
@ SPLIT_H
Definition: TileComponentWindowBuffer.h:46
@ SPLIT_L
Definition: TileComponentWindowBuffer.h:45
@ SPLIT_NUM_ORIENTATIONS
Definition: TileComponentWindowBuffer.h:47
constexpr T getFilterPad(bool lossless)
Definition: TileComponentWindowBuffer.h:51
grk_rect< uint32_t > grk_rect32
Definition: util.h:57
eBandOrientation
Definition: Subband.h:25
@ BAND_ORIENT_HH
Definition: Subband.h:29
@ BAND_ORIENT_HL
Definition: Subband.h:27
@ BAND_NUM_ORIENTATIONS
Definition: Subband.h:30
@ BAND_ORIENT_LH
Definition: Subband.h:28
@ BAND_ORIENT_LL
Definition: Subband.h:26
Definition: MemManager.h:79
Class: ResWindowBuffer.
Definition: TileComponentWindowBuffer.h:67
bool allocated_
Definition: TileComponentWindowBuffer.h:331
~ResWindowBuffer()
Definition: TileComponentWindowBuffer.h:168
grk_buf2d< T, AllocatorAligned > * resWindowBufferREL_
Definition: TileComponentWindowBuffer.h:341
std::vector< grk_rect32 > bandWindowPadded_
Definition: TileComponentWindowBuffer.h:338
uint32_t filterWidth_
Definition: TileComponentWindowBuffer.h:344
Resolution * tileCompResLower_
Definition: TileComponentWindowBuffer.h:334
grk_buf2d< T, AllocatorAligned > * resWindowBufferSplitREL_[SPLIT_NUM_ORIENTATIONS]
Definition: TileComponentWindowBuffer.h:340
static grk_rect32 getBandWindow(uint32_t numDecomps, uint8_t orientation, grk_rect32 tileCompWindowUnreduced)
Get band window (in tile component coordinates) for specified number of decompositions.
Definition: TileComponentWindowBuffer.h:275
bool alloc(bool clear)
Definition: TileComponentWindowBuffer.h:176
grk_rect32 resWindowPadded_
Definition: TileComponentWindowBuffer.h:336
ResWindowBuffer(uint8_t numresolutions, uint8_t resno, grk_buf2d< T, AllocatorAligned > *resWindowTopLevelREL, Resolution *tileCompAtRes, Resolution *tileCompAtLowerRes, grk_rect32 resWindow, grk_rect32 tileCompWindowUnreduced, grk_rect32 tileCompUnreduced, uint32_t FILTER_WIDTH)
Definition: TileComponentWindowBuffer.h:68
std::vector< grk_buf2d< T, AllocatorAligned > * > bandWindowBufferPaddedREL_
Definition: TileComponentWindowBuffer.h:337
grk_buf2d< T, AllocatorAligned > * resWindowBufferTopLevelREL_
Definition: TileComponentWindowBuffer.h:342
static grk_rect32 getBandWindow(uint32_t numDecomps, uint8_t orientation, grk_rect32 unreducedTileCompWindow, grk_rect32 unreducedTileComp, uint32_t padding)
Get band window (in tile component coordinates) for specified number of decompositions (with padding)
Definition: TileComponentWindowBuffer.h:308
Resolution * tileCompRes_
Definition: TileComponentWindowBuffer.h:333
Definition: Resolution.h:24
uint32_t numTileBandWindows
Definition: Resolution.h:85
Subband tileBand[BAND_NUM_INDICES]
Definition: Resolution.h:84
Definition: TileComponentWindowBuffer.h:349
bool compress_
Definition: TileComponentWindowBuffer.h:600
const grk_buf2d< T, AllocatorAligned > * getResWindowBufferREL(uint32_t resno) const
Get resolution window.
Definition: TileComponentWindowBuffer.h:515
bool useBandWindows() const
Definition: TileComponentWindowBuffer.h:568
std::vector< ResWindowBuffer< T > * > resWindowBuffers
Definition: TileComponentWindowBuffer.h:595
const grk_rect32 * getBandWindowPadded(uint8_t resno, eBandOrientation orientation) const
Get padded band window.
Definition: TileComponentWindowBuffer.h:486
~TileComponentWindowBuffer()
Definition: TileComponentWindowBuffer.h:400
grk_rect32 unreducedBounds() const
Definition: TileComponentWindowBuffer.h:547
bool useBufferCoordinatesForCodeblock() const
Definition: TileComponentWindowBuffer.h:572
grk_rect32 bounds() const
Get bounds of tile component (canvas coordinates) decompress: reduced canvas coordinates of window co...
Definition: TileComponentWindowBuffer.h:543
void toRelativeCoordinates(uint8_t resno, eBandOrientation orientation, uint32_t &offsetx, uint32_t &offsety) const
Transform code block offsets from canvas coordinates to either band coordinates (relative to sub band...
Definition: TileComponentWindowBuffer.h:417
TileComponentWindowBuffer(bool isCompressor, bool lossless, bool wholeTileDecompress, grk_rect32 tileCompUnreduced, grk_rect32 tileCompReduced, grk_rect32 unreducedTileCompOrImageCompWindow, Resolution *tileCompResolution, uint8_t numresolutions, uint8_t reducedNumResolutions)
Definition: TileComponentWindowBuffer.h:350
uint8_t getBandIndex(uint8_t resno, eBandOrientation orientation) const
Definition: TileComponentWindowBuffer.h:576
grk_rect32 bounds_
Definition: TileComponentWindowBuffer.h:590
const grk_buf2d< T, AllocatorAligned > * getCodeBlockDestWindowREL(uint8_t resno, eBandOrientation orientation) const
Get code block destination window.
Definition: TileComponentWindowBuffer.h:452
grk_buf2d< T, AllocatorAligned > * getResWindowBufferHighestREL(void) const
Get highest resolution window.
Definition: TileComponentWindowBuffer.h:524
uint8_t numResolutions_
Definition: TileComponentWindowBuffer.h:598
const grk_rect32 * getResWindowPadded(uint8_t resno) const
Definition: TileComponentWindowBuffer.h:493
bool wholeTileDecompress_
Definition: TileComponentWindowBuffer.h:601
std::vector< Resolution * > resolution_
Definition: TileComponentWindowBuffer.h:593
void transfer(T **buffer, uint32_t *stride)
Definition: TileComponentWindowBuffer.h:562
grk_rect32 unreducedBounds_
Definition: TileComponentWindowBuffer.h:589
const grk_buf2d< T, AllocatorAligned > * getBandWindowBufferPaddedREL(uint8_t resno, eBandOrientation orientation) const
Get padded band window buffer.
Definition: TileComponentWindowBuffer.h:468
bool alloc()
Definition: TileComponentWindowBuffer.h:528
void attach(T *buffer, uint32_t stride)
Definition: TileComponentWindowBuffer.h:557
const grk_buf2d< T, AllocatorAligned > * getResWindowBufferSplitREL(uint8_t resno, eSplitOrientation orientation) const
Definition: TileComponentWindowBuffer.h:503
uint64_t stridedArea(void) const
Definition: TileComponentWindowBuffer.h:551
Definition: MemManager.h:278
T width() const
Definition: util.h:246
T y1
Definition: util.h:109
T x0
Definition: util.h:109
T x1
Definition: util.h:109
T height() const
Definition: util.h:250
bool valid(void) const
Definition: util.h:121
grk_rect< T > scaleDownCeilPow2(uint32_t power) const
Definition: util.h:190
grk_rect< T > pan(int64_t x, int64_t y) const
Definition: util.h:262
grk_rect< T > intersection(const grk_rect< T > rhs) const
Definition: util.h:200
grk_rect< T > & growIPL(T boundary)
Definition: util.h:268
T y0
Definition: util.h:109