xrif
A fast lossless compression system
xrif_handle Struct Reference

The xrif library configuration structure, organizing various parameters used by the functions.

This structure provides for setup and management of memory allocation, though externally allocated buffers can be used when desired.

Options related to compression level and speed are also provided.

It is intended that this structure be interacted with via the xrif_t typedef, which is a pointer to xrif_handle. Values of this structure should generally be changed by one of the xrif_set_*() functions, to allow for error checking and consistency. Unless you know what you're doing, of course.

Todo:
need xrif_set_XXXX function unit tests

Definition at line 306 of file xrif.h.

#include <xrif.h>

Data Fields

xrif_dimension_t width
 The width of a single image, in pixels.
 
xrif_dimension_t height
 The height of a single image, in pixels.
 
xrif_dimension_t depth
 The depth of a single image, in pixels.
 
xrif_dimension_t frames
 The number of frames in the stream.
 
xrif_typecode_t type_code
 The code specifying the data type of the pixels.
 
size_t data_size
 The size of the pixels, bytes. This corresponds to sizeof(type).
 
size_t raw_size
 Size of the stream before compression. Set dynamically by xrif_set_size or from header.
 
size_t compressed_size
 Size of the stream after compression. Set dynamically by compression functions or from header.
 
int difference_method
 The difference method to use.
 
int reorder_method
 The method to use for bit reordering.
 
int compress_method
 The compression method used.
 
int lz4_acceleration
 LZ4 acceleration parameter, >=1, higher is faster with less comporession. Default is 1.
 
int omp_parallel
 
int omp_numthreads
 
unsigned char compress_on_raw
 Flag (true/false) indicating whether the raw buffer is used for compression. Default on initializeation is true.
 
unsigned char own_raw
 Flag (true/false) indicating whether the raw_buffer pointer is managed by this handle.
 
char * raw_buffer
 The raw buffer pointer, contains the image data, and if compress_on_raw == true the compressed data.
 
size_t raw_buffer_size
 
unsigned char own_reordered
 Flag (true/false) indicating whether the reordered_buffer pointer is managed by this handle.
 
char * reordered_buffer
 The reordered buffer pointer, contains the reordered data.
 
size_t reordered_buffer_size
 
unsigned char own_compressed
 Flag (true/false) indicating whether the compressed_buffer pointer is managed by this handle. More...
 
char * compressed_buffer
 The compressed buffer pointer, contains the compressed data.
 
size_t compressed_buffer_size
 
Performance Measurements
unsigned char calc_performance
 Flag (true/false) controlling whether performance metrics are calculated. Default is true.
 
double compression_ratio
 The compression ratio, calculated as output-size/input-size.
 
double encode_time
 Time in seconds taken to encode the data.
 
double encode_rate
 Rate at which the data was encoded in bytes per second.
 
double difference_time
 Time in seconds taken to difference the data.
 
double difference_rate
 Rate at which the data was differenced in bytes per second.
 
double reorder_time
 Time in seconds taken to reorder the data.
 
double reorder_rate
 Rate at which the data was reordered in bytes per second.
 
double compress_time
 Time in seconds taken to compress the data.
 
double compress_rate
 Rate at which the data was compressed in bytes per second.
 
struct timespec ts_difference_start
 Timespec used to mark the beginning of differencing, which is also the beginning of encoding.
 
struct timespec ts_reorder_start
 Timespec used to mark the beginning of reordering, which is the end of differencing.
 
struct timespec ts_compress_start
 Timespec used to mark the beginning of compression, which is the end of reordering.
 
struct timespec ts_compress_done
 Timespec used to mark the end of compression and encoding.
 
struct timespec ts_decompress_start
 Timespec used to mark the beginning of decompression, which is also the beginning of decoding.
 
struct timespec ts_unreorder_start
 Timespec used to mark the beginning of unreordering, which is the end of decompression.
 
struct timespec ts_undifference_start
 Timespec used to mark the beginning of undifferencing, which is the end of unreordering.
 
struct timespec ts_undifference_done
 Timespec used to mark the end of undifferencing and decoding.
 

Field Documentation

◆ compressed_buffer_size

size_t xrif_handle::compressed_buffer_size

The size of the compressed_buffer pointer. In principle should be at least LZ4_compressBound(width*height*depth*frames*data_size) in size, but this is not a strict requirement in practice for most streams. It must be at least width*height*depth*frames*data_size.
If this library is used to allocate it, it will be the larger of the two.

Definition at line 350 of file xrif.h.

Referenced by xrif_allocate_compressed(), xrif_compress_lz4(), xrif_compress_none(), and xrif_set_compressed().

◆ omp_numthreads

int xrif_handle::omp_numthreads

Number of threads to use if omp_parallel is 1. For this to be meaningful, XRIF_NO_OMP must NOT be defined at compile time, and XRIF_OMP_NUMTHREADS must be defined at compile time. Default is 1.

Definition at line 331 of file xrif.h.

◆ omp_parallel

int xrif_handle::omp_parallel

Flag controlling whether OMP parallelization is used to speed up. This has no effect if XRIF_NO_OMP is defined at compile time, which completely removes OMP code. Default is 0.

Definition at line 328 of file xrif.h.

◆ own_compressed

unsigned char xrif_handle::own_compressed

Flag (true/false) indicating whether the compressed_buffer pointer is managed by this handle.

Todo:
need reordered_buffer_minsize; ///< The minimum size of the reordered buffer for the image parameters.

Definition at line 348 of file xrif.h.

Referenced by xrif_allocate_compressed(), xrif_reset(), and xrif_set_compressed().

◆ raw_buffer_size

size_t xrif_handle::raw_buffer_size

The size of the raw_buffer pointer. If compress_on_raw is false, then this must be at least width*height*depth*frames*data_size. If compress_on_raw is true, this should be at least LZ4_compressBound(width*height*depth*frames*data_size) in size, but this is not a strict requirement in practice for most streams. If this library is used to allocate it, it will be the larger of the two possibilities.

Definition at line 338 of file xrif.h.

Referenced by xrif_allocate_raw(), xrif_compress_lz4(), xrif_compress_none(), xrif_difference_first(), xrif_difference_pixel(), xrif_difference_previous(), xrif_reorder_none(), xrif_set_raw(), xrif_undifference_first(), xrif_undifference_pixel(), xrif_undifference_previous(), and xrif_unreorder_none().

◆ reordered_buffer_size

size_t xrif_handle::reordered_buffer_size

The size of the reordered_buffer pointer. It must be at least width*height*depth*frames*data_size.

Definition at line 344 of file xrif.h.

Referenced by xrif_allocate_reordered(), xrif_compress_none(), xrif_decompress_lz4(), xrif_decompress_none(), xrif_reorder_none(), xrif_set_reordered(), and xrif_unreorder_none().


The documentation for this struct was generated from the following file: