diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-03-10 14:39:37 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-03-10 14:39:37 +0300 |
commit | 0ec0f2a02fb4d6e87db8fe8c7b9027ceab0263af (patch) | |
tree | 20ca8b404098b87ac8539578809b852ce829a988 /source/blender/imbuf/intern/cineon/logImageCore.c | |
parent | 397ece000812b6acd96f4131c1e2f31cd72be0ab (diff) |
Add an option for saving/loading DPX with in log color space with
reference black, reference white and gamma.
Added 16 bit TIFF saving.
This needs more work to cleanup code and add 16 bit TIFF reading, but
committing it now so it can be tested.
Diffstat (limited to 'source/blender/imbuf/intern/cineon/logImageCore.c')
-rw-r--r-- | source/blender/imbuf/intern/cineon/logImageCore.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/imbuf/intern/cineon/logImageCore.c b/source/blender/imbuf/intern/cineon/logImageCore.c index e88e9241443..6032f342ed8 100644 --- a/source/blender/imbuf/intern/cineon/logImageCore.c +++ b/source/blender/imbuf/intern/cineon/logImageCore.c @@ -93,6 +93,35 @@ setupLut(LogImageFile *logImage) { } } +/* set up the 10 bit to 16 bit and 16 bit to 10 bit tables */ +void +setupLut16(LogImageFile *logImage) { + + int i; + double f_black; + double scale; + + f_black = convertTo(logImage->params.blackPoint, logImage->params.whitePoint, logImage->params.gamma); + scale = 65535.0 / (1.0 - f_black); + + for (i = 0; i <= logImage->params.blackPoint; ++i) { + logImage->lut10_16[i] = 0; + } + for (; i < logImage->params.whitePoint; ++i) { + double f_i; + f_i = convertTo(i, logImage->params.whitePoint, logImage->params.gamma); + logImage->lut10_16[i] = (int)rint(scale * (f_i - f_black)); + } + for (; i < 1024; ++i) { + logImage->lut10_16[i] = 65535; + } + + for (i = 0; i < 65536; ++i) { + double f_i = f_black + (i / 65535.0) * (1.0 - f_black); + logImage->lut16_16[i] = convertFrom(f_i, logImage->params.whitePoint, logImage->params.gamma); + } +} + /* how many longwords to hold this many pixels? */ int pixelsToLongs(int numPixels) { |