[Bf-blender-cvs] [32ea965] temp_imbuf_types_refactor: Make imbuf flags 16 bits.

Antony Riakiotakis noreply at git.blender.org
Mon Jul 13 13:03:38 CEST 2015


Commit: 32ea9651f7dbb4e6f320d8c41d40ef6d41ed06f0
Author: Antony Riakiotakis
Date:   Mon Jul 13 13:03:30 2015 +0200
Branches: temp_imbuf_types_refactor
https://developer.blender.org/rB32ea9651f7dbb4e6f320d8c41d40ef6d41ed06f0

Make imbuf flags 16 bits.

We can clean up and decrease flags a bit more now, but left changes
to the bare minimum.
Some flags such as OpenEXR compression are used in DNA as well (should
be fixed at some point)

===================================================================

M	source/blender/blenkernel/intern/dynamicpaint.c
M	source/blender/imbuf/IMB_imbuf_types.h
M	source/blender/imbuf/intern/jpeg.c

===================================================================

diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 730ea64..a3ec2dd 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -2791,7 +2791,7 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char *filenam
 #ifdef WITH_OPENEXR
 	if (format == R_IMF_IMTYPE_OPENEXR) {   /* OpenEXR 32-bit float */
 		ibuf->ftype = IB_FTYPE_OPENEXR;
-		ibuf->foptions.flag = OPENEXR_COMPRESS;
+		ibuf->foptions.flag |= OPENEXR_COMPRESS;
 	}
 #endif
 
diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h
index 11db55d..2e7f26e 100644
--- a/source/blender/imbuf/IMB_imbuf_types.h
+++ b/source/blender/imbuf/IMB_imbuf_types.h
@@ -100,6 +100,7 @@ enum eImbTypes {
  * Some formats include compression rations on some bits */
 
 #define OPENEXR_HALF	(1 << 8 )
+/* careful changing this, it's used in DNA as well */
 #define OPENEXR_COMPRESS (15)
 
 #ifdef WITH_CINEON
@@ -110,31 +111,31 @@ enum eImbTypes {
 #endif
 
 #ifdef WITH_OPENJPEG
-#define JP2_12BIT		(1 << 17)
-#define JP2_16BIT		(1 << 16)
-#define JP2_YCC			(1 << 15)
-#define JP2_CINE		(1 << 14)
-#define JP2_CINE_48FPS	(1 << 13)
-#define JP2_JP2	(1 << 12)
-#define JP2_J2K	(1 << 11)
+#define JP2_12BIT		(1 << 9)
+#define JP2_16BIT		(1 << 8)
+#define JP2_YCC			(1 << 7)
+#define JP2_CINE		(1 << 6)
+#define JP2_CINE_48FPS	(1 << 5)
+#define JP2_JP2	(1 << 4)
+#define JP2_J2K	(1 << 3)
 #endif
 
 #define PNG_16BIT			(1 << 10)
 
 #define RAWTGA	        1
 
-#define JPG_STD	        (0 << 8)
-#define JPG_VID	        (1 << 8)
-#define JPG_JST	        (2 << 8)
-#define JPG_MAX	        (3 << 8)
-#define JPG_MSK	        (0xffffff00)
+#define JPG_STD	        0
+#define JPG_VID	        1
+#define JPG_JST	        2
+#define JPG_MAX	        3
+#define JPG_MSK	        0x03
 
 #ifdef WITH_TIFF
 #define TIF_16BIT		(1 << 8 )
 #endif
 
 typedef struct ImbFormatOptions {
-	int flag;
+	short flag;
 	char quality; /* quality serves dual purpose as quality number for jpeg or compression amount for png */
 } ImbFormatOptions;
 
diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c
index 5ae8dd0..ccc365d 100644
--- a/source/blender/imbuf/intern/jpeg.c
+++ b/source/blender/imbuf/intern/jpeg.c
@@ -486,7 +486,7 @@ static void write_jpeg(struct jpeg_compress_struct *cinfo, struct ImBuf *ibuf)
 	jpeg_start_compress(cinfo, true);
 
 	strcpy(neogeo, "NeoGeo");
-	ibuf_foptions = BIG_LONG(ibuf->foptions.flag | (int)ibuf->foptions.quality);
+	ibuf_foptions = BIG_LONG((((int)ibuf->foptions.flag) << 8) | (int)ibuf->foptions.quality);
 	
 	memcpy(neogeo + 6, &ibuf_foptions, 4);
 	jpeg_write_marker(cinfo, 0xe1, (JOCTET *) neogeo, 10);




More information about the Bf-blender-cvs mailing list