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:
authorTon Roosendaal <ton@blender.org>2006-01-09 13:55:41 +0300
committerTon Roosendaal <ton@blender.org>2006-01-09 13:55:41 +0300
commitf0aceff1966f76fdf32420b9e319eaa5341c364d (patch)
tree84c0892156689ff3c9d4f578856b3602aa5bc103 /source/blender/imbuf
parentc693e01b8d9bd9af629b0fc8abab0a42a810c177 (diff)
Orange: Further cleanup of EXR saving
- F10 scene buttons now has options "half" and "zbuf" for exr saving. Note: when no float buffer is available, it always saves as "half", that's sufficient anyway, since half is 16 bits per channel. - EXR in imbuf now uses compliant ibuf->ftype flags for denoting exr extensions such as 'half' and 'compression'. - Removed ugly blenkernel dependency from exr module
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r--source/blender/imbuf/IMB_imbuf_types.h13
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp54
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.h3
-rw-r--r--source/blender/imbuf/intern/writeimage.c2
4 files changed, 33 insertions, 39 deletions
diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h
index 4f648031fc6..652c15afdd3 100644
--- a/source/blender/imbuf/IMB_imbuf_types.h
+++ b/source/blender/imbuf/IMB_imbuf_types.h
@@ -134,15 +134,9 @@ typedef enum {
#define IB_mem (1 << 14)
#define IB_rectfloat (1 << 15)
-/**@}*/
-
-/** \name imbuf_formats Image file formats
- * \brief These defines are bit flags for the various image file formats.
- */
-/**@{*/
-/** \brief Identifier for an image file format.
- *
+/*
* The bit flag is stored in the ImBuf.ftype variable.
+ * Note that the lower 10 bits is used for storing custom flags
*/
#define AMI (1 << 31)
#define PNG (1 << 30)
@@ -157,7 +151,10 @@ typedef enum {
#define RADHDR (1 << 24)
#define TIF (1 << 23)
+
#define OPENEXR (1 << 22)
+#define OPENEXR_HALF (1 << 8 )
+#define OPENEXR_COMPRESS (7)
#define RAWTGA (TGA | 1)
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 86beab537ef..76a128cb200 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -39,8 +39,6 @@ extern "C"
#include "IMB_imbuf.h"
#include "IMB_allocimbuf.h"
-#include "BKE_global.h"
-#include "DNA_scene_types.h"
}
#include <iostream>
@@ -150,27 +148,18 @@ static void openexr_header_compression(Header *header, int compression)
}
}
-short imb_save_openexr_half(struct ImBuf *ibuf, char *name, int flags)
+static short imb_save_openexr_half(struct ImBuf *ibuf, char *name, int flags)
{
int width = ibuf->x;
int height = ibuf->y;
-
- if (flags & IB_mem)
- {
- printf("OpenEXR-save: Create EXR in memory CURRENTLY NOT SUPPORTED !\n");
- imb_addencodedbufferImBuf(ibuf);
- ibuf->encodedsize = 0;
- return(0);
- }
-
int write_zbuf = (flags & IB_zbuf) && ibuf->zbuf != NULL; // summarize
try
{
Header header (width, height);
- openexr_header_compression(&header, G.scene->r.quality);
+ openexr_header_compression(&header, ibuf->ftype & OPENEXR_COMPRESS);
header.channels().insert ("R", Channel (HALF));
header.channels().insert ("G", Channel (HALF));
@@ -249,30 +238,18 @@ short imb_save_openexr_half(struct ImBuf *ibuf, char *name, int flags)
return (1);
}
-short imb_save_openexr_float(struct ImBuf *ibuf, char *name, int flags)
+static short imb_save_openexr_float(struct ImBuf *ibuf, char *name, int flags)
{
int width = ibuf->x;
int height = ibuf->y;
-
- if (flags & IB_mem)
- {
- printf("OpenEXR-save: Create EXR in memory CURRENTLY NOT SUPPORTED !\n");
- imb_addencodedbufferImBuf(ibuf);
- ibuf->encodedsize = 0;
- return(0);
- }
-
- if (ibuf->rect_float==NULL)
- return(0);
-
int write_zbuf = (flags & IB_zbuf) && ibuf->zbuf != NULL; // summarize
try
{
Header header (width, height);
- openexr_header_compression(&header, G.scene->r.quality);
+ openexr_header_compression(&header, ibuf->ftype & OPENEXR_COMPRESS);
header.channels().insert ("R", Channel (FLOAT));
header.channels().insert ("G", Channel (FLOAT));
@@ -313,6 +290,26 @@ short imb_save_openexr_float(struct ImBuf *ibuf, char *name, int flags)
}
+short imb_save_openexr(struct ImBuf *ibuf, char *name, int flags)
+{
+ if (flags & IB_mem)
+ {
+ printf("OpenEXR-save: Create EXR in memory CURRENTLY NOT SUPPORTED !\n");
+ imb_addencodedbufferImBuf(ibuf);
+ ibuf->encodedsize = 0;
+ return(0);
+ }
+
+ if (ibuf->ftype & OPENEXR_HALF)
+ return imb_save_openexr_half(ibuf, name, flags);
+ else {
+ /* when no float rect, we save as half (16 bits is sufficient) */
+ if (ibuf->rect_float==NULL)
+ return imb_save_openexr_half(ibuf, name, flags);
+ else
+ return imb_save_openexr_float(ibuf, name, flags);
+ }
+}
struct ImBuf *imb_load_openexr(unsigned char *mem, int size, int flags)
{
@@ -437,5 +434,6 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, int size, int flags)
}
}
-
+
+
} // export "C"
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.h b/source/blender/imbuf/intern/openexr/openexr_api.h
index 882b9d98a06..c12eb1f05ae 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.h
+++ b/source/blender/imbuf/intern/openexr/openexr_api.h
@@ -49,8 +49,7 @@ extern "C" {
int imb_is_a_openexr(unsigned char *mem);
-short imb_save_openexr_half(struct ImBuf *ibuf, char *name, int flags);
-short imb_save_openexr_float(struct ImBuf *ibuf, char *name, int flags);
+short imb_save_openexr(struct ImBuf *ibuf, char *name, int flags);
struct ImBuf *imb_load_openexr(unsigned char *mem, int size, int flags);
diff --git a/source/blender/imbuf/intern/writeimage.c b/source/blender/imbuf/intern/writeimage.c
index b752dbf9dd0..522ce78ebc0 100644
--- a/source/blender/imbuf/intern/writeimage.c
+++ b/source/blender/imbuf/intern/writeimage.c
@@ -97,7 +97,7 @@ short IMB_saveiff(struct ImBuf *ibuf, char *name, int flags)
}
#ifdef WITH_OPENEXR
if (IS_openexr(ibuf)) {
- return imb_save_openexr_half(ibuf, name, flags);
+ return imb_save_openexr(ibuf, name, flags);
}
#endif