summaryrefslogtreecommitdiff
path: root/src/modified_gamma_transfer_function.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-04-22 13:58:16 +0100
committerCarl Hetherington <cth@carlh.net>2015-04-22 13:58:16 +0100
commit86bfdeb77f55b379302a65b22f57fc0583ec6b3c (patch)
tree66ed8eb0e4855c520b1b1a0d9dae052a0ad5bfe6 /src/modified_gamma_transfer_function.cc
parent3c88524c9a2418d6d2d8b8eac29737c95b9a7411 (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/modified_gamma_transfer_function.cc')
-rw-r--r--src/modified_gamma_transfer_function.cc13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/modified_gamma_transfer_function.cc b/src/modified_gamma_transfer_function.cc
index fe9266bd..850c7351 100644
--- a/src/modified_gamma_transfer_function.cc
+++ b/src/modified_gamma_transfer_function.cc
@@ -25,9 +25,8 @@ using boost::shared_ptr;
using boost::dynamic_pointer_cast;
using namespace dcp;
-ModifiedGammaTransferFunction::ModifiedGammaTransferFunction (bool inverse, double power, double threshold, double A, double B)
- : TransferFunction (inverse)
- , _power (power)
+ModifiedGammaTransferFunction::ModifiedGammaTransferFunction (double power, double threshold, double A, double B)
+ : _power (power)
, _threshold (threshold)
, _A (A)
, _B (B)
@@ -36,11 +35,11 @@ ModifiedGammaTransferFunction::ModifiedGammaTransferFunction (bool inverse, doub
}
double *
-ModifiedGammaTransferFunction::make_lut (int bit_depth) const
+ModifiedGammaTransferFunction::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];
- if (_inverse) {
+ if (inverse) {
double const threshold = _threshold / _B;
for (int i = 0; i < bit_length; ++i) {
double const p = static_cast<double> (i) / (bit_length - 1);
@@ -67,10 +66,6 @@ ModifiedGammaTransferFunction::make_lut (int bit_depth) const
bool
ModifiedGammaTransferFunction::about_equal (shared_ptr<const TransferFunction> other, double epsilon) const
{
- if (!TransferFunction::about_equal (other, epsilon)) {
- return false;
- }
-
shared_ptr<const ModifiedGammaTransferFunction> o = dynamic_pointer_cast<const ModifiedGammaTransferFunction> (other);
if (!o) {
return false;