ipwavelet.cc : cleanup, speedup, reduced memory usage

This commit is contained in:
Ingo Weyrich
2020-02-26 14:16:52 +01:00
parent 224659f473
commit f05c10ce55
4 changed files with 156 additions and 256 deletions

View File

@@ -1725,6 +1725,13 @@ void Color::Lab2XYZ(float L, float a, float b, float &x, float &y, float &z)
y = (LL > epskap) ? 65535.0f * fy * fy * fy : 65535.0f * LL / kappa;
}
float Color::L2Y(float L)
{
const float LL = L / 327.68f;
const float fy = (c1By116 * LL) + c16By116; // (L+16)/116
return (LL > epskapf) ? 65535.f * fy * fy * fy : 65535.f * LL / kappaf;
}
void Color::L2XYZ(float L, float &x, float &y, float &z) // for black & white
{
float LL = L / 327.68f;
@@ -1767,19 +1774,6 @@ inline float Color::computeXYZ2Lab(float f)
}
}
inline float Color::computeXYZ2LabY(float f)
{
if (f < 0.f) {
return 327.68 * (kappa * f / MAXVALF);
} else if (f > 65535.f) {
return 327.68f * (116.f * xcbrtf(f / MAXVALF) - 16.f);
} else {
return cachefy[f];
}
}
void Color::RGB2Lab(float *R, float *G, float *B, float *L, float *a, float *b, const float wp[3][3], int width)
{