Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-12-01 05:54:10 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-12-01 05:54:10 +0300
commitf801b2bcba276a26a68accb9167798c4facb9275 (patch)
tree64ea3576e772dff74146d58933a2beacdb95968d /source/blender/imbuf/intern/cineon
parentad0dd98f26bc681c92a0a1893c17a3bc484a0cb5 (diff)
bugfix [#23406] DPX Images load darker then saved, UI broken.
- a linear float buffer was being created and saved into a non-linear DPX/Cineon file. - removed the UI since the settings are not used at the moment. added a utility function IMB_float_profile_ensure(), which returns a float buffer in the requested profile, using the existing if needed or returning an allocated buffer if the profile is different to that of the ImBuf. - Useful this case where the save function has its own linear setting.
Diffstat (limited to 'source/blender/imbuf/intern/cineon')
-rw-r--r--source/blender/imbuf/intern/cineon/cineon_dpx.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c
index 816d2d27b78..1395b047113 100644
--- a/source/blender/imbuf/intern/cineon/cineon_dpx.c
+++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c
@@ -44,6 +44,7 @@
#include "MEM_guardedalloc.h"
+#if 0
static void cineon_conversion_parameters(LogImageByteConversionParameters *params)
{
// params->blackPoint = scene?scene->r.cineonblack:95;
@@ -55,8 +56,8 @@ static void cineon_conversion_parameters(LogImageByteConversionParameters *param
params->whitePoint = 685;
params->gamma = 1.0f;
params->doLogarithm = 0;
-
}
+#endif
static struct ImBuf *imb_load_dpx_cineon(unsigned char *mem, int use_cineon, int size, int flags)
{
@@ -116,34 +117,33 @@ static struct ImBuf *imb_load_dpx_cineon(unsigned char *mem, int use_cineon, int
return ibuf;
}
-static int imb_save_dpx_cineon(ImBuf *buf, const char *filename, int use_cineon, int flags)
+static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filename, int use_cineon, int flags)
{
LogImageByteConversionParameters conversion;
- int width, height, depth;
+ const int width= ibuf->x;
+ const int height= ibuf->y;
+ const int depth= 3;
LogImageFile* logImage;
unsigned short* line, *pixel;
int i, j;
int index;
float *fline;
+ float *fbuf;
+ int is_alloc= 0;
(void)flags; /* unused */
- cineon_conversion_parameters(&conversion);
+ // cineon_conversion_parameters(&conversion);
+ logImageGetByteConversionDefaults(&conversion);
/*
* Get the drawable for the current image...
*/
- width = buf->x;
- height = buf->y;
- depth = 3;
-
-
- 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;
- }
+ fbuf= IMB_float_profile_ensure(ibuf, conversion.doLogarithm ? IB_PROFILE_LINEAR_RGB : IB_PROFILE_NONE, &is_alloc);
+
+ if (fbuf == NULL) { /* in the unlikely event that converting to a float buffer fails */
+ return 0;
}
logImageSetVerbose((G.f & G_DEBUG) ? 1:0);
@@ -151,14 +151,16 @@ static int imb_save_dpx_cineon(ImBuf *buf, const char *filename, int use_cineon,
if (!logImage) return 0;
- logImageSetByteConversion(logImage, &conversion);
+ if(logImageSetByteConversion(logImage, &conversion)==0) {
+ printf("error setting args\n");
+ }
index = 0;
line = MEM_mallocN(sizeof(unsigned short)*depth*width, "line");
/*note that image is flipped when sent to logImageSetRowBytes (see last passed parameter).*/
for (j = 0; j < height; ++j) {
- fline = &buf->rect_float[width*j*4];
+ fline = &fbuf[width*j*4];
for (i=0; i<width; i++) {
float *fpix, fpix2[3];
/*we have to convert to cinepaint's 16-bit-per-channel here*/
@@ -179,6 +181,11 @@ static int imb_save_dpx_cineon(ImBuf *buf, const char *filename, int use_cineon,
logImageClose(logImage);
MEM_freeN(line);
+
+ if(is_alloc) {
+ MEM_freeN(fbuf);
+ }
+
return 1;
}