Skip to content

Commit 024c8d5

Browse files
author
Grok Compression
committed
wavelet: remove dep on tile processor
1 parent 3e3f6f1 commit 024c8d5

File tree

11 files changed

+36
-32
lines changed

11 files changed

+36
-32
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "PostDecodeFilters.h"
2323
#include "htconfig.h"
2424
#include "SparseCanvas.h"
25+
#include "TileComponentWindow.h"
2526

2627
const bool DEBUG_TILE_COMPONENT = false;
2728

src/lib/core/scheduling/CodecScheduler.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,11 @@ size_t ExecSingleton::numThreads_;
6161
namespace grk
6262
{
6363

64-
ResolutionChecker::ResolutionChecker(uint16_t numComponents, ITileProcessor* tileProcessor,
65-
bool cacheAll)
64+
ResolutionChecker::ResolutionChecker(uint16_t numComponents, TileComponent* comps, bool cacheAll)
6665
{
6766
for(uint16_t compno = 0; compno < numComponents; ++compno)
6867
{
69-
auto tilec = tileProcessor->getTile()->comps_ + compno;
68+
auto tilec = comps + compno;
7069
uint8_t resBegin =
7170
cacheAll ? (uint8_t)tilec->currentPacketProgressionState_.numResolutionsRead() : 0;
7271
uint8_t resUpperBound = tilec->nextPacketProgressionState_.numResolutionsRead();

src/lib/core/scheduling/CodecScheduler.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@
2222
namespace grk
2323
{
2424

25+
struct ITileProcessor;
26+
struct TileComponent;
2527
class ResolutionChecker
2628
{
2729
public:
28-
ResolutionChecker(uint16_t numComponents, ITileProcessor* tileProcessor, bool cacheAll);
30+
ResolutionChecker(uint16_t numComponents, TileComponent* comps, bool cacheAll);
2931

3032
// Check if a specific component contains a given resolution
3133
bool contains(uint16_t compno, uint8_t resolution) const;

src/lib/core/scheduling/whole_tile/DecompressScheduler.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ bool DecompressScheduler::schedule(ITileProcessor* tileProcessor)
123123
resMin = std::min(resMin, resBegin);
124124
resMax = std::max(resMax, resUpperBound);
125125
}
126-
ResolutionChecker rChecker(numcomps_, tileProcessor, cacheAll);
126+
ResolutionChecker rChecker(numcomps_, tileProcessor->getTile()->comps_, cacheAll);
127127

128128
for(uint16_t compno = 0; compno < numcomps_; ++compno)
129129
{
@@ -311,9 +311,14 @@ bool DecompressScheduler::schedule(ITileProcessor* tileProcessor)
311311
{
312312
if(waveletReverse_[compno])
313313
delete waveletReverse_[compno];
314-
waveletReverse_[compno] =
315-
new WaveletReverse(tileProcessor, tilec, compno, tilec->getWindow()->unreducedBounds(),
316-
numRes, (tcp->tccps_ + compno)->qmfbid_);
314+
315+
auto maxDim = std::max(tileProcessor->getCodingParams()->t_width_,
316+
tileProcessor->getCodingParams()->t_height_);
317+
318+
waveletReverse_[compno] = new WaveletReverse(tileProcessor->getScheduler(), tilec, compno,
319+
tilec->getWindow()->unreducedBounds(), numRes,
320+
(tcp->tccps_ + compno)->qmfbid_, maxDim,
321+
tileProcessor->getTCP()->wholeTileDecompress_);
317322

318323
if(!waveletReverse_[compno]->decompress())
319324
return false;

src/lib/core/scheduling/whole_tile/WholeTileScheduler.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
#include "TileWindow.h"
2020
#include "Quantizer.h"
2121
#include "ImageComponentFlow.h"
22-
namespace grk
23-
{
24-
struct ITileProcessor;
25-
}
2622
#include "ICoder.h"
2723
#include "CoderPool.h"
2824
#include "CodecScheduler.h"

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ struct ITileProcessor;
5151

5252
#include "CodecScheduler.h"
5353
#include "TileComponentWindow.h"
54+
#include "TileComponent.h"
5455
#include "canvas/tile/Tile.h"
5556
#include "ITileProcessor.h"
5657
#include "CoderFactory.h"
@@ -92,7 +93,7 @@ bool DecompressWindowScheduler::schedule(ITileProcessor* tileProcessor)
9293
resMin = std::min(resMin, resBegin);
9394
resMax = std::max(resMax, resUpperBound);
9495
}
95-
ResolutionChecker rChecker(numcomps_, tileProcessor, cacheAll);
96+
ResolutionChecker rChecker(numcomps_, tileProcessor->getTile()->comps_, cacheAll);
9697
for(uint16_t compno = 0; compno < numcomps_; ++compno)
9798
{
9899
// schedule blocks

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
namespace grk
2323
{
2424
struct ITileProcessor;
25-
}
25+
struct TileComponent;
26+
} // namespace grk
2627
#include "ICoder.h"
2728
#include "WindowScheduler.h"
2829

src/lib/core/wavelet/WaveletFwd.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ struct ITileProcessor;
4949
#include "Subband.h"
5050
#include "Resolution.h"
5151

52-
#include "CodecScheduler.h"
5352
#include "TileComponentWindow.h"
5453
#include "WaveletCommon.h"
5554
#include "WaveletReverse.h"

src/lib/core/wavelet/WaveletReverse.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,11 @@ bool WaveletReverse::allocPoolData(size_t maxDim)
338338
return is_allocated_;
339339
}
340340

341-
WaveletReverse::WaveletReverse(ITileProcessor* tileProcessor, TileComponent* tilec, uint16_t compno,
342-
Rect32 unreducedWindow, uint8_t numres, uint8_t qmfbid)
343-
: tileProcessor_(tileProcessor), scheduler_(tileProcessor->getScheduler()), tilec_(tilec),
344-
compno_(compno), unreducedWindow_(unreducedWindow), numres_(numres), qmfbid_(qmfbid)
341+
WaveletReverse::WaveletReverse(CodecScheduler* scheduler, TileComponent* tilec, uint16_t compno,
342+
Rect32 unreducedWindow, uint8_t numres, uint8_t qmfbid,
343+
uint32_t maxDim, bool wholeTileDecompress)
344+
: scheduler_(scheduler), tilec_(tilec), compno_(compno), unreducedWindow_(unreducedWindow),
345+
numres_(numres), qmfbid_(qmfbid), maxDim_(maxDim), wholeTileDecompress_(wholeTileDecompress)
345346
{}
346347
WaveletReverse::~WaveletReverse(void)
347348
{
@@ -833,11 +834,9 @@ bool WaveletReverse::tile_53(void)
833834

834835
bool WaveletReverse::decompress(void)
835836
{
836-
auto maxDim = std::max(tileProcessor_->getCodingParams()->t_width_,
837-
tileProcessor_->getCodingParams()->t_height_);
838-
WaveletReverse::allocPoolData(maxDim);
837+
WaveletReverse::allocPoolData(maxDim_);
839838

840-
if(!tileProcessor_->getTCP()->wholeTileDecompress_)
839+
if(!wholeTileDecompress_)
841840
return decompressPartial();
842841

843842
if(qmfbid_ == 1)

src/lib/core/wavelet/WaveletReverse.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#pragma once
1919

20+
#include "CodecScheduler.h"
2021
#include "WaveletCommon.h"
2122

2223
namespace grk
@@ -96,8 +97,8 @@ struct dwt_scratch
9697
class WaveletReverse
9798
{
9899
public:
99-
WaveletReverse(ITileProcessor* tileProcessor, TileComponent* tilec, uint16_t compno,
100-
Rect32 window, uint8_t numres, uint8_t qmfbid);
100+
WaveletReverse(CodecScheduler* scheduler, TileComponent* tilec, uint16_t compno, Rect32 window,
101+
uint8_t numres, uint8_t qmfbid, uint32_t maxDim, bool wholeTileDecompress);
101102
~WaveletReverse(void);
102103
bool decompress(void);
103104

@@ -119,13 +120,14 @@ class WaveletReverse
119120
static bool is_allocated_;
120121
static std::once_flag alloc_flag_;
121122

122-
ITileProcessor* tileProcessor_;
123-
CodecScheduler* scheduler_;
124-
TileComponent* tilec_;
125-
uint16_t compno_;
123+
CodecScheduler* scheduler_ = nullptr;
124+
TileComponent* tilec_ = nullptr;
125+
uint16_t compno_ = 0;
126126
Rect32 unreducedWindow_;
127-
uint8_t numres_;
128-
uint8_t qmfbid_;
127+
uint8_t numres_ = 0;
128+
uint8_t qmfbid_ = 0;
129+
uint32_t maxDim_ = 0;
130+
bool wholeTileDecompress_ = true;
129131

130132
// 5/3 ////////////////////////////////////////////////////////////////////////////////////
131133
void load_h_p0_53(int32_t* scratch, const uint32_t width, int32_t* bandL, int32_t* bandH,

0 commit comments

Comments
 (0)