Further reduction of include dependencies

This commit is contained in:
Ingo Weyrich
2019-11-03 14:52:42 +01:00
parent b3b1008270
commit 6335b68a80
45 changed files with 154 additions and 69 deletions

View File

@@ -25,13 +25,12 @@
#include <glibmm/ustring.h>
#include "rt_math.h"
#include "color.h"
#include "flatcurvetypes.h"
#include "diagonalcurvetypes.h"
#include "pipettebuffer.h"
#include "noncopyable.h"
#include "LUT.h"
#include "sleef.c"
#define CURVES_MIN_POLY_POINTS 1000
#include "rt_math.h"
@@ -894,12 +893,6 @@ public:
float *r, float *g, float *b) const;
};
class SatAndValueBlendingToneCurve : public ToneCurve
{
public:
void Apply(float& r, float& g, float& b) const;
};
class WeightedStdToneCurve : public ToneCurve
{
private:
@@ -1269,43 +1262,6 @@ inline void WeightedStdToneCurve::BatchApply(const size_t start, const size_t en
#endif
}
// Tone curve modifying the value channel only, preserving hue and saturation
// values in 0xffff space
inline void SatAndValueBlendingToneCurve::Apply (float& ir, float& ig, float& ib) const
{
assert (lutToneCurve);
float r = CLIP(ir);
float g = CLIP(ig);
float b = CLIP(ib);
const float lum = (r + g + b) / 3.f;
const float newLum = lutToneCurve[lum];
if (newLum == lum) {
return;
}
float h, s, v;
Color::rgb2hsvtc(r, g, b, h, s, v);
float dV;
if (newLum > lum) {
// Linearly targeting Value = 1 and Saturation = 0
const float coef = (newLum - lum) / (65535.f - lum);
dV = (1.f - v) * coef;
s *= 1.f - coef;
} else {
// Linearly targeting Value = 0
const float coef = (newLum - lum) / lum ;
dV = v * coef;
}
Color::hsv2rgbdcp(h, s, v + dV, r, g, b);
setUnlessOOG(ir, ig, ib, r, g, b);
}
}
#undef CLIPI