Skip to content

Commit 30535bf

Browse files
author
Grok Compression
committed
prepareForDecompression now void - if fails, TileProcessor isn't initialized
1 parent 8eee7c6 commit 30535bf

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

src/lib/core/codestream/decompress/CodeStreamDecompress.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,11 +1055,7 @@ bool CodeStreamDecompress::scheduleNextSlatedTile(bool multiTile)
10551055
return false;
10561056
}
10571057

1058-
if(!currTileProcessor_->prepareForDecompression())
1059-
{
1060-
success_ = false;
1061-
return false;
1062-
}
1058+
currTileProcessor_->prepareForDecompression();
10631059

10641060
auto tileProcessor = currTileProcessor_;
10651061
currTileProcessor_ = nullptr;

src/lib/core/tile_processor/TileProcessor.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ grk_progression_state TileProcessor::getProgressionState()
188188

189189
return rc;
190190
}
191+
192+
bool TileProcessor::isInitialized(void)
193+
{
194+
return initialized_;
195+
}
196+
191197
bool TileProcessor::init(void)
192198
{
193199
uint32_t state = grk_plugin_get_debug_state();
@@ -291,6 +297,8 @@ bool TileProcessor::init(void)
291297
grklog.warn("plugin tile differs from grok tile");
292298
}
293299

300+
initialized_ = true;
301+
294302
return true;
295303
}
296304

@@ -367,7 +375,9 @@ bool TileProcessor::decompressPrepareWithTLM(const std::shared_ptr<TPFetchSeq>&
367375

368376
tilePartFetchSeq_ = tilePartFetchSeq;
369377

370-
return prepareForDecompression();
378+
prepareForDecompression();
379+
380+
return true;
371381
}
372382

373383
bool TileProcessor::decompressWithTLM(const std::shared_ptr<TPFetchSeq>& tilePartFetchSeq,
@@ -664,7 +674,7 @@ void TileProcessor::prepareConcurrentParsing(void)
664674
prepareFlow_ = std::make_unique<FlowComponent>();
665675
}
666676

667-
bool TileProcessor::prepareForDecompression(void)
677+
void TileProcessor::prepareForDecompression(void)
668678
{
669679
auto prep = [this]() {
670680
// now we can get ready to decompress this tile
@@ -689,8 +699,6 @@ bool TileProcessor::prepareForDecompression(void)
689699
prepareFlow_->nextTask().work(prep);
690700
else
691701
prep();
692-
693-
return true;
694702
}
695703

696704
Mct* TileProcessor::getMCT(void)
@@ -766,6 +774,8 @@ bool TileProcessor::readPLT(uint8_t* headerData, uint16_t headerSize)
766774

767775
bool TileProcessor::createDecompressTileComponentWindows(void)
768776
{
777+
if(!initialized_)
778+
return false;
769779
for(uint16_t compno = 0; compno < tile_->numcomps_; ++compno)
770780
{
771781
auto imageComp = headerImage_->comps + compno;
@@ -952,7 +962,7 @@ bool TileProcessor::scheduleT2T1(CoderPool* coderPool, Rect32 unreducedImageBoun
952962
}
953963
};
954964

955-
auto t2Parse = [this, allocAndSchedule]() {
965+
auto t2Parse = [this]() {
956966
// synch plugin with T2 data
957967
// todo re-enable decompress synch
958968
// decompress_synch_plugin_with_host(this);

src/lib/core/tile_processor/TileProcessor.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ struct TileProcessor
8181
/**
8282
* @brief Prepares for decompresion
8383
*
84-
* @return true if successful
84+
* If this fails, then TileProcessor doesn't get initialized.
85+
*
8586
*/
86-
bool prepareForDecompression(void);
87+
void prepareForDecompression(void);
8788

8889
/**
8990
* @brief Parses tile part
@@ -342,6 +343,8 @@ struct TileProcessor
342343

343344
bool hasError(void);
344345

346+
bool isInitialized(void);
347+
345348
protected:
346349
/**
347350
* @brief header @ref GrkImage
@@ -401,6 +404,8 @@ struct TileProcessor
401404
CodecScheduler* scheduler_ = nullptr;
402405

403406
private:
407+
bool initialized_ = false;
408+
404409
void prepareConcurrentParsing(void);
405410

406411
std::atomic<bool> success_ = true;

0 commit comments

Comments
 (0)