- _luts[descriptor] = make_double_lut(from, to, bit_depth, inverse);
- return _luts[descriptor];
+ _int_luts[descriptor] = make_int_lut(from, to, bit_depth, inverse, scale);
+ return _int_luts[descriptor];
+}
+
+
+/* Caller must hold lock on _mutex */
+vector<int>
+TransferFunction::make_int_lut(double from, double to, int bit_depth, bool inverse, int scale) const
+{
+ auto source_lut = double_lut_unlocked(from, to, bit_depth, inverse);
+ auto const size = source_lut.size();
+ vector<int> lut(size);
+ for (size_t i = 0; i < size; ++i) {
+ lut[i] = lrint(source_lut[i] * scale);
+ }
+
+ return lut;