HDK
|
#include <openexr_encode.h>
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.
Definition at line 56 of file openexr_encode.h.
exr_coding_channel_info_t _exr_encode_pipeline::_quick_chan_store[5] |
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.
Definition at line 273 of file openexr_encode.h.
void*(* _exr_encode_pipeline::alloc_fn)(exr_transcoding_pipeline_buffer_id_t, size_t) |
Enable a custom allocator for the different buffers (if encoding on a GPU). If NULL
, will use the allocator from the context.
Definition at line 214 of file openexr_encode.h.
int16_t _exr_encode_pipeline::channel_count |
Definition at line 69 of file openexr_encode.h.
exr_coding_channel_info_t* _exr_encode_pipeline::channels |
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().
Definition at line 68 of file openexr_encode.h.
exr_chunk_info_t _exr_encode_pipeline::chunk |
Definition at line 77 of file openexr_encode.h.
exr_result_t(* _exr_encode_pipeline::compress_fn)(struct _exr_encode_pipeline *pipeline) |
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.
Definition at line 237 of file openexr_encode.h.
size_t _exr_encode_pipeline::compressed_alloc_size |
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.
Definition at line 169 of file openexr_encode.h.
void* _exr_encode_pipeline::compressed_buffer |
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.
Definition at line 146 of file openexr_encode.h.
size_t _exr_encode_pipeline::compressed_bytes |
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.
Definition at line 157 of file openexr_encode.h.
exr_const_context_t _exr_encode_pipeline::context |
Definition at line 76 of file openexr_encode.h.
exr_result_t(* _exr_encode_pipeline::convert_and_pack_fn)(struct _exr_encode_pipeline *pipeline) |
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.
Definition at line 229 of file openexr_encode.h.
uint16_t _exr_encode_pipeline::encode_flags |
Encode flags to control the behavior.
Definition at line 72 of file openexr_encode.h.
void* _exr_encode_pipeline::encoding_user_data |
Can be used by the user to pass custom context data through the encode pipeline.
Definition at line 82 of file openexr_encode.h.
void(* _exr_encode_pipeline::free_fn)(exr_transcoding_pipeline_buffer_id_t, void *) |
Enable a custom allocator for the different buffers (if encoding on a GPU). If NULL
, will use the allocator from the context.
Definition at line 220 of file openexr_encode.h.
size_t _exr_encode_pipeline::packed_alloc_size |
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.
Definition at line 106 of file openexr_encode.h.
void* _exr_encode_pipeline::packed_buffer |
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.
Definition at line 92 of file openexr_encode.h.
uint64_t _exr_encode_pipeline::packed_bytes |
Differing from the allocation size, the number of actual bytes
Definition at line 95 of file openexr_encode.h.
size_t _exr_encode_pipeline::packed_sample_count_alloc_size |
Allocated size (to avoid re-allocations) for the packed_sample_count_table.
Definition at line 135 of file openexr_encode.h.
size_t _exr_encode_pipeline::packed_sample_count_bytes |
Number of bytes to write (actual size) for the packed_sample_count_table.
Definition at line 130 of file openexr_encode.h.
void* _exr_encode_pipeline::packed_sample_count_table |
Packed sample table (compressed, raw on disk representation) for deep or other non-image data.
Definition at line 125 of file openexr_encode.h.
int _exr_encode_pipeline::part_index |
Copy of the parameters given to the initialize/update for convenience.
Definition at line 75 of file openexr_encode.h.
size_t _exr_encode_pipeline::sample_count_alloc_size |
Allocated table size (to avoid re-allocations). Number of samples must always be width * height for the chunk.
Definition at line 120 of file openexr_encode.h.
int32_t* _exr_encode_pipeline::sample_count_table |
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, ...).
Definition at line 115 of file openexr_encode.h.
size_t _exr_encode_pipeline::scratch_alloc_size_1 |
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.
Definition at line 192 of file openexr_encode.h.
size_t _exr_encode_pipeline::scratch_alloc_size_2 |
Used when re-using the same encode pipeline struct to know if chunk is changed size whether current buffer is large enough.
Definition at line 208 of file openexr_encode.h.
void* _exr_encode_pipeline::scratch_buffer_1 |
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.
Definition at line 180 of file openexr_encode.h.
void* _exr_encode_pipeline::scratch_buffer_2 |
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.
Definition at line 203 of file openexr_encode.h.
exr_result_t(* _exr_encode_pipeline::write_fn)(struct _exr_encode_pipeline *pipeline) |
Function chosen to write chunk data to the context.
This is allowed to be overridden, but probably is not necessary in most scenarios.
Definition at line 265 of file openexr_encode.h.
exr_result_t(* _exr_encode_pipeline::yield_until_ready_fn)(struct _exr_encode_pipeline *pipeline) |
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.
Definition at line 257 of file openexr_encode.h.