|
Blender V4.3
|
#include <algorithm>#include <cctype>#include <cerrno>#include <cstddef>#include <cstdio>#include <cstdlib>#include <fcntl.h>#include <fstream>#include <iostream>#include <set>#include <stdexcept>#include <string>#include <OpenEXR/OpenEXRConfig.h>#include <OpenEXR/half.h>#include <OpenEXR/Iex.h>#include <OpenEXR/ImfArray.h>#include <OpenEXR/ImfChannelList.h>#include <OpenEXR/ImfCompression.h>#include <OpenEXR/ImfCompressionAttribute.h>#include <OpenEXR/ImfIO.h>#include <OpenEXR/ImfInputFile.h>#include <OpenEXR/ImfOutputFile.h>#include <OpenEXR/ImfPixelType.h>#include <OpenEXR/ImfPreviewImage.h>#include <OpenEXR/ImfRgbaFile.h>#include <OpenEXR/ImfStandardAttributes.h>#include <OpenEXR/ImfStringAttribute.h>#include <OpenEXR/ImfVersion.h>#include <OpenEXR/ImfInputPart.h>#include <OpenEXR/ImfMultiPartInputFile.h>#include <OpenEXR/ImfMultiPartOutputFile.h>#include <OpenEXR/ImfMultiView.h>#include <OpenEXR/ImfOutputPart.h>#include <OpenEXR/ImfPartHelper.h>#include <OpenEXR/ImfPartType.h>#include <OpenEXR/ImfTiledOutputPart.h>#include "DNA_scene_types.h"#include <openexr_api.h>#include <unistd.h>#include "MEM_guardedalloc.h"#include "BLI_blenlib.h"#include "BLI_fileops.h"#include "BLI_math_color.h"#include "BLI_mmap.h"#include "BLI_threads.h"#include "BKE_idprop.hh"#include "BKE_image.hh"#include "IMB_allocimbuf.hh"#include "IMB_colormanagement.hh"#include "IMB_imbuf.hh"#include "IMB_imbuf_types.hh"#include "IMB_metadata.hh"#include "IMB_openexr.hh"Go to the source code of this file.
Classes | |
| class | IMemStream |
| class | IMMapStream |
| class | IFileStream |
| class | OMemStream |
| class | OFileStream |
| struct | _RGBAZ |
| struct | ExrHandle |
| struct | ExrChannel |
| struct | ExrPass |
| struct | ExrLayer |
Macros | |
| #define | COMBINED_OPENEXR_VERSION ((10000 * OPENEXR_VERSION_MAJOR) + (100 * OPENEXR_VERSION_MINOR) + OPENEXR_VERSION_PATCH) |
| #define | exr_file_offset_t Int64 |
Typedefs | |
| using | RGBAZ = _RGBAZ |
Functions | |
| static struct ExrPass * | imb_exr_get_pass (ListBase *lb, const 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 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 uchar *mem, const size_t size) |
| static void | openexr_header_compression (Header *header, int compression) |
| static void | openexr_header_metadata (Header *header, ImBuf *ibuf) |
| static void | openexr_header_metadata_callback (void *data, const char *propname, char *prop, int) |
| static bool | imb_save_openexr_half (ImBuf *ibuf, const char *filepath, const int flags) |
| static bool | imb_save_openexr_float (ImBuf *ibuf, const char *filepath, const int flags) |
| bool | imb_save_openexr (ImBuf *ibuf, const char *filepath, int flags) |
| static bool | imb_exr_multilayer_parse_channels_from_file (ExrHandle *data) |
| void * | IMB_exr_get_handle () |
| 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[EXR_TOT_MAXNAME+1], 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) |
| bool | IMB_exr_begin_write (void *handle, const char *filepath, int width, int height, int compress, const StampData *stamp) |
| void | IMB_exrtile_begin_write (void *handle, const char *filepath, int mipmap, int width, int height, int tilex, int tiley) |
| bool | IMB_exr_begin_read (void *handle, const char *filepath, int *width, int *height, const bool parse_channels) |
| bool | 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 void | imb_exr_pass_name_from_channel (char *passname, const ExrChannel *echan, const char *channelname, const bool has_xyz_channels) |
| static void | imb_exr_pass_name_from_channel_name (char *passname, const ExrChannel *, const char *channelname, const bool) |
| static int | imb_exr_split_channel_name (ExrChannel *echan, char *layname, char *passname, bool has_xyz_channels) |
| static ExrLayer * | imb_exr_get_layer (ListBase *lb, const char *layname) |
| static bool | exr_has_xyz_channels (ExrHandle *exr_handle) |
| static std::vector< MultiViewChannelName > | exr_channels_in_multi_part_file (const MultiPartInputFile &file) |
| 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_has_xyz (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) |
| ImBuf * | imb_load_openexr (const uchar *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]) |
| ImBuf * | imb_load_filepath_thumbnail_openexr (const char *filepath, const int, const size_t max_thumb_size, char colorspace[], size_t *r_width, size_t *r_height) |
| void | imb_initopenexr () |
| void | imb_exitopenexr () |
Variables | |
| static ListBase | exrhandles = {nullptr, nullptr} |
| #define COMBINED_OPENEXR_VERSION ((10000 * OPENEXR_VERSION_MAJOR) + (100 * OPENEXR_VERSION_MINOR) + OPENEXR_VERSION_PATCH) |
Definition at line 26 of file openexr_api.cpp.
| #define exr_file_offset_t Int64 |
Definition at line 37 of file openexr_api.cpp.
Definition at line 372 of file openexr_api.cpp.
|
static |
Definition at line 1625 of file openexr_api.cpp.
References channels().
Referenced by imb_exr_multilayer_parse_channels_from_file().
|
static |
Definition at line 1931 of file openexr_api.cpp.
Referenced by imb_load_openexr().
|
static |
Definition at line 1924 of file openexr_api.cpp.
Referenced by imb_load_openexr().
|
static |
Definition at line 1915 of file openexr_api.cpp.
Referenced by imb_load_openexr().
|
static |
Definition at line 2039 of file openexr_api.cpp.
Referenced by imb_exr_get_views(), and imb_exr_is_multi().
|
static |
Definition at line 2028 of file openexr_api.cpp.
Referenced by imb_exr_get_views(), and imb_exr_is_multi().
|
static |
Definition at line 1884 of file openexr_api.cpp.
Referenced by imb_load_openexr().
|
static |
Definition at line 1937 of file openexr_api.cpp.
Referenced by imb_load_openexr().
|
static |
Definition at line 1603 of file openexr_api.cpp.
References ExrHandle::channels, ELEM, and LISTBASE_FOREACH.
Referenced by imb_exr_multilayer_parse_channels_from_file().
|
static |
|
static |
Definition at line 1837 of file openexr_api.cpp.
References printf.
Referenced by imb_load_openexr().
|
static |
|
static |
Definition at line 1825 of file openexr_api.cpp.
|
static |
Definition at line 1867 of file openexr_api.cpp.
References BLI_strcasecmp(), len, and str.
Referenced by imb_load_openexr().
Definition at line 374 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 2389 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 ) |
Adds flattened ExrChannel's xstride, ystride and rect can be done in set_channel too, for tile writing.
| passname | Does not include view. |
Definition at line 817 of file openexr_api.cpp.
Referenced by IMB_exr_begin_read(), and imb_exr_multilayer_parse_channels_from_file().
| void IMB_exr_add_view | ( | void * | handle, |
| const char * | name ) |
Definition at line 742 of file openexr_api.cpp.
| bool IMB_exr_begin_read | ( | void * | handle, |
| const char * | filepath, | ||
| int * | width, | ||
| int * | height, | ||
| bool | parse_channels ) |
Read from file.
Definition at line 1000 of file openexr_api.cpp.
|
static |
Definition at line 1801 of file openexr_api.cpp.
References data, file, ExrHandle::ifile_stream, IMB_exr_close(), IMB_exr_get_handle(), and imb_exr_multilayer_parse_channels_from_file().
Referenced by imb_load_openexr().
| bool IMB_exr_begin_write | ( | void * | handle, |
| const char * | filepath, | ||
| int | width, | ||
| int | height, | ||
| int | compress, | ||
| const StampData * | stamp ) |
Used for output files (from RenderResult) (single and multi-layer, single and multi-view).
Definition at line 873 of file openexr_api.cpp.
| float * IMB_exr_channel_rect | ( | void * | handle, |
| const char * | layname, | ||
| const char * | passname, | ||
| const char * | viewname ) |
Definition at line 1090 of file openexr_api.cpp.
| void IMB_exr_clear_channels | ( | void * | handle | ) |
Definition at line 1131 of file openexr_api.cpp.
| void IMB_exr_close | ( | void * | handle | ) |
Definition at line 1379 of file openexr_api.cpp.
Referenced by imb_exr_begin_read_mem().
| void * IMB_exr_get_handle | ( | ) |
Definition at line 720 of file openexr_api.cpp.
Referenced by imb_exr_begin_read_mem(), and IMB_exr_get_handle_name().
| void * IMB_exr_get_handle_name | ( | const char * | name | ) |
Definition at line 729 of file openexr_api.cpp.
Definition at line 1570 of file openexr_api.cpp.
References BLI_addtail(), BLI_findstring(), BLI_strncpy(), EXR_LAY_MAXNAME, ExrLayer::name, and offsetof.
Referenced by imb_exr_multilayer_parse_channels_from_file().
|
static |
Definition at line 748 of file openexr_api.cpp.
References count.
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 1583 of file openexr_api.cpp.
References BLI_addhead(), BLI_addtail(), BLI_findstring(), offsetof, STREQ, and STRNCPY.
Referenced by imb_exr_multilayer_parse_channels_from_file().
|
static |
Definition at line 763 of file openexr_api.cpp.
References exr_has_multipart_file(), exr_has_multiview(), imb_exr_get_multiView_id(), and view.
Referenced by IMB_exr_begin_read(), and imb_exr_multilayer_parse_channels_from_file().
| bool IMB_exr_has_multilayer | ( | void * | handle | ) |
Definition at line 2064 of file openexr_api.cpp.
|
static |
Definition at line 789 of file openexr_api.cpp.
References BLI_assert, BLI_snprintf(), BLI_str_rpartition(), BLI_strncpy(), ELEM, EXR_TOT_MAXNAME, and len.
Referenced by IMB_exr_add_channel(), and IMB_exr_channel_rect().
|
static |
Definition at line 2045 of file openexr_api.cpp.
References exr_has_multipart_file(), exr_has_multiview(), and imb_exr_is_multilayer_file().
Referenced by IMB_exr_has_multilayer(), and imb_load_openexr().
|
static |
Definition at line 1960 of file openexr_api.cpp.
Referenced by imb_exr_is_multi().
| 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) ) |
Definition at line 1332 of file openexr_api.cpp.
References BLI_listbase_is_empty(), LISTBASE_FOREACH, and printf.
Referenced by BKE_movieclip_convert_multilayer_ibuf(), render_result_new_from_exr(), and studiolight_load_equirect_image().
|
static |
Definition at line 1679 of file openexr_api.cpp.
References ExrChannel::chan_id, channels(), ELEM, exr_channels_in_multi_part_file(), exr_has_xyz_channels(), EXR_PASS_MAXCHAN, EXR_PASS_MAXNAME, EXR_TOT_MAXNAME, IMB_exr_add_channel(), imb_exr_get_layer(), imb_exr_get_pass(), imb_exr_get_views(), imb_exr_split_channel_name(), LISTBASE_FOREACH, ExrChannel::m, MEM_callocN, ExrChannel::next, ExrLayer::passes, printf, ExrChannel::rect, SNPRINTF, STRNCPY, ExrChannel::view_id, ExrChannel::xstride, and ExrChannel::ystride.
Referenced by IMB_exr_begin_read(), and imb_exr_begin_read_mem().
|
static |
Definition at line 1432 of file openexr_api.cpp.
References BLI_strcaseeq(), BLI_strncpy(), ExrChannel::chan_id, ELEM, and EXR_TOT_MAXNAME.
Referenced by imb_exr_split_channel_name().
|
static |
Definition at line 1453 of file openexr_api.cpp.
References BLI_strncpy(), and EXR_TOT_MAXNAME.
Referenced by imb_exr_split_channel_name().
| void IMB_exr_read_channels | ( | void * | handle | ) |
Definition at line 1253 of file openexr_api.cpp.
Referenced by imb_load_openexr().
| bool IMB_exr_set_channel | ( | void * | handle, |
| const char * | layname, | ||
| const char * | passname, | ||
| int | xstride, | ||
| int | ystride, | ||
| float * | rect ) |
Still clumsy name handling, layers/channels can be ordered as list in list later.
| passname | Here is the raw channel name without the layer. |
Definition at line 1060 of file openexr_api.cpp.
|
static |
Definition at line 1468 of file openexr_api.cpp.
References BLI_strcaseeq(), BLI_strncpy(), BLI_toupper_ascii(), ExrChannel::chan_id, ELEM, EXR_TOT_MAXNAME, imb_exr_pass_name_from_channel(), imb_exr_pass_name_from_channel_name(), imb_exr_split_token(), len, ExrChannel::m, and printf.
Referenced by imb_exr_multilayer_parse_channels_from_file().
|
static |
Get a sub-string from the end of the name, separated by '.'.
Definition at line 1418 of file openexr_api.cpp.
References BLI_str_partition_ex(), int, and str.
Referenced by imb_exr_split_channel_name().
|
static |
Definition at line 1972 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 1142 of file openexr_api.cpp.
| void IMB_exrtile_begin_write | ( | void * | handle, |
| const char * | filepath, | ||
| int | mipmap, | ||
| int | width, | ||
| int | height, | ||
| int | tilex, | ||
| int | tiley ) |
Only used for writing temp. render results (not image files) (FSA and Save Buffers).
Definition at line 936 of file openexr_api.cpp.
| void IMB_exrtile_write_channels | ( | void * | handle, |
| int | partx, | ||
| int | party, | ||
| int | level, | ||
| const char * | viewname, | ||
| bool | empty ) |
Temporary function, used for FSA and Save Buffers. called once per tile * view.
Definition at line 1202 of file openexr_api.cpp.
| void imb_initopenexr | ( | void | ) |
Definition at line 2381 of file openexr_api.cpp.
References BLI_system_thread_count().
| bool imb_is_a_openexr | ( | const unsigned char * | mem, |
| size_t | size ) |
Test presence of OpenEXR file.
| mem | pointer to loaded OpenEXR bit-stream. |
Definition at line 379 of file openexr_api.cpp.
Referenced by imb_load_openexr().
| ImBuf * imb_load_filepath_thumbnail_openexr | ( | const char * | filepath, |
| const int | flags, | ||
| const size_t | max_thumb_size, | ||
| char | colorspace[], | ||
| size_t * | r_width, | ||
| size_t * | r_height ) |
Definition at line 2271 of file openexr_api.cpp.
References BLI_file_size(), COLOR_ROLE_DEFAULT_FLOAT, colorspace_set_default_role(), ImBufFloatBuffer::data, file, ImBuf::float_buffer, IB_rectfloat, IM_MAX_SPACE, IMB_allocFromBuffer(), IMB_allocImBuf(), IMB_flipy(), int, and w().
| ImBuf * imb_load_openexr | ( | const uchar * | mem, |
| size_t | size, | ||
| int | flags, | ||
| char | colorspace[IM_MAX_SPACE] ) |
Definition at line 2070 of file openexr_api.cpp.
References BLI_YCC_ITU_BT709, COLOR_ROLE_DEFAULT_FLOAT, colorspace_set_default_role(), ImBufFloatBuffer::data, double(), exr_has_alpha(), exr_has_chroma(), exr_has_luma(), exr_has_rgb(), exr_has_xyz(), exr_is_half_float(), exr_print_filecontents(), exr_rgba_channelname(), file, flag, ImBuf::flags, ImBuf::float_buffer, ImBuf::ftype, 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, printf, ImBuf::userdata, ImBuf::x, ImBuf::y, and ycc_to_rgb().
Definition at line 625 of file openexr_api.cpp.
References ImBufFloatBuffer::data, ImBuf::encoded_size, ImbFormatOptions::flag, ImBuf::float_buffer, ImBuf::foptions, IB_mem, imb_addencodedbufferImBuf(), imb_save_openexr_float(), imb_save_openexr_half(), and OPENEXR_HALF.
Definition at line 555 of file openexr_api.cpp.
References ImBuf::channels, ImBufFloatBuffer::data, file, ImbFormatOptions::flag, float, ImBuf::float_buffer, ImBuf::foptions, IB_mem, OPENEXR_COMPRESS, openexr_header_compression(), openexr_header_metadata(), ImBuf::planes, printf, ImBuf::x, and ImBuf::y.
Referenced by imb_save_openexr().
Definition at line 454 of file openexr_api.cpp.
References ImBuf::byte_buffer, channels(), ImBuf::channels, ImBufByteBuffer::data, ImBufFloatBuffer::data, exr_printf(), file, ImbFormatOptions::flag, float, ImBuf::float_buffer, float_to_half_safe(), ImBuf::foptions, from, HALF, IB_mem, OPENEXR_COMPRESS, openexr_header_compression(), openexr_header_metadata(), ImBuf::planes, printf, srgb_to_linearrgb(), ImBuf::x, and ImBuf::y.
Referenced by imb_save_openexr().
Definition at line 388 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 429 of file openexr_api.cpp.
References IDProperty::data, IDPropertyData::group, IDP_STRING, IDP_String, LISTBASE_FOREACH, ImBuf::metadata, ImBuf::ppm, and STREQ.
Referenced by imb_save_openexr_float(), and imb_save_openexr_half().
|
static |
Definition at line 445 of file openexr_api.cpp.
Referenced by IMB_exr_begin_write().
|
static |
Definition at line 653 of file openexr_api.cpp.
Referenced by IMB_exr_close(), IMB_exr_get_handle(), and IMB_exr_get_handle_name().