summaryrefslogtreecommitdiff
path: root/src/transfer_function.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-10-21 23:03:43 +0200
committerCarl Hetherington <cth@carlh.net>2023-10-22 00:05:28 +0200
commit251f7a934525e0c846c95cc729664e95928e8aa5 (patch)
treea41b5555f411afb83d4a73e5d2c945591f96788b /src/transfer_function.h
parent5c711929b4f1670ef756a7e54ea59d207c7253a6 (diff)
Support integer LUTs.
Diffstat (limited to 'src/transfer_function.h')
-rw-r--r--src/transfer_function.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/transfer_function.h b/src/transfer_function.h
index 033c3045..2340ebfd 100644
--- a/src/transfer_function.h
+++ b/src/transfer_function.h
@@ -62,6 +62,7 @@ public:
/** @return A look-up table (of size 2^bit_depth) */
std::vector<double> const& double_lut(double from, double to, int bit_depth, bool inverse) const;
+ std::vector<int> const& int_lut(double from, double to, int bit_depth, bool inverse, int scale) const;
virtual bool about_equal (std::shared_ptr<const TransferFunction> other, double epsilon) const = 0;
@@ -69,11 +70,15 @@ protected:
virtual std::vector<double> make_double_lut(double from, double to, int bit_depth, bool inverse) const = 0;
private:
+ std::vector<int> make_int_lut(double from, double to, int bit_depth, bool inverse, int scale) const;
+ std::vector<double> const& double_lut_unlocked(double from, double to, int bit_depth, bool inverse) const;
+
struct LUTDescriptor {
double from;
double to;
int bit_depth;
bool inverse;
+ int scale;
bool operator==(LUTDescriptor const& other) const;
};
@@ -82,8 +87,9 @@ private:
std::size_t operator()(LUTDescriptor const& desc) const;
};
- mutable std::unordered_map<LUTDescriptor, std::vector<double>, LUTDescriptorHasher> _luts;
- /** mutex to protect _luts */
+ mutable std::unordered_map<LUTDescriptor, std::vector<double>, LUTDescriptorHasher> _double_luts;
+ mutable std::unordered_map<LUTDescriptor, std::vector<int>, LUTDescriptorHasher> _int_luts;
+ /** mutex to protect _double_luts and _int_luts */
mutable boost::mutex _mutex;
};