Blender V2.61 - r43446
|
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <string>
#include <openexr_api.h>
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math_color.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "IMB_allocimbuf.h"
#include "IMB_metadata.h"
#include "openexr_multi.h"
#include <iostream>
#include <half.h>
#include <ImfVersion.h>
#include <ImathBox.h>
#include <ImfArray.h>
#include <ImfIO.h>
#include <ImfChannelList.h>
#include <ImfPixelType.h>
#include <ImfInputFile.h>
#include <ImfOutputFile.h>
#include <ImfCompression.h>
#include <ImfCompressionAttribute.h>
#include <ImfStringAttribute.h>
Go to the source code of this file.
Classes | |
class | Mem_IStream |
struct | _RGBAZ |
struct | ExrHandle |
struct | ExrChannel |
struct | ExrPass |
struct | ExrLayer |
struct | RGBA |
Typedefs | |
typedef struct _RGBAZ | RGBAZ |
typedef struct ExrHandle | ExrHandle |
typedef struct ExrChannel | ExrChannel |
typedef struct ExrPass | ExrPass |
typedef struct ExrLayer | ExrLayer |
typedef struct RGBA | RGBA |
Functions | |
int | imb_is_a_openexr (unsigned char *mem) |
static void | openexr_header_compression (Header *header, int compression) |
static void | openexr_header_metadata (Header *header, struct ImBuf *ibuf) |
static int | imb_save_openexr_half (struct ImBuf *ibuf, const char *name, int flags) |
static int | imb_save_openexr_float (struct ImBuf *ibuf, const char *name, int flags) |
int | imb_save_openexr (struct ImBuf *ibuf, const char *name, int flags) |
void * | IMB_exr_get_handle (void) |
void | IMB_exr_add_channel (void *handle, const char *layname, const char *passname, int xstride, int ystride, float *rect) |
int | IMB_exr_begin_write (void *handle, const char *filename, int width, int height, int compress) |
void | IMB_exrtile_begin_write (void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley) |
int | IMB_exr_begin_read (void *handle, const char *filename, int *width, int *height) |
void | IMB_exr_set_channel (void *handle, const char *layname, const char *passname, int xstride, int ystride, float *rect) |
void | IMB_exrtile_clear_channels (void *handle) |
void | IMB_exrtile_write_channels (void *handle, int partx, int party, int level) |
void | IMB_exr_write_channels (void *handle) |
void | IMB_exr_read_channels (void *handle) |
void | IMB_exr_multilayer_convert (void *handle, void *base, void *(*addlayer)(void *base, char *str), void(*addpass)(void *base, void *lay, char *str, float *rect, int totchan, char *chan_id)) |
void | IMB_exr_close (void *handle) |
static int | imb_exr_split_channel_name (ExrChannel *echan, char *layname, char *passname) |
static ExrLayer * | imb_exr_get_layer (ListBase *lb, char *layname) |
static ExrPass * | imb_exr_get_pass (ListBase *lb, char *passname) |
static ExrHandle * | imb_exr_begin_read_mem (InputFile *file, int width, int height) |
static void | exr_print_filecontents (InputFile *file) |
static const char * | exr_rgba_channelname (InputFile *file, const char *chan) |
static int | exr_has_zbuffer (InputFile *file) |
static int | exr_is_renderresult (InputFile *file) |
struct ImBuf * | imb_load_openexr (unsigned char *mem, size_t size, int flags) |
Variables | |
static ListBase | exrhandles = {NULL, NULL} |
Definition in file openexr_api.cpp.
typedef struct ExrChannel ExrChannel |
Definition at line 151 of file openexr_api.cpp.
static int exr_has_zbuffer | ( | InputFile * | file | ) | [static] |
static int exr_is_renderresult | ( | InputFile * | file | ) | [static] |
Definition at line 964 of file openexr_api.cpp.
Referenced by imb_load_openexr().
static void exr_print_filecontents | ( | InputFile * | file | ) | [static] |
static const char* exr_rgba_channelname | ( | InputFile * | file, |
const char * | chan | ||
) | [static] |
Definition at line 939 of file openexr_api.cpp.
References BLI_strcasecmp(), i, len(), str, and strlen().
Referenced by imb_load_openexr().
void IMB_exr_add_channel | ( | void * | handle, |
const char * | layname, | ||
const char * | passname, | ||
int | xstride, | ||
int | ystride, | ||
float * | rect | ||
) |
Definition at line 464 of file openexr_api.cpp.
References BLI_addtail(), BLI_strncpy(), ExrHandle::channels, data, EXR_LAY_MAXNAME, EXR_PASS_MAXNAME, EXR_TOT_MAXNAME, MEM_callocN(), ExrChannel::name, ExrChannel::rect, ExrChannel::xstride, and ExrChannel::ystride.
Referenced by IMB_exr_begin_read(), imb_exr_begin_read_mem(), RE_WriteRenderResult(), render_layer_add_pass(), and render_result_new().
int IMB_exr_begin_read | ( | void * | handle, |
const char * | filename, | ||
int * | width, | ||
int * | height | ||
) |
Definition at line 545 of file openexr_api.cpp.
References BLI_exists(), BLI_file_size(), data, ExrHandle::height, i, ExrHandle::ifile, IMB_exr_add_channel(), NULL, and ExrHandle::width.
Referenced by render_result_exr_file_read_path().
static ExrHandle* imb_exr_begin_read_mem | ( | InputFile * | file, |
int | width, | ||
int | height | ||
) | [static] |
Definition at line 816 of file openexr_api.cpp.
References ExrPass::chan, ExrChannel::chan_id, ExrPass::chan_id, ExrHandle::channels, data, EXR_PASS_MAXCHAN, EXR_TOT_MAXNAME, ListBase::first, ExrHandle::height, i, ExrHandle::ifile, IMB_exr_add_channel(), IMB_exr_close(), IMB_exr_get_handle(), imb_exr_get_layer(), imb_exr_get_pass(), imb_exr_split_channel_name(), ExrHandle::layers, MEM_mapallocN(), ExrChannel::name, ExrPass::next, ExrLayer::next, ExrChannel::next, NULL, ExrLayer::passes, ExrChannel::rect, ExrPass::rect, ExrPass::totchan, ExrHandle::width, ExrChannel::xstride, and ExrChannel::ystride.
Referenced by imb_load_openexr().
int IMB_exr_begin_write | ( | void * | handle, |
const char * | filename, | ||
int | width, | ||
int | height, | ||
int | compress | ||
) |
Definition at line 490 of file openexr_api.cpp.
References ExrHandle::channels, data, ListBase::first, ExrHandle::height, ExrChannel::name, ExrChannel::next, NULL, ExrHandle::ofile, openexr_header_compression(), OutputFile, and ExrHandle::width.
Referenced by RE_WriteRenderResult().
void IMB_exr_close | ( | void * | handle | ) |
Definition at line 713 of file openexr_api.cpp.
References BLI_freelistN(), BLI_remlink(), ExrHandle::channels, data, exrhandles, ListBase::first, ExrHandle::ifile, ExrHandle::layers, MEM_freeN(), ExrPass::next, ExrLayer::next, NULL, ExrHandle::ofile, ExrLayer::passes, ExrPass::rect, and ExrHandle::tofile.
Referenced by image_create_multilayer(), imb_exr_begin_read_mem(), RE_WriteRenderResult(), render_result_exr_file_end(), and render_result_exr_file_read_path().
void* IMB_exr_get_handle | ( | void | ) |
Definition at line 455 of file openexr_api.cpp.
References BLI_addtail(), data, exrhandles, and MEM_callocN().
Referenced by imb_exr_begin_read_mem(), RE_WriteRenderResult(), render_result_exr_file_read_path(), and render_result_new().
Definition at line 784 of file openexr_api.cpp.
References BLI_addtail(), BLI_findstring(), BLI_strncpy(), EXR_LAY_MAXNAME, MEM_callocN(), ExrLayer::name, and NULL.
Referenced by imb_exr_begin_read_mem().
Definition at line 797 of file openexr_api.cpp.
References BLI_addhead(), BLI_addtail(), BLI_findstring(), BLI_strncpy(), EXR_LAY_MAXNAME, MEM_callocN(), ExrPass::name, ExrLayer::name, and NULL.
Referenced by imb_exr_begin_read_mem().
void IMB_exr_multilayer_convert | ( | void * | handle, |
void * | base, | ||
void *(*)(void *base, char *str) | addlayer, | ||
void(*)(void *base, void *lay, char *str, float *rect, int totchan, char *chan_id) | addpass | ||
) |
Definition at line 687 of file openexr_api.cpp.
References ExrPass::chan_id, data, ListBase::first, ExrHandle::layers, ExrPass::name, ExrLayer::name, ExrPass::next, ExrLayer::next, NULL, ExrLayer::passes, ExrPass::rect, and ExrPass::totchan.
Referenced by render_result_new_from_exr().
void IMB_exr_read_channels | ( | void * | handle | ) |
Definition at line 653 of file openexr_api.cpp.
References ExrHandle::channels, data, ListBase::first, ExrHandle::height, ExrHandle::ifile, ExrChannel::name, ExrChannel::next, ExrChannel::rect, ExrHandle::width, ExrChannel::xstride, and ExrChannel::ystride.
Referenced by imb_load_openexr(), and render_result_exr_file_read_path().
void IMB_exr_set_channel | ( | void * | handle, |
const char * | layname, | ||
const char * | passname, | ||
int | xstride, | ||
int | ystride, | ||
float * | rect | ||
) |
Definition at line 568 of file openexr_api.cpp.
References BLI_findstring(), BLI_strncpy(), ExrHandle::channels, data, EXR_LAY_MAXNAME, EXR_PASS_MAXNAME, EXR_TOT_MAXNAME, ExrLayer::name, ExrChannel::rect, ExrChannel::xstride, and ExrChannel::ystride.
Referenced by render_result_exr_file_read_path(), and save_render_result_tile().
static int imb_exr_split_channel_name | ( | ExrChannel * | echan, |
char * | layname, | ||
char * | passname | ||
) | [static] |
Definition at line 746 of file openexr_api.cpp.
References BLI_strncpy(), ExrChannel::chan_id, EXR_LAY_MAXNAME, EXR_PASS_MAXNAME, len(), ExrChannel::name, and strlen().
Referenced by imb_exr_begin_read_mem().
void IMB_exr_write_channels | ( | void * | handle | ) |
Definition at line 625 of file openexr_api.cpp.
References ExrHandle::channels, data, ListBase::first, ExrHandle::height, ExrChannel::name, ExrChannel::next, ExrHandle::ofile, ExrChannel::rect, ExrHandle::width, ExrChannel::xstride, and ExrChannel::ystride.
Referenced by RE_WriteRenderResult().
void IMB_exrtile_begin_write | ( | void * | handle, |
const char * | filename, | ||
int | mipmap, | ||
int | width, | ||
int | height, | ||
int | tilex, | ||
int | tiley | ||
) |
Definition at line 520 of file openexr_api.cpp.
References ExrHandle::channels, data, ListBase::first, ExrHandle::height, ExrHandle::mipmap, ExrChannel::name, ExrChannel::next, ExrHandle::tilex, ExrHandle::tiley, ExrHandle::tofile, and ExrHandle::width.
Referenced by render_result_exr_file_begin().
void IMB_exrtile_clear_channels | ( | void * | handle | ) |
Definition at line 595 of file openexr_api.cpp.
References BLI_freelistN(), ExrHandle::channels, and data.
Referenced by save_empty_result_tiles().
void IMB_exrtile_write_channels | ( | void * | handle, |
int | partx, | ||
int | party, | ||
int | level | ||
) |
Definition at line 601 of file openexr_api.cpp.
References ExrHandle::channels, data, ListBase::first, ExrChannel::name, ExrChannel::next, ExrChannel::rect, ExrHandle::tilex, ExrHandle::tiley, ExrHandle::tofile, ExrChannel::xstride, and ExrChannel::ystride.
Referenced by save_empty_result_tiles(), and save_render_result_tile().
int imb_is_a_openexr | ( | unsigned char * | mem | ) |
Test presence of OpenEXR file.
mem | pointer to loaded OpenEXR bitstream |
Definition at line 156 of file openexr_api.cpp.
Referenced by imb_load_openexr().
struct ImBuf* imb_load_openexr | ( | unsigned char * | mem, |
size_t | size, | ||
int | flags | ||
) | [read] |
Definition at line 973 of file openexr_api.cpp.
References addzbuffloatImBuf(), exr_has_zbuffer(), exr_is_renderresult(), exr_print_filecontents(), exr_rgba_channelname(), ImBuf::ftype, IB_multilayer, IB_PROFILE_LINEAR_RGB, IB_test, imb_addrectfloatImBuf(), IMB_allocImBuf(), imb_exr_begin_read_mem(), IMB_exr_read_channels(), IMB_freeImBuf(), imb_is_a_openexr(), NULL, OPENEXR, ImBuf::profile, ImBuf::rect_float, ImBuf::userdata, and ImBuf::zbuf_float.
int imb_save_openexr | ( | struct ImBuf * | ibuf, |
const char * | name, | ||
int | flags | ||
) |
Definition at line 380 of file openexr_api.cpp.
References ImBuf::encodedsize, ImBuf::ftype, IB_mem, imb_addencodedbufferImBuf(), imb_save_openexr_float(), imb_save_openexr_half(), NULL, OPENEXR_HALF, and ImBuf::rect_float.
static int imb_save_openexr_float | ( | struct ImBuf * | ibuf, |
const char * | name, | ||
int | flags | ||
) | [static] |
Definition at line 321 of file openexr_api.cpp.
References ImBuf::channels, ImBuf::ftype, IB_zbuffloat, NULL, OPENEXR_COMPRESS, openexr_header_compression(), openexr_header_metadata(), OutputFile, ImBuf::planes, ImBuf::rect_float, ImBuf::x, ImBuf::y, and ImBuf::zbuf_float.
Referenced by imb_save_openexr().
static int imb_save_openexr_half | ( | struct ImBuf * | ibuf, |
const char * | name, | ||
int | flags | ||
) | [static] |
Definition at line 194 of file openexr_api.cpp.
References _RGBAZ::a, _RGBAZ::b, ImBuf::channels, ImBuf::ftype, _RGBAZ::g, g, i, IB_PROFILE_LINEAR_RGB, IB_zbuffloat, NULL, OPENEXR_COMPRESS, openexr_header_compression(), openexr_header_metadata(), OutputFile, ImBuf::planes, ImBuf::profile, _RGBAZ::r, ImBuf::rect, ImBuf::rect_float, srgb_to_linearrgb(), ImBuf::x, ImBuf::y, and ImBuf::zbuf_float.
Referenced by imb_save_openexr().
static void openexr_header_compression | ( | Header * | header, |
int | compression | ||
) | [static] |
Definition at line 161 of file openexr_api.cpp.
Referenced by IMB_exr_begin_write(), imb_save_openexr_float(), and imb_save_openexr_half().
Definition at line 186 of file openexr_api.cpp.
References ImMetaData::key, ImBuf::metadata, ImMetaData::next, and ImMetaData::value.
Referenced by imb_save_openexr_float(), and imb_save_openexr_half().
ListBase exrhandles = {NULL, NULL} [static] |
Definition at line 410 of file openexr_api.cpp.
Referenced by IMB_exr_close(), and IMB_exr_get_handle().