44 using std::dynamic_pointer_cast;
46 using std::shared_ptr;
52 SGamut3TransferFunction::make_double_lut(
double from,
double to,
int bit_depth,
bool inverse)
const
54 int const bit_length = int(std::pow(2.0f, bit_depth));
55 auto lut = vector<double>(bit_length);
57 for (
int i = 0; i < bit_length; ++i) {
58 auto const p =
static_cast<double>(i) / (bit_length - 1);
59 auto const q = (p * (to - from)) + from;
60 if (q >= (0.01125 / 1023)) {
61 lut[i] = (420 + log10((q + 0.01) / (0.18 + 0.01)) * 261.5) / 1023;
63 lut[i] = (q * (171.2102946929 - 95) / 0.01125000 + 95) / 1023;
67 for (
int i = 0; i < bit_length; ++i) {
68 auto const p =
static_cast<double>(i) / (bit_length - 1);
69 auto const q = (p * (to - from)) + from;
70 if (q >= (171.2102946929 / 1023)) {
71 lut[i] = pow(10, ((p * 1023 - 420) / 261.5)) * (0.18 + 0.01) - 0.01;
73 lut[i] = (q * 1023 - 95) * 0.01125000 / (171.2102946929 - 95);
82 SGamut3TransferFunction::about_equal (shared_ptr<const TransferFunction> other,
double)
const
84 auto o = dynamic_pointer_cast<const SGamut3TransferFunction> (other);
85 return static_cast<bool> (o);
Namespace for everything in libdcp.
SGamut3TransferFunction class.