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/transfer_function.cc | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'src/transfer_function.cc') diff --git a/src/transfer_function.cc b/src/transfer_function.cc index 8a844d9b..bf9b0f2b 100644 --- a/src/transfer_function.cc +++ b/src/transfer_function.cc @@ -22,20 +22,16 @@ using std::pow; using std::map; +using std::pair; +using std::make_pair; using boost::shared_ptr; using namespace dcp; -TransferFunction::TransferFunction (bool inverse) - : _inverse (inverse) -{ - -} - TransferFunction::~TransferFunction () { boost::mutex::scoped_lock lm (_mutex); - for (map::const_iterator i = _luts.begin(); i != _luts.end(); ++i) { + for (map, double*>::const_iterator i = _luts.begin(); i != _luts.end(); ++i) { delete[] i->second; } @@ -43,21 +39,15 @@ TransferFunction::~TransferFunction () } double const * -TransferFunction::lut (int bit_depth) const +TransferFunction::lut (int bit_depth, bool inverse) const { boost::mutex::scoped_lock lm (_mutex); - map::const_iterator i = _luts.find (bit_depth); + map, double*>::const_iterator i = _luts.find (make_pair (bit_depth, inverse)); if (i != _luts.end ()) { return i->second; } - _luts[bit_depth] = make_lut (bit_depth); - return _luts[bit_depth]; -} - -bool -TransferFunction::about_equal (shared_ptr other, double) const -{ - return _inverse == other->_inverse; + _luts[make_pair(bit_depth, inverse)] = make_lut (bit_depth, inverse); + return _luts[make_pair(bit_depth, inverse)]; } -- cgit v1.2.3