|
Blender
V2.93
|
#include <algorithm>#include <cerrno>#include <cstddef>#include <cstdio>#include <cstdlib>#include <fstream>#include <iostream>#include <set>#include <stdexcept>#include <string>#include <Iex.h>#include <ImathBox.h>#include <ImfArray.h>#include <ImfChannelList.h>#include <ImfCompression.h>#include <ImfCompressionAttribute.h>#include <ImfIO.h>#include <ImfInputFile.h>#include <ImfOutputFile.h>#include <ImfPixelType.h>#include <ImfStandardAttributes.h>#include <ImfStringAttribute.h>#include <ImfVersion.h>#include <half.h>#include <ImfInputPart.h>#include <ImfMultiPartInputFile.h>#include <ImfMultiPartOutputFile.h>#include <ImfMultiView.h>#include <ImfOutputPart.h>#include <ImfPartHelper.h>#include <ImfPartType.h>#include <ImfTiledOutputPart.h>#include "DNA_scene_types.h"#include <openexr_api.h>#include "MEM_guardedalloc.h"#include "BLI_blenlib.h"#include "BLI_math_color.h"#include "BLI_threads.h"#include "BKE_idprop.h"#include "BKE_image.h"#include "IMB_allocimbuf.h"#include "IMB_colormanagement.h"#include "IMB_colormanagement_intern.h"#include "IMB_imbuf.h"#include "IMB_imbuf_types.h"#include "IMB_metadata.h"#include "openexr_multi.h"Go to the source code of this file.
Classes | |
| class | IMemStream |
| class | IFileStream |
| class | OMemStream |
| class | OFileStream |
| struct | _RGBAZ |
| struct | ExrHandle |
| struct | ExrChannel |
| struct | ExrPass |
| struct | ExrLayer |
Typedefs | |
| using | RGBAZ = _RGBAZ |
Functions | |
| static struct ExrPass * | imb_exr_get_pass (ListBase *lb, char *passname) |
| static bool | exr_has_multiview (MultiPartInputFile &file) |
| static bool | exr_has_multipart_file (MultiPartInputFile &file) |
| static bool | exr_has_alpha (MultiPartInputFile &file) |
| static bool | exr_has_zbuffer (MultiPartInputFile &file) |
| static void | exr_printf (const char *__restrict fmt,...) |
| static void | imb_exr_type_by_channels (ChannelList &channels, StringVector &views, bool *r_singlelayer, bool *r_multilayer, bool *r_multiview) |
| static half | float_to_half_safe (const float value) |
| bool | imb_is_a_openexr (const unsigned char *mem, const size_t size) |
| static void | openexr_header_compression (Header *header, int compression) |
| static void | openexr_header_metadata (Header *header, struct ImBuf *ibuf) |
| static void | openexr_header_metadata_callback (void *data, const char *propname, char *prop, int UNUSED(len)) |
| static bool | imb_save_openexr_half (ImBuf *ibuf, const char *name, const int flags) |
| static bool | imb_save_openexr_float (ImBuf *ibuf, const char *name, const int flags) |
| bool | imb_save_openexr (struct ImBuf *ibuf, const char *name, int flags) |
| void * | IMB_exr_get_handle (void) |
| void * | IMB_exr_get_handle_name (const char *name) |
| void | IMB_exr_add_view (void *handle, const char *name) |
| static int | imb_exr_get_multiView_id (StringVector &views, const std::string &name) |
| static void | imb_exr_get_views (MultiPartInputFile &file, StringVector &views) |
| static void | imb_exr_insert_view_name (char *name_full, const char *passname, const char *viewname) |
| void | IMB_exr_add_channel (void *handle, const char *layname, const char *passname, const char *viewname, int xstride, int ystride, float *rect, bool use_half_float) |
| int | IMB_exr_begin_write (void *handle, const char *filename, int width, int height, int compress, const StampData *stamp) |
| 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) |
| float * | IMB_exr_channel_rect (void *handle, const char *layname, const char *passname, const char *viewname) |
| void | IMB_exr_clear_channels (void *handle) |
| void | IMB_exr_write_channels (void *handle) |
| void | IMB_exrtile_write_channels (void *handle, int partx, int party, int level, const char *viewname, bool empty) |
| void | IMB_exr_read_channels (void *handle) |
| void | IMB_exr_multilayer_convert (void *handle, void *base, void *(*addview)(void *base, const char *str), void *(*addlayer)(void *base, const char *str), void(*addpass)(void *base, void *lay, const char *str, float *rect, int totchan, const char *chan_id, const char *view)) |
| void | IMB_exr_close (void *handle) |
| static int | imb_exr_split_token (const char *str, const char *end, const char **token) |
| static int | imb_exr_split_channel_name (ExrChannel *echan, char *layname, char *passname) |
| static ExrLayer * | imb_exr_get_layer (ListBase *lb, char *layname) |
| static ExrHandle * | imb_exr_begin_read_mem (IStream &file_stream, MultiPartInputFile &file, int width, int height) |
| static void | exr_printf (const char *fmt,...) |
| static void | exr_print_filecontents (MultiPartInputFile &file) |
| static const char * | exr_rgba_channelname (MultiPartInputFile &file, const char *chan) |
| static int | exr_has_rgb (MultiPartInputFile &file, const char *rgb_channels[3]) |
| static bool | exr_has_luma (MultiPartInputFile &file) |
| static bool | exr_has_chroma (MultiPartInputFile &file) |
| static bool | exr_is_half_float (MultiPartInputFile &file) |
| static bool | imb_exr_is_multilayer_file (MultiPartInputFile &file) |
| static bool | imb_exr_is_multi (MultiPartInputFile &file) |
| bool | IMB_exr_has_multilayer (void *handle) |
| struct ImBuf * | imb_load_openexr (const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]) |
| void | imb_initopenexr (void) |
| void | imb_exitopenexr (void) |
Variables | |
| static ListBase | exrhandles = {nullptr, nullptr} |
Definition at line 321 of file openexr_api.cpp.
|
static |
|
static |
|
static |
|
static |
Definition at line 1866 of file openexr_api.cpp.
References file.
Referenced by imb_exr_get_views(), and imb_exr_is_multi().
|
static |
Definition at line 1855 of file openexr_api.cpp.
References file.
Referenced by imb_exr_get_views(), and imb_exr_is_multi().
|
static |
|
static |
|
static |
Definition at line 1775 of file openexr_api.cpp.
Referenced by imb_load_openexr().
|
static |
Definition at line 1679 of file openexr_api.cpp.
Referenced by imb_load_openexr().
|
static |
|
static |
Definition at line 1665 of file openexr_api.cpp.
References output.
|
static |
Definition at line 1709 of file openexr_api.cpp.
References BLI_strcasecmp(), file, len, and str.
Referenced by imb_load_openexr().
Definition at line 323 of file openexr_api.cpp.
References clamp_f().
Referenced by IMB_exr_write_channels(), and imb_save_openexr_half().
| void imb_exitopenexr | ( | void | ) |
Definition at line 2102 of file openexr_api.cpp.
| void IMB_exr_add_channel | ( | void * | handle, |
| const char * | layname, | ||
| const char * | passname, | ||
| const char * | viewname, | ||
| int | xstride, | ||
| int | ystride, | ||
| float * | rect, | ||
| bool | use_half_float | ||
| ) |
Definition at line 785 of file openexr_api.cpp.
References BLI_addtail(), BLI_strncpy(), data, exr_printf(), imb_exr_get_multiView_id(), imb_exr_insert_view_name(), ExrChannel::m, max, MEM_callocN, ExrChannel::name, ExrChannel::rect, ExrChannel::use_half_float, ExrChannel::view_id, ExrChannel::xstride, and ExrChannel::ystride.
Referenced by blender::compositor::add_exr_channels(), blender::compositor::OutputStereoOperation::deinitExecution(), IMB_exr_begin_read(), imb_exr_begin_read_mem(), RE_WriteRenderResult(), and render_layer_add_pass().
| void IMB_exr_add_view | ( | void * | handle, |
| const char * | name | ||
| ) |
Definition at line 711 of file openexr_api.cpp.
References data, and ExrLayer::name.
Referenced by blender::compositor::OutputOpenExrSingleLayerMultiViewOperation::get_handle(), blender::compositor::OutputOpenExrMultiLayerMultiViewOperation::get_handle(), blender::compositor::OutputStereoOperation::get_handle(), RE_WriteRenderResult(), and render_result_new().
| int IMB_exr_begin_read | ( | void * | handle, |
| const char * | filename, | ||
| int * | width, | ||
| int * | height | ||
| ) |
Definition at line 965 of file openexr_api.cpp.
References BLI_exists(), BLI_file_size(), data, height, IMB_exr_add_channel(), imb_exr_get_views(), ExrChannel::m, and width.
Referenced by render_result_exr_file_read_path().
|
static |
Definition at line 1528 of file openexr_api.cpp.
References Freestyle::a, BLI_snprintf(), BLI_strncpy(), ExrPass::chan, ExrChannel::chan_id, ExrPass::chan_id, data, ELEM, EXR_PASS_MAXCHAN, EXR_PASS_MAXNAME, EXR_TOT_MAXNAME, file, ListBase::first, height, IMB_exr_add_channel(), IMB_exr_close(), IMB_exr_get_handle(), imb_exr_get_layer(), imb_exr_get_pass(), imb_exr_get_views(), imb_exr_split_channel_name(), ExrPass::internal_name, ExrChannel::m, MEM_callocN, ExrChannel::next, ExrPass::next, ExrLayer::next, ExrLayer::passes, ExrChannel::rect, ExrPass::rect, ExrPass::totchan, view, ExrPass::view, ExrChannel::view_id, ExrPass::view_id, 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, | ||
| const StampData * | stamp | ||
| ) |
Definition at line 842 of file openexr_api.cpp.
References BKE_stamp_info_callback(), data, HALF, height, imb_exr_type_by_channels(), ExrChannel::name, ExrChannel::next, openexr_header_compression(), openexr_header_metadata_callback(), ExrChannel::use_half_float, and width.
Referenced by blender::compositor::OutputOpenExrMultiLayerOperation::deinitExecution(), blender::compositor::OutputOpenExrSingleLayerMultiViewOperation::get_handle(), blender::compositor::OutputOpenExrMultiLayerMultiViewOperation::get_handle(), and RE_WriteRenderResult().
| float* IMB_exr_channel_rect | ( | void * | handle, |
| const char * | layname, | ||
| const char * | passname, | ||
| const char * | viewname | ||
| ) |
Definition at line 1044 of file openexr_api.cpp.
References BLI_findstring(), BLI_snprintf(), BLI_strncpy(), data, EXR_LAY_MAXNAME, EXR_PASS_MAXNAME, EXR_TOT_MAXNAME, imb_exr_get_multiView_id(), imb_exr_insert_view_name(), max, ExrLayer::name, and ExrChannel::rect.
Referenced by blender::compositor::OutputStereoOperation::deinitExecution(), and blender::compositor::free_exr_channels().
| void IMB_exr_clear_channels | ( | void * | handle | ) |
Definition at line 1085 of file openexr_api.cpp.
References BLI_freelistN(), data, ExrChannel::m, and ExrChannel::next.
Referenced by blender::compositor::OutputOpenExrSingleLayerMultiViewOperation::get_handle(), blender::compositor::OutputOpenExrMultiLayerMultiViewOperation::get_handle(), and blender::compositor::OutputStereoOperation::get_handle().
| void IMB_exr_close | ( | void * | handle | ) |
Definition at line 1336 of file openexr_api.cpp.
References BLI_freelistN(), BLI_remlink(), data, exrhandles, ListBase::first, ExrChannel::m, MEM_freeN, ExrChannel::next, ExrPass::next, ExrLayer::next, ExrLayer::passes, and ExrPass::rect.
Referenced by BKE_movieclip_convert_multilayer_ibuf(), blender::compositor::OutputOpenExrSingleLayerMultiViewOperation::deinitExecution(), blender::compositor::OutputOpenExrMultiLayerMultiViewOperation::deinitExecution(), blender::compositor::OutputStereoOperation::deinitExecution(), blender::compositor::OutputOpenExrMultiLayerOperation::deinitExecution(), blender::compositor::OutputOpenExrSingleLayerMultiViewOperation::get_handle(), blender::compositor::OutputOpenExrMultiLayerMultiViewOperation::get_handle(), imb_exr_begin_read_mem(), RE_WriteRenderResult(), render_result_exr_file_end(), render_result_exr_file_read_path(), and studiolight_load_equirect_image().
| void* IMB_exr_get_handle | ( | void | ) |
Definition at line 686 of file openexr_api.cpp.
References BLI_addtail(), data, exrhandles, and MEM_callocN.
Referenced by blender::compositor::OutputOpenExrMultiLayerOperation::deinitExecution(), imb_exr_begin_read_mem(), IMB_exr_get_handle_name(), RE_WriteRenderResult(), render_result_exr_file_read_path(), and render_result_new().
| void* IMB_exr_get_handle_name | ( | const char * | name | ) |
Definition at line 695 of file openexr_api.cpp.
References BLI_rfindstring(), BLI_strncpy(), data, exrhandles, IMB_exr_get_handle(), and ExrLayer::name.
Referenced by blender::compositor::OutputOpenExrSingleLayerMultiViewOperation::get_handle(), blender::compositor::OutputOpenExrMultiLayerMultiViewOperation::get_handle(), and blender::compositor::OutputStereoOperation::get_handle().
Definition at line 1494 of file openexr_api.cpp.
References BLI_addtail(), BLI_findstring(), BLI_strncpy(), EXR_LAY_MAXNAME, MEM_callocN, and ExrLayer::name.
Referenced by imb_exr_begin_read_mem().
|
static |
Definition at line 717 of file openexr_api.cpp.
References count, and ExrLayer::name.
Referenced by IMB_exr_add_channel(), IMB_exr_channel_rect(), imb_exr_get_views(), imb_exr_type_by_channels(), and IMB_exrtile_write_channels().
Definition at line 1507 of file openexr_api.cpp.
References BLI_addhead(), BLI_addtail(), BLI_findstring(), BLI_strncpy(), EXR_LAY_MAXNAME, MEM_callocN, ExrLayer::name, ExrPass::name, and STREQ.
Referenced by imb_exr_begin_read_mem().
|
static |
Definition at line 732 of file openexr_api.cpp.
References exr_has_multipart_file(), exr_has_multiview(), file, imb_exr_get_multiView_id(), and view.
Referenced by IMB_exr_begin_read(), and imb_exr_begin_read_mem().
| bool IMB_exr_has_multilayer | ( | void * | handle | ) |
Definition at line 1891 of file openexr_api.cpp.
References data, and imb_exr_is_multi().
Referenced by load_image_single(), and load_sequence_single().
|
static |
Definition at line 758 of file openexr_api.cpp.
References BLI_assert, BLI_snprintf(), BLI_str_rpartition(), BLI_strncpy(), ELEM, EXR_PASS_MAXNAME, len, and ExrLayer::name.
Referenced by IMB_exr_add_channel(), and IMB_exr_channel_rect().
|
static |
Definition at line 1872 of file openexr_api.cpp.
References exr_has_multipart_file(), exr_has_multiview(), file, and imb_exr_is_multilayer_file().
Referenced by IMB_exr_has_multilayer(), and imb_load_openexr().
|
static |
| void IMB_exr_multilayer_convert | ( | void * | handle, |
| void * | base, | ||
| void *(*)(void *base, const char *str) | addview, | ||
| void *(*)(void *base, const char *str) | addlayer, | ||
| void(*)(void *base, void *lay, const char *str, float *rect, int totchan, const char *chan_id, const char *view) | addpass | ||
| ) |
Definition at line 1287 of file openexr_api.cpp.
References BLI_listbase_is_empty(), ExrPass::chan_id, data, ExrPass::internal_name, ExrPass::next, ExrPass::rect, ExrPass::totchan, and ExrPass::view.
Referenced by BKE_movieclip_convert_multilayer_ibuf(), render_result_new_from_exr(), and studiolight_load_equirect_image().
| void IMB_exr_read_channels | ( | void * | handle | ) |
Definition at line 1208 of file openexr_api.cpp.
References data, exr_printf(), float(), ExrChannel::m, ExrChannel::next, ExrChannel::rect, STRPREFIX, 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 1014 of file openexr_api.cpp.
References BLI_findstring(), BLI_snprintf(), BLI_strncpy(), 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 |
Definition at line 1392 of file openexr_api.cpp.
References BLI_strcaseeq(), BLI_strncpy(), ExrChannel::chan_id, ELEM, EXR_TOT_MAXNAME, imb_exr_split_token(), len, ExrChannel::m, min, and ExrLayer::name.
Referenced by imb_exr_begin_read_mem().
|
static |
Definition at line 1378 of file openexr_api.cpp.
References BLI_str_partition_ex(), and str.
Referenced by imb_exr_split_channel_name().
|
static |
Definition at line 1799 of file openexr_api.cpp.
References BLI_assert, imb_exr_get_multiView_id(), and pos.
Referenced by IMB_exr_begin_write().
| void IMB_exr_write_channels | ( | void * | handle | ) |
Definition at line 1097 of file openexr_api.cpp.
References data, float(), float_to_half_safe(), HALF, MEM_freeN, MEM_mallocN, ExrChannel::name, ExrChannel::next, ExrChannel::rect, ExrChannel::use_half_float, ExrChannel::xstride, and ExrChannel::ystride.
Referenced by blender::compositor::OutputOpenExrSingleLayerMultiViewOperation::deinitExecution(), blender::compositor::OutputOpenExrMultiLayerMultiViewOperation::deinitExecution(), blender::compositor::OutputOpenExrMultiLayerOperation::deinitExecution(), and 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 899 of file openexr_api.cpp.
References BLI_assert, data, exr_printf(), height, ExrChannel::m, ExrChannel::next, ExrChannel::use_half_float, ExrChannel::view_id, and width.
Referenced by render_result_exr_file_begin().
| void IMB_exrtile_write_channels | ( | void * | handle, |
| int | partx, | ||
| int | party, | ||
| int | level, | ||
| const char * | viewname, | ||
| bool | empty | ||
| ) |
Definition at line 1157 of file openexr_api.cpp.
References data, exr_printf(), imb_exr_get_multiView_id(), ExrChannel::m, ExrChannel::next, ExrChannel::rect, STREQ, view, ExrChannel::xstride, and ExrChannel::ystride.
Referenced by render_result_save_empty_result_tiles(), and save_render_result_tile().
| void imb_initopenexr | ( | void | ) |
Definition at line 2095 of file openexr_api.cpp.
References BLI_system_thread_count().
| bool imb_is_a_openexr | ( | const unsigned char * | mem, |
| const size_t | size | ||
| ) |
Test presence of OpenEXR file.
| mem | pointer to loaded OpenEXR bitstream |
Definition at line 334 of file openexr_api.cpp.
References size().
Referenced by imb_load_openexr().
| struct ImBuf* imb_load_openexr | ( | const unsigned char * | mem, |
| size_t | size, | ||
| int | flags, | ||
| char | colorspace[IM_MAX_SPACE] | ||
| ) |
Definition at line 1897 of file openexr_api.cpp.
References Freestyle::a, addzbuffloatImBuf(), BLI_YCC_ITU_BT709, COLOR_ROLE_DEFAULT_FLOAT, colorspace_set_default_role(), double(), exr_has_alpha(), exr_has_chroma(), exr_has_luma(), exr_has_rgb(), exr_has_zbuffer(), exr_is_half_float(), exr_print_filecontents(), exr_rgba_channelname(), file, ImBuf::flags, float(), ImBuf::ftype, height, IB_alphamode_detect, IB_alphamode_premul, IB_halffloat, IB_metadata, IB_multilayer, IB_test, IB_thumbnail, IM_MAX_SPACE, imb_addrectfloatImBuf(), IMB_allocImBuf(), imb_exr_begin_read_mem(), imb_exr_is_multi(), IMB_exr_read_channels(), IMB_freeImBuf(), IMB_FTYPE_OPENEXR, imb_is_a_openexr(), IMB_metadata_ensure(), IMB_metadata_set_field(), IMB_rect_from_float(), ImBuf::metadata, IDProperty::name, ImBuf::ppm, ImBuf::rect_float, size(), ImBuf::userdata, width, ImBuf::x, ImBuf::y, ycc_to_rgb(), and ImBuf::zbuf_float.
| bool imb_save_openexr | ( | struct ImBuf * | ibuf, |
| const char * | name, | ||
| int | flags | ||
| ) |
Definition at line 594 of file openexr_api.cpp.
References ImBuf::encodedsize, ImbFormatOptions::flag, ImBuf::foptions, IB_mem, imb_addencodedbufferImBuf(), imb_save_openexr_float(), imb_save_openexr_half(), OPENEXR_HALF, and ImBuf::rect_float.
|
static |
Definition at line 518 of file openexr_api.cpp.
References ImBuf::channels, file, ImbFormatOptions::flag, float(), ImBuf::foptions, height, IB_mem, IB_zbuffloat, OPENEXR_COMPRESS, openexr_header_compression(), openexr_header_metadata(), ImBuf::planes, ImBuf::rect_float, width, ImBuf::x, ImBuf::y, and ImBuf::zbuf_float.
Referenced by imb_save_openexr().
|
static |
Definition at line 411 of file openexr_api.cpp.
References _RGBAZ::a, _RGBAZ::b, ImBuf::channels, exr_printf(), file, ImbFormatOptions::flag, float(), float_to_half_safe(), ImBuf::foptions, from, _RGBAZ::g, HALF, height, IB_mem, IB_zbuffloat, OPENEXR_COMPRESS, openexr_header_compression(), openexr_header_metadata(), ImBuf::planes, _RGBAZ::r, ImBuf::rect, ImBuf::rect_float, srgb_to_linearrgb(), width, ImBuf::x, ImBuf::y, and ImBuf::zbuf_float.
Referenced by imb_save_openexr().
|
static |
Definition at line 343 of file openexr_api.cpp.
References R_IMF_EXR_CODEC_B44, R_IMF_EXR_CODEC_B44A, R_IMF_EXR_CODEC_DWAA, R_IMF_EXR_CODEC_DWAB, R_IMF_EXR_CODEC_NONE, R_IMF_EXR_CODEC_PIZ, R_IMF_EXR_CODEC_PXR24, R_IMF_EXR_CODEC_RLE, R_IMF_EXR_CODEC_ZIP, and R_IMF_EXR_CODEC_ZIPS.
Referenced by IMB_exr_begin_write(), imb_save_openexr_float(), and imb_save_openexr_half().
Definition at line 384 of file openexr_api.cpp.
References IDProperty::data, ListBase::first, IDPropertyData::group, IDP_String, IDP_STRING, ImBuf::metadata, IDProperty::name, IDProperty::next, ImBuf::ppm, and IDProperty::type.
Referenced by imb_save_openexr_float(), and imb_save_openexr_half().
|
static |
Definition at line 402 of file openexr_api.cpp.
References data.
Referenced by IMB_exr_begin_write().
|
static |
Definition at line 622 of file openexr_api.cpp.
Referenced by IMB_exr_close(), IMB_exr_get_handle(), and IMB_exr_get_handle_name().