mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 09:00:04 +00:00
Properly unpack levels from RLE data
This commit is contained in:
parent
6fc1f89fb1
commit
5e20ff9311
1 changed files with 13 additions and 6 deletions
|
|
@ -218,13 +218,20 @@ bool RadialDataPacket::Parse(std::istream& is)
|
|||
radial.data_.pop_back();
|
||||
}
|
||||
|
||||
radial.level_.resize(radial.data_.size());
|
||||
// Unpack the levels from the Run Length Encoded data
|
||||
radial.level_.resize(p->numberOfRangeBins_);
|
||||
|
||||
std::transform(std::execution::par_unseq,
|
||||
radial.data_.cbegin(),
|
||||
radial.data_.cend(),
|
||||
radial.level_.begin(),
|
||||
[](uint8_t data) -> uint8_t { return data & 0x0f; });
|
||||
uint16_t b = 0;
|
||||
for (auto it = radial.data_.cbegin(); it != radial.data_.cend(); it++)
|
||||
{
|
||||
uint8_t run = *it >> 4;
|
||||
uint8_t level = *it & 0x0f;
|
||||
|
||||
for (int i = 0; i < run && b < p->numberOfRangeBins_; i++)
|
||||
{
|
||||
radial.level_[b++] = level;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue