Skip to content

Commit c737920

Browse files
author
Grok Compression
committed
Fix SparseCanvas sub-band padding allocation for region decompress
PartialBandInfo::alloc used fullRes->band[BAND_INDEX_LH].width() and fullRes->band[BAND_INDEX_HL].height() to compute sub-band offsets when pre-allocating DWT filter padding blocks. For resno=1, fullRes points to resolution 0 which only has 1 band (LL) — band[1] and band[2] are uninitialized Rect32(0,0,0,0), producing zero offsets. Use fullRes->width()/height() directly (= LL band dimensions = lower resolution dimensions), which is correct for all resolution levels. Also fix grow_IN_PLACE clamp bounds: use fullResNext (current resolution) dimensions instead of fullRes (lower resolution), since panned sub-band windows extend beyond the lower resolution's coordinate range.
1 parent bf5a6cb commit c737920

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/lib/core/wavelet/WaveletReversePartial.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -534,16 +534,17 @@ struct PartialBandInfo
534534

535535
tileBandWindowREL[t1::BAND_ORIENT_LL] = bandWindowREL_[t1::BAND_ORIENT_LL];
536536
tileBandWindowREL[t1::BAND_ORIENT_HL] =
537-
bandWindowREL_[t1::BAND_ORIENT_HL].pan(fullRes->band[t1::BAND_INDEX_LH].width(), 0);
537+
bandWindowREL_[t1::BAND_ORIENT_HL].pan(fullRes->width(), 0);
538538
tileBandWindowREL[t1::BAND_ORIENT_LH] =
539-
bandWindowREL_[t1::BAND_ORIENT_LH].pan(0, fullRes->band[t1::BAND_INDEX_HL].height());
540-
tileBandWindowREL[t1::BAND_ORIENT_HH] = bandWindowREL_[t1::BAND_ORIENT_HH].pan(
541-
fullRes->band[t1::BAND_INDEX_LH].width(), fullRes->band[t1::BAND_INDEX_HL].height());
539+
bandWindowREL_[t1::BAND_ORIENT_LH].pan(0, fullRes->height());
540+
tileBandWindowREL[t1::BAND_ORIENT_HH] =
541+
bandWindowREL_[t1::BAND_ORIENT_HH].pan(fullRes->width(), fullRes->height());
542542
// 2. pre-allocate sparse blocks
543+
auto fullResNext = fullRes + 1;
543544
for(uint32_t i = 0; i < t1::BAND_NUM_ORIENTATIONS; ++i)
544545
{
545546
auto temp = tileBandWindowREL[i];
546-
if(!sa->alloc(temp.grow_IN_PLACE(2 * FILTER_WIDTH, fullRes->width(), fullRes->height()),
547+
if(!sa->alloc(temp.grow_IN_PLACE(2 * FILTER_WIDTH, fullResNext->width(), fullResNext->height()),
547548
true))
548549
return false;
549550
}
@@ -553,7 +554,6 @@ struct PartialBandInfo
553554
splitWindowREL_[SPLIT_L] = tileWindow->getResWindowBufferSplitREL(resno, SPLIT_L);
554555
splitWindowREL_[SPLIT_H] = tileWindow->getResWindowBufferSplitREL(resno, SPLIT_H);
555556

556-
auto fullResNext = fullRes + 1;
557557
for(uint32_t k = 0; k < SPLIT_NUM_ORIENTATIONS; ++k)
558558
{
559559
auto temp = splitWindowREL_[k];

0 commit comments

Comments
 (0)