mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2025-06-18 07:17:05 +01:00
DWT concatenation and CDR
This commit is contained in:
@ -135,3 +135,26 @@ DVec DWT::backward(const std::vector<DWTLevel>& dwt) const
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
// concatenate levels //////////////////////////////////////////////////////////
|
||||
DVec DWT::concat(const std::vector<DWTLevel> &dwt, const int maxLevel, const bool dropLow)
|
||||
{
|
||||
unsigned int level = ((maxLevel >= 0) ? (maxLevel + 1) : dwt.size());
|
||||
Index nlast = dwt[level - 1].first.size();
|
||||
Index n = 2*dwt.front().first.size() - ((dropLow) ? nlast : 0);
|
||||
Index pt = n, nl;
|
||||
DVec res(n);
|
||||
|
||||
for (unsigned int l = 0; l < level; ++l)
|
||||
{
|
||||
nl = dwt[l].second.size();
|
||||
pt -= nl;
|
||||
res.segment(pt, nl) = dwt[l].second;
|
||||
}
|
||||
if (!dropLow)
|
||||
{
|
||||
res.segment(0, nl) = dwt[level-1].first;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -46,6 +46,8 @@ public:
|
||||
// DWT
|
||||
std::vector<DWTLevel> forward(const DVec &data, const unsigned int level) const;
|
||||
DVec backward(const std::vector<DWTLevel>& dwt) const;
|
||||
// concatenate levels
|
||||
static DVec concat(const std::vector<DWTLevel>& dwt, const int maxLevel = -1, const bool dropLow = false);
|
||||
private:
|
||||
DWTFilter filter_;
|
||||
};
|
||||
|
Reference in New Issue
Block a user