diff options
Diffstat (limited to 'source/blender/imbuf/intern/cineon')
-rw-r--r-- | source/blender/imbuf/intern/cineon/SConscript | 14 | ||||
-rw-r--r-- | source/blender/imbuf/intern/cineon/cineon_dpx.c | 32 | ||||
-rw-r--r-- | source/blender/imbuf/intern/cineon/cineonlib.c | 46 | ||||
-rw-r--r-- | source/blender/imbuf/intern/cineon/dpxlib.c | 93 | ||||
-rw-r--r-- | source/blender/imbuf/intern/cineon/logImageCore.c | 29 | ||||
-rw-r--r-- | source/blender/imbuf/intern/cineon/logImageCore.h | 10 | ||||
-rw-r--r-- | source/blender/imbuf/intern/cineon/logImageLib.c | 5 | ||||
-rw-r--r-- | source/blender/imbuf/intern/cineon/logImageLib.h | 1 | ||||
-rw-r--r-- | source/blender/imbuf/intern/cineon/logmemfile.c | 6 | ||||
-rw-r--r-- | source/blender/imbuf/intern/cineon/logmemfile.h | 2 |
10 files changed, 171 insertions, 67 deletions
diff --git a/source/blender/imbuf/intern/cineon/SConscript b/source/blender/imbuf/intern/cineon/SConscript index 9d3bbcbc058..f887516443c 100644 --- a/source/blender/imbuf/intern/cineon/SConscript +++ b/source/blender/imbuf/intern/cineon/SConscript @@ -4,13 +4,13 @@ Import ('env') source_files = env.Glob('*.c') incs = ['.', - '../../../blenkernel', - '../../', - '..', - '../../../blenlib', - 'intern/include', - '#/intern/guardedalloc', - '../../../makesdna'] + '../../../blenkernel', + '../../', + '..', + '../../../blenlib', + 'intern/include', + '#/intern/guardedalloc', + '../../../makesdna'] defs = [] diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c index 691b81745e0..514d6b5522b 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?G.scene->r.cineonblack:95; + params->whitePoint = G.scene?G.scene->r.cineonwhite:685; + params->gamma = G.scene?G.scene->r.cineongamma:1.7f; + params->doLogarithm = G.scene?G.scene->r.subimtype & R_CINEON_LOG:0; +} + 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... */ @@ -119,7 +135,13 @@ static int imb_save_dpx_cineon(ImBuf *buf, char *filename, int use_cineon, int f height = buf->y; depth = 3; - if (!buf->rect_float) return 0; + + if (!buf->rect_float) { + IMB_float_from_rect(buf); + if (!buf->rect_float) { /* in the unlikely event that converting to a float buffer fails */ + return 0; + } + } logImageSetVerbose(0); logImage = logImageCreate(filename, use_cineon, width, height, depth); diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c index 20f4e0d4de4..75516bbf3ae 100644 --- a/source/blender/imbuf/intern/cineon/cineonlib.c +++ b/source/blender/imbuf/intern/cineon/cineonlib.c @@ -67,12 +67,12 @@ fillCineonFileInfo(CineonFile* cineon, CineonFileInformation* fileInfo, const ch static void dumpCineonFileInfo(CineonFileInformation* fileInfo) { d_printf("\n--File Information--\n"); - d_printf("Magic: %8.8lX\n", (unsigned long)ntohl(fileInfo->magic_num)); - d_printf("Image Offset %ld\n", (long)ntohl(fileInfo->image_offset)); - d_printf("Generic Header size %ld\n", (long)ntohl(fileInfo->gen_hdr_size)); - d_printf("Industry Header size %ld\n", (long)ntohl(fileInfo->ind_hdr_size)); - d_printf("User Data size %ld\n", (long)ntohl(fileInfo->user_data_size)); - d_printf("File size %ld\n", (long)ntohl(fileInfo->file_size)); + d_printf("Magic: %8.8lX\n", (uintptr_t)ntohl(fileInfo->magic_num)); + d_printf("Image Offset %ld\n", (intptr_t)ntohl(fileInfo->image_offset)); + d_printf("Generic Header size %ld\n", (intptr_t)ntohl(fileInfo->gen_hdr_size)); + d_printf("Industry Header size %ld\n", (intptr_t)ntohl(fileInfo->ind_hdr_size)); + d_printf("User Data size %ld\n", (intptr_t)ntohl(fileInfo->user_data_size)); + d_printf("File size %ld\n", (intptr_t)ntohl(fileInfo->file_size)); d_printf("Version \"%s\"\n", fileInfo->vers); d_printf("File name \"%s\"\n", fileInfo->file_name); d_printf("Creation date \"%s\"\n", fileInfo->create_date); @@ -112,11 +112,11 @@ dumpCineonChannelInfo(CineonChannelInformation* chan) { default: d_printf(" (unknown)\n"); break; } d_printf(" Bits per pixel %d\n", chan->bits_per_pixel); - d_printf(" Pixels per line %ld\n", (long)ntohl(chan->pixels_per_line)); - d_printf(" Lines per image %ld\n", (long)ntohl(chan->lines_per_image)); - d_printf(" Ref low data %ld\n", (long)ntohl(chan->ref_low_data)); + d_printf(" Pixels per line %ld\n", (intptr_t)ntohl(chan->pixels_per_line)); + d_printf(" Lines per image %ld\n", (intptr_t)ntohl(chan->lines_per_image)); + d_printf(" Ref low data %ld\n", (intptr_t)ntohl(chan->ref_low_data)); d_printf(" Ref low quantity %f\n", ntohf(chan->ref_low_quantity)); - d_printf(" Ref high data %ld\n", (long)ntohl(chan->ref_high_data)); + d_printf(" Ref high data %ld\n", (intptr_t)ntohl(chan->ref_high_data)); d_printf(" Ref high quantity %f\n", ntohf(chan->ref_high_quantity)); } @@ -231,8 +231,8 @@ dumpCineonFormatInfo(CineonFormatInformation* formatInfo) { } else { d_printf(" positive\n"); } - d_printf("End of line padding %ld\n", (long)ntohl(formatInfo->line_padding)); - d_printf("End of channel padding %ld\n", (long)ntohl(formatInfo->channel_padding)); + d_printf("End of line padding %ld\n", (intptr_t)ntohl(formatInfo->line_padding)); + d_printf("End of channel padding %ld\n", (intptr_t)ntohl(formatInfo->channel_padding)); } static void @@ -256,8 +256,8 @@ fillCineonOriginationInfo(CineonFile* cineon, static void dumpCineonOriginationInfo(CineonOriginationInformation* originInfo) { d_printf("\n--Origination Information--\n"); - d_printf("X offset %ld\n", (long)ntohl(originInfo->x_offset)); - d_printf("Y offset %ld\n", (long)ntohl(originInfo->y_offset)); + d_printf("X offset %ld\n", (intptr_t)ntohl(originInfo->x_offset)); + d_printf("Y offset %ld\n", (intptr_t)ntohl(originInfo->y_offset)); d_printf("File name \"%s\"\n", originInfo->file_name); d_printf("Creation date \"%s\"\n", originInfo->create_date); d_printf("Creation time \"%s\"\n", originInfo->create_time); @@ -350,8 +350,10 @@ cineonGetRowBytes(CineonFile* cineon, unsigned short* row, int y) { /* extract required pixels */ for (pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex) { - /* row[pixelIndex] = cineon->lut10[cineon->pixelBuffer[pixelIndex]]; */ - row[pixelIndex] = cineon->pixelBuffer[pixelIndex] << 6; + if(cineon->params.doLogarithm) + row[pixelIndex] = cineon->lut10_16[cineon->pixelBuffer[pixelIndex]]; + else + row[pixelIndex] = cineon->pixelBuffer[pixelIndex] << 6; } return 0; @@ -367,8 +369,10 @@ cineonSetRowBytes(CineonFile* cineon, const unsigned short* row, int y) { /* put new pixels into pixelBuffer */ for (pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex) { - /* cineon->pixelBuffer[pixelIndex] = cineon->lut8[row[pixelIndex]]; */ - cineon->pixelBuffer[pixelIndex] = row[pixelIndex] >> 6; + if(cineon->params.doLogarithm) + cineon->pixelBuffer[pixelIndex] = cineon->lut16_16[row[pixelIndex]]; + else + cineon->pixelBuffer[pixelIndex] = row[pixelIndex] >> 6; } /* pack into longwords */ @@ -525,7 +529,7 @@ cineonOpen(const char* filename) { /* let's assume cineon files are always network order */ if (header.fileInfo.magic_num != ntohl(CINEON_FILE_MAGIC)) { if (verbose) d_printf("Bad magic number %8.8lX in \"%s\".\n", - (unsigned long)ntohl(header.fileInfo.magic_num), filename); + (uintptr_t)ntohl(header.fileInfo.magic_num), filename); cineonClose(cineon); return 0; } @@ -613,7 +617,7 @@ cineonOpenFromMem(unsigned char *mem, unsigned int size) { cineon->file = 0; cineon->reading = 1; - verbose = 1; + verbose = 0; if (size < sizeof(CineonGenericHeader)) { if (verbose) d_printf("Not enough data for header!\n"); cineonClose(cineon); @@ -624,7 +628,7 @@ cineonOpenFromMem(unsigned char *mem, unsigned int size) { /* let's assume cineon files are always network order */ if (header.fileInfo.magic_num != ntohl(CINEON_FILE_MAGIC)) { - if (verbose) d_printf("Bad magic number %8.8lX in\n", (unsigned long)ntohl(header.fileInfo.magic_num)); + if (verbose) d_printf("Bad magic number %8.8lX in\n", (uintptr_t)ntohl(header.fileInfo.magic_num)); cineonClose(cineon); return 0; diff --git a/source/blender/imbuf/intern/cineon/dpxlib.c b/source/blender/imbuf/intern/cineon/dpxlib.c index b769d1e6132..8a9adc73cdc 100644 --- a/source/blender/imbuf/intern/cineon/dpxlib.c +++ b/source/blender/imbuf/intern/cineon/dpxlib.c @@ -58,15 +58,15 @@ fillDpxChannelInfo(DpxFile* dpx, DpxChannelInformation* chan, int des) { static void dumpDpxChannelInfo(DpxChannelInformation* chan) { - d_printf(" Signage %ld", (long)ntohl(chan->signage)); - d_printf(" Ref low data %ld\n", (long)ntohl(chan->ref_low_data)); + d_printf(" Signage %ld", (intptr_t)ntohl(chan->signage)); + d_printf(" Ref low data %ld\n", (intptr_t)ntohl(chan->ref_low_data)); d_printf(" Ref low quantity %f\n", ntohf(chan->ref_low_quantity)); - d_printf(" Ref high data %ld\n", (long)ntohl(chan->ref_high_data)); + d_printf(" Ref high data %ld\n", (intptr_t)ntohl(chan->ref_high_data)); d_printf(" Ref high quantity %f\n", ntohf(chan->ref_high_quantity)); d_printf(" Designator1: %d,", chan->designator1); d_printf(" Bits per pixel %d\n", chan->bits_per_pixel); d_printf(" Packing: %d,", ntohs(chan->packing)); - d_printf(" Data Offset: %ld,", (long)ntohl(chan->data_offset)); + d_printf(" Data Offset: %ld,", (intptr_t)ntohl(chan->data_offset)); } static void @@ -110,19 +110,19 @@ static void dumpDpxFileInfo(DpxFileInformation* fileInfo) { d_printf("\n--File Information--\n"); d_printf("Magic: %8.8lX\n", (unsigned long)ntohl(fileInfo->magic_num)); - d_printf("Image Offset %ld\n", (long)ntohl(fileInfo->offset)); + d_printf("Image Offset %ld\n", (intptr_t)ntohl(fileInfo->offset)); d_printf("Version \"%s\"\n", fileInfo->vers); - d_printf("File size %ld\n", (long)ntohl(fileInfo->file_size)); - d_printf("Ditto key %ld\n", (long)ntohl(fileInfo->ditto_key)); - d_printf("Generic Header size %ld\n", (long)ntohl(fileInfo->gen_hdr_size)); - d_printf("Industry Header size %ld\n", (long)ntohl(fileInfo->ind_hdr_size)); - d_printf("User Data size %ld\n", (long)ntohl(fileInfo->user_data_size)); + d_printf("File size %ld\n", (intptr_t)ntohl(fileInfo->file_size)); + d_printf("Ditto key %ld\n", (intptr_t)ntohl(fileInfo->ditto_key)); + d_printf("Generic Header size %ld\n", (intptr_t)ntohl(fileInfo->gen_hdr_size)); + d_printf("Industry Header size %ld\n", (intptr_t)ntohl(fileInfo->ind_hdr_size)); + d_printf("User Data size %ld\n", (intptr_t)ntohl(fileInfo->user_data_size)); d_printf("File name \"%s\"\n", fileInfo->file_name); d_printf("Creation date \"%s\"\n", fileInfo->create_date); d_printf("Creator \"%s\"\n", fileInfo->creator); d_printf("Project \"%s\"\n", fileInfo->project); d_printf("Copyright \"%s\"\n", fileInfo->copyright); - d_printf("Key %ld\n", (long)ntohl(fileInfo->key)); + d_printf("Key %ld\n", (intptr_t)ntohl(fileInfo->key)); } static void @@ -150,8 +150,8 @@ dumpDpxImageInfo(DpxImageInformation* imageInfo) { d_printf("Image orientation %d,", ntohs(imageInfo->orientation)); n = ntohs(imageInfo->channels_per_image); d_printf("Channels %d\n", n); - d_printf("Pixels per line %ld\n", (long)ntohl(imageInfo->pixels_per_line)); - d_printf("Lines per image %ld\n", (long)ntohl(imageInfo->lines_per_image)); + d_printf("Pixels per line %ld\n", (intptr_t)ntohl(imageInfo->pixels_per_line)); + d_printf("Lines per image %ld\n", (intptr_t)ntohl(imageInfo->lines_per_image)); for (i = 0; i < n; ++i) { d_printf(" --Channel %d--\n", i); dumpDpxChannelInfo(&imageInfo->channel[i]); @@ -166,12 +166,12 @@ fillDpxOriginationInfo( static void dumpDpxOriginationInfo(DpxOriginationInformation* originInfo) { d_printf("\n--Origination Information--\n"); - d_printf("X offset %ld\n", (long)ntohl(originInfo->x_offset)); - d_printf("Y offset %ld\n", (long)ntohl(originInfo->y_offset)); + d_printf("X offset %ld\n", (intptr_t)ntohl(originInfo->x_offset)); + d_printf("Y offset %ld\n", (intptr_t)ntohl(originInfo->y_offset)); d_printf("X centre %f\n", ntohf(originInfo->x_centre)); d_printf("Y centre %f\n", ntohf(originInfo->y_centre)); - d_printf("Original X %ld\n", (long)ntohl(originInfo->x_original_size)); - d_printf("Original Y %ld\n", (long)ntohl(originInfo->y_original_size)); + d_printf("Original X %ld\n", (intptr_t)ntohl(originInfo->x_original_size)); + d_printf("Original Y %ld\n", (intptr_t)ntohl(originInfo->y_original_size)); d_printf("File name \"%s\"\n", originInfo->file_name); d_printf("Creation time \"%s\"\n", originInfo->creation_time); d_printf("Input device \"%s\"\n", originInfo->input_device); @@ -275,8 +275,10 @@ dpxGetRowBytes(DpxFile* dpx, unsigned short* row, int y) { /* extract required pixels */ for (pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex) { - /* row[pixelIndex] = dpx->lut10[dpx->pixelBuffer[pixelIndex]]; */ - row[pixelIndex] = dpx->pixelBuffer[pixelIndex] << 6; + if(dpx->params.doLogarithm) + row[pixelIndex] = dpx->lut10_16[dpx->pixelBuffer[pixelIndex]]; + else + row[pixelIndex] = dpx->pixelBuffer[pixelIndex] << 6; } /* save remaining pixels */ @@ -316,8 +318,10 @@ dpxSetRowBytes(DpxFile* dpx, const unsigned short* row, int y) { /* put new pixels into pixelBuffer */ for (pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex) { - /* dpx->pixelBuffer[dpx->pixelBufferUsed + pixelIndex] = dpx->lut8[row[pixelIndex]]; */ - dpx->pixelBuffer[dpx->pixelBufferUsed + pixelIndex] = row[pixelIndex] >> 6; + if(dpx->params.doLogarithm) + dpx->pixelBuffer[dpx->pixelBufferUsed + pixelIndex] = dpx->lut16_16[row[pixelIndex]]; + else + dpx->pixelBuffer[dpx->pixelBufferUsed + pixelIndex] = row[pixelIndex] >> 6; } dpx->pixelBufferUsed += numPixels; @@ -413,7 +417,7 @@ intern_dpxOpen(int mode, const char* bytestuff, int bufsize) { /* let's assume dpx files are always network order */ if (header.fileInfo.magic_num != ntohl(DPX_FILE_MAGIC)) { if (verbose) d_printf("Bad magic number %8.8lX in \"%s\".\n", - (unsigned long)ntohl(header.fileInfo.magic_num), filename); + (uintptr_t)ntohl(header.fileInfo.magic_num), filename); dpxClose(dpx); return 0; } @@ -437,10 +441,15 @@ intern_dpxOpen(int mode, const char* bytestuff, int bufsize) { default: break; } } - dpx->bitsPerPixel = 10; - /* dpx->bitsPerPixel = header.imageInfo.channel[0].bits_per_pixel; */ - dpx->imageOffset = ntohl(header.fileInfo.offset); + /* dpx->bitsPerPixel = 10; */ + dpx->bitsPerPixel = header.imageInfo.channel[0].bits_per_pixel; + if (dpx->bitsPerPixel != 10) { + if (verbose) d_printf("Don't support depth: %d\n", dpx->bitsPerPixel); + dpxClose(dpx); + return 0; + } + dpx->imageOffset = ntohl(header.fileInfo.offset); dpx->lineBufferLength = pixelsToLongs(dpx->width * dpx->depth); dpx->lineBuffer = malloc(dpx->lineBufferLength * 4); if (dpx->lineBuffer == 0) { @@ -467,6 +476,26 @@ intern_dpxOpen(int mode, const char* bytestuff, int bufsize) { dpx->fileYPos = 0; logImageGetByteConversionDefaults(&dpx->params); + /* The SMPTE define this code: + * 2 - Linear + * 3 - Logarithmic + * + * Note that transfer_characteristics is U8, don't need + * check the byte order. + */ + switch (header.imageInfo.channel[0].transfer_characteristics) { + case 2: + dpx->params.doLogarithm= 0; + break; + case 3: + dpx->params.doLogarithm= 1; + break; + default: + if (verbose) d_printf("Un-supported Transfer Characteristics: %d\n", header.imageInfo.channel[0].transfer_characteristics); + dpxClose(dpx); + return 0; + break; + } setupLut(dpx); dpx->getRow = &dpxGetRowBytes; @@ -559,6 +588,18 @@ dpxCreate(const char* filename, int width, int height, int depth) { ++shortFilename; } initDpxMainHeader(dpx, &header, shortFilename); + logImageGetByteConversionDefaults(&dpx->params); + /* Need set the file type before write the header! + * 2 - Linear + * 3 - Logarithmic + * + * Note that transfer characteristics is U8, don't need + * check the byte order. + */ + if (dpx->params.doLogarithm == 0) + header.imageInfo.channel[0].transfer_characteristics= 2; + else + header.imageInfo.channel[0].transfer_characteristics= 3; if (fwrite(&header, sizeof(header), 1, dpx->file) == 0) { if (verbose) d_printf("Couldn't write image header\n"); @@ -566,8 +607,6 @@ dpxCreate(const char* filename, int width, int height, int depth) { return 0; } dpx->fileYPos = 0; - - logImageGetByteConversionDefaults(&dpx->params); setupLut(dpx); dpx->getRow = 0; 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) { diff --git a/source/blender/imbuf/intern/cineon/logImageCore.h b/source/blender/imbuf/intern/cineon/logImageCore.h index 1af18d5e3b8..2646e8b3c12 100644 --- a/source/blender/imbuf/intern/cineon/logImageCore.h +++ b/source/blender/imbuf/intern/cineon/logImageCore.h @@ -34,7 +34,9 @@ extern "C" { #endif - +#include "BLO_sys_types.h" // for intptr_t support +#undef ntohl +#undef htonl typedef int (GetRowFn)(LogImageFile* logImage, unsigned short* row, int lineNum); typedef int (SetRowFn)(LogImageFile* logImage, const unsigned short* row, int lineNum); typedef void (CloseFn)(LogImageFile* logImage); @@ -71,17 +73,21 @@ struct _Log_Image_File_t_ unsigned char lut10[1024]; unsigned short lut8[256]; + unsigned short lut10_16[1024]; + unsigned short lut16_16[65536]; + /* pixel access functions */ GetRowFn* getRow; SetRowFn* setRow; CloseFn* close; unsigned char *membuffer; - unsigned long membuffersize; + uintptr_t membuffersize; unsigned char *memcursor; }; void setupLut(LogImageFile*); +void setupLut16(LogImageFile*); int pixelsToLongs(int numPixels); diff --git a/source/blender/imbuf/intern/cineon/logImageLib.c b/source/blender/imbuf/intern/cineon/logImageLib.c index ff209d5ebd0..2fc52959ff6 100644 --- a/source/blender/imbuf/intern/cineon/logImageLib.c +++ b/source/blender/imbuf/intern/cineon/logImageLib.c @@ -89,6 +89,7 @@ logImageGetByteConversionDefaults(LogImageByteConversionParameters* params) { params->gamma = DEFAULT_GAMMA; params->blackPoint = DEFAULT_BLACK_POINT; params->whitePoint = DEFAULT_WHITE_POINT; + params->doLogarithm = 0; return 0; } @@ -97,6 +98,7 @@ logImageGetByteConversion(const LogImageFile* logImage, LogImageByteConversionPa params->gamma = logImage->params.gamma; params->blackPoint = logImage->params.blackPoint; params->whitePoint = logImage->params.whitePoint; + params->doLogarithm = 0; return 0; } @@ -110,7 +112,8 @@ logImageSetByteConversion(LogImageFile* logImage, const LogImageByteConversionPa logImage->params.gamma = params->gamma; logImage->params.blackPoint = params->blackPoint; logImage->params.whitePoint = params->whitePoint; - setupLut(logImage); + logImage->params.doLogarithm = params->doLogarithm; + setupLut16(logImage); return 0; } return 1; diff --git a/source/blender/imbuf/intern/cineon/logImageLib.h b/source/blender/imbuf/intern/cineon/logImageLib.h index ea45c675fe2..617da1d0d92 100644 --- a/source/blender/imbuf/intern/cineon/logImageLib.h +++ b/source/blender/imbuf/intern/cineon/logImageLib.h @@ -47,6 +47,7 @@ typedef struct { float gamma; int blackPoint; int whitePoint; + int doLogarithm; } LogImageByteConversionParameters; /* int functions return 0 for OK */ diff --git a/source/blender/imbuf/intern/cineon/logmemfile.c b/source/blender/imbuf/intern/cineon/logmemfile.c index 20359335933..160e8453713 100644 --- a/source/blender/imbuf/intern/cineon/logmemfile.c +++ b/source/blender/imbuf/intern/cineon/logmemfile.c @@ -24,10 +24,10 @@ #include "logImageCore.h" -int logimage_fseek(void* logfile, long offsett, int origin) +int logimage_fseek(void* logfile, intptr_t offsett, int origin) { struct _Log_Image_File_t_ *file = (struct _Log_Image_File_t_*) logfile; - long offset = offsett; + intptr_t offset = offsett; if (file->file) fseek(file->file, offset, origin); else { /*we're seeking in memory*/ @@ -38,7 +38,7 @@ int logimage_fseek(void* logfile, long offsett, int origin) if (offset > file->membuffersize) return 1; file->memcursor = (file->membuffer + file->membuffersize) - offset; } else if (origin==SEEK_CUR) { - unsigned long pos = (unsigned long)file->membuffer - (unsigned long)file->memcursor; + uintptr_t pos = (uintptr_t)file->membuffer - (uintptr_t)file->memcursor; if (pos + offset > file->membuffersize) return 1; if (pos < 0) return 1; file->memcursor += offset; diff --git a/source/blender/imbuf/intern/cineon/logmemfile.h b/source/blender/imbuf/intern/cineon/logmemfile.h index 6e82cf2b145..39e2f36dad9 100644 --- a/source/blender/imbuf/intern/cineon/logmemfile.h +++ b/source/blender/imbuf/intern/cineon/logmemfile.h @@ -22,7 +22,7 @@ #ifndef _LOGMEMFILE_H #define _LOGMEMFILE_H -int logimage_fseek(void* logfile, long offsett, int origin); +int logimage_fseek(void* logfile, intptr_t offsett, int origin); int logimage_fwrite(void *buffer, unsigned int size, unsigned int count, void *logfile); int logimage_fread(void *buffer, unsigned int size, unsigned int count, void *logfile); |