diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-04-22 13:58:16 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-04-22 13:58:16 +0100 |
| commit | 86bfdeb77f55b379302a65b22f57fc0583ec6b3c (patch) | |
| tree | 66ed8eb0e4855c520b1b1a0d9dae052a0ad5bfe6 /src/transfer_function.cc | |
| parent | 3c88524c9a2418d6d2d8b8eac29737c95b9a7411 (diff) | |
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.
Diffstat (limited to 'src/transfer_function.cc')
| -rw-r--r-- | src/transfer_function.cc | 24 |
1 files changed, 7 insertions, 17 deletions
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<int, double*>::const_iterator i = _luts.begin(); i != _luts.end(); ++i) { + for (map<pair<int, bool>, 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<int, double*>::const_iterator i = _luts.find (bit_depth); + map<pair<int, bool>, 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<const TransferFunction> 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)]; } |
