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/cineon_dpx.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/cineon_dpx.c')
-rw-r--r-- | source/blender/imbuf/intern/cineon/cineon_dpx.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c index 691b81745e0..f00f6bc38c5 100644 --- a/source/blender/imbuf/intern/cineon/cineon_dpx.c +++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c @@ -42,14 +42,29 @@ #include "MEM_guardedalloc.h" +/* ugly bad level, should be fixed */ +#include "DNA_scene_types.h" +#include "BKE_global.h" + +static void cineon_conversion_parameters(LogImageByteConversionParameters *params) +{ + params->blackPoint = G.scene->r.cineonblack; + params->whitePoint = G.scene->r.cineonwhite; + params->gamma = G.scene->r.cineongamma; + params->doLogarithm = G.scene->r.subimtype & R_CINEON_LOG; +} + static struct ImBuf *imb_load_dpx_cineon(unsigned char *mem, int use_cineon, int size, int flags) { + LogImageByteConversionParameters conversion; ImBuf *ibuf; LogImageFile *image; int x, y; unsigned short *row, *upix; int width, height, depth; float *frow; + + cineon_conversion_parameters(&conversion); image = logImageOpenFromMem(mem, size, use_cineon); @@ -70,6 +85,8 @@ static struct ImBuf *imb_load_dpx_cineon(unsigned char *mem, int use_cineon, int return NULL; } + logImageSetByteConversion(image, &conversion); + ibuf = IMB_allocImBuf(width, height, 32, IB_rectfloat | flags, 0); row = MEM_mallocN(sizeof(unsigned short)*width*depth, "row in cineon_dpx.c"); @@ -107,10 +124,9 @@ static int imb_save_dpx_cineon(ImBuf *buf, char *filename, int use_cineon, int f int i, j; int index; float *fline; - - conversion.blackPoint = 95; - conversion.whitePoint = 685; - conversion.gamma = 1; + + cineon_conversion_parameters(&conversion); + /* * Get the drawable for the current image... */ |