xrif
A fast lossless compression system
xrif.c File Reference

The eXtreme-ao Reordered Image Format: Definitions. More...

The eXtreme-ao Reordered Image Format: Definitions.

Author
Jared R. Males (jared.nosp@m.male.nosp@m.s@gma.nosp@m.il.c.nosp@m.om)

Definition in file xrif.c.

#include "xrif.h"
#include "bitshift_and_nibbles.inc"
#include "bit_to_position.inc"
#include "set_bits.inc"
Include dependency graph for xrif.c:

Go to the source code of this file.

Macros

#define BIT15   (32768)
 
#define BIT14   (16384)
 
#define BIT13   (8192)
 
#define BIT12   (4096)
 
#define BIT11   (2048)
 
#define BIT10   (1024)
 
#define BIT09   (512)
 
#define BIT08   (256)
 
#define BIT07   (128)
 
#define BIT06   (64)
 
#define BIT05   (32)
 
#define BIT04   (16)
 
#define BIT03   (8)
 
#define BIT02   (4)
 
#define BIT01   (2)
 
#define BIT00   (1)
 

Functions

xrif_error_t xrif_new (xrif_t *handle_ptr)
 Allocate a handle and initialize it. More...
 
xrif_error_t xrif_set_size (xrif_t handle, xrif_dimension_t w, xrif_dimension_t h, xrif_dimension_t d, xrif_dimension_t f, xrif_typecode_t c)
 Set the basic parameters of an xrif handle. More...
 
xrif_error_t xrif_configure (xrif_t handle, int difference_method, int reorder_method, int compress_method)
 Configure the difference, reorder, and compression methods. More...
 
xrif_error_t xrif_allocate (xrif_t handle)
 Allocate all memory buffers according to the configuration specified in the handle. More...
 
xrif_error_t xrif_reset (xrif_t handle)
 Reset a handle, restoring it to the initialized state. De-allocates owned pointers and re-initializes. More...
 
xrif_error_t xrif_delete (xrif_t handle)
 Deallocate a handle, including any memory that it owns. More...
 
xrif_error_t xrif_initialize_handle (xrif_t handle)
 Initialize an xrif handle object. More...
 
xrif_error_t xrif_set_difference_method (xrif_t handle, int difference_method)
 Set the difference method. More...
 
xrif_error_t xrif_set_reorder_method (xrif_t handle, int reorder_method)
 Set the reorder method. More...
 
xrif_error_t xrif_set_compress_method (xrif_t handle, int compress_method)
 Set the compress method. More...
 
xrif_error_t xrif_set_lz4_acceleration (xrif_t handle, int32_t lz4_accel)
 Set the LZ4 acceleration parameter. More...
 
size_t xrif_min_raw_size (xrif_t handle)
 Calculate the minimum size of the raw buffer. More...
 
size_t xrif_min_reordered_size (xrif_t handle)
 Calculate the minimum size of the reordered buffer. More...
 
size_t xrif_min_compressed_size (xrif_t handle)
 Calculate the minimum size of the compressed buffer. More...
 
xrif_error_t xrif_set_raw (xrif_t handle, void *raw, size_t size)
 Set the raw data buffer to a pre-allocated pointer. More...
 
xrif_error_t xrif_allocate_raw (xrif_t handle)
 Allocate the raw buffer based on the already set stream dimensions. More...
 
xrif_error_t xrif_set_reordered (xrif_t handle, void *reordered, size_t size)
 Set the rordered (working) data buffer to a pre-allocated pointer. More...
 
xrif_error_t xrif_allocate_reordered (xrif_t handle)
 Allocate the reordered buffer based on the already set stream dimensions. More...
 
xrif_error_t xrif_set_compressed (xrif_t handle, void *compressed, size_t size)
 Set the compressed data buffer to a pre-allocated pointer. More...
 
xrif_error_t xrif_allocate_compressed (xrif_t handle)
 Allocate the compressed buffer based on the already set stream dimensions. More...
 
xrif_dimension_t xrif_width (xrif_t handle)
 Get the current width of the configured handle. More...
 
xrif_dimension_t xrif_height (xrif_t handle)
 Get the current height of the configured handle. More...
 
xrif_dimension_t xrif_depth (xrif_t handle)
 Get the current depth of the configured handle. More...
 
xrif_dimension_t xrif_frames (xrif_t handle)
 Get the current number of frames of the configured handle. More...
 
xrif_error_t xrif_write_header (char *header, xrif_t handle)
 Populate a header buffer with the xrif protocol details. More...
 
xrif_error_t xrif_read_header (xrif_t handle, uint32_t *header_size, char *header)
 Configure an xrif handle by reading a xrif protocol header. More...
 
xrif_error_t xrif_encode (xrif_t handle)
 Encode data using the xrif format. More...
 
xrif_error_t xrif_decode (xrif_t handle)
 Decode data from the xrif format. More...
 
