mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:00:08 +00:00
Use common data level functions when generating color table lut
This commit is contained in:
parent
8921c08f4f
commit
36f8f73b0f
3 changed files with 20 additions and 29 deletions
|
|
@ -247,7 +247,6 @@ void Level3ProductView::UpdateColorTableLut()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::int16_t productCode = descriptionBlock->product_code();
|
|
||||||
float offset = descriptionBlock->offset();
|
float offset = descriptionBlock->offset();
|
||||||
float scale = descriptionBlock->scale();
|
float scale = descriptionBlock->scale();
|
||||||
std::uint8_t threshold = static_cast<std::uint8_t>(
|
std::uint8_t threshold = static_cast<std::uint8_t>(
|
||||||
|
|
@ -292,7 +291,7 @@ void Level3ProductView::UpdateColorTableLut()
|
||||||
std::optional<float> f = descriptionBlock->data_value(i);
|
std::optional<float> f = descriptionBlock->data_value(i);
|
||||||
|
|
||||||
// Different products use different scale/offset formulas
|
// Different products use different scale/offset formulas
|
||||||
if (numberOfLevels > 16 || productCode == 34)
|
if (numberOfLevels > 16 || !descriptionBlock->IsDataLevelCoded())
|
||||||
{
|
{
|
||||||
if (i == RANGE_FOLDED && threshold > RANGE_FOLDED)
|
if (i == RANGE_FOLDED && threshold > RANGE_FOLDED)
|
||||||
{
|
{
|
||||||
|
|
@ -312,11 +311,14 @@ void Level3ProductView::UpdateColorTableLut()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint16_t th = descriptionBlock->data_level_threshold(i);
|
std::optional<wsr88d::DataLevelCode> dataLevelCode =
|
||||||
if ((th & 0x8000u) == 0)
|
descriptionBlock->data_level_code(i);
|
||||||
|
|
||||||
|
if (dataLevelCode == wsr88d::DataLevelCode::RangeFolded)
|
||||||
{
|
{
|
||||||
// If bit 0 is zero, then the LSB is numeric
|
lut[lutIndex] = p->colorTable_->rf_color();
|
||||||
if (f.has_value())
|
}
|
||||||
|
else if (f.has_value())
|
||||||
{
|
{
|
||||||
lut[lutIndex] = p->colorTable_->Color(f.value());
|
lut[lutIndex] = p->colorTable_->Color(f.value());
|
||||||
}
|
}
|
||||||
|
|
@ -325,23 +327,6 @@ void Level3ProductView::UpdateColorTableLut()
|
||||||
lut[lutIndex] = boost::gil::rgba8_pixel_t {0, 0, 0, 0};
|
lut[lutIndex] = boost::gil::rgba8_pixel_t {0, 0, 0, 0};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// If bit 0 is one, then the LSB is coded
|
|
||||||
uint16_t lsb = th & 0x00ffu;
|
|
||||||
|
|
||||||
switch (lsb)
|
|
||||||
{
|
|
||||||
case 3: // RF
|
|
||||||
lut[lutIndex] = p->colorTable_->rf_color();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: // Ignore other values
|
|
||||||
lut[lutIndex] = boost::gil::rgba8_pixel_t {0, 0, 0, 0};
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
p->colorTableMin_ = rangeMin;
|
p->colorTableMin_ = rangeMin;
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ public:
|
||||||
units::angle::degrees<double> elevation() const;
|
units::angle::degrees<double> elevation() const;
|
||||||
|
|
||||||
bool IsCompressionEnabled() const;
|
bool IsCompressionEnabled() const;
|
||||||
|
bool IsDataLevelCoded() const;
|
||||||
|
|
||||||
size_t data_size() const override;
|
size_t data_size() const override;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -633,6 +633,11 @@ bool ProductDescriptionBlock::IsCompressionEnabled() const
|
||||||
return isCompressed;
|
return isCompressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ProductDescriptionBlock::IsDataLevelCoded() const
|
||||||
|
{
|
||||||
|
return !uncodedDataLevelProducts_.contains(p->productCode_);
|
||||||
|
}
|
||||||
|
|
||||||
size_t ProductDescriptionBlock::data_size() const
|
size_t ProductDescriptionBlock::data_size() const
|
||||||
{
|
{
|
||||||
return SIZE;
|
return SIZE;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue