summaryrefslogtreecommitdiff
path: root/src/s_gamut3_transfer_function.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-01-24 04:15:26 +0100
committerCarl Hetherington <cth@carlh.net>2021-01-24 04:15:26 +0100
commitceaf7bc52712cb60708ed5eb5c62c5e463dd8e89 (patch)
treec55e4b85ee30138ce83263045d77d01631378b2e /src/s_gamut3_transfer_function.cc
parent6c37cc1979b2a01205a888c4c98f3334685ee8dd (diff)
Tidying.
Diffstat (limited to 'src/s_gamut3_transfer_function.cc')
-rw-r--r--src/s_gamut3_transfer_function.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/s_gamut3_transfer_function.cc b/src/s_gamut3_transfer_function.cc
index 599028b4..edfbe2ad 100644
--- a/src/s_gamut3_transfer_function.cc
+++ b/src/s_gamut3_transfer_function.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
@@ -31,18 +31,22 @@
files in the program, then also delete it here.
*/
+
/** @file src/s_gamut3_transfer_function.cc
- * @brief SGamut3TransferFunction class.
+ * @brief SGamut3TransferFunction class
*/
+
#include "s_gamut3_transfer_function.h"
#include <cmath>
+
using std::pow;
using std::shared_ptr;
using std::dynamic_pointer_cast;
using namespace dcp;
+
double *
SGamut3TransferFunction::make_lut (int bit_depth, bool inverse) const
{
@@ -50,7 +54,7 @@ SGamut3TransferFunction::make_lut (int bit_depth, bool inverse) const
double* lut = new double[bit_length];
if (inverse) {
for (int i = 0; i < bit_length; ++i) {
- double const p = static_cast<double> (i) / (bit_length - 1);
+ auto const p = static_cast<double>(i) / (bit_length - 1);
if (p >= (0.01125 / 1023)) {
lut[i] = (420 + log10((p + 0.01) / (0.18 + 0.01)) * 261.5) / 1023;
} else {
@@ -59,7 +63,7 @@ SGamut3TransferFunction::make_lut (int bit_depth, bool inverse) const
}
} else {
for (int i = 0; i < bit_length; ++i) {
- double const p = static_cast<double> (i) / (bit_length - 1);
+ auto const p = static_cast<double>(i) / (bit_length - 1);
if (p >= (171.2102946929 / 1023)) {
lut[i] = pow(10, ((p * 1023 - 420) / 261.5)) * (0.18 + 0.01) - 0.01;
} else {
@@ -70,9 +74,10 @@ SGamut3TransferFunction::make_lut (int bit_depth, bool inverse) const
return lut;
}
+
bool
SGamut3TransferFunction::about_equal (shared_ptr<const TransferFunction> other, double) const
{
- shared_ptr<const SGamut3TransferFunction> o = dynamic_pointer_cast<const SGamut3TransferFunction> (other);
+ auto o = dynamic_pointer_cast<const SGamut3TransferFunction> (other);
return static_cast<bool> (o);
}