xrif_error_t xrif_difference (xrif_t handle)
 Difference the image(s) More...
 
xrif_error_t xrif_undifference (xrif_t handle)
 Undifference the image(s) More...
 
xrif_error_t xrif_difference_sint16_rgb (xrif_t handle)
 
xrif_error_t xrif_reorder (xrif_t handle)
 Reorder the data using the method specified by reorder_method More...
 
xrif_error_t xrif_unreorder (xrif_t handle)
 Un-reorder the data using the method specified by reorder_method More...
 
xrif_error_t xrif_reorder_none (xrif_t handle)
 Perform no re-ordering, simply copy raw to reordered. More...
 
xrif_error_t xrif_reorder_bytepack (xrif_t handle)
 Dispatch bytepack reodering based on type. More...
 
xrif_error_t xrif_reorder_bytepack_sint16 (xrif_t handle)
 Perform bytepack reodering for signed 16 bit ints. More...
 
xrif_error_t xrif_reorder_bytepack_renibble (xrif_t handle)
 
xrif_error_t xrif_reorder_bitpack (xrif_t handle)
 
xrif_error_t xrif_unreorder_none (xrif_t handle)
 Perform no un-re-ordering, simply copy reordered to raw. More...
 
xrif_error_t xrif_unreorder_bytepack (xrif_t handle)
 Dispatch bytepack unreodering based on type. More...
 
xrif_error_t xrif_unreorder_bytepack_sint16 (xrif_t handle)
 Perform bytepack unreodering for signed 16 bit ints. More...
 
xrif_error_t xrif_unreorder_bytepack_renibble (xrif_t handle)
 
xrif_error_t xrif_unreorder_bitpack (xrif_t handle)
 
xrif_error_t xrif_compress (xrif_t handle)
 
xrif_error_t xrif_decompress (xrif_t handle)
 
xrif_error_t xrif_compress_none (xrif_t handle)
 
xrif_error_t xrif_decompress_none (xrif_t handle)
 
xrif_error_t xrif_compress_lz4 (xrif_t handle)
 
xrif_error_t xrif_decompress_lz4 (xrif_t handle)
 
double xrif_compression_ratio (xrif_t handle)
 Calculate the compression ratio. More...
 
double xrif_encode_time (xrif_t handle)
 Calculate the time in seconds taken to encode the data. More...
 
double xrif_encode_rate (xrif_t handle)
 Calculate the encode rate in bytes/sec. More...
 
double xrif_difference_time (xrif_t handle)
 Calculate the time in seconds taken to difference the data. More...
 
double xrif_difference_rate (xrif_t handle)
 Calculate the differencing rate in bytes/sec. More...
 
double xrif_reorder_time (xrif_t handle)
 Calculate the time in seconds taken to reorder the data. More...
 
double xrif_reorder_rate (xrif_t handle)
 Calculate the reordering rate in bytes/sec. More...
 
double xrif_compress_time (xrif_t handle)
 Calculate the time in seconds taken to compress the differenced and reordered data. More...
 
double xrif_compress_rate (xrif_t handle)
 Calculate the compression rate in bytes/sec. More...
 
double xrif_decode_time (xrif_t handle)
 Calculate the time in seconds taken to decode the data. More...
 
double xrif_decode_rate (xrif_t handle)
 Calculate the decode rate in bytes/sec. More...
 
double xrif_undifference_time (xrif_t handle)
 Calculate the time in seconds taken to undifference the data. More...
 
double xrif_undifference_rate (xrif_t handle)
 Calculate the undifferencing rate in bytes/sec. More...
 
double xrif_unreorder_time (xrif_t handle)
 Calculate the time in seconds taken to unreorder the data. More...
 
double xrif_unreorder_rate (xrif_t handle)
 Calculate the unreordering rate in bytes/sec. More...
 
double xrif_decompress_time (xrif_t handle)
 Calculate the time in seconds taken to decompress the differenced and reordered data. More...
 
double xrif_decompress_rate (xrif_t handle)
 Calculate the decompression rate in bytes/sec. More...
 
size_t xrif_typesize (xrif_typecode_t type_code)
 Return the size of the type specified by the code. More...
 
double xrif_ts_difference (struct timespec *ts1, struct timespec *ts0)
 Calculate the difference between two timespecs. More...
 
const char * xrif_difference_method_string (int diff_method)
 Get a string describing the difference method. More...
 
const char * xrif_reorder_method_string (int reorder_method)
 Get a string describing the reordering method. More...
 
const char * xrif_compress_method_string (int compress_method)
 Get a string describing the compression method. More...
 

Function Documentation

◆ xrif_reorder_bitpack()

xrif_error_t xrif_reorder_bitpack ( xrif_t  handle)
Todo:
xrif_reorder_bitpack needs a size check

Definition at line 1517 of file xrif.c.

References xrif_handle::difference_method.