35 #ifndef LIBDCP_PIECEWISE_LUT_H
36 #define LIBDCP_PIECEWISE_LUT_H
50 PiecewiseLUT2(std::shared_ptr<const TransferFunction> fn,
double boundary,
int low_bits,
int high_bits,
bool inverse,
int scale)
52 , _low(fn->int_lut(0, boundary, low_bits, inverse, scale))
53 , _high(fn->int_lut(boundary, 1, high_bits, inverse, scale))
54 , _low_scale(
static_cast<int>(std::pow(2.0f, low_bits)) - 1)
55 , _high_scale(
static_cast<int>(std::pow(2.0f, high_bits)) - 1)
60 inline int lookup(
double x)
const {
61 return x < _boundary ? _low[lrint((x / _boundary) * _low_scale)] : _high[lrint(((x - _boundary) / (1 - _boundary)) * _high_scale)];
66 std::vector<int> _low;
67 std::vector<int> _high;
Namespace for everything in libdcp.