Bindings for [[ OpenEXRCore ; https://github.com/AcademySoftwareFoundation/openexr/tree/main/src/lib/OpenEXRCore ]].

Collection Info

View Source
Collection
vendor
Path
OpenEXRCore
Entries
232

Source Files

Constants

12

CONTEXT_FLAG_DISABLE_CHUNK_RECONSTRUCTION #

Source
CONTEXT_FLAG_DISABLE_CHUNK_RECONSTRUCTION :: 1 << 2

@brief 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 #

Source
CONTEXT_FLAG_SILENT_HEADER_PARSE :: 1 << 1

@brief 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 #

Source
CONTEXT_FLAG_STRICT_HEADER :: 1 << 0

@brief 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 #

Source
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 #

Source
DECODE_PIPELINE_INITIALIZER :: decode_pipeline_t{pipe_size = size_of(decode_pipeline_t)}

DECODE_SAMPLE_COUNTS_AS_INDIVIDUAL #

Source
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 #

Source
DECODE_SAMPLE_DATA_ONLY :: u16(1 << 2)

* * When reading non-image data (i.e. deep), only read the sample table.

DEFAULT_CONTEXT_INITIALIZER #

Source
DEFAULT_CONTEXT_INITIALIZER :: context_initializer_t{zip_level = -2, dwa_quality = -1}

@brief Simple macro to initialize the context initializer with default values.

ENCODE_DATA_SAMPLE_COUNTS_ARE_INDIVIDUAL #

Source
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 #

Source
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 #

Source
ENCODE_PIPELINE_INITIALIZER :: encode_pipeline_t{pipe_size = size_of(encode_pipeline_t)}

OPENEXRCORE_SHARED #

Source
OPENEXRCORE_SHARED :: #config(OPENEXRCORE_SHARED, false)

Config Values

1

OPENEXRCORE_SHARED #

Source
OPENEXRCORE_SHARED :: #config(OPENEXRCORE_SHARED, false)

Types

54

attr_chromaticities_t #

Source
attr_chromaticities_t :: attr_chromaticities_t

@brief Struct to hold color chromaticities to interpret the tristimulus color values in the image data.

attr_opaquedata_t #

Source
attr_opaquedata_t :: attr_opaquedata_t

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_tiledesc_t #

Source
attr_tiledesc_t :: attr_tiledesc_t

@brief 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.

attribute_t #

Source
attribute_t :: attribute_t

@brief 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 #

Source
attribute_type_t :: attribute_type_t

@brief Built-in/native attribute type enum. * * This will enable us to do a tagged type struct to generically store * attributes.

chunk_info_t #

Source
chunk_info_t :: chunk_info_t

* * 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 #

Source
coding_channel_info_t :: coding_channel_info_t

@brief 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.

compression_t #

Source
compression_t :: compression_t

Enum declaring allowed values for \c u8 value stored in built-in compression type.

context_initializer_t #

Source
context_initializer_t :: context_initializer_t

@brief 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 *

decode_pipeline_t #

Source
decode_pipeline_t :: 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.

destroy_stream_func_ptr_t #

Source
destroy_stream_func_ptr_t :: 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 #

Source
encode_pipeline_t :: encode_pipeline_t

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.

envmap_t #

Source
envmap_t :: envmap_t

Enum declaring allowed values for \c u8 value stored in built-in env map type.

error_handler_cb_t #

Source
error_handler_cb_t :: error_handler_cb_t

@brief 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.

memory_allocation_func_t #

Source
memory_allocation_func_t :: memory_allocation_func_t

@brief 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 #

Source
memory_free_func_t :: memory_free_func_t

@brief 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 #

Source
perceptual_treatment_t :: perceptual_treatment_t

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).

query_size_func_ptr_t #

Source
query_size_func_ptr_t :: 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 #

Source
read_func_ptr_t :: read_func_ptr_t

@brief 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 #

Source
result_t :: result_t

Error codes that may be returned by various functions. Return type for all functions.

stream_error_func_ptr_t #

Source
stream_error_func_ptr_t :: stream_error_func_ptr_t

@brief 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.

transcoding_pipeline_buffer_id_t #

Source
transcoding_pipeline_buffer_id_t :: transcoding_pipeline_buffer_id_t

* * 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 #

Source
write_func_ptr_t :: write_func_ptr_t

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.

Procedures

165

add_channel #

Source
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 ---

@brief 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.

attr_get_channels #

Source
attr_get_channels :: proc "c" (ctxt: context_t, part_index: i32, name: cstring, chlist: ^^attr_chlist_t) -> result_t ---

@brief 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_float_vector #

Source
attr_get_float_vector :: proc "c" (ctxt: context_t, part_index: i32, name: cstring, sz: ^i32, out: ^[^]f32) -> result_t ---

@brief 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_string #

Source
attr_get_string :: proc "c" (ctxt: context_t, part_index: i32, name: cstring, length: ^i32, out: ^cstring) -> result_t ---

@brief 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 #

Source
attr_get_string_vector :: proc "c" (ctxt: context_t, part_index: i32, name: cstring, size: ^i32, out: ^cstring) -> result_t ---

@brief 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.

chunk_default_initialize #

Source
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

compress_buffer #

Source
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 #

Source
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 #

Source
compress_max_buffer_size :: proc "c" (in_bytes: uint) -> uint ---

Computes a buffer that will be large enough to hold the compressed * data. This may include some extra padding for headers / scratch

compression_lines_per_chunk #

Source
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.

copy_unset_attributes #

Source
copy_unset_attributes :: proc "c" (ctxt: context_t, part_index: i32, source: context_t, src_part_index: i32) -> result_t ---

@brief 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 #

Source
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 #

Source
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 #

Source
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_update #

Source
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 #

Source
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 #

Source
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 #

Source
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_update #

Source
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.

exr_validate_chunk_table #

Source
exr_validate_chunk_table :: proc "c" (ctxt: context_t, part_index: i32) -> result_t ---

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

finish #

Source
finish :: proc "c" (ctxt: ^context_t) -> result_t ---

@brief 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_list #

Source
get_attribute_list :: proc "c" (ctxt: context_t, part_index: i32, mode: attr_list_access_mode_t, count: ^i32, outlist: ^[^]attribute_t) -> result_t ---

@brief 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_chunk_count #

Source
get_chunk_count :: proc "c" (ctxt: context_t, part_index: i32, out: ^i32) -> result_t ---

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 #

Source
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 #

Source
get_chunk_table_offset :: proc "c" (ctxt: context_t, part_index: i32, chunk_offset_out: ^u64) -> result_t ---

@brief Retrieve the chunk table offset for the part in question.

get_chunk_unpacked_size #

Source
get_chunk_unpacked_size :: proc "c" (ctxt: context_t, part_index: i32, out: ^u64) -> result_t ---

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_default_dwa_compression_quality #

Source
get_default_dwa_compression_quality :: proc "c" (q: ^f32) ---

@brief Retrieve the global default dwa compression quality

get_default_error_message #

Source
get_default_error_message :: proc "c" (code: result_t) -> cstring ---

@brief Return a static string corresponding to the specified error code. * * The string should not be freed (it is compiled into the binary).

get_default_maximum_image_size #

Source
get_default_maximum_image_size :: proc "c" (w, h: ^i32) ---

@brief Retrieve the global default maximum image size. * * This function does not fail.

get_default_maximum_tile_size #

Source
get_default_maximum_tile_size :: proc "c" (w, h: ^i32) ---

@brief Retrieve the global maximum tile size. * * This function does not fail.

get_default_zip_compression_level #

Source
get_default_zip_compression_level :: proc "c" (l: ^i32) ---

@brief Retrieve the global default zip compression value

get_dwa_compression_level #

Source
get_dwa_compression_level :: proc "c" (ctxt: context_t, part_index: i32, level: ^f32) -> result_t ---

@brief 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 #

Source
get_error_code_as_string :: proc "c" (code: result_t) -> cstring ---

@brief 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 #

Source
get_file_name :: proc "c" (ctxt: context_t, name: ^cstring) -> result_t ---

@brief 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 #

Source
get_file_version_and_flags :: proc "c" (ctxt: context_t, ver: ^u32) -> result_t ---

@brief Retrieve the file version and flags the context is for as * parsed during the start routine.

get_level_sizes #

Source
get_level_sizes :: proc "c" (
	ctxt:       context_t, 
	part_index: i32, 
	levelx:     i32, 
	levely:     i32, 
	levw:       ^i32, 
	levh:       ^i32, 
) -> result_t ---

@brief 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 #

Source
get_library_version :: proc "c" (maj, min, patch: ^i32, extra: ^cstring) ---

@brief 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_name #

Source
get_name :: proc "c" (ctxt: context_t, part_index: i32, out: ^cstring) -> result_t ---

@brief 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 #

Source
get_pixel_aspect_ratio :: proc "c" (ctxt: context_t, part_index: i32, par: ^f32) -> result_t ---

@brief Retrieve the pixel aspect ratio for the specified part (use 0 for single part images).

get_scanlines_per_chunk #

Source
get_scanlines_per_chunk :: proc "c" (ctxt: context_t, part_index: i32, out: ^i32) -> result_t ---

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 #

Source
get_screen_window_center :: proc "c" (ctxt: context_t, part_index: i32, wc: ^attr_v2f_t) -> result_t ---

@brief Retrieve the screen oriented window center for the specified part (use 0 for single part images).

get_screen_window_width #

Source
get_screen_window_width :: proc "c" (ctxt: context_t, part_index: i32, out: ^f32) -> result_t ---

@brief Retrieve the screen oriented window width for the specified part (use 0 for single part images).

get_tile_counts #

Source
get_tile_counts :: proc "c" (
	ctxt:       context_t, 
	part_index: i32, 
	levelx:     i32, 
	levely:     i32, 
	countx:     ^i32, 
	county:     ^i32, 
) -> result_t ---

@brief 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_levels #

Source
get_tile_levels :: proc "c" (ctxt: context_t, part_index: i32, levelsx: ^i32, levelsy: ^i32) -> result_t ---

@brief 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 #

Source
get_tile_sizes :: proc "c" (
	ctxt:       context_t, 
	part_index: i32, 
	levelx:     i32, 
	levely:     i32, 
	tilew:      ^i32, 
	tileh:      ^i32, 
) -> result_t ---

@brief 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 #

Source
get_user_data :: proc "c" (ctxt: context_t, userdata: ^rawptr) -> result_t ---

@brief 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_zip_compression_level #

Source
get_zip_compression_level :: proc "c" (ctxt: context_t, part_index: i32, level: ^i32) -> result_t ---

@brief 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.

initialize_required_attr_simple #

Source
initialize_required_attr_simple :: proc "c" (ctxt: context_t, part_index: i32, width: i32, height: i32, ctype: compression_t) -> result_t ---

@brief Initialize all required attributes to default values: * * - `displayWindow` is set to (0, 0 -> @p width - 1, @p height - 1) * - `dataWindow` is set to (0, 0 -> @p width - 1, @p height - 1) * - `pixelAspectRatio` is set to 1.0 * - `screenWindowCenter` is set to 0.f, 0.f * - `screenWindowWidth` is set to 1.f * - `lineorder` is set to `INCREASING_Y` * - `compression` is set to @p ctype

read_chunk #

Source
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 #

Source
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.

register_attr_type_handler #

Source
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 #

Source
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 #

Source
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 #

Source
set_channels :: proc "c" (ctxt: context_t, part_index: i32, channels: ^attr_chlist_t) -> result_t ---

@brief Copy the channels from another source. * * Useful if you are manually constructing the list or simply copying * from an input file.

set_default_dwa_compression_quality #

Source
set_default_dwa_compression_quality :: proc "c" (q: f32) ---

@brief 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_maximum_image_size #

Source
set_default_maximum_image_size :: proc "c" (w, h: i32) ---

@brief 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: * * 1. negative values are ignored. * * 2. if either value has a positive (non-zero) value, and the other * has 0, the positive value is preferred. * * 3. If both are positive (non-zero), the minimum value is used. * * 4. If both values are 0, this disables the constrained size checks. * * This function does not fail.

set_default_maximum_tile_size #

Source
set_default_maximum_tile_size :: proc "c" (w, h: i32) ---

@brief 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: * * 1. negative values are ignored. * * 2. if either value has a positive (non-zero) value, and the other * has 0, the positive value is preferred. * * 3. If both are positive (non-zero), the minimum value is used. * * 4. If both values are 0, this disables the constrained size checks. * * This function does not fail.

set_default_memory_routines #

Source
set_default_memory_routines :: proc "c" (alloc_func: memory_allocation_func_t, free_func: memory_free_func_t) ---

@brief 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 #

Source
set_default_zip_compression_level :: proc "c" (l: i32) ---

@brief Assigns a default zip compression level. * * This value may be controlled separately on each part, but this * global control determines the initial value.

set_dwa_compression_level #

Source
set_dwa_compression_level :: proc "c" (ctxt: context_t, part_index: i32, level: f32) -> result_t ---

@brief 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_pixel_aspect_ratio #

Source
set_pixel_aspect_ratio :: proc "c" (ctxt: context_t, part_index: i32, par: f32) -> result_t ---

@brief Set the pixel aspect ratio for the specified part (use 0 for single part images).

set_screen_window_center #

Source
set_screen_window_center :: proc "c" (ctxt: context_t, part_index: i32, wc: ^attr_v2f_t) -> i32 ---

@brief Set the screen oriented window center for the specified part (use 0 for single part images).

set_screen_window_width #

Source
set_screen_window_width :: proc "c" (ctxt: context_t, part_index: i32, ssw: f32) -> result_t ---

@brief Set the screen oriented window width for the specified part (use 0 for single part images).

set_zip_compression_level #

Source
set_zip_compression_level :: proc "c" (ctxt: context_t, part_index: i32, level: i32) -> result_t ---

@brief 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.

start_inplace_header_update #

Source
start_inplace_header_update :: proc "c" (ctxt: ^context_t, filename: cstring, ctxtdata: ^context_initializer_t) -> result_t ---

@brief 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 #

Source
start_read :: proc "c" (ctxt: ^context_t, filename: cstring, ctxtdata: ^context_initializer_t) -> result_t ---

@brief 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 #

Source
start_temporary_context :: proc "c" (ctxt: ^context_t, context_name: [^]u8, ctxtdata: ^context_initializer_t) -> result_t ---

@brief 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 #

Source
start_write :: proc "c" (ctxt: ^context_t, filename: cstring, default_mode: default_write_mode_t, ctxtdata: ^context_initializer_t) -> result_t ---

@brief 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: * * 1. Context creation (this function) * * 2. Part definition (required attributes and additional metadata) * * 3. Transition to writing data (this "commits" the part definitions, * any changes requested after will result in an error) * * 4. Write part data in sequential order of parts (part<sub>0</sub> * -> part<sub>N-1</sub>). * * 5. 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 * * 6. 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 #

Source
test_file_header :: proc "c" (filename: cstring, ctxtdata: ^context_initializer_t) -> result_t ---

@brief 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_chunk #

Source
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).

write_deep_scanline_chunk #

Source
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_header #

Source
write_header :: proc "c" (ctxt: context_t) -> result_t ---

@brief 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_info #

Source
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_info #

Source
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).