[Bf-blender-cvs] [67a6934] KTX_support: Merge branch 'temp_imbuf_types_refactor' into KTX_support
Antony Riakiotakis
noreply at git.blender.org
Mon Jun 8 12:18:10 CEST 2015
Commit: 67a6934dcbfaf8e15244c8f99712f2391635e429
Author: Antony Riakiotakis
Date: Mon Jun 8 12:17:15 2015 +0200
Branches: KTX_support
https://developer.blender.org/rB67a6934dcbfaf8e15244c8f99712f2391635e429
Merge branch 'temp_imbuf_types_refactor' into KTX_support
Conflicts:
source/blender/blenkernel/BKE_image.h
source/blender/blenkernel/intern/image.c
source/blender/imbuf/IMB_imbuf_types.h
===================================================================
===================================================================
diff --cc source/blender/blenkernel/intern/image.c
index 1d3246d,b2e607f..87e1db6
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@@ -1256,41 -1262,39 +1262,43 @@@ char BKE_image_ftype_to_imtype(const in
else if (ftype == IMAGIC)
return R_IMF_IMTYPE_IRIS;
#ifdef WITH_HDR
- else if (ftype & RADHDR)
+ else if (ftype == RADHDR)
return R_IMF_IMTYPE_RADHDR;
#endif
- else if (ftype & PNG)
+ else if (ftype == PNG)
return R_IMF_IMTYPE_PNG;
#ifdef WITH_DDS
- else if (ftype & DDS)
+ else if (ftype == DDS)
return R_IMF_IMTYPE_DDS;
#endif
- else if (ftype & BMP)
+ else if (ftype == BMP)
return R_IMF_IMTYPE_BMP;
#ifdef WITH_TIFF
- else if (ftype & TIF)
+ else if (ftype == TIF)
return R_IMF_IMTYPE_TIFF;
#endif
- else if (ftype & OPENEXR)
+ else if (ftype == OPENEXR)
return R_IMF_IMTYPE_OPENEXR;
#ifdef WITH_CINEON
- else if (ftype & CINEON)
+ else if (ftype == CINEON)
return R_IMF_IMTYPE_CINEON;
- else if (ftype & DPX)
+ else if (ftype == DPX)
return R_IMF_IMTYPE_DPX;
#endif
- else if (ftype & TGA)
- return R_IMF_IMTYPE_TARGA;
- else if (ftype & RAWTGA)
- return R_IMF_IMTYPE_RAWTGA;
+ else if (ftype == TGA) {
+ if (options & RAWTGA)
+ return R_IMF_IMTYPE_RAWTGA;
+ else
+ return R_IMF_IMTYPE_TARGA;
+ }
#ifdef WITH_OPENJPEG
- else if (ftype & JP2)
+ else if (ftype == JP2)
return R_IMF_IMTYPE_JP2;
#endif
+#ifdef WITH_KTX
- else if (ftype & KTX)
++ else if (ftype == KTX)
+ return R_IMF_IMTYPE_KTX;
+#endif
else
return R_IMF_IMTYPE_JPEG90;
}
@@@ -1694,11 -1690,6 +1701,11 @@@ void BKE_imbuf_to_image_format(struct I
}
#endif
+#ifdef WITH_KTX
- else if (ftype & KTX) {
++ else if (ftype == KTX) {
+ im_format->imtype = R_IMF_IMTYPE_KTX;
+ }
+#endif
else {
im_format->imtype = R_IMF_IMTYPE_JPEG90;
im_format->quality = custom_flags & ~JPG_MSK;
diff --cc source/blender/imbuf/IMB_imbuf_types.h
index 1627fe7,dc5c452..1d5e315
--- a/source/blender/imbuf/IMB_imbuf_types.h
+++ b/source/blender/imbuf/IMB_imbuf_types.h
@@@ -65,6 -65,78 +65,82 @@@ typedef struct DDSData
* Also; add new variables to the end to save pain!
*
*/
+
+ /* ibuf->ftype flag, main image types */
+ enum eImbTypes {
+ PNG = 1,
+ TGA,
+ JPG,
+ BMP,
+ OPENEXR,
+ IMAGIC,
+ #ifdef WITH_OPENIMAGEIO
+ PSD,
+ #endif
+ #ifdef WITH_OPENJPEG
+ JP2,
+ #endif
+ #ifdef WITH_QUICKTIME
+ QUICKTIME,
+ #endif
+ #ifdef WITH_HDR
+ RADHDR,
+ #endif
+ #ifdef WITH_TIFF
+ TIF,
+ #endif
+ #ifdef WITH_CINEON
+ CINEON,
+ DPX,
+ #endif
+
+ #ifdef WITH_DDS
+ DDS,
+ #endif
++
++#ifdef WITH_KTX
++ KTX,
++#endif
+ };
+
+ /* ibuf->foptions flag, type specific options.
+ * Some formats include compression rations on some bits */
+
+ #define OPENEXR_HALF (1 << 8 )
+ #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 << 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 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)
+
+ #ifdef WITH_TIFF
+ #define TIF_16BIT (1 << 8 )
+ #endif
+
+
typedef struct ImBuf {
struct ImBuf *next, *prev; /**< allow lists of ImBufs, for caches or flipbooks */
@@@ -174,80 -245,9 +249,9 @@@
#define IB_alphamode_premul (1 << 12) /* indicates whether image on disk have premul alpha */
#define IB_alphamode_detect (1 << 13) /* if this flag is set, alpha mode would be guessed from file */
#define IB_ignore_alpha (1 << 14) /* ignore alpha on load and substitude it with 1.0f */
-#define IB_thumbnail (1 << 15)
+#define IB_thumbnail (1 << 15) /* only used as a flag during thumbnail creation */
#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_KTX
- #define KTX (1LL << 32)
- #endif
-
- #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
diff --cc source/blender/imbuf/intern/filetype.c
index db13700,0e1b3a7..7f3ac32
--- a/source/blender/imbuf/intern/filetype.c
+++ b/source/blender/imbuf/intern/filetype.c
@@@ -51,11 -51,11 +51,11 @@@
#include "quicktime_import.h"
#endif
-static int imb_ftype_default(const ImFileType *type, ImBuf *ibuf)
+static long long int imb_ftype_default(const ImFileType *type, ImBuf *ibuf)
{
- return (ibuf->ftype & type->filetype);
+ return (ibuf->ftype == type->filetype);
}
-static int imb_ftype_iris(const ImFileType *type, ImBuf *ibuf)
+static long long int imb_ftype_iris(const ImFileType *type, ImBuf *ibuf)
{
(void)type;
return (ibuf->ftype == IMAGIC);
diff --cc source/blender/imbuf/intern/openexr/openexr_api.cpp
index 6f432f4,47adcda..ac3ae19
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@@ -1912,9 -1917,9 +1917,9 @@@ struct ImBuf *imb_load_openexr(unsigne
}
}
- if (is_multi && ((flags & IB_thumbnail) == 0)) { /* only enters with IB_multilayer flag set */
+ if (is_multi) { /* only enters with IB_multilayer flag set */
/* constructs channels for reading, allocates memory in channels */
- ExrHandle *handle = imb_exr_begin_read_mem(*file, width, height);
+ ExrHandle *handle = imb_exr_begin_read_mem(*membuf, *file, width, height);
if (handle) {
IMB_exr_read_channels(handle);
ibuf->userdata = handle; /* potential danger, the caller has to check for this! */
More information about the Bf-blender-cvs
mailing list