Skip to content

Commit 4bb52b9

Browse files
author
Grok Compression
committed
16 vs 32 branch cleanup
1 parent 5523c0d commit 4bb52b9

2 files changed

Lines changed: 23 additions & 16 deletions

File tree

src/lib/core/canvas/tile/TileComponent.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,22 @@ struct TileComponent : public Rect32
347347
{
348348
return window_->getBandWindowPadded(resno, orientation);
349349
}
350+
void transferWindowData(void** data, uint32_t* stride)
351+
{
352+
window_->transferData(data, stride);
353+
}
354+
void attachWindowData(void* data, uint32_t stride)
355+
{
356+
window_->attachData(data, stride);
357+
}
358+
uint32_t highestResStride() const
359+
{
360+
return window_->highestResStride();
361+
}
362+
uint64_t windowStridedArea() const
363+
{
364+
return window_->stridedArea();
365+
}
350366
/**
351367
* @brief Checks if whole tile will be decoded
352368
*

src/lib/core/util/GrkImage.cpp

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,23 +1363,14 @@ void GrkImage::transferDataFrom_T(const Tile* tile_src_data)
13631363
auto srcComp = tile_src_data->comps_ + compno;
13641364
auto destComp = comps + compno;
13651365

1366-
// transfer memory from tile component to output image
1366+
// transfer memory from tile component to output image via type-erased interface
13671367
single_component_data_free(destComp);
1368-
if(srcComp->is16BitDwt())
1369-
{
1370-
// DWT ran in int16; transfer directly without widening.
1371-
int16_t* data16 = nullptr;
1372-
uint32_t stride16 = 0;
1373-
srcComp->getWindow16()->transfer(&data16, &stride16);
1374-
destComp->data = data16;
1375-
destComp->stride = stride16;
1376-
destComp->data_type = GRK_INT_16;
1377-
}
1378-
else
1379-
{
1380-
srcComp->getWindow()->transfer((T**)&destComp->data, &destComp->stride);
1381-
destComp->data_type = GRK_INT_32;
1382-
}
1368+
uint32_t stride = 0;
1369+
void* data = nullptr;
1370+
srcComp->transferWindowData(&data, &stride);
1371+
destComp->data = data;
1372+
destComp->stride = stride;
1373+
destComp->data_type = srcComp->is16BitDwt() ? GRK_INT_16 : GRK_INT_32;
13831374
destComp->owns_data = true;
13841375
}
13851376
}

0 commit comments

Comments
 (0)