Revision: 18896
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18896
Author:   campbellbarton
Date:     2009-02-10 03:43:35 +0100 (Tue, 10 Feb 2009)

Log Message:
-----------
dpx/cineon was using the OUTPUT settings when loading DPX - white point, 
blackpoint, gamma, log.
Allow DPX's with different color channel types to load, even if they are 
unsupported.

Saving log DPX's is broken, the header will always be written with log off 
because dpxCreate is called before the image presets are set. However there is 
no access to image presets before running dpxCreate() so log data is written 
but the header always sets it off.
Made a fix for this but couldn't test because it seems loading log images is 
also broken.

Enable verbose DPX output when '-d' debug flag is used.

Modified Paths:
--------------
    trunk/blender/source/blender/imbuf/intern/cineon/cineon_dpx.c
    trunk/blender/source/blender/imbuf/intern/cineon/dpxlib.c

Modified: trunk/blender/source/blender/imbuf/intern/cineon/cineon_dpx.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/cineon/cineon_dpx.c       
2009-02-10 02:39:19 UTC (rev 18895)
+++ trunk/blender/source/blender/imbuf/intern/cineon/cineon_dpx.c       
2009-02-10 02:43:35 UTC (rev 18896)
@@ -56,7 +56,6 @@
 
 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;
@@ -64,7 +63,7 @@
        int width, height, depth;
        float *frow;
 
-       cineon_conversion_parameters(&conversion);
+       logImageSetVerbose((G.f & G_DEBUG) ? 1:0);
        
        image = logImageOpenFromMem(mem, size, use_cineon);
        
@@ -85,15 +84,13 @@
                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");
        frow = ibuf->rect_float+width*height*4;
        
        for (y = 0; y < height; y++) {
-               logImageGetRowBytes(image, row, y);
+               logImageGetRowBytes(image, row, y); /* checks 
image->params.doLogarithm and convert */
                upix = row;
                frow -= width*4;
                
@@ -143,7 +140,7 @@
                }
        }
        
-       logImageSetVerbose(0);
+       logImageSetVerbose((G.f & G_DEBUG) ? 1:0);
        logImage = logImageCreate(filename, use_cineon, width, height, depth);
 
        if (!logImage) return 0;

Modified: trunk/blender/source/blender/imbuf/intern/cineon/dpxlib.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/cineon/dpxlib.c   2009-02-10 
02:39:19 UTC (rev 18895)
+++ trunk/blender/source/blender/imbuf/intern/cineon/dpxlib.c   2009-02-10 
02:43:35 UTC (rev 18896)
@@ -477,19 +477,49 @@
 
        logImageGetByteConversionDefaults(&dpx->params);
        /* The SMPTE define this code:
+        *  0 - User-defined
+        *  1 - Printing density
         *  2 - Linear
         *  3 - Logarithmic
+        *  4 - Unspecified video
+        *  5 - SMPTE 240M
+        *  6 - CCIR 709-1
+        *  7 - CCIR 601-2 system B or G
+        *  8 - CCIR 601-2 system M
+        *  9 - NTSC composite video
+        *  10 - PAL composite video
+        *  11 - Z linear
+        *  12 - homogeneous
         *
         * Note that transfer_characteristics is U8, don't need
         * check the byte order.
         */
+       
        switch (header.imageInfo.channel[0].transfer_characteristics) {
-               case 2:
+               case 1:
+               case 2: /* linear */
                        dpx->params.doLogarithm= 0;
                        break;
+               
                case 3:
                        dpx->params.doLogarithm= 1;
                        break;
+               
+               /* TODO - Unsupported, but for now just load them,
+                * colors may look wrong, but can solve color conversion later
+                */
+               case 4: 
+               case 5:
+               case 6:
+               case 7:
+               case 8:
+               case 9:
+               case 10:
+               case 11:
+               case 12:
+                       if (verbose) d_printf("Un-supported Transfer 
Characteristics: %d using linear color conversion\n", 
header.imageInfo.channel[0].transfer_characteristics);
+                       dpx->params.doLogarithm= 0;
+                       break;
                default:
                        if (verbose) d_printf("Un-supported Transfer 
Characteristics: %d\n", header.imageInfo.channel[0].transfer_characteristics);
                        dpxClose(dpx);


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to