Go to the documentation of this file.
31 for (uint32_t i = 0; i < 3; ++i)
36 for (uint32_t i = 0; i < 3; ++i)
40 if (!
res->alloc(clear))
42 for (uint32_t i = 0; i < 3; ++i){
70 uint32_t dx,uint32_t dy,
73 uint32_t reduced_num_resolutions,
74 uint32_t numresolutions,
87 ceildiv<uint32_t>(output_image->
y0, dy),
88 ceildiv<uint32_t>(output_image->
x1, dx),
89 ceildiv<uint32_t>(output_image->
y1, dy));
100 assert(reduced_num_resolutions>0);
102 for (uint32_t resno = 0; resno < reduced_num_resolutions; ++resno)
103 resolutions.push_back(tile_comp_resolutions+resno);
109 for (uint32_t resno = 1; resno < reduced_num_resolutions; ++resno)
129 T*
cblk_ptr(uint32_t resno,uint32_t bandno, uint32_t &offsetx, uint32_t &offsety)
const {
137 auto band = res->bands + bandno;
138 uint32_t x = offsetx;
139 uint32_t y = offsety;
146 auto pres = resno == 0 ? nullptr :
resolutions[ resno - 1];
148 if (band->bandno & 1)
150 if (band->bandno & 2)
158 return dest->data + (uint64_t) x + y * (uint64_t) dest->stride;
161 return dest->data + (uint64_t) x + y * (uint64_t) dest->stride;
170 T*
ptr(uint32_t resno,uint32_t bandno)
const{
173 return band_buf(resno,bandno)->data;
178 return tile_buf()->data + lower_res->width();
181 return tile_buf()->data + lower_res->height() *
stride(resno,bandno);
184 return tile_buf()->data + lower_res->width() +
185 lower_res->height() *
stride(resno,bandno);
200 T*
ptr(uint32_t resno)
const{
221 uint32_t
stride(uint32_t resno,uint32_t bandno)
const{
224 return band_buf(resno,bandno)->stride;
250 if (!b_prev->res->data)
251 b_prev->res->data = b->bands[0]->data;
252 if (!b->bands[1]->data)
253 b->bands[1]->data = b->bands[2]->data;
275 uint32_t* tby1)
const{
277 uint32_t nb = (resno == 0) ?
287 uint32_t x0b = bandno & 1;
288 uint32_t y0b = bandno >> 1;
290 *tbx0 = (nb == 0) ? tcx0 :
291 (tcx0 <= (1U << (nb - 1)) * x0b) ? 0 :
292 ceildivpow2<uint32_t>(tcx0 - (1U << (nb - 1)) * x0b, nb);
295 *tby0 = (nb == 0) ? tcy0 :
296 (tcy0 <= (1U << (nb - 1)) * y0b) ? 0 :
297 ceildivpow2<uint32_t>(tcy0 - (1U << (nb - 1)) * y0b, nb);
300 *tbx1 = (nb == 0) ? tcx1 :
301 (tcx1 <= (1U << (nb - 1)) * x0b) ? 0 :
302 ceildivpow2<uint32_t>(tcx1 - (1U << (nb - 1)) * x0b, nb);
305 *tby1 = (nb == 0) ? tcy1 :
306 (tcy1 <= (1U << (nb - 1)) * y0b) ? 0 :
307 ceildivpow2<uint32_t>(tcy1 - (1U << (nb - 1)) * y0b, nb);
void acquire(T *buffer, uint32_t stride)
Definition: TileComponentBuffer.h:333
std::vector< grk_resolution * > resolutions
Definition: TileComponentBuffer.h:363
grk_rect_u32 to_u32()
Definition: util.h:62
grk_rectangle< T > & rectceildivpow2(uint32_t power)
Definition: util.h:136
uint32_t num_resolutions
Definition: TileComponentBuffer.h:365
uint32_t stride(void) const
Definition: TileComponentBuffer.h:236
Definition: TileProcessor.h:164
grk_buffer_2d< T > * band_buf(uint32_t resno, uint32_t bandno) const
Definition: TileComponentBuffer.h:348
T * cblk_ptr(uint32_t resno, uint32_t bandno, uint32_t &offsetx, uint32_t &offsety) const
Get pointer to code block region in tile buffer.
Definition: TileComponentBuffer.h:129
void attach(T *buffer, uint32_t stride)
Definition: TileComponentBuffer.h:329
TileComponentBuffer(grk_image *output_image, uint32_t dx, uint32_t dy, grk_rect unreduced_dim, grk_rect reduced_dim, uint32_t reduced_num_resolutions, uint32_t numresolutions, grk_resolution *tile_comp_resolutions, bool whole_tile)
Definition: TileComponentBuffer.h:69
grk_rectangle< int64_t > grk_rect
Definition: util.h:45
grk_rect m_bounds
Definition: TileComponentBuffer.h:361
grk_rect unreduced_bounds() const
Definition: TileComponentBuffer.h:320
bool alloc(bool clear)
Definition: TileComponentBuffer.h:39
void get_region_band_coordinates(uint32_t resno, uint32_t bandno, uint32_t *tbx0, uint32_t *tby0, uint32_t *tbx1, uint32_t *tby1) const
Get reduced coordinates of sub-band region.
Definition: TileComponentBuffer.h:270
bool clip(grk_rectangle< T > &r2, grk_rectangle< T > *result)
Definition: util.h:84
T x1
Definition: util.h:51
T * ptr(uint32_t resno) const
Get pointer to resolution buffer.
Definition: TileComponentBuffer.h:200
T * ptr(uint32_t resno, uint32_t bandno) const
Get pointer to band buffer.
Definition: TileComponentBuffer.h:170
uint32_t stride(uint32_t resno, uint32_t bandno) const
Get stride of band buffer.
Definition: TileComponentBuffer.h:221
grk_buffer_2d< T > * bands[3]
Definition: TileComponentBuffer.h:50
grk_band bands[3]
Definition: TileProcessor.h:170
T * ptr(void) const
Get pointer to tile buffer.
Definition: TileComponentBuffer.h:212
res_buf(grk_resolution *res, grk_rect_u32 res_bounds)
Definition: TileComponentBuffer.h:29
uint32_t stride(uint32_t resno) const
Definition: TileComponentBuffer.h:229
T height()
Definition: util.h:170
bool whole_tile_decoding
Definition: TileComponentBuffer.h:368
uint32_t y0
YOsiz: vertical offset from the origin of the reference grid to the top side of the image area.
Definition: grok.h:886
grk_rect m_unreduced_bounds
Definition: TileComponentBuffer.h:357
Copyright (C) 2016-2020 Grok Image Compression Inc.
Definition: BitIO.h:27
bool use_band_buffers() const
Definition: TileComponentBuffer.h:343
std::vector< res_buf< T > * > res_buffers
Definition: TileComponentBuffer.h:364
uint64_t strided_area(void)
Definition: TileComponentBuffer.h:324
Definition: TileComponentBuffer.h:27
grk_rect bounds() const
Get bounds of tile component decode: reduced tile component coordinates of region encode: unreduced t...
Definition: TileComponentBuffer.h:316
void transfer(T **buffer, bool *owns, uint32_t *stride)
Definition: TileComponentBuffer.h:337
~TileComponentBuffer()
Definition: TileComponentBuffer.h:115
~res_buf()
Definition: TileComponentBuffer.h:34
grk_buffer_2d< T > * res
Definition: TileComponentBuffer.h:49
T x0
Definition: util.h:49
T y1
Definition: util.h:52
uint32_t x1
Xsiz: width of the reference grid.
Definition: grok.h:888
bool alloc()
Definition: TileComponentBuffer.h:241
bool m_encode
Definition: TileComponentBuffer.h:367
Image.
Definition: grok.h:880
T y0
Definition: util.h:50
uint32_t y1
Ysiz: height of the reference grid.
Definition: grok.h:890
Definition: TileComponentBuffer.h:68
grk_buffer_2d< T > * tile_buf() const
Definition: TileComponentBuffer.h:353
uint32_t x0
XOsiz: horizontal offset from the origin of the reference grid to the left side of the image area.
Definition: grok.h:883