diff options
author | Joseph Eagar <joeedh@gmail.com> | 2007-03-11 15:27:57 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2007-03-11 15:27:57 +0300 |
commit | dcd74620e5e0a3cccd093dca00301e8d818a0353 (patch) | |
tree | 7d141470af0fbeb89df626ac369c8133c9d969e6 /source | |
parent | d0d9899e7615d71e1cb1036d2a9c0a15fdb41f54 (diff) |
=Cineon Bug=
In my attempts to get cinepaint's cineon code to work with files in memory,
I accidently rewrote something that should have been left as it is. This
causes images whose image buffers didn't start right after the cineon header to
become "shifted" to the left.
The DPX code looks correct, though.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/imbuf/intern/cineon/cineon_dpx.c | 22 | ||||
-rw-r--r-- | source/blender/imbuf/intern/cineon/cineonlib.c | 3 |
2 files changed, 12 insertions, 13 deletions
diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c index 4058f27b929..691b81745e0 100644 --- a/source/blender/imbuf/intern/cineon/cineon_dpx.c +++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c @@ -47,7 +47,7 @@ static struct ImBuf *imb_load_dpx_cineon(unsigned char *mem, int use_cineon, int ImBuf *ibuf; LogImageFile *image; int x, y; - unsigned short *row; + unsigned short *row, *upix; int width, height, depth; float *frow; @@ -64,6 +64,7 @@ static struct ImBuf *imb_load_dpx_cineon(unsigned char *mem, int use_cineon, int logImageClose(image); return NULL; } + if (width == 0 && height == 0) { logImageClose(image); return NULL; @@ -72,23 +73,20 @@ static struct ImBuf *imb_load_dpx_cineon(unsigned char *mem, int use_cineon, int ibuf = IMB_allocImBuf(width, height, 32, IB_rectfloat | flags, 0); row = MEM_mallocN(sizeof(unsigned short)*width*depth, "row in cineon_dpx.c"); + frow = ibuf->rect_float+width*height*4; for (y = 0; y < height; y++) { - unsigned int index = (width) * (height-y-1); - index = index * 4; - - frow = &ibuf->rect_float[index]; - logImageGetRowBytes(image, row, y); + upix = row; + frow -= width*4; for (x=0; x<width; x++) { - unsigned short *upix = &row[x*depth]; - float *fpix = &frow[x*4]; - fpix[0] = ((float)upix[0]) / 65535.0f; - fpix[1] = ((float)upix[1]) / 65535.0f; - fpix[2] = ((float)upix[2]) / 65535.0f; - fpix[3] = 1.0f; + *(frow++) = ((float)*(upix++)) / 65535.0f; + *(frow++) = ((float)*(upix++)) / 65535.0f; + *(frow++) = ((float)*(upix++)) / 65535.0f; + *(frow++) = 1.0f; } + frow -= width*4; } MEM_freeN(row); diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c index 5253646be4d..91973927fab 100644 --- a/source/blender/imbuf/intern/cineon/cineonlib.c +++ b/source/blender/imbuf/intern/cineon/cineonlib.c @@ -662,11 +662,12 @@ cineonOpenFromMem(unsigned char *mem, unsigned int size) { i = cineon->imageOffset; - if (i >= size) { + if (logimage_fseek(cineon, cineon->imageOffset, SEEK_SET) != 0) { if (verbose) d_printf("Couldn't seek to image data at %d\n", cineon->imageOffset); cineonClose(cineon); return 0; } + cineon->fileYPos = 0; logImageGetByteConversionDefaults(&cineon->params); |