44 using std::dynamic_pointer_cast;
46 using std::shared_ptr;
51 GammaTransferFunction::GammaTransferFunction (
double gamma)
59 GammaTransferFunction::make_double_lut(
double from,
double to,
int bit_depth,
bool inverse)
const
61 int const bit_length = int(std::pow(2.0f, bit_depth));
62 auto lut = vector<double>(bit_length);
63 double const gamma = inverse ? (1 / _gamma) : _gamma;
64 for (
int i = 0; i < bit_length; ++i) {
65 double const x = double(i) / (bit_length - 1);
66 lut[i] = pow((x * (to - from)) + from, gamma);
74 GammaTransferFunction::about_equal (shared_ptr<const TransferFunction> other,
double epsilon)
const
76 auto o = dynamic_pointer_cast<const GammaTransferFunction>(other);
81 return fabs(_gamma - o->_gamma) < epsilon;
GammaTransferFunction class.
Namespace for everything in libdcp.