diff options
author | Ton Roosendaal <ton@blender.org> | 2006-01-09 13:55:41 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-01-09 13:55:41 +0300 |
commit | f0aceff1966f76fdf32420b9e319eaa5341c364d (patch) | |
tree | 84c0892156689ff3c9d4f578856b3602aa5bc103 /source/blender/imbuf/intern/openexr | |
parent | c693e01b8d9bd9af629b0fc8abab0a42a810c177 (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/intern/openexr')
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_api.cpp | 54 | ||||
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_api.h | 3 |
2 files changed, 27 insertions, 30 deletions
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); |