Skip to content

Commit 6a607f8

Browse files
author
Grok Compression
committed
t1: improve namespacing II
1 parent fd824c2 commit 6a607f8

66 files changed

Lines changed: 166 additions & 162 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -325,21 +325,23 @@ struct TileComponent : public Rect32
325325
* @param block @ref DecompressBlockExec
326326
*/
327327
template<typename T>
328-
void postProcess(T* srcData, DecompressBlockExec* block)
328+
void postProcess(T* srcData, t1::DecompressBlockExec* block)
329329
{
330330
if(block->roishift)
331331
{
332332
if(block->qmfbid == 1)
333-
postDecompressImpl<T, RoiShiftFilter<T>>(srcData, block, (uint16_t)block->cblk->width());
333+
postDecompressImpl<T, t1::RoiShiftFilter<T>>(srcData, block,
334+
(uint16_t)block->cblk->width());
334335
else
335-
postDecompressImpl<T, RoiScaleFilter<T>>(srcData, block, (uint16_t)block->cblk->width());
336+
postDecompressImpl<T, t1::RoiScaleFilter<T>>(srcData, block,
337+
(uint16_t)block->cblk->width());
336338
}
337339
else
338340
{
339341
if(block->qmfbid == 1)
340-
postDecompressImpl<T, ShiftFilter<T>>(srcData, block, (uint16_t)block->cblk->width());
342+
postDecompressImpl<T, t1::ShiftFilter<T>>(srcData, block, (uint16_t)block->cblk->width());
341343
else
342-
postDecompressImpl<T, ScaleFilter<T>>(srcData, block, (uint16_t)block->cblk->width());
344+
postDecompressImpl<T, t1::ScaleFilter<T>>(srcData, block, (uint16_t)block->cblk->width());
343345
}
344346
}
345347

