HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
openexr_encode.h File Reference
#include "openexr_chunkio.h"
#include "openexr_coding.h"
+ Include dependency graph for openexr_encode.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _exr_encode_pipeline
 

Macros

#define EXR_ENCODE_DATA_SAMPLE_COUNTS_ARE_INDIVIDUAL   ((uint16_t) (1 << 0))
 
#define EXR_ENCODE_NON_IMAGE_DATA_AS_POINTERS   ((uint16_t) (1 << 1))
 
#define EXR_ENCODE_PIPELINE_INITIALIZER
 Simple macro to initialize an empty decode pipeline. More...
 

Typedefs

typedef struct _exr_encode_pipeline exr_encode_pipeline_t
 

Functions

EXR_EXPORT exr_result_t exr_encoding_initialize (exr_const_context_t ctxt, int part_index, const exr_chunk_info_t *cinfo, exr_encode_pipeline_t *encode_pipe)
 
EXR_EXPORT exr_result_t exr_encoding_choose_default_routines (exr_const_context_t ctxt, int part_index, exr_encode_pipeline_t *encode_pipe)
 
EXR_EXPORT exr_result_t exr_encoding_update (exr_const_context_t ctxt, int part_index, const exr_chunk_info_t *cinfo, exr_encode_pipeline_t *encode_pipe)
 
EXR_EXPORT exr_result_t exr_encoding_run (exr_const_context_t ctxt, int part_index, exr_encode_pipeline_t *encode_pipe)
 
EXR_EXPORT exr_result_t exr_encoding_destroy (exr_const_context_t ctxt, exr_encode_pipeline_t *encode_pipe)
 

Macro Definition Documentation

#define EXR_ENCODE_DATA_SAMPLE_COUNTS_ARE_INDIVIDUAL   ((uint16_t) (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.

Definition at line 28 of file openexr_encode.h.

#define EXR_ENCODE_NON_IMAGE_DATA_AS_POINTERS   ((uint16_t) (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.

Definition at line 48 of file openexr_encode.h.

#define EXR_ENCODE_PIPELINE_INITIALIZER
Value:
{ \
0 \
}

Simple macro to initialize an empty decode pipeline.

Definition at line 277 of file openexr_encode.h.

Typedef Documentation

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.

Function Documentation

EXR_EXPORT exr_result_t exr_encoding_choose_default_routines ( exr_const_context_t  ctxt,
int  part_index,
exr_encode_pipeline_t encode_pipe 
)

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.

EXR_EXPORT exr_result_t exr_encoding_destroy ( exr_const_context_t  ctxt,
exr_encode_pipeline_t encode_pipe 
)

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.

EXR_EXPORT exr_result_t exr_encoding_initialize ( exr_const_context_t  ctxt,
int  part_index,
const exr_chunk_info_t cinfo,
exr_encode_pipeline_t encode_pipe 
)

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

EXR_EXPORT exr_result_t exr_encoding_run ( exr_const_context_t  ctxt,
int  part_index,
exr_encode_pipeline_t encode_pipe 
)

Execute the encoding pipeline.

EXR_EXPORT exr_result_t exr_encoding_update ( exr_const_context_t  ctxt,
int  part_index,
const exr_chunk_info_t cinfo,
exr_encode_pipeline_t encode_pipe 
)

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.