package vendor:OpenEXRCore
Overview
Bindings for OpenEXRCore.
Index
Types (60)
attr_… (26)
- attr_box2f_t
- attr_box2i_t
- attr_bytes_t
- attr_chlist_entry_t
- attr_chlist_t
- attr_chromaticities_t
- attr_float_vector_t
- attr_keycode_t
- attr_list_access_mode_t
- attr_m33d_t
- attr_m33f_t
- attr_m44d_t
- attr_m44f_t
- attr_opaquedata_t
- attr_preview_t
- attr_rational_t
- attr_string_t
- attr_string_vector_t
- attr_tiledesc_t
- attr_timecode_t
- attr_v2d_t
- attr_v2f_t
- attr_v2i_t
- attr_v3d_t
- attr_v3f_t
- attr_v3i_t
- attribute_t
- attribute_type_t
- chunk_info_t
- coding_channel_info_t
- compression_t
- const_context_t
- context_initializer_t
- context_t
- decode_pipeline_t
- deep_image_state_t
- default_write_mode_t
- destroy_stream_func_ptr_t
- encode_pipeline_t
- envmap_t
- error_code_t
- error_handler_cb_t
- lineorder_t
- memory_allocation_func_t
- memory_free_func_t
- perceptual_treatment_t
- pixel_type_t
- query_size_func_ptr_t
- read_func_ptr_t
- result_t
- storage_t
- stream_error_func_ptr_t
- tile_level_mode_t
- tile_round_mode_t
- transcoding_pipeline_buffer_id_t
- write_func_ptr_t
Constants (13)
- COLOR_INTEROP_ID_CHROMATICITIES_TOLERANCE
- CONTEXT_FLAG_DISABLE_CHUNK_RECONSTRUCTION
- CONTEXT_FLAG_SILENT_HEADER_PARSE
- CONTEXT_FLAG_STRICT_HEADER
- DECODE_NON_IMAGE_DATA_AS_POINTERS
- DECODE_PIPELINE_INITIALIZER
- DECODE_SAMPLE_COUNTS_AS_INDIVIDUAL
- DECODE_SAMPLE_DATA_ONLY
- DEFAULT_CONTEXT_INITIALIZER
- ENCODE_DATA_SAMPLE_COUNTS_ARE_INDIVIDUAL
- ENCODE_NON_IMAGE_DATA_AS_POINTERS
- ENCODE_PIPELINE_INITIALIZER
- OPENEXRCORE_SHARED
Variables (0)
This section is empty.
Procedures (185)
- GET_TILE_LEVEL_MODE
- GET_TILE_ROUND_MODE
- PACK_TILE_LEVEL_ROUND
- add_channel
- add_part
attr_… (62)
- attr_declare
- attr_declare_by_type
- attr_get_box2f
- attr_get_box2i
- attr_get_bytes
- attr_get_channels
- attr_get_chromaticities
- attr_get_compression
- attr_get_double
- attr_get_envmap
- attr_get_float
- attr_get_float_vector
- attr_get_int
- attr_get_keycode
- attr_get_lineorder
- attr_get_m33d
- attr_get_m33f
- attr_get_m44d
- attr_get_m44f
- attr_get_preview
- attr_get_rational
- attr_get_string
- attr_get_string_vector
- attr_get_tiledesc
- attr_get_timecode
- attr_get_user
- attr_get_v2d
- attr_get_v2f
- attr_get_v2i
- attr_get_v3d
- attr_get_v3f
- attr_get_v3i
- attr_set_box2f
- attr_set_box2i
- attr_set_bytes
- attr_set_channels
- attr_set_chromaticities
- attr_set_compression
- attr_set_double
- attr_set_envmap
- attr_set_float
- attr_set_float_vector
- attr_set_int
- attr_set_keycode
- attr_set_lineorder
- attr_set_m33d
- attr_set_m33f
- attr_set_m44d
- attr_set_m44f
- attr_set_preview
- attr_set_rational
- attr_set_string
- attr_set_string_vector
- attr_set_tiledesc
- attr_set_timecode
- attr_set_user
- attr_set_v2d
- attr_set_v2f
- attr_set_v2i
- attr_set_v3d
- attr_set_v3f
- attr_set_v3i
- check_color_metadata
- check_color_metadata_values
- chromaticities_to_color_interop_id
- chunk_default_initialize
- color_interop_id_to_chromaticities
compress_… (3)
- copy_unset_attributes
- finish
get_… (43)
- get_attribute_by_index
- get_attribute_by_name
- get_attribute_count
- get_attribute_list
- get_channels
- get_chunk_count
- get_chunk_table
- get_chunk_table_offset
- get_chunk_unpacked_size
- get_color_metadata_warning_as_string
- get_compression
- get_count
- get_data_window
- get_default_dwa_compression_quality
- get_default_error_message
- get_default_lossy_htj2k_quality
- get_default_maximum_image_size
- get_default_maximum_tile_size
- get_default_zip_compression_level
- get_default_zstd_compression_level
- get_display_window
- get_dwa_compression_level
- get_error_code_as_string
- get_file_name
- get_file_version_and_flags
- get_level_sizes
- get_library_version
- get_lineorder
- get_lossy_htj2k_quality
- get_name
- get_pixel_aspect_ratio
- get_scanlines_per_chunk
- get_screen_window_center
- get_screen_window_width
- get_storage
- get_tile_counts
- get_tile_descriptor
- get_tile_levels
- get_tile_sizes
- get_user_data
- get_version
- get_zip_compression_level
- get_zstd_compression_level
- initialize_required_attr
- initialize_required_attr_simple
- print_context_info
- register_attr_type_handler
- rle_compress_buffer
- rle_uncompress_buffer
set_… (24)
- set_channels
- set_chunk_count
- set_compression
- set_data_window
- set_default_dwa_compression_quality
- set_default_lossy_htj2k_quality
- set_default_maximum_image_size
- set_default_maximum_tile_size
- set_default_memory_routines
- set_default_zip_compression_level
- set_default_zstd_compression_level
- set_display_window
- set_dwa_compression_level
- set_lineorder
- set_longname_support
- set_lossy_htj2k_quality
- set_name
- set_pixel_aspect_ratio
- set_screen_window_center
- set_screen_window_width
- set_tile_descriptor
- set_version
- set_zip_compression_level
- set_zstd_compression_level
- test_file_header
- uncompress_buffer
- uncompress_chunk
- validate_chunk_table
Procedure Groups (0)
This section is empty.
`#config` values (1)
Types
attr_box2f_t ¶
attr_box2f_t :: struct #packed { min: attr_v2f_t, max: attr_v2f_t, }
Struct to hold a floating-point box/region definition.
Related Procedures With Parameters
attr_box2i_t ¶
attr_box2i_t :: struct #packed { min: attr_v2i_t, max: attr_v2i_t, }
Struct to hold an integer box/region definition.
Related Procedures With Parameters
attr_bytes_t ¶
attr_bytes_t :: struct { size: uint, data: [^]u8, // The type hint is not null terminated when serialized. The length // is instead determined by the hint_length attribute. hint_length: u32, type_hint: cstring, }
Struct to define bytes attributes
Related Procedures With Parameters
attr_chlist_entry_t ¶
attr_chlist_entry_t :: struct { name: attr_string_t, // Data representation for these pixels: uint, half, float. pixel_type: pixel_type_t, // Possible values are 0 and 1 per docs perceptual_treatment_t. p_linear: u8, reserved: [3]u8, x_sampling: i32, y_sampling: i32, }
Individual channel information.
attr_chlist_t ¶
attr_chlist_t :: struct { num_channels: i32, num_alloced: i32, entries: [^]attr_chlist_entry_t, }
List of channel information (sorted alphabetically).
Related Procedures With Parameters
attr_chromaticities_t ¶
attr_chromaticities_t :: struct #packed { red_x: f32, red_y: f32, green_x: f32, green_y: f32, blue_x: f32, blue_y: f32, white_x: f32, white_y: f32, }
Struct to hold color chromaticities to interpret the tristimulus color values in the image data.
Related Procedures With Parameters
attr_float_vector_t ¶
attr_float_vector_t :: struct { length: i32, // If this is non-zero, the float vector owns the data, if 0, is a const ref. alloc_size: i32, arr: [^]f32, }
Float vector storage struct.
attr_keycode_t ¶
attr_keycode_t :: struct #packed { film_mfc_code: i32, film_type: i32, prefix: i32, count: i32, perf_offset: i32, perfs_per_frame: i32, perfs_per_count: i32, }
Struct to hold keycode information.
Related Procedures With Parameters
attr_list_access_mode_t ¶
attr_list_access_mode_t :: enum i32 { FILE_ORDER, // *< Order they appear in the file SORTED_ORDER, // *< Alphabetically sorted }
Related Procedures With Parameters
attr_m33d_t ¶
attr_m33d_t :: struct #packed { m: [9]f64, }
struct to hold a 64-bit floating-point 3x3 matrix.
Related Procedures With Parameters
attr_m33f_t ¶
attr_m33f_t :: struct #packed { m: [9]f32, }
struct to hold a 32-bit floating-point 3x3 matrix.
Related Procedures With Parameters
attr_m44d_t ¶
attr_m44d_t :: struct #packed { m: [16]f64, }
Struct to hold a 64-bit floating-point 4x4 matrix.
Related Procedures With Parameters
attr_m44f_t ¶
attr_m44f_t :: struct #packed { m: [16]f32, }
Struct to hold a 32-bit floating-point 4x4 matrix.
Related Procedures With Parameters
attr_opaquedata_t ¶
attr_opaquedata_t :: struct { size: i32, unpacked_size: i32, // If this is non-zero, the struct owns the data, if 0, is a const ref. packed_alloc_size: i32, pad: [4]u8, packed_data: rawptr, // When an application wants to have custom data, they can store // * an unpacked form here which will be requested to be destroyed // * upon destruction of the attribute. unpacked_data: rawptr, // An application can register an attribute handler which then // * fills in these function pointers. This allows a user to delay // * the expansion of the custom type until access is desired, and // * similarly, to delay the packing of the data until write time. unpack_func_ptr: proc "c" (ctxt: context_t, data: rawptr, attrsize: i32, outsize: ^i32, outbuffer: ^rawptr) -> result_t, pack_func_ptr: proc "c" (ctxt: context_t, data: rawptr, datasize: i32, outsize: ^i32, outbuffer: rawptr) -> result_t, destroy_unpacked_func_ptr: proc "c" (ctxt: context_t, data: rawptr, attrsize: i32), }
Custom storage structure for opaque data.
Handlers for opaque types can be registered, then when a non-builtin type is encountered with a registered handler, the function pointers to unpack/pack it will be set up.
@sa register_attr_type_handler
attr_preview_t ¶
attr_preview_t :: struct { width: u32, height: u32, // If this is non-zero, the preview owns the data, if 0, is a const ref. alloc_size: uint, rgba: [^]u8, }
Struct to define attributes of an embedded preview image.
Related Procedures With Parameters
attr_string_t ¶
attr_string_t :: struct { length: i32, // If this is non-zero, the string owns the data, if 0, is a const ref to a static string. alloc_size: i32, str: cstring, }
Storage for a string.
attr_string_vector_t ¶
attr_string_vector_t :: struct { n_strings: i32, // If this is non-zero, the string vector owns the data, if 0, is a const ref. alloc_size: i32, strings: [^]attr_string_t, }
Storage for a string vector.
attr_tiledesc_t ¶
Struct holding base tiledesc attribute type defined in spec
NB: This is in a tightly packed area so it can be read directly, be careful it doesn't become padded to the next \c uint32_t boundary.
Related Procedures With Parameters
attr_v2d_t ¶
attr_v2d_t :: distinct [2]f64
Struct to hold a 2-element 64-bit float vector.
Related Procedures With Parameters
attr_v2f_t ¶
attr_v2f_t :: distinct [2]f32
Struct to hold a 2-element 32-bit float vector.
Related Procedures With Parameters
attr_v2i_t ¶
attr_v2i_t :: distinct [2]i32
Struct to hold a 2-element integer vector.
Related Procedures With Parameters
attr_v3d_t ¶
attr_v3d_t :: distinct [3]f64
Struct to hold a 3-element 64-bit float vector.
Related Procedures With Parameters
attr_v3f_t ¶
attr_v3f_t :: distinct [3]f32
Struct to hold a 3-element 32-bit float vector.
Related Procedures With Parameters
attr_v3i_t ¶
attr_v3i_t :: distinct [3]i32
Struct to hold a 3-element integer vector.
Related Procedures With Parameters
attribute_t ¶
attribute_t :: struct { // Name of the attribute. name: cstring, // String type name of the attribute. type_name: cstring, // Length of name string (short flag is 31 max, long allows 255). name_length: u8, // Length of type string (short flag is 31 max, long allows 255). type_name_length: u8, pad: [2]u8, // Enum of the attribute type. type: attribute_type_t, // Union of pointers of different types that can be used to type // * pun to an appropriate type for builtins. Do note that while // * this looks like a big thing, it is only the size of a single // * pointer. These are all pointers into some other data block // * storing the value you want, with the exception of the pod types // * which are just put in place (i.e. small value optimization). // * // * The attribute type \c type should directly correlate to one // * of these entries. using _: struct #raw_union { // NB: not pointers for POD types uc: u8, d: f64, f: f32, i: i32, box2i: ^attr_box2i_t, box2f: ^attr_box2f_t, bytes: ^attr_bytes_t, chlist: ^attr_chlist_t, chromaticities: ^attr_chromaticities_t, keycode: ^attr_keycode_t, floatvector: ^attr_float_vector_t, m33f: ^attr_m33f_t, m33d: ^attr_m33d_t, m44f: ^attr_m44f_t, m44d: ^attr_m44d_t, preview: ^attr_preview_t, rational: ^attr_rational_t, string: ^attr_string_t, stringvector: ^attr_string_vector_t, tiledesc: ^attr_tiledesc_t, timecode: ^attr_timecode_t, v2i: ^attr_v2i_t, v2f: ^attr_v2f_t, v2d: ^attr_v2d_t, v3i: ^attr_v3i_t, v3f: ^attr_v3f_t, v3d: ^attr_v3d_t, opaque: ^attr_opaquedata_t, rawptr: ^u8, }, }
Storage, name and type information for an attribute.
Attributes (metadata) for the file cause a surprising amount of overhead. It is not uncommon for a production-grade EXR to have many attributes. As such, the attribute struct is designed in a slightly more complicated manner. It is optimized to have the storage for that attribute: the struct itself, the name, the type, and the data all allocated as one block. Further, the type and standard names may use a static string to avoid allocating space for those as necessary with the pointers pointing to static strings (not to be freed). Finally, small values are optimized for.
attribute_type_t ¶
attribute_type_t :: enum i32 { UNKNOWN = 0, // Type indicating an error or uninitialized attribute. BOX2I, // Integer region definition. @see attr_box2i_t. BOX2F, // Float region definition. @see attr_box2f_t. BYTES, // Bytes definition. @see attr_bytes_t. CHLIST, // Definition of channels in file @see chlist_entry. CHROMATICITIES, // Values to specify color space of colors in file @see attr_chromaticities_t. COMPRESSION, // ``u8`` declaring compression present. DOUBLE, // Double precision floating point number. ENVMAP, // ``u8`` declaring environment map type. FLOAT, // Normal (4 byte) precision floating point number. FLOAT_VECTOR, // List of normal (4 byte) precision floating point numbers. INT, // 32-bit signed integer value. KEYCODE, // Struct recording keycode @see attr_keycode_t. LINEORDER, // ``u8`` declaring scanline ordering. M33F, // 9 32-bit floats representing a 3x3 matrix. M33D, // 9 64-bit floats representing a 3x3 matrix. M44F, // 16 32-bit floats representing a 4x4 matrix. M44D, // 16 64-bit floats representing a 4x4 matrix. PREVIEW, // 2 ``unsigned ints`` followed by 4 x w x h ``u8`` image. RATIONAL, // \c int followed by ``unsigned int`` STRING, // ``int`` (length) followed by char string data. STRING_VECTOR, // 0 or more text strings (int + string). number is based on attribute size. TILEDESC, // 2 ``unsigned ints`` ``xSize``, ``ySize`` followed by mode. TIMECODE, // 2 ``unsigned ints`` time and flags, user data. V2I, // Pair of 32-bit integers. V2F, // Pair of 32-bit floats. V2D, // Pair of 64-bit floats. V3I, // Set of 3 32-bit integers. V3F, // Set of 3 32-bit floats. V3D, // Set of 3 64-bit floats. DEEP_IMAGE_STATE, // ``uint8_t`` declaring deep image state. OPAQUE, // User/unknown provided type. }
Built-in/native attribute type enum.
This will enable us to do a tagged type struct to generically store attributes.
chunk_info_t ¶
chunk_info_t :: struct { idx: i32, // For tiles, this is the tilex; for scans it is the x. start_x: i32, // For tiles, this is the tiley; for scans it is the scanline y. start_y: i32, height: i32, // *< For this chunk. width: i32, // *< For this chunk. level_x: u8, // *< For tiled files. level_y: u8, // *< For tiled files. type: u8, compression: u8, data_offset: u64, packed_size: u64, unpacked_size: u64, sample_count_data_offset: u64, sample_count_table_size: u64, }
Struct describing raw data information about a chunk.
A chunk is the generic term for a pixel data block in an EXR file, as described in the OpenEXR File Layout documentation. This is common between all different forms of data that can be stored.
coding_channel_info_t ¶
coding_channel_info_t :: struct { // Channel name. // * // * This is provided as a convenient reference. Do not free, this // * refers to the internal data structure in the context. channel_name: cstring, // Number of lines for this channel in this chunk. // * // * May be 0 or less than overall image height based on sampling // * (i.e. when in 4:2:0 type sampling) height: i32, // Width in pixel count. // * // * May be 0 or less than overall image width based on sampling // * (i.e. 4:2:2 will have some channels have fewer values). width: i32, // Horizontal subsampling information. x_samples: i32, // Vertical subsampling information. y_samples: i32, // Linear flag from channel definition (used by b44). p_linear: u8, // How many bytes per pixel this channel consumes (2 for float16, // * 4 for float32/uint32). bytes_per_element: i8, // Small form of exr_pixel_type_t enum (EXR_PIXEL_UINT/HALF/FLOAT). data_type: u16, // How many bytes per pixel the input is or output should be // * (2 for float16, 4 for float32/uint32). Defaults to same // * size as input. user_bytes_per_element: i16, // Small form of exr_pixel_type_t enum // * (EXR_PIXEL_UINT/HALF/FLOAT). Defaults to same type as input. user_data_type: u16, user_pixel_stride: i32, // When \c lines > 1 for a chunk, this is the increment used to get // * from beginning of line to beginning of next line. // * // * This is in bytes. Must be specified when the decode pointer is // * specified (and always for encode). user_line_stride: i32, // This data member has different requirements reading vs // * writing. When reading, if this is left as `NULL`, the channel // * will be skipped during read and not filled in. During a write // * operation, this pointer is considered const and not // * modified. To make this more clear, a union is used here. using _: struct #raw_union { decode_to_ptr: ^u8, encode_from_ptr: ^u8, }, }
Struct for negotiating buffers when decoding/encoding chunks of data.
This is generic and meant to negotiate exr data bi-directionally, in that the same structure is used for both decoding and encoding chunks for read and write, respectively.
The first half of the structure will be filled by the library, and the caller is expected to fill the second half appropriately.
color_metadata_t ¶
color_metadata_t :: struct { // The part's colorInteropID, or NULL if it has none. color_interop_id: cstring, // The part's chromaticities, or NULL if it has none. chromaticities: ^attr_chromaticities_t, // Non-zero if the part has a whiteLuminance attribute. has_white_luminance: i32, // Non-zero if the part has an adoptedNeutral attribute. has_adopted_neutral: i32, // Non-zero if the part has an acesImageContainerFlag attribute, of any type. has_aces_image_container_flag: i32, // The value of the part's acesImageContainerFlag. Only read when // * `has_aces_image_container_flag` is non-zero. Pass any value other // * than 1 when the attribute is present but is not an int, since a // * wrong type and a wrong value are reported the same way. aces_image_container_flag: i32, // The first part's colorInteropID, or NULL if the first part has none. // * Only read when `compare_to_first_part` is non-zero. first_part_color_interop_id: cstring, // Non-zero to check the shared attribute rules against // * `first_part_color_interop_id`. Leave this zero when checking the // * first part of a file, or a single-part file, since there is then // * nothing to compare against. compare_to_first_part: i32, }
The color space metadata of one part, as input to
check_color_metadata_values.
All strings are NULL-terminated and are only read for the duration of the call.
color_metadata_warning_flag_t ¶
color_metadata_warning_flag_t :: enum u32 { EMPTY_INTEROP_ID = 0, CHROMATICITIES_DIFFER = 1, DATA_HAS_CHROMATICITIES = 2, DATA_HAS_WHITE_LUMINANCE = 3, DATA_HAS_ADOPTED_NEUTRAL = 4, INTEROP_ID_NOT_SHARED = 5, ACES_FLAG_NOT_ONE = 6, ACES_FLAG_INTEROP_ID_NOT_AP0 = 7, ACES_FLAG_NO_CHROMATICITIES = 8, ACES_FLAG_CHROMATICITIES_NOT_AP0 = 9, }
The same flags as a bit_set, for the u32 that check_color_metadata fills in
(transmute(color_metadata_warning_flags_t)warnings).
color_metadata_warning_flags_t ¶
color_metadata_warning_flags_t :: bit_set[color_metadata_warning_flag_t; u32]
color_metadata_warning_t ¶
color_metadata_warning_t :: enum i32 { // No inconsistency was found. OK = 0, // colorInteropID is present but empty; it should be omitted, or set // * to "unknown", instead. EMPTY_INTEROP_ID = 1 << 0, // colorInteropID denotes a color space with defined chromaticities, the // * part also has a chromaticities attribute, and they are different. CHROMATICITIES_DIFFER = 1 << 1, // colorInteropID is "data", marking the part as deliberately not color // * managed, yet the part has a chromaticities attribute. DATA_HAS_CHROMATICITIES = 1 << 2, // colorInteropID is "data", yet the part has a whiteLuminance attribute. DATA_HAS_WHITE_LUMINANCE = 1 << 3, // colorInteropID is "data", yet the part has an adoptedNeutral attribute. DATA_HAS_ADOPTED_NEUTRAL = 1 << 4, // This part of a multipart file has a colorInteropID that is neither // * "data" nor equal to the first part's, so it does not conform to the // * shared attribute rules. INTEROP_ID_NOT_SHARED = 1 << 5, // acesImageContainerFlag is present but is not an int of value 1. It // * is the only defined value; the attribute is a flag, and its presence // * alone is not the assertion. ACES_FLAG_NOT_ONE = 1 << 6, // acesImageContainerFlag is present, so the part must be ACES2065-1, // * but its colorInteropID is present and is not "lin_ap0_scene". ACES_FLAG_INTEROP_ID_NOT_AP0 = 1 << 7, // acesImageContainerFlag is present, but the part has no // * chromaticities attribute. ST 2065-4 requires it. ACES_FLAG_NO_CHROMATICITIES = 1 << 8, // acesImageContainerFlag is present and the part has chromaticities, // * but they are not those of "lin_ap0_scene". ACES_FLAG_CHROMATICITIES_NOT_AP0 = 1 << 9, }
Inconsistencies that check_color_metadata can report.
None of these make a file malformed or unsafe to read. They are semantic problems that leave a part's color space ambiguous, so they are reported as warnings rather than as errors.
The values are flags, and are returned OR'd together in a u32.
compression_t ¶
compression_t :: enum i32 { NONE = 0, RLE = 1, ZIPS = 2, ZIP = 3, PIZ = 4, PXR24 = 5, B44 = 6, B44A = 7, DWAA = 8, DWAB = 9, HTJ2K256 = 10, // High-Throughput JPEG 2000, lossless, 256 scanlines. HTJ2K32 = 11, // High-Throughput JPEG 2000, lossless, 32 scanlines. LJ2K = 12, // High-Throughput JPEG 2000, lossy, 256 scanlines. ZSTD = 13, // zstd lossless compression, one scan line at a time. }
Enum declaring allowed values for \c u8 value stored in built-in compression type.
const_context_t ¶
const_context_t :: context_t
context_initializer_t ¶
context_initializer_t :: struct { // Size member to tag initializer for version stability. // * // * This should be initialized to the size of the current // * structure. This allows EXR to add functions or other // * initializers in the future, and retain version compatibility size: uint, // Error callback function pointer // * // * The error callback is allowed to be `NULL`, and will use a // * default print which outputs to \c stderr. // * // * @sa exr_error_handler_cb_t error_handler_fn: error_handler_cb_t, // Custom allocator, if `NULL`, will use malloc. @sa memory_allocation_func_t alloc_fn: memory_allocation_func_t, // Custom deallocator, if `NULL`, will use free. @sa memory_free_func_t free_fn: memory_free_func_t, // Blind data passed to custom read, size, write, destroy // * functions below. Up to user to manage this pointer. user_data: rawptr, // Custom read routine. // * // * This is only used during read or update contexts. If this is // * provided, it is expected that the caller has previously made // * the stream available, and placed whatever stream/file data // * into \c user_data above. // * // * If this is `NULL`, and the context requested is for reading an // * exr file, an internal implementation is provided for reading // * from normal filesystem files, and the filename provided is // * attempted to be opened as such. // * // * Expected to be `NULL` for a write-only operation, but is ignored // * if it is provided. // * // * For update contexts, both read and write functions must be // * provided if either is. // * // * @sa exr_read_func_ptr_t read_fn: read_func_ptr_t, // Custom size query routine. // * // * Used to provide validation when reading header values. If this // * is not provided, but a custom read routine is provided, this // * will disable some of the validation checks when parsing the // * image header. // * // * Expected to be `NULL` for a write-only operation, but is ignored // * if it is provided. // * // * @sa exr_query_size_func_ptr_t size_fn: query_size_func_ptr_t, // Custom write routine. // * // * This is only used during write or update contexts. If this is // * provided, it is expected that the caller has previously made // * the stream available, and placed whatever stream/file data // * into \c user_data above. // * // * If this is `NULL`, and the context requested is for writing an // * exr file, an internal implementation is provided for reading // * from normal filesystem files, and the filename provided is // * attempted to be opened as such. // * // * For update contexts, both read and write functions must be // * provided if either is. // * // * @sa exr_write_func_ptr_t write_fn: write_func_ptr_t, // Optional function to destroy the user data block of a custom stream. // * // * Allows one to free any user allocated data, and close any handles. // * // * @sa exr_destroy_stream_func_ptr_t // * destroy_fn: destroy_stream_func_ptr_t, // Initialize a field specifying what the maximum image width // * allowed by the context is. See exr_set_default_maximum_image_size() to // * understand how this interacts with global defaults. max_image_width: i32, // Initialize a field specifying what the maximum image height // * allowed by the context is. See exr_set_default_maximum_image_size() to // * understand how this interacts with global defaults. max_image_height: i32, // Initialize a field specifying what the maximum tile width // * allowed by the context is. See exr_set_default_maximum_tile_size() to // * understand how this interacts with global defaults. max_tile_width: i32, // Initialize a field specifying what the maximum tile height // * allowed by the context is. See exr_set_default_maximum_tile_size() to // * understand how this interacts with global defaults. max_tile_height: i32, // Initialize a field specifying what the default zip compression level should be // * for this context. See exr_set_default_zip_compresion_level() to // * set it for all contexts. zip_level: i32, // Initialize the default dwa compression quality. See // * exr_set_default_dwa_compression_quality() to set the default // * for all contexts. dwa_quality: f32, // Initialize with a bitwise or of the various context flags flags: i32, // Initialize the default HTJ2K compression quality. See // * set_default_lossy_htj2k_quality() to set the default for all // * contexts. lossy_htj2k_quality: f32, // Default zstd compression level for this context (1-22; values are // * clamped). See set_default_zstd_compression_level() for the global // * default (5). zstd_level: i32, }
Struct used to pass function pointers into the context initialization routines.
This partly exists to avoid the chicken and egg issue around creating the storage needed for the context on systems which want to override the malloc/free routines.
However, it also serves to make a tidier/simpler set of functions to create and start processing exr files.
The size member is required for version portability.
It can be initialized using \c EXR_DEFAULT_CONTEXT_INITIALIZER.
\code{.c} exr_context_initializer_t myctxtinit = DEFAULT_CONTEXT_INITIALIZER; myctxtinit.error_cb = &my_super_cool_error_callback_function; ... \endcode
Related Procedures With Parameters
Related Constants
context_t ¶
context_t :: distinct rawptr
decode_pipeline_t ¶
decode_pipeline_t :: struct { // Used for versioning the decode pipeline in the future. // * // * \ref EXR_DECODE_PIPELINE_INITIALIZER pipe_size: uint, // The output channel information for this chunk. // * // * User is expected to fill the channel pointers for the desired // * output channels (any that are `NULL` will be skipped) if you are // * going to use exr_decoding_choose_default_routines(). If all that is // * desired is to read and decompress the data, this can be left // * uninitialized. // * // * Describes the channel information. This information is // * allocated dynamically during exr_decoding_initialize(). channels: [^]coding_channel_info_t, channel_count: i16, // Decode flags to control the behavior. decode_flags: u16, // Copy of the parameters given to the initialize/update for // * convenience. part_index: i32, ctx: context_t, chunk: chunk_info_t, // How many lines of the chunk to skip filling, assumes the // * pointer is at the beginning of data (i.e. includes this // * skip so does not need to be adjusted user_line_begin_skip: i32, // How many lines of the chunk to ignore at the end, assumes the // * output is meant to be N lines smaller user_line_end_ignore: i32, // How many bytes were actually decoded when items compressed bytes_decompressed: u64, // Can be used by the user to pass custom context data through // * the decode pipeline. decoding_user_data: rawptr, // The (compressed) buffer. // * // * If `NULL`, will be allocated during the run of the pipeline. // * // * If the caller wishes to take control of the buffer, simple // * adopt the pointer and set it to `NULL` here. Be cognizant of any // * custom allocators. packed_buffer: rawptr, // Used when re-using the same decode pipeline struct to know if // * chunk is changed size whether current buffer is large enough. packed_alloc_size: uint, // The decompressed buffer (unpacked_size from the chunk block // * info), but still packed into storage order, only needed for // * compressed files. // * // * If `NULL`, will be allocated during the run of the pipeline when // * needed. // * // * If the caller wishes to take control of the buffer, simple // * adopt the pointer and set it to `NULL` here. Be cognizant of any // * custom allocators. unpacked_buffer: rawptr, // Used when re-using the same decode pipeline struct to know if // * chunk is changed size whether current buffer is large enough. unpacked_alloc_size: uint, // For deep or other non-image data: packed sample table // * (compressed, raw on disk representation). packed_sample_count_table: rawptr, packed_sample_count_alloc_size: uint, // Usable, native sample count table. Depending on the flag set // * above, will be decoded to either a cumulative list (n, n+m, // * n+m+o, ...), or an individual table (n, m, o, ...). As an // * optimization, if the latter individual count table is chosen, // * an extra int32_t will be allocated at the end of the table to // * contain the total count of samples, so the table will be n+1 // * samples in size. sample_count_table: [^]i32, sample_count_alloc_size: uint, // A scratch buffer of unpacked_size for intermediate results. // * // * If `NULL`, will be allocated during the run of the pipeline when // * needed. // * // * If the caller wishes to take control of the buffer, simple // * adopt the pointer and set it to `NULL` here. Be cognizant of any // * custom allocators. scratch_buffer_1: rawptr, // Used when re-using the same decode pipeline struct to know if // * chunk is changed size whether current buffer is large enough. scratch_alloc_size_1: uint, // Some decompression routines may need a second scratch buffer (zlib). // * // * If `NULL`, will be allocated during the run of the pipeline when // * needed. // * // * If the caller wishes to take control of the buffer, simple // * adopt the pointer and set it to `NULL` here. Be cognizant of any // * custom allocators. scratch_buffer_2: rawptr, // Used when re-using the same decode pipeline struct to know if // * chunk is changed size whether current buffer is large enough. scratch_alloc_size_2: uint, // Enable a custom allocator for the different buffers (if // * decoding on a GPU). If `NULL`, will use the allocator from the // * context. alloc_fn: proc "c" (transcoding_pipeline_buffer_id_t, uint) -> rawptr, // Enable a custom allocator for the different buffers (if // * decoding on a GPU). If `NULL`, will use the allocator from the // * context. free_fn: proc "c" (transcoding_pipeline_buffer_id_t, rawptr), // Function chosen to read chunk data from the context. // * // * Initialized to a default generic read routine, may be updated // * based on channel information when // * exr_decoding_choose_default_routines() is called. This is done such that // * if the file is uncompressed and the output channel data is // * planar and the same type, the read function can read straight // * into the output channels, getting closer to a zero-copy // * operation. Otherwise a more traditional read, decompress, then // * unpack pipeline will be used with a default reader. // * // * This is allowed to be overridden, but probably is not necessary // * in most scenarios. read_fn: proc "c" (pipeline: ^decode_pipeline_t) -> result_t, // Function chosen based on the compression type of the part to // * decompress data. // * // * If the user has a custom decompression method for the // * compression on this part, this can be changed after // * initialization. // * // * If only compressed data is desired, then assign this to `NULL` // * after initialization. decompress_fn: proc "c" (pipeline: ^decode_pipeline_t) -> result_t, // Function which can be provided if you have bespoke handling for // * non-image data and need to re-allocate the data to handle the // * about-to-be unpacked data. // * // * If left `NULL`, will assume the memory pointed to by the channel // * pointers is sufficient. realloc_nonimage_data_fn: proc "c" (pipeline: ^decode_pipeline_t) -> result_t, // Function chosen based on the output layout of the channels of the part to // * decompress data. // * // * This will be `NULL` after initialization, until the user // * specifies a custom routine, or initializes the channel data and // * calls exr_decoding_choose_default_routines(). // * // * If only compressed data is desired, then leave or assign this // * to `NULL` after initialization. unpack_and_convert_fn: proc "c" (pipeline: ^decode_pipeline_t) -> result_t, // Small stash of channel info values. This is faster than calling // * malloc when the channel count in the part is small (RGBAZ), // * which is super common, however if there are a large number of // * channels, it will allocate space for that, so do not rely on // * this being used. _quick_chan_store: [5]coding_channel_info_t, // Set when the sample count table has been decompressed. sample_count_valid: i32, // Some compression methods (using external libraries) require additional // * contexts to be constructed. Rather than re-initialize those every chunk, // * allow the context to be re-used across chunks. // * // * NB: Do not store thread-specific data or contexts which use // * thread-specific data using this mechanism, as the decode pipeline is // * free to be used by multiple threads from invocation to invocation // * (just not concurrently). // * // * If the context is not NULL upon destruction, or if somehow the // * compression changes during an update, the `free_compression_context` // * function will be invoked. If that free routine is not provided, // * memory may leak. compression_context: rawptr, // Cleanup routine for the `compression_context` member. // * If a compression context is set, but this routine is NULL, // * no attempt to free will be made, so your program might leak. free_compression_context: proc "c" (pipeline: ^decode_pipeline_t), }
Struct meant to be used on a per-thread basis for reading exr data
As should be obvious, this structure is NOT thread safe, but rather meant to be used by separate threads, which can all be accessing the same context concurrently.
Related Procedures With Parameters
Related Constants
deep_image_state_t ¶
deep_image_state_t :: enum i32 { MESSY = 0, SORTED = 1, NON_OVERLAPPING = 2, TIDY = 3, }
Enum declaring allowed values for \c u8 value stored in \c deepImageState type.
default_write_mode_t ¶
default_write_mode_t :: enum i32 { WRITE_FILE_DIRECTLY = 0, // *< Overwrite filename provided directly, deleted upon error. INTERMEDIATE_TEMP_FILE = 1, // *< Create a temporary file, renaming it upon successful write, leaving original upon error }
Enum describing how default files are handled during write.
destroy_stream_func_ptr_t ¶
Destroy custom stream function pointer
Generic callback to clean up user data for custom streams. This is called when the file is closed and expected not to error.
@param failed Indicates the write operation failed, the implementor may wish to cleanup temporary files
encode_pipeline_t ¶
encode_pipeline_t :: struct { // Used for versioning the decode pipeline in the future // * // * \ref EXR_ENCODE_PIPELINE_INITIALIZER pipe_size: uint, // The output channel information for this chunk. // * // * User is expected to fill the channel pointers for the input // * channels. For writing, all channels must be initialized prior // * to using exr_encoding_choose_default_routines(). If a custom pack routine // * is written, that is up to the implementor. // * // * Describes the channel information. This information is // * allocated dynamically during exr_encoding_initialize(). channels: [^]coding_channel_info_t, channel_count: i16, // Encode flags to control the behavior. encode_flags: u16, // Copy of the parameters given to the initialize/update for convenience. part_index: i32, ctx: context_t, chunk: chunk_info_t, // Can be used by the user to pass custom context data through // * the encode pipeline. encoding_user_data: rawptr, // The packed buffer where individual channels have been put into here. // * // * If `NULL`, will be allocated during the run of the pipeline. // * // * If the caller wishes to take control of the buffer, simple // * adopt the pointer and set it to `NULL` here. Be cognizant of any // * custom allocators. packed_buffer: rawptr, // Differing from the allocation size, the number of actual bytes packed_bytes: u64, // Used when re-using the same encode pipeline struct to know if // * chunk is changed size whether current buffer is large enough // * // * If `NULL`, will be allocated during the run of the pipeline. // * // * If the caller wishes to take control of the buffer, simple // * adopt the pointer and set it to `NULL` here. Be cognizant of any // * custom allocators. packed_alloc_size: uint, // For deep data. NB: the members NOT const because we need to // * temporarily swap it to xdr order and restore it (to avoid a // * duplicate buffer allocation). // * // * Depending on the flag set above, will be treated either as a // * cumulative list (n, n+m, n+m+o, ...), or an individual table // * (n, m, o, ...). sample_count_table: [^]i32, // Allocated table size (to avoid re-allocations). Number of // * samples must always be width * height for the chunk. sample_count_alloc_size: uint, // Packed sample table (compressed, raw on disk representation) // * for deep or other non-image data. packed_sample_count_table: rawptr, // Number of bytes to write (actual size) for the // * packed_sample_count_table. packed_sample_count_bytes: uint, // Allocated size (to avoid re-allocations) for the // * packed_sample_count_table. packed_sample_count_alloc_size: uint, // The compressed buffer, only needed for compressed files. // * // * If `NULL`, will be allocated during the run of the pipeline when // * needed. // * // * If the caller wishes to take control of the buffer, simple // * adopt the pointer and set it to `NULL` here. Be cognizant of any // * custom allocators. compressed_buffer: rawptr, // Must be filled in as the pipeline runs to inform the writing // * software about the compressed size of the chunk (if it is an // * uncompressed file or the compression would make the file // * larger, it is expected to be the packed_buffer) // * // * If the caller wishes to take control of the buffer, simple // * adopt the pointer and set it to zero here. Be cognizant of any // * custom allocators. compressed_bytes: uint, // Used when re-using the same encode pipeline struct to know if // * chunk is changed size whether current buffer is large enough. // * // * If `NULL`, will be allocated during the run of the pipeline when // * needed. // * // * If the caller wishes to take control of the buffer, simple // * adopt the pointer and set it to zero here. Be cognizant of any // * custom allocators. compressed_alloc_size: uint, // A scratch buffer for intermediate results. // * // * If `NULL`, will be allocated during the run of the pipeline when // * needed. // * // * If the caller wishes to take control of the buffer, simple // * adopt the pointer and set it to `NULL` here. Be cognizant of any // * custom allocators. scratch_buffer_1: rawptr, // Used when re-using the same encode pipeline struct to know if // * chunk is changed size whether current buffer is large enough. // * // * If `NULL`, will be allocated during the run of the pipeline when // * needed. // * // * If the caller wishes to take control of the buffer, simple // * adopt the pointer and set it to `NULL` here. Be cognizant of any // * custom allocators. scratch_alloc_size_1: uint, // Some compression routines may need a second scratch buffer. // * // * If `NULL`, will be allocated during the run of the pipeline when // * needed. // * // * If the caller wishes to take control of the buffer, simple // * adopt the pointer and set it to `NULL` here. Be cognizant of any // * custom allocators. scratch_buffer_2: rawptr, // Used when re-using the same encode pipeline struct to know if // * chunk is changed size whether current buffer is large enough. scratch_alloc_size_2: uint, // Enable a custom allocator for the different buffers (if // * encoding on a GPU). If `NULL`, will use the allocator from the // * context. alloc_fn: proc "c" (transcoding_pipeline_buffer_id_t, uint) -> rawptr, // Enable a custom allocator for the different buffers (if // * encoding on a GPU). If `NULL`, will use the allocator from the // * context. free_fn: proc "c" (transcoding_pipeline_buffer_id_t, rawptr), // Function chosen based on the output layout of the channels of the part to // * decompress data. // * // * If the user has a custom method for the // * compression on this part, this can be changed after // * initialization. convert_and_pack_fn: proc "c" (pipeline: ^encode_pipeline_t) -> result_t, // Function chosen based on the compression type of the part to // * compress data. // * // * If the user has a custom compression method for the compression // * type on this part, this can be changed after initialization. compress_fn: proc "c" (pipeline: ^encode_pipeline_t) -> result_t, // This routine is used when waiting for other threads to finish // * writing previous chunks such that this thread can write this // * chunk. This is used for parts which have a specified chunk // * ordering (increasing/decreasing y) and the chunks can not be // * written randomly (as could be true for uncompressed). // * // * This enables the calling application to contribute thread time // * to other computation as needed, or just use something like // * pthread_yield(). // * // * By default, this routine will be assigned to a function which // * returns an error, failing the encode immediately. In this way, // * it assumes that there is only one thread being used for // * writing. // * // * It is up to the user to provide an appropriate routine if // * performing multi-threaded writing. yield_until_ready_fn: proc "c" (pipeline: ^encode_pipeline_t) -> result_t, // Function chosen to write chunk data to the context. // * // * This is allowed to be overridden, but probably is not necessary // * in most scenarios. write_fn: proc "c" (pipeline: ^encode_pipeline_t) -> result_t, // Small stash of channel info values. This is faster than calling // * malloc when the channel count in the part is small (RGBAZ), // * which is super common, however if there are a large number of // * channels, it will allocate space for that, so do not rely on // * this being used. _quick_chan_store: [5]coding_channel_info_t, // When set, skip compressing the sample count table separately. skip_sample_count_table_compression: i32, }
Struct meant to be used on a per-thread basis for writing exr data.
As should be obvious, this structure is NOT thread safe, but rather meant to be used by separate threads, which can all be accessing the same context concurrently.
Related Procedures With Parameters
Related Constants
envmap_t ¶
envmap_t :: enum i32 { LATLONG = 0, CUBE = 1, }
Enum declaring allowed values for \c u8 value stored in built-in env map type.
Related Procedures With Parameters
error_handler_cb_t ¶
Error callback function
Because a file can be read from using many threads at once, it is difficult to store an error message for later retrieval. As such, when a file is constructed, a callback function can be provided which delivers an error message for the calling application to handle. This will then be delivered on the same thread causing the error.
lineorder_t ¶
lineorder_t :: enum i32 { INCREASING_Y = 0, DECREASING_Y = 1, RANDOM_Y = 2, }
Enum declaring allowed values for \c u8 value stored in \c lineOrder type.
Related Procedures With Parameters
memory_allocation_func_t ¶
Function pointer used to hold a malloc-like routine.
Providing these to a context will override what memory is used to allocate the context itself, as well as any allocations which happen during processing of a file or stream. This can be used by systems which provide rich malloc tracking routines to override the internal allocations performed by the library.
This function is expected to allocate and return a new memory
handle, or NULL if allocation failed (which the library will then
handle and return an out-of-memory error).
If one is provided, both should be provided. @sa exr_memory_free_func_t
memory_free_func_t ¶
memory_free_func_t :: proc "c" (ptr: rawptr)
Function pointer used to hold a free-like routine.
Providing these to a context will override what memory is used to allocate the context itself, as well as any allocations which happen during processing of a file or stream. This can be used by systems which provide rich malloc tracking routines to override the internal allocations performed by the library.
This function is expected to return memory to the system, ala free from the C library.
If providing one, probably need to provide both routines. @sa exr_memory_allocation_func_t
perceptual_treatment_t ¶
perceptual_treatment_t :: enum i32 { LOGARITHMIC = 0, LINEAR = 1, }
Hint for lossy compression methods about how to treat values (logarithmic or linear), meaning a human sees values like R, G, B, luminance difference between 0.1 and 0.2 as about the same as 1.0 to 2.0 (logarithmic), where chroma coordinates are closer to linear (0.1 and 0.2 is about the same difference as 1.0 and 1.1).
pixel_type_t ¶
pixel_type_t :: enum i32 { UINT = 0, HALF = 1, FLOAT = 2, }
Enum capturing the underlying data type on a channel.
query_size_func_ptr_t ¶
Query stream size function pointer
Used to query the size of the file, or amount of data representing the openexr file in the data stream.
This is used to validate requests against the file. If the size is unavailable, return -1, which will disable these validation steps for this file, although appropriate memory safeguards must be in place in the calling application.
read_func_ptr_t ¶
read_func_ptr_t :: proc "c" (ctxt: context_t, userdata: rawptr, buffer: rawptr, sz: u64, offset: u64, error_cb: stream_error_func_ptr_t) -> i64
Read custom function pointer
Used to read data from a custom output. Expects similar semantics to pread or ReadFile with overlapped data under win32.
It is required that this provides thread-safe concurrent access to the same file. If the stream/input layer you are providing does not have this guarantee, your are responsible for providing appropriate serialization of requests.
A file should be expected to be accessed in the following pattern:
- upon open, the header and part information attributes will be read
- upon the first image read request, the offset tables will be read multiple threads accessing this concurrently may actually read these values at the same time
- chunks can then be read in any order as preferred by the application
While this should mean that the header will be read in 'stream' order (no seeks required), no guarantee is made beyond that to retrieve image/deep data in order. So if the backing file is truly a stream, it is up to the provider to implement appropriate caching of data to give the appearance of being able to seek/read atomically.
result_t ¶
result_t :: enum i32 { SUCCESS = 0, OUT_OF_MEMORY, MISSING_CONTEXT_ARG, INVALID_ARGUMENT, ARGUMENT_OUT_OF_RANGE, FILE_ACCESS, FILE_BAD_HEADER, NOT_OPEN_READ, NOT_OPEN_WRITE, HEADER_NOT_WRITTEN, READ_IO, WRITE_IO, NAME_TOO_LONG, MISSING_REQ_ATTR, INVALID_ATTR, NO_ATTR_BY_NAME, ATTR_TYPE_MISMATCH, ATTR_SIZE_MISMATCH, SCAN_TILE_MIXEDAPI, TILE_SCAN_MIXEDAPI, MODIFY_SIZE_CHANGE, ALREADY_WROTE_ATTRS, BAD_CHUNK_LEADER, CORRUPT_CHUNK, INCOMPLETE_CHUNK_TABLE, INCORRECT_PART, INCORRECT_CHUNK, USE_SCAN_DEEP_WRITE, USE_TILE_DEEP_WRITE, USE_SCAN_NONDEEP_WRITE, USE_TILE_NONDEEP_WRITE, INVALID_SAMPLE_DATA, FEATURE_NOT_IMPLEMENTED, COMPRESSION_FAILED, DECOMPRESSION_FAILED, UNKNOWN, }
Error codes that may be returned by various functions. Return type for all functions.
Related Procedures With Parameters
storage_t ¶
storage_t :: enum i32 { SCANLINE = 0, // Corresponds to type of \c scanlineimage. TILED, // Corresponds to type of \c tiledimage. DEEP_SCANLINE, // Corresponds to type of \c deepscanline. DEEP_TILED, // Corresponds to type of \c deeptile. }
Enum declaring allowed values for part type.
Related Procedures With Parameters
stream_error_func_ptr_t ¶
stream_error_func_ptr_t :: proc "c" (ctxt: context_t, code: result_t, fmt: cstring, args: ..any) -> result_t
Stream error notifier
This function pointer is provided to the stream functions by the library such that they can provide a nice error message to the user during stream operations.
tile_level_mode_t ¶
tile_level_mode_t :: enum i32 { ONE_LEVEL = 0, // Single level of image data. MIPMAP_LEVELS = 1, // Mipmapped image data. RIPMAP_LEVELS = 2, // Ripmapped image data. }
Enum representing what type of tile information is contained.
Related Procedures With Parameters
tile_round_mode_t ¶
tile_round_mode_t :: enum i32 { DOWN = 0, UP = 1, }
Enum representing how to scale positions between levels.
Related Procedures With Parameters
transcoding_pipeline_buffer_id_t ¶
transcoding_pipeline_buffer_id_t :: enum i32 { PACKED, UNPACKED, COMPRESSED, SCRATCH1, SCRATCH2, PACKED_SAMPLES, SAMPLES, }
Enum for use in a custom allocator in the encode/decode pipelines (that is, so the implementor knows whether to allocate on which device based on the buffer disposition).
write_func_ptr_t ¶
write_func_ptr_t :: proc "c" (ctxt: context_t, userdata: rawptr, buffer: rawptr, sz: u64, offset: u64, error_cb: stream_error_func_ptr_t) -> i64
Write custom function pointer
Used to write data to a custom output. Expects similar semantics to pwrite or WriteFile with overlapped data under win32.
It is required that this provides thread-safe concurrent access to the same file. While it is unlikely that multiple threads will be used to write data for compressed forms, it is possible.
A file should be expected to be accessed in the following pattern:
-
upon open, the header and part information attributes is constructed.
-
when the write_header routine is called, the header becomes immutable and is written to the file. This computes the space to store the chunk offsets, but does not yet write the values.
-
Image chunks are written to the file, and appear in the order they are written, not in the ordering that is required by the chunk offset table (unless written in that order). This may vary slightly if the size of the chunks is not directly known and tight packing of data is necessary.
-
at file close, the chunk offset tables are written to the file.
Constants
COLOR_INTEROP_ID_CHROMATICITIES_TOLERANCE ¶
COLOR_INTEROP_ID_CHROMATICITIES_TOLERANCE :: f32(0.001)
Tolerance recommended when matching a chromaticities attribute against the chromaticities of a color interop ID.
This is the value the Color Interop Forum recommendation suggests.
CONTEXT_FLAG_DISABLE_CHUNK_RECONSTRUCTION ¶
CONTEXT_FLAG_DISABLE_CHUNK_RECONSTRUCTION :: 1 << 2
Disables reconstruction logic upon corrupt / missing data chunks
This will disable the reconstruction logic that searches through an incomplete file, and will instead just return errors at read time. This is only valid for reading contexts
CONTEXT_FLAG_SILENT_HEADER_PARSE ¶
CONTEXT_FLAG_SILENT_HEADER_PARSE :: 1 << 1
Disables error messages while parsing headers
The return values will remain the same, but error reporting will be skipped. This is only valid for reading contexts
CONTEXT_FLAG_STRICT_HEADER ¶
CONTEXT_FLAG_STRICT_HEADER :: 1 << 0
context flag which will enforce strict header validation checks and may prevent reading of files which could otherwise be processed.
DECODE_NON_IMAGE_DATA_AS_POINTERS ¶
DECODE_NON_IMAGE_DATA_AS_POINTERS :: u16(1 << 1)
Can be bit-wise or'ed into the decode_flags in the decode pipeline.
Indicates that the data in the channel pointers to decode to is not
a direct pointer, but instead is a pointer-to-pointers. In this
mode, the user_pixel_stride and user_line_stride are used to
advance the pointer offsets for each pixel in the output, but the
user_bytes_per_element and user_data_type are used to put
(successive) entries into each destination pointer (if not NULL).
So each channel pointer must then point to an array of chunk.width * chunk.height pointers.
With this, you can only extract desired pixels (although all the pixels must be initially decompressed) to handle such operations like proxying where you might want to read every other pixel.
If this is NOT set (0), the default unpacking routine assumes the data will be planar and contiguous (each channel is a separate memory block), ignoring user_line_stride and user_pixel_stride.
DECODE_PIPELINE_INITIALIZER ¶
DECODE_PIPELINE_INITIALIZER :: decode_pipeline_t{pipe_size = size_of(decode_pipeline_t)}
DECODE_SAMPLE_COUNTS_AS_INDIVIDUAL ¶
DECODE_SAMPLE_COUNTS_AS_INDIVIDUAL :: u16(1 << 0)
Can be bit-wise or'ed into the decode_flags in the decode pipeline.
Indicates that the sample count table should be decoded to a an individual sample count list (n, m, o, ...), with an extra int at the end containing the total samples.
Without this (i.e. a value of 0 in that bit), indicates the sample count table should be decoded to a cumulative list (n, n+m, n+m+o, ...), which is the on-disk representation.
DECODE_SAMPLE_DATA_ONLY ¶
DECODE_SAMPLE_DATA_ONLY :: u16(1 << 2)
When reading non-image data (i.e. deep), only read the sample table.
DEFAULT_CONTEXT_INITIALIZER ¶
DEFAULT_CONTEXT_INITIALIZER :: context_initializer_t{size = size_of(context_initializer_t), zip_level = -2, dwa_quality = -1, zstd_level = -1}
Simple macro to initialize the context initializer with default values.
ENCODE_DATA_SAMPLE_COUNTS_ARE_INDIVIDUAL ¶
ENCODE_DATA_SAMPLE_COUNTS_ARE_INDIVIDUAL :: u16(1 << 0)
Can be bit-wise or'ed into the decode_flags in the decode pipeline.
Indicates that the sample count table should be encoded from an individual sample count list (n, m, o, ...), meaning it will have to compute the cumulative counts on the fly.
Without this (i.e. a value of 0 in that bit), indicates the sample count table is already a cumulative list (n, n+m, n+m+o, ...), which is the on-disk representation.
ENCODE_NON_IMAGE_DATA_AS_POINTERS ¶
ENCODE_NON_IMAGE_DATA_AS_POINTERS :: u16(1 << 1)
Can be bit-wise or'ed into the decode_flags in the decode pipeline.
Indicates that the data in the channel pointers to encode from is not a direct pointer, but instead is a pointer-to-pointers. In this mode, the user_pixel_stride and user_line_stride are used to advance the pointer offsets for each pixel in the output, but the user_bytes_per_element and user_data_type are used to put (successive) entries into each destination.
So each channel pointer must then point to an array of
chunk.width * chunk.height pointers. If an entry is
NULL, 0 samples will be placed in the output.
If this is NOT set (0), the default packing routine assumes the data will be planar and contiguous (each channel is a separate memory block), ignoring user_line_stride and user_pixel_stride and advancing only by the sample counts and bytes per element.
ENCODE_PIPELINE_INITIALIZER ¶
ENCODE_PIPELINE_INITIALIZER :: encode_pipeline_t{pipe_size = size_of(encode_pipeline_t)}
OPENEXRCORE_SHARED ¶
OPENEXRCORE_SHARED :: #config(OPENEXRCORE_SHARED, false)
-define:OPENEXRCORE_SHARED=false
Variables
This section is empty.
Procedures
GET_TILE_LEVEL_MODE ¶
GET_TILE_LEVEL_MODE :: proc "c" (tiledesc: attr_tiledesc_t) -> tile_level_mode_t {…}
Macro to access type of tiling from packed structure.
GET_TILE_ROUND_MODE ¶
GET_TILE_ROUND_MODE :: proc "c" (tiledesc: attr_tiledesc_t) -> tile_round_mode_t {…}
Macro to access the rounding mode of tiling from packed structure.
PACK_TILE_LEVEL_ROUND ¶
PACK_TILE_LEVEL_ROUND :: proc "c" (lvl: tile_level_mode_t, mode: tile_round_mode_t) -> u8 {…}
Macro to pack the tiling type and rounding mode into packed structure.
add_channel ¶C · exr_add_channelSource · exr_part.odin:371
add_channel :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, ptype: pixel_type_t, percept: perceptual_treatment_t, xsamp: i32, ysamp: i32, ) -> result_t ---
Define a new channel to the output file part.
The @p percept parameter is used for lossy compression techniques to indicate that the value represented is closer to linear (1) or closer to logarithmic (0). For r, g, b, luminance, this is normally 0.
add_part ¶C · exr_add_partSource · exr_part.odin:26
add_part :: proc "c" ( ctxt: context_t, partname: cstring, type: storage_t, new_index: ^i32, ) -> result_t ---
Define a new part in the file.
attr_declare ¶C · exr_attr_declareSource · exr_part.odin:293
attr_declare :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, type: attribute_type_t, newattr: ^^attribute_t, ) -> result_t ---
Declare an attribute within the specified part.
Only valid when a file is opened for write.
attr_declare_by_type ¶C · exr_attr_declare_by_typeSource · exr_part.odin:282
attr_declare_by_type :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, type: cstring, newattr: ^^attribute_t, ) -> result_t ---
Declare an attribute within the specified part.
Only valid when a file is opened for write.
attr_get_box2f ¶C · exr_attr_get_box2fSource · exr_part.odin:470
attr_get_box2f :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, outval: ^attr_box2f_t, ) -> result_t ---
attr_get_box2i ¶C · exr_attr_get_box2iSource · exr_part.odin:458
attr_get_box2i :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, outval: ^attr_box2i_t, ) -> result_t ---
attr_get_bytes ¶C · exr_attr_get_bytesSource · exr_part.odin:482
attr_get_bytes :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, out: ^attr_bytes_t, ) -> result_t ---
attr_get_channels ¶C · exr_attr_get_channelsSource · exr_part.odin:499
attr_get_channels :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, chlist: ^^attr_chlist_t, ) -> result_t ---
Zero-copy query of channel data.
Do not free or manipulate the @p chlist data, or use after the lifetime of the context.
attr_get_chromaticities ¶C · exr_attr_get_chromaticitiesSource · exr_part.odin:514
attr_get_chromaticities :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, chroma: ^attr_chromaticities_t, ) -> result_t ---
attr_get_compression ¶C · exr_attr_get_compressionSource · exr_part.odin:526
attr_get_compression :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, out: ^compression_t, ) -> result_t ---
attr_get_double ¶C · exr_attr_get_doubleSource · exr_part.odin:538
attr_get_envmap ¶C · exr_attr_get_envmapSource · exr_part.odin:542
attr_get_float ¶C · exr_attr_get_floatSource · exr_part.odin:550
attr_get_float_vector ¶C · exr_attr_get_float_vectorSource · exr_part.odin:559
attr_get_float_vector :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, sz: ^i32, out: ^[^]f32, ) -> result_t ---
Zero-copy query of float data.
Do not free or manipulate the @p out data, or use after the lifetime of the context.
attr_get_int ¶C · exr_attr_get_intSource · exr_part.odin:573
attr_get_keycode ¶C · exr_attr_get_keycodeSource · exr_part.odin:577
attr_get_keycode :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, out: ^attr_keycode_t, ) -> result_t ---
attr_get_lineorder ¶C · exr_attr_get_lineorderSource · exr_part.odin:589
attr_get_lineorder :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, out: ^lineorder_t, ) -> result_t ---
attr_get_m33d ¶C · exr_attr_get_m33dSource · exr_part.odin:609
attr_get_m33d :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, out: ^attr_m33d_t, ) -> result_t ---
attr_get_m33f ¶C · exr_attr_get_m33fSource · exr_part.odin:597
attr_get_m33f :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, out: ^attr_m33f_t, ) -> result_t ---
attr_get_m44d ¶C · exr_attr_get_m44dSource · exr_part.odin:633
attr_get_m44d :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, out: ^attr_m44d_t, ) -> result_t ---
attr_get_m44f ¶C · exr_attr_get_m44fSource · exr_part.odin:621
attr_get_m44f :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, out: ^attr_m44f_t, ) -> result_t ---
attr_get_preview ¶C · exr_attr_get_previewSource · exr_part.odin:645
attr_get_preview :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, out: ^attr_preview_t, ) -> result_t ---
attr_get_rational ¶C · exr_attr_get_rationalSource · exr_part.odin:657
attr_get_rational :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, out: ^attr_rational_t, ) -> result_t ---
attr_get_string ¶C · exr_attr_get_stringSource · exr_part.odin:674
attr_get_string :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, length: ^i32, out: ^cstring, ) -> result_t ---
Zero-copy query of string value.
Do not modify the string pointed to by @p out, and do not use after the lifetime of the context.
attr_get_string_vector ¶C · exr_attr_get_string_vectorSource · exr_part.odin:692
attr_get_string_vector :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, size: ^i32, out: [^]cstring, ) -> result_t ---
Zero-copy query of string data.
Do not free the strings pointed to by the array.
Must provide @p size.
\p out must be a ^cstring array large enough to hold
the string pointers for the string vector when provided.
attr_get_tiledesc ¶C · exr_attr_get_tiledescSource · exr_part.odin:706
attr_get_tiledesc :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, out: ^attr_tiledesc_t, ) -> result_t ---
attr_get_timecode ¶C · exr_attr_get_timecodeSource · exr_part.odin:718
attr_get_timecode :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, out: ^attr_timecode_t, ) -> result_t ---
attr_get_user ¶C · exr_attr_get_userSource · exr_part.odin:802
attr_get_v2d ¶C · exr_attr_get_v2dSource · exr_part.odin:754
attr_get_v2d :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, out: ^attr_v2d_t, ) -> result_t ---
attr_get_v2f ¶C · exr_attr_get_v2fSource · exr_part.odin:742
attr_get_v2f :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, out: ^attr_v2f_t, ) -> result_t ---
attr_get_v2i ¶C · exr_attr_get_v2iSource · exr_part.odin:730
attr_get_v2i :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, out: ^attr_v2i_t, ) -> result_t ---
attr_get_v3d ¶C · exr_attr_get_v3dSource · exr_part.odin:790
attr_get_v3d :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, out: ^attr_v3d_t, ) -> result_t ---
attr_get_v3f ¶C · exr_attr_get_v3fSource · exr_part.odin:778
attr_get_v3f :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, out: ^attr_v3f_t, ) -> result_t ---
attr_get_v3i ¶C · exr_attr_get_v3iSource · exr_part.odin:766
attr_get_v3i :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, out: ^attr_v3i_t, ) -> result_t ---
attr_set_box2f ¶C · exr_attr_set_box2fSource · exr_part.odin:476
attr_set_box2f :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, val: ^attr_box2f_t, ) -> result_t ---
attr_set_box2i ¶C · exr_attr_set_box2iSource · exr_part.odin:464
attr_set_box2i :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, val: ^attr_box2i_t, ) -> result_t ---
attr_set_bytes ¶C · exr_attr_set_bytesSource · exr_part.odin:488
attr_set_bytes :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, val: ^attr_bytes_t, ) -> result_t ---
attr_set_channels ¶C · exr_attr_set_channelsSource · exr_part.odin:508
attr_set_channels :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, channels: ^attr_chlist_t, ) -> result_t ---
This allows one to quickly copy the channels from one file to another.
attr_set_chromaticities ¶C · exr_attr_set_chromaticitiesSource · exr_part.odin:520
attr_set_chromaticities :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, chroma: ^attr_chromaticities_t, ) -> result_t ---
attr_set_compression ¶C · exr_attr_set_compressionSource · exr_part.odin:532
attr_set_compression :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, comp: compression_t, ) -> result_t ---
attr_set_double ¶C · exr_attr_set_doubleSource · exr_part.odin:540
attr_set_envmap ¶C · exr_attr_set_envmapSource · exr_part.odin:548
attr_set_float ¶C · exr_attr_set_floatSource · exr_part.odin:552
attr_set_float_vector ¶C · exr_attr_set_float_vectorSource · exr_part.odin:566
attr_set_int ¶C · exr_attr_set_intSource · exr_part.odin:575
attr_set_keycode ¶C · exr_attr_set_keycodeSource · exr_part.odin:583
attr_set_keycode :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, kc: ^attr_keycode_t, ) -> result_t ---
attr_set_lineorder ¶C · exr_attr_set_lineorderSource · exr_part.odin:595
attr_set_lineorder :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, lo: lineorder_t, ) -> result_t ---
attr_set_m33d ¶C · exr_attr_set_m33dSource · exr_part.odin:615
attr_set_m33d :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, m: ^attr_m33d_t, ) -> result_t ---
attr_set_m33f ¶C · exr_attr_set_m33fSource · exr_part.odin:603
attr_set_m33f :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, m: ^attr_m33f_t, ) -> result_t ---
attr_set_m44d ¶C · exr_attr_set_m44dSource · exr_part.odin:639
attr_set_m44d :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, m: ^attr_m44d_t, ) -> result_t ---
attr_set_m44f ¶C · exr_attr_set_m44fSource · exr_part.odin:627
attr_set_m44f :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, m: ^attr_m44f_t, ) -> result_t ---
attr_set_preview ¶C · exr_attr_set_previewSource · exr_part.odin:651
attr_set_preview :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, p: ^attr_preview_t, ) -> result_t ---
attr_set_rational ¶C · exr_attr_set_rationalSource · exr_part.odin:663
attr_set_rational :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, r: ^attr_rational_t, ) -> result_t ---
attr_set_string ¶C · exr_attr_set_stringSource · exr_part.odin:681
attr_set_string_vector ¶C · exr_attr_set_string_vectorSource · exr_part.odin:699
attr_set_tiledesc ¶C · exr_attr_set_tiledescSource · exr_part.odin:712
attr_set_tiledesc :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, td: ^attr_tiledesc_t, ) -> result_t ---
attr_set_timecode ¶C · exr_attr_set_timecodeSource · exr_part.odin:724
attr_set_timecode :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, tc: ^attr_timecode_t, ) -> result_t ---
attr_set_user ¶C · exr_attr_set_userSource · exr_part.odin:810
attr_set_v2d ¶C · exr_attr_set_v2dSource · exr_part.odin:760
attr_set_v2d :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, v: ^attr_v2d_t, ) -> result_t ---
attr_set_v2f ¶C · exr_attr_set_v2fSource · exr_part.odin:748
attr_set_v2f :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, v: ^attr_v2f_t, ) -> result_t ---
attr_set_v2i ¶C · exr_attr_set_v2iSource · exr_part.odin:736
attr_set_v2i :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, v: ^attr_v2i_t, ) -> result_t ---
attr_set_v3d ¶C · exr_attr_set_v3dSource · exr_part.odin:796
attr_set_v3d :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, v: ^attr_v3d_t, ) -> result_t ---
attr_set_v3f ¶C · exr_attr_set_v3fSource · exr_part.odin:784
attr_set_v3f :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, v: ^attr_v3f_t, ) -> result_t ---
attr_set_v3i ¶C · exr_attr_set_v3iSource · exr_part.odin:772
attr_set_v3i :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, v: ^attr_v3i_t, ) -> result_t ---
check_color_metadata ¶C · exr_check_color_metadataSource · exr_color_metadata.odin:197
check_color_metadata :: proc "c" ( ctxt: context_t, part_index: i32, warnings: ^u32, ) -> result_t ---
Check one part of a file for inconsistent color space metadata.
Reads only header attributes; no pixel data is decoded, and nothing is allocated, so this is safe to call on untrusted files.
When part_index is greater than zero, the part's colorInteropID is
additionally checked against the first part's, and
.INTEROP_ID_NOT_SHARED may be reported. This is the only place that
rule is enforced: a context opened with CONTEXT_FLAG_STRICT_HEADER
does not reject such a file, and writing one is not restricted either.
@param ctxt The context to check.
@param part_index Which part of ctxt to check.
@param warnings Receives zero or more color_metadata_warning_t flags
OR'd together, or .OK if nothing was found.
@return .SUCCESS whether or not warnings were found;
.INVALID_ARGUMENT if warnings is NULL;
.INCORRECT_PART if part_index is out of range.
check_color_metadata_values ¶C · exr_check_color_metadata_valuesSource · exr_color_metadata.odin:175
check_color_metadata_values :: proc "c" ( values: ^color_metadata_t, warnings: ^u32, ) -> result_t ---
Check a part's color space metadata for internal inconsistency.
This is the rule implementation behind check_color_metadata. Prefer
that function when you have a context to check; use this one to check
metadata you are about to write, before any context exists.
@param values The metadata to check.
@param warnings Receives zero or more color_metadata_warning_t flags
OR'd together, or .OK if nothing was found.
@return .SUCCESS whether or not warnings were found;
.INVALID_ARGUMENT if either argument is NULL.
chromaticities_to_color_interop_id ¶C · exr_chromaticities_to_color_interop_idSource · exr_color_metadata.odin:157
chromaticities_to_color_interop_id :: proc "c" ( chromaticities: ^attr_chromaticities_t, tolerance: f32, color_interop_id: ^cstring, ) -> result_t ---
Return the color interop ID denoting a set of chromaticities.
The reverse of color_interop_id_to_chromaticities; the same six IDs
are the only possible results.
A set of chromaticities matches an entry when all four coordinate pairs
are within +/- tolerance in both x and y. Pass
COLOR_INTEROP_ID_CHROMATICITIES_TOLERANCE unless you have reason not to.
@return .SUCCESS if the chromaticities match an entry, in which
case color_interop_id receives a pointer to a static string that must
not be freed; .NO_ATTR_BY_NAME if they match no entry, in which
case color_interop_id is left unmodified; .INVALID_ARGUMENT if
either pointer argument is NULL or tolerance is negative.
chunk_default_initialize ¶C · exr_chunk_default_initializeSource · exr_chunkio.odin:50
chunk_default_initialize :: proc "c" ( ctxt: context_t, part_index: i32, box: ^attr_box2i_t, levelx: i32, levely: i32, cinfo: ^chunk_info_t, ) -> result_t ---
initialize chunk info with the default values from the specified part
The 'x' and 'y' parameters are used to indicate the starting position of the chunk being initialized. This does not perform any I/O to validate and so the values are only indicative. (but can be used to do things like compress / decompress a chunk without having a file to actually read
color_interop_id_to_chromaticities ¶C · exr_color_interop_id_to_chromaticitiesSource · exr_color_metadata.odin:138
color_interop_id_to_chromaticities :: proc "c" ( color_interop_id: cstring, chromaticities: ^attr_chromaticities_t, ) -> result_t ---
Return the chromaticities denoted by a color interop ID.
The Color Interop Forum recommendation for OpenEXR files defines a mapping between chromaticities and the subset of color interop IDs that denote linear, scene-referred RGB color spaces. Only these six IDs have a defined mapping:
lin_rec709_scene lin_ap0_scene lin_ap1_scene
lin_p3d65_scene lin_rec2020_scene lin_adobergb_scene
Note that the recommendation is that the chromaticities attribute not be set when setting the colorInteropID, other than for ST 2065-4 compliance. This function is intended for feeding legacy consumers that understand only chromaticities.
@return .SUCCESS if color_interop_id has a defined mapping, in
which case chromaticities is filled in; .NO_ATTR_BY_NAME for
any other ID, including "unknown" and "data", in which case
chromaticities is left unmodified; .INVALID_ARGUMENT if either
argument is NULL.
compress_buffer ¶C · exr_compress_bufferSource · exr_compression.odin:16
compress_buffer :: proc "c" ( ctxt: context_t, level: i32, in_: rawptr, in_bytes: uint, out: rawptr, out_bytes_avail: uint, actual_out: ^uint, ) -> result_t ---
Compresses a buffer using a zlib style compression.
If the level is -1, will use the default compression set to the library \ref set_default_zip_compression_level data. This may include some extra padding for headers / scratch
compress_chunk ¶C · exr_compress_chunkSource · exr_compression.odin:105
compress_chunk :: proc "c" (encode_state: ^encode_pipeline_t) -> result_t ---
Exposes a method to apply compression to a chunk of data.
This can be useful for inheriting default behavior of the compression stage of an encoding pipeline, or other helper classes to expose compression.
NB: As implied, this function will be used during a normal encode and write operation but can be used directly with a temporary context (i.e. not running the full encode pipeline).
compress_max_buffer_size ¶C · exr_compress_max_buffer_sizeSource · exr_compression.odin:9
Computes a buffer that will be large enough to hold the compressed data. This may include some extra padding for headers / scratch
compression_description ¶C · exr_compression_descriptionSource · exr_compression.odin:79
compression_description :: proc "c" (comptype: compression_t) -> cstring ---
Routine to give a short description for a compression type.
This is useful for building user-facing routines.
compression_is_lossy ¶C · exr_compression_is_lossySource · exr_compression.odin:86
compression_is_lossy :: proc "c" (comptype: compression_t) -> i32 ---
Routine to query whether the compression mechanism is lossy.
Returns 1 when the compression type is valid and does NOT preserve data integrity, 0 otherwise.
compression_is_valid_for_deep ¶C · exr_compression_is_valid_for_deepSource · exr_compression.odin:93
compression_is_valid_for_deep :: proc "c" (comptype: compression_t) -> i32 ---
Routine to query whether the compression mechanism is valid for deep compression.
Returns 1 when the compression type is valid to compress deep data, 0 otherwise.
compression_lines_per_chunk ¶C · exr_compression_lines_per_chunkSource · exr_compression.odin:57
compression_lines_per_chunk :: proc "c" (comptype: compression_t) -> i32 ---
Routine to query the lines required per chunk to compress with the specified method.
This is only meaningful for scanline encodings, tiled representations have a different interpretation of this.
These are constant values, this function returns -1 if the compression type is unknown.
compression_name ¶C · exr_compression_nameSource · exr_compression.odin:63
compression_name :: proc "c" (comptype: compression_t) -> cstring ---
Routine to give a short name for a compression type.
This is useful for building user-facing routines.
compression_type_from_name ¶C · exr_compression_type_from_nameSource · exr_compression.odin:73
compression_type_from_name :: proc "c" (compname: cstring) -> compression_t ---
Routine to map a short compression name back to a compression type.
This is useful for building user-facing routines and similar string-based storage where you may not want the integer.
This will return an out of range value (the C enum's LAST_TYPE) when the name is invalid
or otherwise unrecognised.
copy_unset_attributes ¶C · exr_copy_unset_attributesSource · exr_part.odin:355
copy_unset_attributes :: proc "c" ( ctxt: context_t, part_index: i32, source: context_t, src_part_index: i32, ) -> result_t ---
Copy the attributes from one part to another.
This allows one to quickly unassigned attributes from one source to another.
If an attribute in the source part has not been yet set in the destination part, the item will be copied over.
For example, when you add a part, the storage type and name attributes are required arguments to the definition of a new part, but channels has not yet been assigned. So by calling this with an input file as the source, you can copy the channel definitions (and any other unassigned attributes from the source).
decoding_choose_default_routines ¶C · exr_decoding_choose_default_routinesSource · exr_decode.odin:304
decoding_choose_default_routines :: proc "c" ( ctxt: context_t, part_index: i32, decode: ^decode_pipeline_t, ) -> result_t ---
Given an initialized decode pipeline, find appropriate functions to read and shuffle/convert data into the defined channel outputs.
Calling this is not required if custom routines will be used, or if just the raw compressed data is desired. Although in that scenario, it is probably easier to just read the chunk directly using exr_read_chunk().
decoding_destroy ¶C · exr_decoding_destroySource · exr_decode.odin:330
decoding_destroy :: proc "c" (ctxt: context_t, decode: ^decode_pipeline_t) -> result_t ---
Free any intermediate memory in the decoding pipeline.
This does not free any pointers referred to in the channel info areas, but rather only the intermediate buffers and memory needed for the structure itself.
decoding_initialize ¶C · exr_decoding_initializeSource · exr_decode.odin:290
decoding_initialize :: proc "c" ( ctxt: context_t, part_index: i32, cinfo: ^chunk_info_t, decode: ^decode_pipeline_t, ) -> result_t ---
Initialize the decoding pipeline structure with the channel info for the specified part, and the first block to be read.
NB: The decode->unpack_and_convert_fn field will be NULL after this. If that
stage is desired, initialize the channel output information and
call exr_decoding_choose_default_routines().
decoding_run ¶C · exr_decoding_runSource · exr_decode.odin:321
decoding_run :: proc "c" ( ctxt: context_t, part_index: i32, decode: ^decode_pipeline_t, ) -> result_t ---
Execute the decoding pipeline.
decoding_update ¶C · exr_decoding_updateSource · exr_decode.odin:314
decoding_update :: proc "c" ( ctxt: context_t, part_index: i32, cinfo: ^chunk_info_t, decode: ^decode_pipeline_t, ) -> result_t ---
Given a decode pipeline previously initialized, update it for the new chunk to be read.
In this manner, memory buffers can be re-used to avoid continual malloc/free calls. Further, it allows the previous choices for the various functions to be quickly re-used.
encoding_choose_default_routines ¶C · exr_encoding_choose_default_routinesSource · exr_encode.odin:295
encoding_choose_default_routines :: proc "c" ( ctxt: context_t, part_index: i32, encode_pipe: ^encode_pipeline_t, ) -> result_t ---
Given an initialized encode pipeline, find an appropriate function to shuffle and convert data into the defined channel outputs.
Calling this is not required if a custom routine will be used, or if just the raw decompressed data is desired.
encoding_destroy ¶C · exr_encoding_destroySource · exr_encode.odin:325
encoding_destroy :: proc "c" (ctxt: context_t, encode_pipe: ^encode_pipeline_t) -> result_t ---
Free any intermediate memory in the encoding pipeline.
This does NOT free any pointers referred to in the channel info areas, but rather only the intermediate buffers and memory needed for the structure itself.
encoding_initialize ¶C · exr_encoding_initializeSource · exr_encode.odin:282
encoding_initialize :: proc "c" ( ctxt: context_t, part_index: i32, cinfo: ^chunk_info_t, encode_pipe: ^encode_pipeline_t, ) -> result_t ---
Initialize the encoding pipeline structure with the channel info for the specified part based on the chunk to be written.
NB: The encode_pipe->pack_and_convert_fn field will be NULL after this. If that
stage is desired, initialize the channel output information and
call exr_encoding_choose_default_routines().
encoding_run ¶C · exr_encoding_runSource · exr_encode.odin:314
encoding_run :: proc "c" ( ctxt: context_t, part_index: i32, encode_pipe: ^encode_pipeline_t, ) -> result_t ---
Execute the encoding pipeline.
encoding_update ¶C · exr_encoding_updateSource · exr_encode.odin:307
encoding_update :: proc "c" ( ctxt: context_t, part_index: i32, cinfo: ^chunk_info_t, encode_pipe: ^encode_pipeline_t, ) -> result_t ---
Given a encode pipeline previously initialized, update it for the new chunk to be written.
In this manner, memory buffers can be re-used to avoid continual malloc/free calls. Further, it allows the previous choices for the various functions to be quickly re-used.
finish ¶C · exr_finishSource · exr_context.odin:346
Close and free any internally allocated memory, calling any provided destroy function for custom streams.
If the file was opened for write, first save the chunk offsets or any other unwritten data.
get_attribute_by_index ¶C · exr_get_attribute_by_indexSource · exr_part.odin:249
get_attribute_by_index :: proc "c" ( ctxt: context_t, part_index: i32, mode: attr_list_access_mode_t, idx: i32, outattr: ^^attribute_t, ) -> result_t ---
Query a particular attribute by index.
get_attribute_by_name ¶C · exr_get_attribute_by_nameSource · exr_part.odin:257
get_attribute_by_name :: proc "c" ( ctxt: context_t, part_index: i32, name: cstring, outattr: ^^attribute_t, ) -> result_t ---
Query a particular attribute by name.
get_attribute_count ¶C · exr_get_attribute_countSource · exr_part.odin:246
Query the count of attributes in a part.
get_attribute_list ¶C · exr_get_attribute_listSource · exr_part.odin:271
get_attribute_list :: proc "c" ( ctxt: context_t, part_index: i32, mode: attr_list_access_mode_t, count: ^i32, outlist: [^]^attribute_t, ) -> result_t ---
Query the list of attributes in a part.
This retrieves a list of attributes currently defined in a part.
If outlist is NULL, this function still succeeds, filling only the
count. In this manner, the user can allocate memory for the list of
attributes, then re-call this function to get the full list.
get_channels ¶C · exr_get_channelsSource · exr_part.odin:362
get_channels :: proc "c" ( ctxt: context_t, part_index: i32, chlist: ^^attr_chlist_t, ) -> result_t ---
Retrieve the list of channels.
get_chunk_count ¶C · exr_get_chunk_countSource · exr_part.odin:122
Return the number of chunks contained in this part of the file.
As in the technical documentation for OpenEXR, the chunk is the generic term for a pixel data block. This is the atomic unit that this library uses to negotiate data to and from a context.
This should be used as a basis for splitting up how a file is processed. Depending on the compression, a different number of scanlines are encoded in each chunk, and since those need to be encoded/decoded as a block, the chunk should be the basis for I/O as well.
get_chunk_table ¶C · exr_get_chunk_tableSource · exr_part.odin:128
get_chunk_table :: proc "c" ( ctxt: context_t, part_index: i32, table: ^[^]u64, count: ^i32, ) -> result_t ---
Return a pointer to the chunk table and the count
TODO: consider removing this prior to release once C++ fully converted
get_chunk_table_offset ¶C · exr_get_chunk_table_offsetSource · exr_chunkio.odin:40
get_chunk_table_offset :: proc "c" ( ctxt: context_t, part_index: i32, chunk_offset_out: ^u64, ) -> result_t ---
Retrieve the chunk table offset for the part in question.
get_chunk_unpacked_size ¶C · exr_get_chunk_unpacked_sizeSource · exr_part.odin:153
Return the maximum unpacked size of a chunk for the file part.
This may be used ahead of any actual reading of data, so can be used to pre-allocate buffers for multiple threads in one block or whatever your application may require.
get_color_metadata_warning_as_string ¶C · exr_get_color_metadata_warning_as_stringSource · exr_color_metadata.odin:208
get_color_metadata_warning_as_string :: proc "c" (warning: color_metadata_warning_t) -> cstring ---
Return a static string describing one color metadata warning.
The string should not be freed (it is compiled into the binary). It describes a single flag, so callers reporting a set of warnings should test each flag in turn rather than passing the combined value.
@return A description of warning, or a placeholder for .OK and for
values that are not a single known flag.
get_compression ¶C · exr_get_compressionSource · exr_part.odin:388
get_compression :: proc "c" ( ctxt: context_t, part_index: i32, compression: ^compression_t, ) -> result_t ---
Retrieve the compression method used for the specified part.
get_count ¶C · exr_get_countSource · exr_part.odin:13
Query how many parts are in the file.
get_data_window ¶C · exr_get_data_windowSource · exr_part.odin:393
get_data_window :: proc "c" (ctxt: context_t, part_index: i32, out: ^attr_box2i_t) -> result_t ---
Retrieve the data window for the specified part.
get_default_dwa_compression_quality ¶C · exr_get_default_dwa_compression_qualitySource · exr_base.odin:177
get_default_dwa_compression_quality :: proc "c" (q: ^f32) ---
Retrieve the global default dwa compression quality
get_default_error_message ¶C · exr_get_default_error_messageSource · exr_errors.odin:57
Return a static string corresponding to the specified error code.
The string should not be freed (it is compiled into the binary).
get_default_lossy_htj2k_quality ¶C · exr_get_default_lossy_htj2k_qualitySource · exr_base.odin:188
get_default_lossy_htj2k_quality :: proc "c" (q: ^f32) ---
Retrieve the global default lossy HTJ2K compression quality.
get_default_maximum_image_size ¶C · exr_get_default_maximum_image_sizeSource · exr_base.odin:107
get_default_maximum_image_size :: proc "c" (w, h: ^i32) ---
Retrieve the global default maximum image size.
This function does not fail.
get_default_maximum_tile_size ¶C · exr_get_default_maximum_tile_sizeSource · exr_base.odin:148
get_default_maximum_tile_size :: proc "c" (w, h: ^i32) ---
Retrieve the global maximum tile size.
This function does not fail.
get_default_zip_compression_level ¶C · exr_get_default_zip_compression_levelSource · exr_base.odin:166
get_default_zip_compression_level :: proc "c" (l: ^i32) ---
Retrieve the global default zip compression value
get_default_zstd_compression_level ¶C · exr_get_default_zstd_compression_levelSource · exr_base.odin:202
get_default_zstd_compression_level :: proc "c" (l: ^i32) ---
Retrieve the global default zstd compression level (1-22; default 5).
get_display_window ¶C · exr_get_display_windowSource · exr_part.odin:398
get_display_window :: proc "c" ( ctxt: context_t, part_index: i32, out: ^attr_box2i_t, ) -> result_t ---
Retrieve the display window for the specified part.
get_dwa_compression_level ¶C · exr_get_dwa_compression_levelSource · exr_part.odin:185
get_dwa_compression_level :: proc "c" ( ctxt: context_t, part_index: i32, level: ^f32, ) -> result_t ---
Retrieve the dwa compression level used for the specified part.
This only applies when the compression method is DWAA/DWAB.
This value is NOT persisted in the file, and only exists for the lifetime of the context, so will be at the default value when just reading a file.
get_error_code_as_string ¶C · exr_get_error_code_as_stringSource · exr_errors.odin:63
Return a static string corresponding to the specified error code.
The string should not be freed (it is compiled into the binary).
get_file_name ¶C · exr_get_file_nameSource · exr_context.odin:457
Retrieve the file name the context is for as provided during the start routine.
Do not free the resulting string.
get_file_version_and_flags ¶C · exr_get_file_version_and_flagsSource · exr_context.odin:462
Retrieve the file version and flags the context is for as parsed during the start routine.
get_level_sizes ¶C · exr_get_level_sizesSource · exr_part.odin:102
get_level_sizes :: proc "c" ( ctxt: context_t, part_index: i32, levelx: i32, levely: i32, levw: ^i32, levh: ^i32, ) -> result_t ---
Query the data sizes for a particular level in the specified part.
If the part is a tiled part, fill in the width/height for the specified levels.
Return ERR_SUCCESS on success, an error otherwise (i.e. if the part
is not tiled).
It is valid to pass NULL to either of the @p levw or @p levh
arguments, which enables testing if this part is a tiled part, or
if you don't need both for some reason.
get_library_version ¶C · exr_get_library_versionSource · exr_base.odin:69
Retrieve the current library version. The @p extra string is for custom installs, and is a static string, do not free the returned pointer.
get_lineorder ¶C · exr_get_lineorderSource · exr_part.odin:403
get_lineorder :: proc "c" (ctxt: context_t, part_index: i32, out: ^lineorder_t) -> result_t ---
Retrieve the line order for storing data in the specified part (use 0 for single part images).
get_lossy_htj2k_quality ¶C · exr_get_lossy_htj2k_qualitySource · exr_part.odin:205
get_lossy_htj2k_quality :: proc "c" ( ctxt: context_t, part_index: i32, level: ^f32, ) -> result_t ---
Retrieve the lossy HTJ2K compression quality used for the specified part.
This only applies when the compression method is LJ2K.
This value is NOT persisted in the file, and only exists for the lifetime of the context, so will be at the default value when just reading a file.
get_name ¶C · exr_get_nameSource · exr_part.odin:20
Query the part name for the specified part.
NB: If this file is a single part file and name has not been set, this
will return NULL.
get_pixel_aspect_ratio ¶C · exr_get_pixel_aspect_ratioSource · exr_part.odin:408
Retrieve the pixel aspect ratio for the specified part (use 0 for single part images).
get_scanlines_per_chunk ¶C · exr_get_scanlines_per_chunkSource · exr_part.odin:145
Return the number of scanlines chunks for this file part.
When iterating over a scanline file, this may be an easier metric for multi-threading or other access than only negotiating chunk counts, and so is provided as a utility.
get_screen_window_center ¶C · exr_get_screen_window_centerSource · exr_part.odin:413
get_screen_window_center :: proc "c" ( ctxt: context_t, part_index: i32, wc: ^attr_v2f_t, ) -> result_t ---
Retrieve the screen oriented window center for the specified part (use 0 for single part images).
get_screen_window_width ¶C · exr_get_screen_window_widthSource · exr_part.odin:418
Retrieve the screen oriented window width for the specified part (use 0 for single part images).
get_storage ¶C · exr_get_storageSource · exr_part.odin:23
Query the storage type for the specified part.
get_tile_counts ¶C · exr_get_tile_countsSource · exr_part.odin:82
get_tile_counts :: proc "c" ( ctxt: context_t, part_index: i32, levelx: i32, levely: i32, countx: ^i32, county: ^i32, ) -> result_t ---
Query the tile count for a particular level in the specified part.
If the part is a tiled part, fills in the count for the specified levels.
Return ERR_SUCCESS on success, an error otherwise (i.e. if the part
is not tiled).
It is valid to pass NULL to either of the @p countx or @p county
arguments, which enables testing if this part is a tiled part, or
if you don't need both for some reason.
get_tile_descriptor ¶C · exr_get_tile_descriptorSource · exr_part.odin:423
get_tile_descriptor :: proc "c" ( ctxt: context_t, part_index: i32, xsize: ^u32, ysize: ^u32, level: ^tile_level_mode_t, round: ^tile_round_mode_t, ) -> result_t ---
Retrieve the tiling info for a tiled part (use 0 for single part images).
get_tile_levels ¶C · exr_get_tile_levelsSource · exr_part.odin:44
get_tile_levels :: proc "c" ( ctxt: context_t, part_index: i32, levelsx: ^i32, levelsy: ^i32, ) -> result_t ---
Query how many levels are in the specified part.
If the part is a tiled part, fill in how many tile levels are present.
Return ERR_SUCCESS on success, an error otherwise (i.e. if the part
is not tiled).
It is valid to pass NULL to either of the @p levelsx or @p levelsy
arguments, which enables testing if this part is a tiled part, or
if you don't need both (i.e. in the case of a mip-level tiled
image)
get_tile_sizes ¶C · exr_get_tile_sizesSource · exr_part.odin:63
get_tile_sizes :: proc "c" ( ctxt: context_t, part_index: i32, levelx: i32, levely: i32, tilew: ^i32, tileh: ^i32, ) -> result_t ---
Query the tile size for a particular level in the specified part.
If the part is a tiled part, fill in the tile size for the specified part/level.
Return ERR_SUCCESS on success, an error otherwise (i.e. if the
part is not tiled).
It is valid to pass NULL to either of the @p tilew or @p tileh
arguments, which enables testing if this part is a tiled part, or
if you don't need both (i.e. in the case of a mip-level tiled
image)
get_user_data ¶C · exr_get_user_dataSource · exr_context.odin:468
Query the user data the context was constructed with. This is perhaps useful in the error handler callback to jump back into an object the user controls.
get_version ¶C · exr_get_versionSource · exr_part.odin:442
get_zip_compression_level ¶C · exr_get_zip_compression_levelSource · exr_part.odin:164
get_zip_compression_level :: proc "c" ( ctxt: context_t, part_index: i32, level: ^i32, ) -> result_t ---
Retrieve the zip compression level used for the specified part.
This only applies when the compression method involves using zip compression (zip, zips, some modes of DWAA/DWAB).
This value is NOT persisted in the file, and only exists for the lifetime of the context, so will be at the default value when just reading a file.
get_zstd_compression_level ¶C · exr_get_zstd_compression_levelSource · exr_part.odin:225
get_zstd_compression_level :: proc "c" ( ctxt: context_t, part_index: i32, level: ^i32, ) -> result_t ---
Retrieve the zstd compression level used for the specified part.
This only applies when the compression method is zstd. Valid levels are 1 through 22; the default is 5.
This value is NOT persisted in the file, and only exists for the lifetime of the context, so will be at the default value when just reading a file.
initialize_required_attr ¶C · exr_initialize_required_attrSource · exr_part.odin:314
initialize_required_attr :: proc "c" ( ctxt: context_t, part_index: i32, displayWindow: ^attr_box2i_t, dataWindow: ^attr_box2i_t, pixelaspectratio: f32, screenWindowCenter: ^attr_v2f_t, screenWindowWidth: f32, lineorder: lineorder_t, ctype: compression_t, ) -> result_t ---
Initialize all required attributes for all files.
NB: other file types do require other attributes, such as the tile description for a tiled file.
initialize_required_attr_simple ¶C · exr_initialize_required_attr_simpleSource · exr_part.odin:335
initialize_required_attr_simple :: proc "c" ( ctxt: context_t, part_index: i32, width: i32, height: i32, ctype: compression_t, ) -> result_t ---
Initialize all required attributes to default values:
displayWindowis set to (0, 0 -> @p width - 1, @p height - 1)dataWindowis set to (0, 0 -> @p width - 1, @p height - 1)pixelAspectRatiois set to 1.0screenWindowCenteris set to 0.f, 0.fscreenWindowWidthis set to 1.flineorderis set toINCREASING_Ycompressionis set to @p ctype
print_context_info ¶C · exr_print_context_infoSource · exr_debug.odin:5
read_chunk ¶C · exr_read_chunkSource · exr_chunkio.odin:68
read_chunk :: proc "c" ( ctxt: context_t, part_index: i32, cinfo: ^chunk_info_t, packed_data: rawptr, ) -> result_t ---
Read the packed data block for a chunk.
This assumes that the buffer pointed to by @p packed_data is large enough to hold the chunk block info packed_size bytes.
read_deep_chunk ¶C · exr_read_deep_chunkSource · exr_chunkio.odin:83
read_deep_chunk :: proc "c" ( ctxt: context_t, part_index: i32, cinfo: ^chunk_info_t, packed_data: rawptr, sample_data: rawptr, ) -> result_t ---
Read chunk for deep data.
This allows one to read the packed data, the sample count data, or both. \c exr_read_chunk also works to read deep data packed data, but this is a routine to get the sample count table and the packed data in one go, or if you want to pre-read the sample count data, you can get just that buffer.
read_scanline_chunk_info ¶C · exr_read_scanline_chunk_infoSource · exr_chunkio.odin:52
read_scanline_chunk_info :: proc "c" ( ctxt: context_t, part_index: i32, y: i32, cinfo: ^chunk_info_t, ) -> result_t ---
read_tile_chunk_info ¶C · exr_read_tile_chunk_infoSource · exr_chunkio.odin:54
register_attr_type_handler ¶C · exr_register_attr_type_handlerSource · exr_context.odin:485
register_attr_type_handler :: proc "c" ( ctxt: context_t, type: cstring, unpack_func_ptr: proc "c" (ctxt: context_t, data: rawptr, attrsize: i32, outsize: ^i32, outbuffer: ^rawptr) -> result_t, pack_func_ptr: proc "c" (ctxt: context_t, data: rawptr, datasize: i32, outsize: ^i32, outbuffer: rawptr) -> result_t, destroy_unpacked_func_ptr: proc "c" (ctxt: context_t, data: rawptr, datasize: i32), ) -> result_t ---
Any opaque attribute data entry of the specified type is tagged with these functions enabling downstream users to unpack (or pack) the data.
The library handles the memory packed data internally, but the handler is expected to allocate and manage memory for the unpacked buffer (the library will call the destroy function).
NB: the pack function will be called twice (unless there is a
memory failure), the first with a NULL buffer, requesting the
maximum size (or exact size if known) for the packed buffer, then
the second to fill the output packed buffer, at which point the
size can be re-updated to have the final, precise size to put into
the file.
rle_compress_buffer ¶C · exr_rle_compress_bufferSource · exr_compression.odin:35
rle_compress_buffer :: proc "c" ( in_bytes: uint, in_: rawptr, out: rawptr, out_bytes_avail: uint, ) -> uint ---
Apply simple run length encoding and put in the output buffer.
rle_uncompress_buffer ¶C · exr_rle_uncompress_bufferSource · exr_compression.odin:42
rle_uncompress_buffer :: proc "c" ( in_bytes: uint, max_len: uint, in_: rawptr, out: rawptr, ) -> uint ---
Decode run length encoding and put in the output buffer.
set_channels ¶C · exr_set_channelsSource · exr_part.odin:385
set_channels :: proc "c" ( ctxt: context_t, part_index: i32, channels: ^attr_chlist_t, ) -> result_t ---
Copy the channels from another source.
Useful if you are manually constructing the list or simply copying from an input file.
set_chunk_count ¶C · exr_set_chunk_countSource · exr_part.odin:446
set_compression ¶C · exr_set_compressionSource · exr_part.odin:390
set_compression :: proc "c" ( ctxt: context_t, part_index: i32, ctype: compression_t, ) -> result_t ---
Set the compression method used for the specified part.
set_data_window ¶C · exr_set_data_windowSource · exr_part.odin:395
set_data_window :: proc "c" (ctxt: context_t, part_index: i32, dw: ^attr_box2i_t) -> i32 ---
Set the data window for the specified part.
set_default_dwa_compression_quality ¶C · exr_set_default_dwa_compression_qualitySource · exr_base.odin:173
set_default_dwa_compression_quality :: proc "c" (q: f32) ---
Assigns a default DWA compression quality level.
This value may be controlled separately on each part, but this global control determines the initial value.
set_default_lossy_htj2k_quality ¶C · exr_set_default_lossy_htj2k_qualitySource · exr_base.odin:184
set_default_lossy_htj2k_quality :: proc "c" (q: f32) ---
Assigns a default lossy HTJ2K compression quality.
This value may be controlled separately on each part, but this global control determines the initial value.
set_default_maximum_image_size ¶C · exr_set_default_maximum_image_sizeSource · exr_base.odin:101
set_default_maximum_image_size :: proc "c" (w, h: i32) ---
Limit the size of image allowed to be parsed or created by the library.
This is used as a safety check against corrupt files, but can also serve to avoid potential issues on machines which have very constrained RAM.
These values are among the only globals in the core layer of OpenEXR. The intended use is for applications to define a global default, which will be combined with the values provided to the individual context creation routine. The values are used to check against parsed header values. This adds some level of safety from memory overruns where a corrupt file given to the system may cause a large allocation to happen, enabling buffer overruns or other potential security issue.
These global values are combined with the values in \ref exr_context_initializer_t using the following rules:
-
negative values are ignored.
-
if either value has a positive (non-zero) value, and the other has 0, the positive value is preferred.
-
If both are positive (non-zero), the minimum value is used.
-
If both values are 0, this disables the constrained size checks.
This function does not fail.
set_default_maximum_tile_size ¶C · exr_set_default_maximum_tile_sizeSource · exr_base.odin:142
set_default_maximum_tile_size :: proc "c" (w, h: i32) ---
Limit the size of an image tile allowed to be parsed or created by the library.
Similar to image size, this places constraints on the maximum tile size as a safety check against bad file data
This is used as a safety check against corrupt files, but can also serve to avoid potential issues on machines which have very constrained RAM
These values are among the only globals in the core layer of OpenEXR. The intended use is for applications to define a global default, which will be combined with the values provided to the individual context creation routine. The values are used to check against parsed header values. This adds some level of safety from memory overruns where a corrupt file given to the system may cause a large allocation to happen, enabling buffer overruns or other potential security issue.
These global values are combined with the values in \ref exr_context_initializer_t using the following rules:
-
negative values are ignored.
-
if either value has a positive (non-zero) value, and the other has 0, the positive value is preferred.
-
If both are positive (non-zero), the minimum value is used.
-
If both values are 0, this disables the constrained size checks.
This function does not fail.
set_default_memory_routines ¶C · exr_set_default_memory_routinesSource · exr_base.odin:217
set_default_memory_routines :: proc "c" ( alloc_func: memory_allocation_func_t, free_func: memory_free_func_t, ) ---
Allow the user to override default allocator used internal allocations necessary for files, attributes, and other temporary memory.
These routines may be overridden when creating a specific context, however this provides global defaults such that the default can be applied.
If either pointer is 0, the appropriate malloc/free routine will be substituted.
This function does not fail.
set_default_zip_compression_level ¶C · exr_set_default_zip_compression_levelSource · exr_base.odin:162
set_default_zip_compression_level :: proc "c" (l: i32) ---
Assigns a default zip compression level.
This value may be controlled separately on each part, but this global control determines the initial value.
set_default_zstd_compression_level ¶C · exr_set_default_zstd_compression_levelSource · exr_base.odin:198
set_default_zstd_compression_level :: proc "c" (l: i32) ---
Assigns a default zstd compression level.
Valid levels are 1 through 22 (libzstd). Values outside that range are clamped. The library default is 5.
This value may be controlled separately on each part, but this global control determines the initial value.
set_display_window ¶C · exr_set_display_windowSource · exr_part.odin:400
set_display_window :: proc "c" (ctxt: context_t, part_index: i32, dw: ^attr_box2i_t) -> i32 ---
Set the display window for the specified part.
set_dwa_compression_level ¶C · exr_set_dwa_compression_levelSource · exr_part.odin:195
set_dwa_compression_level :: proc "c" ( ctxt: context_t, part_index: i32, level: f32, ) -> result_t ---
Set the dwa compression method used for the specified part.
This only applies when the compression method is DWAA/DWAB.
This value is NOT persisted in the file, and only exists for the lifetime of the context, so this value will be ignored when reading a file.
set_lineorder ¶C · exr_set_lineorderSource · exr_part.odin:405
set_lineorder :: proc "c" (ctxt: context_t, part_index: i32, lo: lineorder_t) -> result_t ---
Set the line order for storing data in the specified part (use 0 for single part images).
set_longname_support ¶C · exr_set_longname_supportSource · exr_context.odin:506
set_lossy_htj2k_quality ¶C · exr_set_lossy_htj2k_qualitySource · exr_part.odin:214
Set the lossy HTJ2K compression quality for the specified part.
This only applies when the compression method is LJ2K.
This value is NOT persisted in the file, and only exists for the lifetime of the context, so this value will be ignored when reading a file.
set_name ¶C · exr_set_nameSource · exr_part.odin:440
set_pixel_aspect_ratio ¶C · exr_set_pixel_aspect_ratioSource · exr_part.odin:410
Set the pixel aspect ratio for the specified part (use 0 for single part images).
set_screen_window_center ¶C · exr_set_screen_window_centerSource · exr_part.odin:415
set_screen_window_center :: proc "c" ( ctxt: context_t, part_index: i32, wc: ^attr_v2f_t, ) -> i32 ---
Set the screen oriented window center for the specified part (use 0 for single part images).
set_screen_window_width ¶C · exr_set_screen_window_widthSource · exr_part.odin:420
Set the screen oriented window width for the specified part (use 0 for single part images).
set_tile_descriptor ¶C · exr_set_tile_descriptorSource · exr_part.odin:432
set_tile_descriptor :: proc "c" ( ctxt: context_t, part_index: i32, x_size: u32, y_size: u32, level_mode: tile_level_mode_t, round_mode: tile_round_mode_t, ) -> result_t ---
Set the tiling info for a tiled part (use 0 for single part images).
set_version ¶C · exr_set_versionSource · exr_part.odin:444
set_zip_compression_level ¶C · exr_set_zip_compression_levelSource · exr_part.odin:175
set_zip_compression_level :: proc "c" ( ctxt: context_t, part_index: i32, level: i32, ) -> result_t ---
Set the zip compression method used for the specified part.
This only applies when the compression method involves using zip compression (zip, zips, some modes of DWAA/DWAB).
This value is NOT persisted in the file, and only exists for the lifetime of the context, so this value will be ignored when reading a file.
set_zstd_compression_level ¶C · exr_set_zstd_compression_levelSource · exr_part.odin:236
set_zstd_compression_level :: proc "c" ( ctxt: context_t, part_index: i32, level: i32, ) -> result_t ---
Set the zstd compression level for the specified part.
This only applies when the compression method is zstd. level must
be between 1 and 22 inclusive (libzstd range).
This value is NOT persisted in the file, and only exists for the lifetime of the context, so this value will be ignored when reading a file.
start_inplace_header_update ¶C · exr_start_inplace_header_updateSource · exr_context.odin:427
start_inplace_header_update :: proc "c" ( ctxt: ^context_t, filename: cstring, ctxtdata: ^context_initializer_t, ) -> result_t ---
Create a new context for updating an exr file in place.
This is a custom mode that allows one to modify the value of a metadata entry, although not to change the size of the header, or any of the image data.
If you have custom I/O requirements, see the initializer context
documentation \ref exr_context_initializer_t. The @p ctxtdata parameter
is optional, if NULL, default values will be used.
start_read ¶C · exr_start_readSource · exr_context.odin:368
start_read :: proc "c" ( ctxt: ^context_t, filename: cstring, ctxtdata: ^context_initializer_t, ) -> result_t ---
Create and initialize a read-only exr read context.
If a custom read function is provided, the filename is for informational purposes only, the system assumes the user has previously opened a stream, file, or whatever and placed relevant data in userdata to access that.
One notable attribute of the context is that once it has been created and returned a successful code, it has parsed all the header data. This is done as one step such that it is easier to provide a safe context for multiple threads to request data from the same context concurrently.
Once finished reading data, use exr_finish() to clean up the context.
If you have custom I/O requirements, see the initializer context
documentation \ref exr_context_initializer_t. The @p ctxtdata parameter
is optional, if NULL, default values will be used.
start_temporary_context ¶C · exr_start_temporary_contextSource · exr_context.odin:447
start_temporary_context :: proc "c" ( ctxt: ^context_t, context_name: cstring, ctxtdata: ^context_initializer_t, ) -> result_t ---
Create a new context for temporary use in memory.
This is a custom mode that does not supporting writing actual image data, but one can create one of these, manipulate attributes, define additional parts, run validation, etc. without any requirement of actual file i/o.
Note that this creates an defines an initial part for use, so one can immediately start definining attributes into part index 0.
See the initializer context documentation \ref
exr_context_initializer_t to be able to provide allocation
overrides or other controls. The @p ctxtdata parameter is optional,
if NULL, default values will be used.
start_write ¶C · exr_start_writeSource · exr_context.odin:411
start_write :: proc "c" ( ctxt: ^context_t, filename: cstring, default_mode: default_write_mode_t, ctxtdata: ^context_initializer_t, ) -> result_t ---
Create and initialize a write-only context.
If a custom write function is provided, the filename is for informational purposes only, and the @p default_mode parameter will be ignored. As such, the system assumes the user has previously opened a stream, file, or whatever and placed relevant data in userdata to access that.
Multi-Threading: To avoid issues with creating multi-part EXR files, the library approaches writing as a multi-step process, so the same concurrent guarantees can not be made for writing a file. The steps are:
-
Context creation (this function)
-
Part definition (required attributes and additional metadata)
-
Transition to writing data (this "commits" the part definitions, any changes requested after will result in an error)
-
Write part data in sequential order of parts (part0 -> partN-1).
-
Within each part, multiple threads can be encoding and writing data concurrently. For some EXR part definitions, this may be able to write data concurrently when it can predict the chunk sizes, or data is allowed to be padded. For others, it may need to temporarily cache chunks until the data is received to flush in order. The concurrency around this is handled by the library
-
Once finished writing data, use exr_finish() to clean up the context, which will flush any unwritten data such as the final chunk offset tables, and handle the temporary file flags.
If you have custom I/O requirements, see the initializer context
documentation \ref exr_context_initializer_t. The @p ctxtdata
parameter is optional, if NULL, default values will be used.
test_file_header ¶C · exr_test_file_headerSource · exr_context.odin:338
test_file_header :: proc "c" (filename: cstring, ctxtdata: ^context_initializer_t) -> result_t ---
Check the magic number of the file and report
EXR_ERR_SUCCESS if the file appears to be a valid file (or at least
has the correct magic number and can be read).
uncompress_buffer ¶C · exr_uncompress_bufferSource · exr_compression.odin:26
uncompress_buffer :: proc "c" ( ctxt: context_t, in_: rawptr, in_bytes: uint, out: rawptr, out_bytes_avail: uint, actual_out: ^uint, ) -> result_t ---
Decompresses a buffer using a zlib style compression.
uncompress_chunk ¶C · exr_uncompress_chunkSource · exr_compression.odin:117
uncompress_chunk :: proc "c" (decode_state: ^decode_pipeline_t) -> result_t ---
Exposes a method to decompress a chunk of data.
This can be useful for inheriting default behavior of the uncompression stage of an decoding pipeline, or other helper classes to expose compress / uncompress operations.
NB: This function will be used during a normal read and decode operation but can be used directly with a temporary context (i.e. not running the full decode pipeline).
validate_chunk_table ¶C · exr_validate_chunk_tableSource · exr_part.odin:137
Return whether the chunk table for this part is completely written.
This only validates that all the offsets are valid.
return EXR_ERR_INCOMPLETE_CHUNK_TABLE when incomplete, EXR_ERR_SUCCESS if it appears ok, or another error if otherwise problematic
write_deep_scanline_chunk ¶C · exr_write_deep_scanline_chunkSource · exr_chunkio.odin:123
write_deep_scanline_chunk :: proc "c" ( ctxt: context_t, part_index: i32, y: i32, packed_data: rawptr, packed_size: u64, unpacked_size: u64, sample_data: rawptr, sample_data_size: u64, ) -> result_t ---
@p y must the appropriate starting y for the specified chunk.
write_deep_tile_chunk ¶C · exr_write_deep_tile_chunkSource · exr_chunkio.odin:143
write_header ¶C · exr_write_headerSource · exr_context.odin:522
Write the header data.
Opening a new output file has a small initialization state problem compared to opening for read/update: we need to enable the user to specify an arbitrary set of metadata across an arbitrary number of parts. To avoid having to create the list of parts and entire metadata up front, prior to calling the above exr_start_write(), allow the data to be set, then once this is called, it switches into a mode where the library assumes the data is now valid.
It will recompute the number of chunks that will be written, and reset the chunk offsets. If you modify file attributes or part information after a call to this, it will error.
write_scanline_chunk ¶C · exr_write_scanline_chunkSource · exr_chunkio.odin:113
write_scanline_chunk :: proc "c" ( ctxt: context_t, part_index: i32, y: i32, packed_data: rawptr, packed_size: u64, ) -> result_t ---
@p y must the appropriate starting y for the specified chunk.
write_scanline_chunk_info ¶C · exr_write_scanline_chunk_infoSource · exr_chunkio.odin:96
write_scanline_chunk_info :: proc "c" ( ctxt: context_t, part_index: i32, y: i32, cinfo: ^chunk_info_t, ) -> result_t ---
Initialize a \c chunk_info_t structure when encoding scanline data (similar to read but does not do anything with a chunk table).
write_tile_chunk ¶C · exr_write_tile_chunkSource · exr_chunkio.odin:133
write_tile_chunk_info ¶C · exr_write_tile_chunk_infoSource · exr_chunkio.odin:101
write_tile_chunk_info :: proc "c" ( ctxt: context_t, part_index: i32, tilex: i32, tiley: i32, levelx: i32, levely: i32, cinfo: ^chunk_info_t, ) -> result_t ---
Initialize a \c chunk_info_t structure when encoding tiled data (similar to read but does not do anything with a chunk table).
Procedure Groups
This section is empty.
`#config` values
- OPENEXRCORE_SHARED
-define:OPENEXRCORE_SHARED=false
Source Files
- exr_attr.odin
- exr_base.odin
- exr_chunkio.odin
- exr_coding.odin
- exr_color_metadata.odin
- exr_compression.odin
- exr_context.odin
- exr_debug.odin
- exr_decode.odin
- exr_encode.odin
- exr_errors.odin
- exr_part.odin
Generation Information
Generated with odin version dev-2026-11 (vendor "odin") Windows_amd64 @ 2026-11-02 00:06:06.977463700 +0000 UTC