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:
authorAntony Riakiotakis <kalast@gmail.com>2015-07-13 14:58:17 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-07-13 14:58:17 +0300
commite142ae77cadf04103fbc643f21cf60891862f6a8 (patch)
tree142e25fccd5ba3e748a1652706e7e4f1220ca289 /source/blender/imbuf/IMB_imbuf_types.h
parent107bbee4c763c95ea5d07a3b2f08bfe3b6adb24c (diff)
Imbuf types refactor.
ImBuf types were getting stored as bitflags in a 32bit integer which had already run out of space. Solved the problem by separating file type to an ftype enum, and file specific options to foptions. Reviewed by Campbell, thanks a lot!
Diffstat (limited to 'source/blender/imbuf/IMB_imbuf_types.h')
-rw-r--r--source/blender/imbuf/IMB_imbuf_types.h144
1 files changed, 76 insertions, 68 deletions
diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h
index 862c587f75b..4af63131740 100644
--- a/source/blender/imbuf/IMB_imbuf_types.h
+++ b/source/blender/imbuf/IMB_imbuf_types.h
@@ -65,6 +65,80 @@ typedef struct DDSData {
* Also; add new variables to the end to save pain!
*
*/
+
+/* ibuf->ftype flag, main image types */
+enum eImbTypes {
+ IMB_FTYPE_PNG = 1,
+ IMB_FTYPE_TGA,
+ IMB_FTYPE_JPG,
+ IMB_FTYPE_BMP,
+ IMB_FTYPE_OPENEXR,
+ IMB_FTYPE_IMAGIC,
+#ifdef WITH_OPENIMAGEIO
+ IMB_FTYPE_PSD,
+#endif
+#ifdef WITH_OPENJPEG
+ IMB_FTYPE_JP2,
+#endif
+#ifdef WITH_HDR
+ IMB_FTYPE_RADHDR,
+#endif
+#ifdef WITH_TIFF
+ IMB_FTYPE_TIF,
+#endif
+#ifdef WITH_CINEON
+ IMB_FTYPE_CINEON,
+ IMB_FTYPE_DPX,
+#endif
+
+#ifdef WITH_DDS
+ IMB_FTYPE_DDS,
+#endif
+};
+
+/* ibuf->foptions flag, type specific options.
+ * 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
+#define CINEON_LOG (1 << 8)
+#define CINEON_16BIT (1 << 7)
+#define CINEON_12BIT (1 << 6)
+#define CINEON_10BIT (1 << 5)
+#endif
+
+#ifdef WITH_OPENJPEG
+#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
+#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 {
+ short flag;
+ char quality; /* quality serves dual purpose as quality number for jpeg or compression amount for png */
+} ImbFormatOptions;
+
typedef struct ImBuf {
struct ImBuf *next, *prev; /**< allow lists of ImBufs, for caches or flipbooks */
@@ -113,7 +187,8 @@ typedef struct ImBuf {
void *userdata; /* temporary storage */
/* file information */
- int ftype; /* file type we are going to save as */
+ enum eImbTypes ftype; /* file type we are going to save as */
+ ImbFormatOptions foptions; /* file format specific flags */
char name[IB_FILENAME_SIZE]; /* filename associated with this image */
char cachename[IB_FILENAME_SIZE]; /* full filename used for reading from cache */
@@ -175,73 +250,6 @@ typedef struct ImBuf {
#define IB_thumbnail (1 << 15)
#define IB_multiview (1 << 16)
-/*
- * The bit flag is stored in the ImBuf.ftype variable.
- * Note that the lower 11 bits is used for storing custom flags
- */
-#define IB_CUSTOM_FLAGS_MASK 0x7ff
-
-#ifdef WITH_OPENIMAGEIO
-#define PSD (1 << 31)
-#endif
-
-#define PNG (1 << 30)
-#define TGA (1 << 28)
-#define JPG (1 << 27)
-#define BMP (1 << 26)
-
-#ifdef WITH_QUICKTIME
-#define QUICKTIME (1 << 25)
-#endif
-
-#ifdef WITH_HDR
-#define RADHDR (1 << 24)
-#endif
-#ifdef WITH_TIFF
-#define TIF (1 << 23)
-#define TIF_16BIT (1 << 8 )
-#endif
-
-#define OPENEXR (1 << 22)
-#define OPENEXR_HALF (1 << 8 )
-#define OPENEXR_COMPRESS (15)
-
-#ifdef WITH_CINEON
-#define CINEON (1 << 21)
-#define DPX (1 << 20)
-#define CINEON_LOG (1 << 8)
-#define CINEON_16BIT (1 << 7)
-#define CINEON_12BIT (1 << 6)
-#define CINEON_10BIT (1 << 5)
-#endif
-
-#ifdef WITH_DDS
-#define DDS (1 << 19)
-#endif
-
-#ifdef WITH_OPENJPEG
-#define JP2 (1 << 18)
-#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)
-#endif
-
-#define PNG_16BIT (1 << 10)
-
-#define RAWTGA (TGA | 1)
-
-#define JPG_STD (JPG | (0 << 8))
-#define JPG_VID (JPG | (1 << 8))
-#define JPG_JST (JPG | (2 << 8))
-#define JPG_MAX (JPG | (3 << 8))
-#define JPG_MSK (0xffffff00)
-
-#define IMAGIC 0732
-
/**
* \name Imbuf preset profile tags
* \brief Some predefined color space profiles that 8 bit imbufs can represent