59 for(
auto bandIndex = 0U; bandIndex < 3; ++bandIndex)
61 auto band = res->band + bandIndex;
62 for(
auto prc : band->precincts_)
64 band->precincts_.clear();
85 for(uint8_t resno = 0U; resno < numres; ++resno)
88 for(
auto bandIndex = 0U; bandIndex < res->numBands_; ++bandIndex)
90 auto band = res->band + bandIndex;
91 auto roi =
window_->getBandWindowPadded(resno, band->orientation_);
92 for(
auto precinct : band->precincts_)
96 auto cblk_grid = precinct->getCblkGrid();
97 auto cblk_expn = precinct->getCblkExpn();
98 auto roi_grid = roi->scaleDownPow2(cblk_expn).clip(cblk_grid);
99 auto w = cblk_grid.width();
100 for(
auto j = roi_grid.y0; j < roi_grid.y1; ++j)
103 (uint32_t)((roi_grid.x0 - cblk_grid.x0()) + (uint64_t)(j - cblk_grid.y0()) * w);
104 for(
auto i = roi_grid.x0; i < roi_grid.x1; ++i)
106 auto cblkBounds = precinct->getCodeBlockBounds(cblkno);
110 uint32_t x = cblkBounds.x0() - band->x0;
111 uint32_t y = cblkBounds.y0() - band->y0;
112 if(band->orientation_ & 1)
115 x += prev_res->width();
117 if(band->orientation_ & 2)
120 y += prev_res->height();
125 temp =
Rect32(x, y, x + cblkBounds.width(), y + cblkBounds.height());
131 temp.
rectUnion(
Rect32(x, y, x + cblkBounds.width(), y + cblkBounds.height()));
141 const uint32_t blockSizeExp = 6;
146 for(uint8_t resno = 0; resno < numres; ++resno)
149 for(
auto bandIndex = 0U; bandIndex < res->numBands_; ++bandIndex)
151 auto band = res->band + bandIndex;
152 auto roi =
window_->getBandWindowPadded(resno, band->orientation_);
153 for(
auto precinct : band->precincts_)
155 if(precinct->empty())
157 auto cblk_grid = precinct->getCblkGrid();
158 auto cblk_expn = precinct->getCblkExpn();
159 auto roi_grid = roi->scaleDownPow2(cblk_expn).clip(cblk_grid);
160 auto w = cblk_grid.width();
161 for(
auto gridY = roi_grid.y0; gridY < roi_grid.y1; ++gridY)
164 (uint32_t)((roi_grid.x0 - cblk_grid.x0()) + (uint64_t)(gridY - cblk_grid.y0()) * w);
165 for(
auto gridX = roi_grid.x0; gridX < roi_grid.x1; ++gridX)
167 auto cblkBounds = precinct->getCodeBlockBounds(cblkno);
171 uint32_t x = cblkBounds.x0() - band->x0;
172 uint32_t y = cblkBounds.y0() - band->y0;
173 if(band->orientation_ & 1)
176 x += prev_res->width();
178 if(band->orientation_ & 2)
181 y += prev_res->height();
184 if(!regionWindow->alloc(
Rect32(x, y, x + cblkBounds.width(), y + cblkBounds.height()),
188 throw std::runtime_error(
"unable to allocate sparse array");
215 grklog.error(
"Decompress region (%u,%u,%u,%u) must overlap image bounds (%u,%u,%u,%u)",
217 maxResolution->x0, maxResolution->y0, maxResolution->x1, maxResolution->y1);
278 void init(
Resolution* resolutions,
bool isCompressor,
bool wholeTileDecompress, uint8_t reduce,
302 tccp_->numresolutions_ < reduce ? 1 : (uint8_t)(
tccp_->numresolutions_ - reduce);
303 auto highestNumberOfResolutions =
305 auto hightestResolution =
resolutions_ + highestNumberOfResolutions - 1;
344 return window_->unreducedBounds();
348 return window_->getBandWindowPadded(resno, orientation);
352 window_->transferData(data, stride);
356 window_->attachData(data, stride);
360 return window_->highestResStride();
const bool DEBUG_TILE_COMPONENT
Definition TileComponent.h:26
Definition ISparseCanvas.h:42
Definition SparseCanvas.h:46
eBandOrientation
Definition t1_common.h:28
ResWindow.
Definition CompressedChunkCache.h:36
ILogger & grklog
Definition Logger.cpp:24
Rect< uint32_t > Rect32
Definition geometry.h:64
Type-erased interface for tile component windows.
Definition TileComponentWindow.h:58
Stores the maximum number of layers read corresponding to packet data that has been read,...
Definition PacketProgressionState.h:32
Rect< T > rectUnion(const Rect *rhs) const
Definition geometry.h:397
void setRect(const Rect *rhs)
Definition geometry.h:297
Rect< T > & grow_IN_PLACE(T boundary)
Definition geometry.h:444
Stores a tile component resolution's dimensions, sub bands and other information.
Definition Resolution.h:31
Tile-component coding parameters.
Definition CodingParams.h:54
uint8_t numresolutions_
number of resolutions
Definition CodingParams.h:59
ITileComponentWindow * window_
ITileComponentWindow (type-erased, points to TileComponentWindow<int32_t> or <int16_t>)
Definition TileComponent.h:454
TileComponentWindow< int32_t > * getWindow() const
Definition TileComponent.h:317
TileComponentWindow< T > * typedWindow() const
Gets typed window (static_cast from type-erased pointer).
Definition TileComponent.h:313
uint32_t highestResStride() const
Definition TileComponent.h:358
bool allocWindow()
Definition TileComponent.h:334
uint64_t windowStridedArea() const
Definition TileComponent.h:362
void init(Resolution *resolutions, bool isCompressor, bool wholeTileDecompress, uint8_t reduce, TileComponentCodingParams *tccp)
Initalizes tile component.
Definition TileComponent.h:278
uint8_t num_resolutions_
number of resolutions
Definition TileComponent.h:416
bool allocRegionWindow(uint32_t numres, bool truncatedTile)
Allocates a region window.
Definition TileComponent.h:79
bool is16BitDwt() const
Definition TileComponent.h:325
bool isWholeTileDecoding()
Checks if whole tile will be decoded.
Definition TileComponent.h:371
void transferWindowData(void **data, uint32_t *stride)
Definition TileComponent.h:350
Rect32 windowBounds() const
Definition TileComponent.h:338
const Rect32 * getBandWindowPadded(uint8_t resno, t1::eBandOrientation orientation) const
Definition TileComponent.h:346
~TileComponent()
Destroys the Tile Component object.
Definition TileComponent.h:52
void createWindow(Rect32 unreducedTileCompOrImageCompWindow)
Creates tile component window.
Definition TileComponent.h:232
void setUse16BitDwt(bool use16Bit)
Definition TileComponent.h:329
Resolution * resolutions_
array of Resolution
Definition TileComponent.h:411
TileComponent()
Constructs a new Tile Component object.
Definition TileComponent.h:42
bool use16BitDwt_
Definition TileComponent.h:455
void postProcessBlockHT(int32_t *srcData, t1::DecompressBlockExec *block, uint16_t stride)
Post processes HTJ2K code block via virtual dispatch on window.
Definition TileComponent.h:402
TileComponentCodingParams * tccp_
TileComponentCodingParams
Definition TileComponent.h:460
uint8_t resolutions_to_decompress_
number of desired resolutions to decompress
Definition TileComponent.h:421
bool wholeTileDecompress_
true if whole tile will be decompressed
Definition TileComponent.h:443
void dealloc(void)
Deallocates component resources.
Definition TileComponent.h:257
Rect32 windowUnreducedBounds() const
Definition TileComponent.h:342
ISparseCanvas< int32_t > * getRegionWindow()
Gets return window.
Definition TileComponent.h:380
ISparseCanvas< int32_t > * regionWindow_
@ISparseCanvas for region window
Definition TileComponent.h:438
void update(uint8_t reduce)
Differential decompression update.
Definition TileComponent.h:299
void attachWindowData(void *data, uint32_t stride)
Definition TileComponent.h:354
PacketProgressionState currentPacketProgressionState_
current PacketProgressionState
Definition TileComponent.h:426
TileComponentWindow< int16_t > * getWindow16() const
Definition TileComponent.h:321
PacketProgressionState nextPacketProgressionState_
next PacketProgressionState
Definition TileComponent.h:431
void postProcessBlock(int32_t *srcData, t1::DecompressBlockExec *block)
Post processes code block via virtual dispatch on window.
Definition TileComponent.h:390
bool canCreateWindow(Rect32 windowBounds)
Check if a window can be created.
Definition TileComponent.h:210
bool isCompressor_
true if compression is occcurring
Definition TileComponent.h:448
Definition TileComponentWindow.h:197
Definition BlockExec.h:64