Skip to content

Commit 4aa168c

Browse files
author
Grok Compression
committed
tidy
1 parent 0861d60 commit 4aa168c

File tree

2 files changed

+53
-54
lines changed

2 files changed

+53
-54
lines changed

examples/core/core_decompress.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] const char** argv)
638638
grk_stream_params streamParams = {};
639639
ReadStreamInfoExample sinfo(&streamParams);
640640

641-
//#define TEST_FUZZER
641+
// #define TEST_FUZZER
642642
#ifdef TEST_FUZZER
643643
{
644644
grk_header_info headerInfo = {};

src/lib/core/scheduling/window/DecompressWindowScheduler.cpp

Lines changed: 52 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -92,68 +92,67 @@ bool DecompressWindowScheduler::schedule(TileProcessor* tileProcessor)
9292
auto paddedBandWindow = tilec->getWindow()->getBandWindowPadded(resno, band->orientation_);
9393
for(auto precinct : band->precincts_)
9494
{
95+
// skip precincts that don't overlap with padded decompression window
9596
if(!wholeTileDecoding && !paddedBandWindow->nonEmptyIntersection(precinct))
9697
continue;
9798
for(uint32_t cblkno = 0; cblkno < precinct->getNumCblks(); ++cblkno)
9899
{
99100
auto cblkBounds = precinct->getCodeBlockBounds(cblkno);
100-
if(wholeTileDecoding || paddedBandWindow->nonEmptyIntersection(&cblkBounds))
101-
{
102-
auto cblk = precinct->getDecompressedBlock(cblkno);
103-
auto block = new DecompressBlockExec(cacheAll);
104-
block->x = cblk->x0();
105-
block->y = cblk->y0();
106-
block->tilec = tilec;
107-
block->bandIndex = bandIndex;
108-
block->bandNumbps = band->maxBitPlanes_;
109-
block->bandOrientation = band->orientation_;
110-
block->cblk = cblk;
111-
block->cblk_sty = tccp->cblkStyle_;
112-
block->qmfbid = tccp->qmfbid_;
113-
block->resno = resno;
114-
block->roishift = tccp->roishift_;
115-
block->stepsize = band->stepsize_;
116-
block->k_msbs = (uint8_t)(band->maxBitPlanes_ - cblk->numbps());
117-
block->R_b = prec_ + gain_b[band->orientation_];
118-
block->finalLayer_ = finalLayer;
119-
120-
auto t = placeholder();
121-
tileProcessor->blockTasks_.emplace_back(t);
122-
auto blockFunc = [this, activePool, singleThread, tileProcessor, block, cbw, cbh,
123-
cacheAll] {
124-
if(!success)
101+
// skip code blocks that don't overlap with padded decompression window
102+
if(!wholeTileDecoding && !paddedBandWindow->nonEmptyIntersection(&cblkBounds))
103+
continue;
104+
105+
auto cblk = precinct->getDecompressedBlock(cblkno);
106+
auto block = new DecompressBlockExec(cacheAll);
107+
block->x = cblk->x0();
108+
block->y = cblk->y0();
109+
block->tilec = tilec;
110+
block->bandIndex = bandIndex;
111+
block->bandNumbps = band->maxBitPlanes_;
112+
block->bandOrientation = band->orientation_;
113+
block->cblk = cblk;
114+
block->cblk_sty = tccp->cblkStyle_;
115+
block->qmfbid = tccp->qmfbid_;
116+
block->resno = resno;
117+
block->roishift = tccp->roishift_;
118+
block->stepsize = band->stepsize_;
119+
block->k_msbs = (uint8_t)(band->maxBitPlanes_ - cblk->numbps());
120+
block->R_b = prec_ + gain_b[band->orientation_];
121+
block->finalLayer_ = finalLayer;
122+
123+
auto t = placeholder();
124+
tileProcessor->blockTasks_.emplace_back(t);
125+
auto blockFunc = [this, activePool, singleThread, tileProcessor, block, cbw, cbh,
126+
cacheAll] {
127+
if(success)
128+
{
129+
ICoder* coder = nullptr;
130+
if(block->needsCachedCoder())
131+
{
132+
coder = CoderFactory::makeCoder(tileProcessor->getTCP()->isHT(), false, cbw, cbh,
133+
tileProcessor->getTileCacheStrategy());
134+
}
135+
else if(!cacheAll)
136+
{
137+
auto threadnum = singleThread ? 0 : ExecSingleton::get().this_worker_id();
138+
coder = activePool->getCoder((size_t)threadnum, cbw, cbh).get();
139+
}
140+
try
125141
{
142+
success = block->open(coder);
126143
}
127-
else
144+
catch(const std::runtime_error& rerr)
128145
{
129-
ICoder* coder = nullptr;
130-
if(block->needsCachedCoder())
131-
{
132-
coder = CoderFactory::makeCoder(tileProcessor->getTCP()->isHT(), false, cbw,
133-
cbh, tileProcessor->getTileCacheStrategy());
134-
}
135-
else if(!cacheAll)
136-
{
137-
auto threadnum = singleThread ? 0 : ExecSingleton::get().this_worker_id();
138-
coder = activePool->getCoder((size_t)threadnum, cbw, cbh).get();
139-
}
140-
try
141-
{
142-
success = block->open(coder);
143-
}
144-
catch(const std::runtime_error& rerr)
145-
{
146-
grklog.error(rerr.what());
147-
success = false;
148-
}
149-
delete block;
146+
grklog.error(rerr.what());
147+
success = false;
150148
}
151-
};
152-
if(singleThread)
153-
blockFunc();
154-
else
155-
t.work(blockFunc);
156-
}
149+
delete block;
150+
}
151+
};
152+
if(singleThread)
153+
blockFunc();
154+
else
155+
t.work(blockFunc);
157156
}
158157
}
159158
}

0 commit comments

Comments
 (0)