45 using std::shared_ptr;
46 using std::dynamic_pointer_cast;
50 GammaTransferFunction::GammaTransferFunction (
double gamma)
58 GammaTransferFunction::make_lut (
int bit_depth,
bool inverse)
const
60 int const bit_length = int(std::pow(2.0f, bit_depth));
61 auto lut =
new double[bit_length];
62 double const gamma = inverse ? (1 / _gamma) : _gamma;
63 for (
int i = 0; i < bit_length; ++i) {
64 lut[i] = pow(
double(i) / (bit_length - 1), gamma);
72 GammaTransferFunction::about_equal (shared_ptr<const TransferFunction> other,
double epsilon)
const
74 auto o = dynamic_pointer_cast<const GammaTransferFunction>(other);
79 return fabs(_gamma - o->_gamma) < epsilon;
double const * lut(int bit_depth, bool inverse) const
GammaTransferFunction class.
Namespace for everything in libdcp.