@@ -351,7 +353,7 @@ struct TileComponent : public Rect32
351353
* @param stride source data stride
352354
*/
353355
template<typename T>
354-
void postProcessHT(T* srcData, DecompressBlockExec* block, uint16_t stride)
356+
void postProcessHT(T* srcData, t1::DecompressBlockExec* block, uint16_t stride)
355357
{
356358
if(block->roishift)
357359
{
@@ -405,7 +407,7 @@ struct TileComponent : public Rect32
405407
* @param stride source data stride
406408
*/
407409
template<typename T, typename F>
408-
void postDecompressImpl(T* srcData, DecompressBlockExec* block, uint16_t stride)
410+
void postDecompressImpl(T* srcData, t1::DecompressBlockExec* block, uint16_t stride)
409411
{
410412
auto cblk = block->cblk;
411413
bool empty = cblk->dataChunksEmpty();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ struct TileComponentWindow : public TileComponentWindowBase<T>
205205
}
206206
template<typename F>
207207
void postProcess(Buf2dAligned& src, uint8_t resno, eBandOrientation bandOrientation,
208-
DecompressBlockExec* block)
208+
t1::DecompressBlockExec* block)
209209
{
210210
Buffer2d<int32_t, AllocatorAligned> dst;
211211
dst = getCodeBlockDestWindowREL(resno, bandOrientation);

src/lib/core/codestream/CodingParams.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ TileCodingParams::TileCodingParams(const TileCodingParams& rhs)
292292
// Or recreate
293293
bool reversible = (rhs.tccps_[0].qmfbid_ == 1);
294294
uint8_t guardBits = rhs.tccps_[0].numgbits_;
295-
qcd_ = CoderFactory::makeQuantizer(rhs.ht_, reversible, guardBits);
295+
qcd_ = t1::CoderFactory::makeQuantizer(rhs.ht_, reversible, guardBits);
296296
}
297297

298298
// Deep copy other pointers if necessary, e.g. packets_, mct_norms_, mctCodingMatrix_,
@@ -404,7 +404,7 @@ bool TileCodingParams::readQcd(bool fromTileHeader, uint8_t* headerData, uint16_
404404
{
405405
dest->qntsty_ = src->qntsty_;
406406
dest->numgbits_ = src->numgbits_;
407-
auto size = GRK_MAXBANDS * sizeof(grk_stepsize);
407+
auto size = GRK_MAXBANDS * sizeof(t1::grk_stepsize);
408408
memcpy(dest->stepsizes_, src->stepsizes_, size);
409409
}
410410
}
@@ -1761,7 +1761,7 @@ void TileCodingParams::setIsHT(bool ht, bool reversible, uint8_t guardBits)
17611761
{
17621762
ht_ = ht;
17631763
if(!qcd_)
1764-
qcd_ = CoderFactory::makeQuantizer(ht, reversible, guardBits);
1764+
qcd_ = t1::CoderFactory::makeQuantizer(ht, reversible, guardBits);
17651765
}
17661766

17671767
bool TileCodingParams::isHT(void)

src/lib/core/codestream/CodingParams.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ struct TileComponentCodingParams
7474
/** quantisation style */
7575
uint8_t qntsty_;
7676
/** stepsizes used for quantization */
77-
grk_stepsize stepsizes_[GRK_MAXBANDS];
77+
t1::grk_stepsize stepsizes_[GRK_MAXBANDS];
7878
// number of step sizes read from QCC marker
7979
uint8_t numStepSizes_;
8080
/** number of guard bits */
@@ -321,7 +321,7 @@ struct TileCodingParams
321321
uint32_t cod_ = 0;
322322
/** If ppt == true --> there was a PPT marker for the present tile */
323323
bool ppt_ = false;
324-
Quantizer* qcd_ = nullptr;
324+
t1::Quantizer* qcd_ = nullptr;
325325
uint16_t numComps_ = 0;
326326

327327
private:

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,14 @@ bool CodeStreamDecompress::readHeader(grk_header_info* headerInfo)
179179
headerImage_->copyHeaderTo(multiTileComposite_.get());
180180
multiTileComposite_->validateColourSpace();
181181
uint32_t num_threads = (uint32_t)ExecSingleton::num_threads();
182-
coderPool_.makeCoders(num_threads, 6, 6, [this]() -> std::shared_ptr<ICoder> {
183-
return std::shared_ptr<ICoder>(
184-
CoderFactory::makeCoder(isHT_, false, 64, 64, tileCache_->getStrategy()));
182+
coderPool_.makeCoders(num_threads, 6, 6, [this]() -> std::shared_ptr<t1::ICoder> {
183+
return std::shared_ptr<t1::ICoder>(
184+
t1::CoderFactory::makeCoder(isHT_, false, 64, 64, tileCache_->getStrategy()));
185185
});
186186

187-
coderPool_.makeCoders(num_threads, 5, 5, [this]() -> std::shared_ptr<ICoder> {
188-
return std::shared_ptr<ICoder>(
189-
CoderFactory::makeCoder(isHT_, false, 32, 32, tileCache_->getStrategy()));
187+
coderPool_.makeCoders(num_threads, 5, 5, [this]() -> std::shared_ptr<t1::ICoder> {
188+
return std::shared_ptr<t1::ICoder>(
189+
t1::CoderFactory::makeCoder(isHT_, false, 32, 32, tileCache_->getStrategy()));
190190
});
191191
defaultTcp_->finalizePocs();
192192
if(isHT_)
@@ -473,7 +473,7 @@ bool CodeStreamDecompress::readSIZ(uint8_t* headerData, uint16_t headerSize)
473473
headerImage_->has_multiple_tiles = numTilesToDecompress > 1;
474474
}
475475
auto maxDim = std::max(cp_.t_width_, cp_.t_height_);
476-
WaveletReverse::allocPoolData(maxDim);
476+
t1::WaveletReverse::allocPoolData(maxDim);
477477

478478
return rc;
479479
}

src/lib/core/debug/debug_context.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ DebugContext& DebugContext::getInstance()
4444
}
4545

4646
// Handling the mqcoder
47-
bool DebugContext::handle(const mqcoder& mq, uint8_t passno, uint8_t position, uint16_t i,
47+
bool DebugContext::handle(const t1::mqcoder& mq, uint8_t passno, uint8_t position, uint16_t i,
4848
uint16_t k)
4949
{
5050
uint16_t layer = static_cast<uint16_t>(mq.cur_buffer_index);
@@ -58,9 +58,9 @@ bool DebugContext::handle(const mqcoder& mq, uint8_t passno, uint8_t position, u
5858
}
5959
else if(!queue.empty())
6060
{
61-
if(mq.backup_->i != BACKUP_DISABLED)
61+
if(mq.backup_->i != t1::BACKUP_DISABLED)
6262
return true;
63-
mqcoder ref = queue.front();
63+
t1::mqcoder ref = queue.front();
6464
queue.pop();
6565
bool isEqual = (mq == ref);
6666
logProbe(true, layer, queue.size(), ref.c, passno, position, i, k);
@@ -113,7 +113,7 @@ void DebugContext::checkEmpty() const
113113
}
114114

115115
// Getting the queue for a specific layer
116-
std::queue<mqcoder>& DebugContext::getQueue(uint16_t layer)
116+
std::queue<t1::mqcoder>& DebugContext::getQueue(uint16_t layer)
117117
{
118118
return referenceCoders_[{resno_, layer}];
119119
}

src/lib/core/debug/debug_context.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ namespace grk
2626
{
2727

2828
using ResolutionLayerKey = std::pair<uint8_t, uint16_t>;
29-
using QueueMap = std::map<ResolutionLayerKey, std::queue<mqcoder>>;
29+
using QueueMap = std::map<ResolutionLayerKey, std::queue<t1::mqcoder>>;
3030

3131
struct BackupCache
3232
{
33-
BackupCache(const mqcoder& coder, uint8_t passno, uint8_t position, uint16_t i, uint16_t k)
33+
BackupCache(const t1::mqcoder& coder, uint8_t passno, uint8_t position, uint16_t i, uint16_t k)
3434
: coder_(coder), passno_(passno), position_(position), i_(i), k_(k)
3535
{}
36-
mqcoder coder_;
36+
t1::mqcoder coder_;
3737
uint8_t passno_;
3838
uint8_t position_;
3939
uint16_t i_;
@@ -58,7 +58,7 @@ class DebugContext
5858
public:
5959
static DebugContext& getInstance();
6060

61-
bool handle(const mqcoder& mq, uint8_t passno, uint8_t position, uint16_t i, uint16_t k);
61+
bool handle(const t1::mqcoder& mq, uint8_t passno, uint8_t position, uint16_t i, uint16_t k);
6262
void incrementDifferentialLayer();
6363
void restoreBackup(void);
6464

@@ -76,7 +76,7 @@ class DebugContext
7676
private:
7777
DebugContext();
7878
void checkEmpty() const;
79-
std::queue<mqcoder>& getQueue(uint16_t layer);
79+
std::queue<t1::mqcoder>& getQueue(uint16_t layer);
8080
void logProbe(bool differential, uint16_t layer, size_t order, uint32_t c, uint8_t passno,
8181
uint8_t position, uint16_t i, uint16_t k) const;
8282

src/lib/core/scheduling/CodecScheduler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class CodecScheduler : public FlowComponent
121121
* @brief pool of @ref ICoder
122122
*
123123
*/
124-
std::vector<ICoder*> coders_;
124+
std::vector<t1::ICoder*> coders_;
125125

126126
/**
127127
* @brief @ref tf::Future<void> resulting from running scheduler

src/lib/core/scheduling/CoderPool.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,17 @@ bool CoderPool::contains(uint8_t maxCblkWExp, uint8_t maxCblkHExp)
2727
}
2828

2929
void CoderPool::makeCoders(uint32_t numCoders, uint8_t maxCblkWExp, uint8_t maxCblkHExp,
30-
std::function<std::shared_ptr<ICoder>()> creator)
30+
std::function<std::shared_ptr<t1::ICoder>()> creator)
3131
{
3232
if(contains(maxCblkWExp, maxCblkHExp))
3333
return;
34-
std::vector<std::shared_ptr<ICoder>> coders;
34+
std::vector<std::shared_ptr<t1::ICoder>> coders;
3535
for(uint32_t i = 0; i < numCoders; ++i)
3636
coders.push_back(creator());
3737
coderMap_[{maxCblkWExp, maxCblkHExp}] = std::move(coders);
3838
}
39-
std::shared_ptr<ICoder> CoderPool::getCoder(size_t worker, uint8_t maxCblkWExp, uint8_t maxCblkHExp)
39+
std::shared_ptr<t1::ICoder> CoderPool::getCoder(size_t worker, uint8_t maxCblkWExp,
40+
uint8_t maxCblkHExp)
4041
{
4142
auto it = coderMap_.find({maxCblkWExp, maxCblkHExp});
4243
if(it == coderMap_.end())

src/lib/core/scheduling/CoderPool.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,18 @@ struct CoderKeyHash
4343
}
4444
};
4545

46-
typedef std::unordered_map<CoderKey, std::vector<std::shared_ptr<ICoder>>, CoderKeyHash> CODERMAP;
46+
typedef std::unordered_map<CoderKey, std::vector<std::shared_ptr<t1::ICoder>>, CoderKeyHash>
47+
CODERMAP;
4748

4849
struct CoderPool
4950
{
5051
public:
5152
CoderPool(void) = default;
5253
~CoderPool(void) = default;
5354
void makeCoders(uint32_t numCoders, uint8_t maxCblkWExp, uint8_t maxCblkHExp,
54-
std::function<std::shared_ptr<ICoder>()> creator);
55+
std::function<std::shared_ptr<t1::ICoder>()> creator);
5556
bool contains(uint8_t maxCblkWExp, uint8_t maxCblkHExp);
56-
std::shared_ptr<ICoder> getCoder(size_t worker, uint8_t maxCblkWExp, uint8_t maxCblkHExp);
57+
std::shared_ptr<t1::ICoder> getCoder(size_t worker, uint8_t maxCblkWExp, uint8_t maxCblkHExp);
5758

5859
private:
5960
CODERMAP coderMap_;

0 commit comments

Comments
 (0)