Libpolycomp
1.0
A compression/decompression library that implements the polynomial compression and other simple compression schemes
|
Functions | |
size_t | pcomp_diffrle_bufsize (size_t input_size) |
Calculate an upper limit for the size of a buffer holding streams encoded using differenced RLE. More... | |
int | pcomp_compress_diffrle_int8 (int8_t *output_buf, size_t *output_size, const int8_t *input_buf, size_t input_size) |
Compress an array of int8_t values using the diffRLE compression. More... | |
int | pcomp_compress_diffrle_int16 (int16_t *output_buf, size_t *output_size, const int16_t *input_buf, size_t input_size) |
Compress an array of int16_t values using the diffRLE compression. More... | |
int | pcomp_compress_diffrle_int32 (int32_t *output_buf, size_t *output_size, const int32_t *input_buf, size_t input_size) |
Compress an array of int32_t values using the diffRLE compression. More... | |
int | pcomp_compress_diffrle_int64 (int64_t *output_buf, size_t *output_size, const int64_t *input_buf, size_t input_size) |
Compress an array of int64_t values using the diffRLE compression. More... | |
int | pcomp_compress_diffrle_uint8 (uint8_t *output_buf, size_t *output_size, const uint8_t *input_buf, size_t input_size) |
Compress an array of uint8_t values using the diffRLE compression. More... | |
int | pcomp_compress_diffrle_uint16 (uint16_t *output_buf, size_t *output_size, const uint16_t *input_buf, size_t input_size) |
Compress an array of uint16_t values using the diffRLE compression. More... | |
int | pcomp_compress_diffrle_uint32 (uint32_t *output_buf, size_t *output_size, const uint32_t *input_buf, size_t input_size) |
Compress an array of uint32_t values using the diffRLE compression. More... | |
int | pcomp_compress_diffrle_uint64 (uint64_t *output_buf, size_t *output_size, const uint64_t *input_buf, size_t input_size) |
Compress an array of uint64_t values using the diffRLE compression. More... | |
int | pcomp_decompress_diffrle_int8 (int8_t *output_buf, size_t output_size, const int8_t *input_buf, size_t input_size) |
Decompress an array of int8_t values encoded using the diffRLE compression. More... | |
int | pcomp_decompress_diffrle_int16 (int16_t *output_buf, size_t output_size, const int16_t *input_buf, size_t input_size) |
Compress an array of int16_t values using the diffRLE compression. More... | |
int | pcomp_decompress_diffrle_int32 (int32_t *output_buf, size_t output_size, const int32_t *input_buf, size_t input_size) |
Compress an array of int32_t values using the diffRLE compression. More... | |
int | pcomp_decompress_diffrle_int64 (int64_t *output_buf, size_t output_size, const int64_t *input_buf, size_t input_size) |
Compress an array of int64_t values using the diffRLE compression. More... | |
int | pcomp_decompress_diffrle_uint8 (uint8_t *output_buf, size_t output_size, const uint8_t *input_buf, size_t input_size) |
Compress an array of uint8_t values using the diffRLE compression. More... | |
int | pcomp_decompress_diffrle_uint16 (uint16_t *output_buf, size_t output_size, const uint16_t *input_buf, size_t input_size) |
Compress an array of uint16_t values using the diffRLE compression. More... | |
int | pcomp_decompress_diffrle_uint32 (uint32_t *output_buf, size_t output_size, const uint32_t *input_buf, size_t input_size) |
Compress an array of uint32_t values using the diffRLE compression. More... | |
int | pcomp_decompress_diffrle_uint64 (uint64_t *output_buf, size_t output_size, const uint64_t *input_buf, size_t input_size) |
Compress an array of uint64_t values using the diffRLE compression. More... | |
The differenced RLE compression is like RLE encoding, but it is applied to the stream of consecutive differences of the original stream. The first value of the input stream is prepended to the sequence of run-length encoded values, in order to allow proper decompression.
For instance, given the following sequence:
10 11 12 13 15 17 19 20 21
the compressed stream is
10 1 3 2 3 1 2
The main domain of applicability of this variant of RLE is for integer quantities that increase regularly, like the number of clock ticks in a digital chronometer.
As for RLE routines like pcomp_compress_rle_int8, the caller is expected to pre-allocate the memory which will contain the output. The routine pcomp_diffrle_bufsize is meant to provide an upper estimate for the number of elements that will be saved in the compressed stream.
int pcomp_compress_diffrle_int16 | ( | int16_t * | output_buf, |
size_t * | output_size, | ||
const int16_t * | input_buf, | ||
size_t | input_size | ||
) |
Compress an array of int16_t values using the diffRLE compression.
Refer to the documentation for pcomp_compress_diffrle_int8 for more information.
int pcomp_compress_diffrle_int32 | ( | int32_t * | output_buf, |
size_t * | output_size, | ||
const int32_t * | input_buf, | ||
size_t | input_size | ||
) |
Compress an array of int32_t values using the diffRLE compression.
Refer to the documentation for pcomp_compress_diffrle_int8 for more information.
int pcomp_compress_diffrle_int64 | ( | int64_t * | output_buf, |
size_t * | output_size, | ||
const int64_t * | input_buf, | ||
size_t | input_size | ||
) |
Compress an array of int64_t values using the diffRLE compression.
Refer to the documentation for pcomp_compress_diffrle_int8 for more information.
int pcomp_compress_diffrle_int8 | ( | int8_t * | output_buf, |
size_t * | output_size, | ||
const int8_t * | input_buf, | ||
size_t | input_size | ||
) |
Compress an array of int8_t values using the diffRLE compression.
The size of the output buffer is typically guessed using pcomp_diffrle_bufsize. After the call to the function, the buffer should be resized to claim unused space at the end. Here is an example:
[out] | output_buf | The buffer that will hold the compressed stream. It must have space for a number of elements at least equal to the value returned by pcomp_diffrle_bufsize. |
[in,out] | output_size | On entering the function, this must specify the number of elements (not bytes) that can be written in output_buf. On exit, it will contain the actual number of elements written. |
[in] | input_buf | The array of values to compress |
[in] | input_size | Number of elements (not bytes) in the array input_buf |
int pcomp_compress_diffrle_uint16 | ( | uint16_t * | output_buf, |
size_t * | output_size, | ||
const uint16_t * | input_buf, | ||
size_t | input_size | ||
) |
Compress an array of uint16_t values using the diffRLE compression.
Refer to the documentation for pcomp_compress_diffrle_int8 for more information.
int pcomp_compress_diffrle_uint32 | ( | uint32_t * | output_buf, |
size_t * | output_size, | ||
const uint32_t * | input_buf, | ||
size_t | input_size | ||
) |
Compress an array of uint32_t values using the diffRLE compression.
Refer to the documentation for pcomp_compress_diffrle_int8 for more information.
int pcomp_compress_diffrle_uint64 | ( | uint64_t * | output_buf, |
size_t * | output_size, | ||
const uint64_t * | input_buf, | ||
size_t | input_size | ||
) |
Compress an array of uint64_t values using the diffRLE compression.
Refer to the documentation for pcomp_compress_diffrle_int8 for more information.
int pcomp_compress_diffrle_uint8 | ( | uint8_t * | output_buf, |
size_t * | output_size, | ||
const uint8_t * | input_buf, | ||
size_t | input_size | ||
) |
Compress an array of uint8_t values using the diffRLE compression.
Refer to the documentation for pcomp_compress_diffrle_int8 for more information.
int pcomp_decompress_diffrle_int16 | ( | int16_t * | output_buf, |
size_t | output_size, | ||
const int16_t * | input_buf, | ||
size_t | input_size | ||
) |
Compress an array of int16_t values using the diffRLE compression.
Refer to the documentation for pcomp_decompress_diffrle_int8 for more information.
int pcomp_decompress_diffrle_int32 | ( | int32_t * | output_buf, |
size_t | output_size, | ||
const int32_t * | input_buf, | ||
size_t | input_size | ||
) |
Compress an array of int32_t values using the diffRLE compression.
Refer to the documentation for pcomp_decompress_diffrle_int8 for more information.
int pcomp_decompress_diffrle_int64 | ( | int64_t * | output_buf, |
size_t | output_size, | ||
const int64_t * | input_buf, | ||
size_t | input_size | ||
) |
Compress an array of int64_t values using the diffRLE compression.
Refer to the documentation for pcomp_decompress_diffrle_int8 for more information.
int pcomp_decompress_diffrle_int8 | ( | int8_t * | output_buf, |
size_t | output_size, | ||
const int8_t * | input_buf, | ||
size_t | input_size | ||
) |
Decompress an array of int8_t values encoded using the diffRLE compression.
The size of the output buffer must have been saved somewhere instead with the compressed data. It is currently not possible to retrieve it directly from input_buf.
[out] | output_buf | The buffer that will hold the decompressed stream. The space required for the decompressed chunks must have been already allocated. |
[in] | output_size | Number of elements (not bytes) in the decompressed stream output_buf. |
[in] | input_buf | The array of values to compress |
[in] | input_size | Number of elements (not bytes) in the array input_buf |
int pcomp_decompress_diffrle_uint16 | ( | uint16_t * | output_buf, |
size_t | output_size, | ||
const uint16_t * | input_buf, | ||
size_t | input_size | ||
) |
Compress an array of uint16_t values using the diffRLE compression.
Refer to the documentation for pcomp_decompress_diffrle_int8 for more information.
int pcomp_decompress_diffrle_uint32 | ( | uint32_t * | output_buf, |
size_t | output_size, | ||
const uint32_t * | input_buf, | ||
size_t | input_size | ||
) |
Compress an array of uint32_t values using the diffRLE compression.
Refer to the documentation for pcomp_decompress_diffrle_int8 for more information.
int pcomp_decompress_diffrle_uint64 | ( | uint64_t * | output_buf, |
size_t | output_size, | ||
const uint64_t * | input_buf, | ||
size_t | input_size | ||
) |
Compress an array of uint64_t values using the diffRLE compression.
Refer to the documentation for pcomp_decompress_diffrle_int8 for more information.
int pcomp_decompress_diffrle_uint8 | ( | uint8_t * | output_buf, |
size_t | output_size, | ||
const uint8_t * | input_buf, | ||
size_t | input_size | ||
) |
Compress an array of uint8_t values using the diffRLE compression.
Refer to the documentation for pcomp_decompress_diffrle_int8 for more information.
size_t pcomp_diffrle_bufsize | ( | size_t | input_size | ) |
Calculate an upper limit for the size of a buffer holding streams encoded using differenced RLE.
Return the number of elements required for a buffer used to hold the RLE-compressed version of a datastream. It is typically used together with functions like pcomp_compress_diffrle_int8 to pre-allocate the buffer that will contain the result.
The number returned by this function might be severely overestimated. Therefore, when using this function to allocate a buffer for functions like pcomp_compress_diffrle_int8, it is recommended to claim any unused space at the end of the buffer. (Functions like pcomp_compress_diffrle_int8 inform the caller about the number of elements actually written in the buffer.)
[in] | input_size | Number of elements of the data stream to compress |
Definition at line 78 of file diff_rle.c.