From 86bfdeb77f55b379302a65b22f57fc0583ec6b3c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 22 Apr 2015 13:58:16 +0100 Subject: Express colour conversions as chromaticities and adjust so that everything is specified as something_to_xyz and then you can get an inverse LUT if you want one. --- src/gamma_transfer_function.cc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/gamma_transfer_function.cc') diff --git a/src/gamma_transfer_function.cc b/src/gamma_transfer_function.cc index bf773fb3..062599d6 100644 --- a/src/gamma_transfer_function.cc +++ b/src/gamma_transfer_function.cc @@ -25,19 +25,18 @@ using boost::shared_ptr; using boost::dynamic_pointer_cast; using namespace dcp; -GammaTransferFunction::GammaTransferFunction (bool inverse, double gamma) - : TransferFunction (inverse) - , _gamma (gamma) +GammaTransferFunction::GammaTransferFunction (double gamma) + : _gamma (gamma) { } double * -GammaTransferFunction::make_lut (int bit_depth) const +GammaTransferFunction::make_lut (int bit_depth, bool inverse) const { int const bit_length = int(std::pow(2.0f, bit_depth)); double* lut = new double[bit_length]; - double const gamma = _inverse ? (1 / _gamma) : _gamma; + double const gamma = inverse ? (1 / _gamma) : _gamma; for (int i = 0; i < bit_length; ++i) { lut[i] = pow(double(i) / (bit_length - 1), gamma); } @@ -48,10 +47,6 @@ GammaTransferFunction::make_lut (int bit_depth) const bool GammaTransferFunction::about_equal (shared_ptr other, double epsilon) const { - if (!TransferFunction::about_equal (other, epsilon)) { - return false; - } - shared_ptr o = dynamic_pointer_cast (other); if (!o) { return false; -- cgit v1.2.3