diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-05-05 20:56:14 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-05-05 21:09:40 +0200 |
| commit | cbbb9e63b7ec7a5c34f186ceafe5da6be8faa739 (patch) | |
| tree | 79ccaa11973954138df02c2022b2ea25c0717b9d /src/identity_transfer_function.cc | |
| parent | ad7244de981a7dd0b9b4f8f3d62d4704f1968012 (diff) | |
Allow LUTs to be created with a particular range.
Diffstat (limited to 'src/identity_transfer_function.cc')
| -rw-r--r-- | src/identity_transfer_function.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/identity_transfer_function.cc b/src/identity_transfer_function.cc index c888bd3e..b6f03d07 100644 --- a/src/identity_transfer_function.cc +++ b/src/identity_transfer_function.cc @@ -49,12 +49,13 @@ using namespace dcp; vector<double> -IdentityTransferFunction::make_lut (int bit_depth, bool) const +IdentityTransferFunction::make_lut (double from, double to, int bit_depth, bool) const { int const bit_length = int(std::pow(2.0f, bit_depth)); auto lut = vector<double>(bit_length); for (int i = 0; i < bit_length; ++i) { - lut[i] = double(i) / (bit_length - 1); + double x = double(i) / (bit_length - 1); + lut[i] = (x * (to - from)) + from; } return lut; |
