Added CIE Lab Gamma Equation (#651)

This commit is contained in:
Michael Miller
2023-02-12 09:35:42 -08:00
committed by GitHub
parent 656a48ff33
commit efdfdc6ac7
3 changed files with 28 additions and 0 deletions
+2
View File
@@ -722,6 +722,7 @@ NeoTopology KEYWORD1
NeoRingTopology KEYWORD1
NeoTiles KEYWORD1
NeoMosaic KEYWORD1
NeoGammaCieLabEquationMethod KEYWORD1
NeoGammaEquationMethod KEYWORD1
NeoGammaTableMethod KEYWORD1
NeoGamma KEYWORD1
@@ -817,6 +818,7 @@ CircularOut KEYWORD2
CircularInOut KEYWORD2
CircularCenter KEYWORD2
Gamma KEYWORD2
GammaCieLab KEYWORD2
Map KEYWORD2
MapProbe KEYWORD2
getWidth KEYWORD2
+12
View File
@@ -312,4 +312,16 @@ public:
{
return pow(unitValue, 1.0f / 0.45f);
}
static float GammaCieLab(float unitValue)
{
if (unitValue <= 0.08f)
{
return unitValue / 9.033f;
}
else
{
return pow((unitValue + 0.16f) / 1.16f, 3.0f);
}
}
};
+14
View File
@@ -40,6 +40,20 @@ public:
}
};
// Alternative equation to provide at least one official model for specific LEDs
class NeoGammaCieLabEquationMethod
{
public:
static uint8_t Correct(uint8_t value)
{
return static_cast<uint8_t>(255.0f * NeoEase::GammaCieLab(value / 255.0f) + 0.5f);
}
static uint16_t Correct(uint16_t value)
{
return static_cast<uint16_t>(65535.0f * NeoEase::GammaCieLab(value / 65535.0f) + 0.5f);
}
};
struct NeoGamma16LowHint
{
uint8_t pos;