- group API
Interface APIs and data structures of AOCL Compression library are described in this section.
This file contains the unified interface API set and associated data structure.
Enums
-
enum aocl_compression_type#
Types of compression methods supported.
Optimizations are included for all the supported methods
Values:
-
enumerator LZ4#
-
enumerator LZ4HC#
-
enumerator LZMA#
-
enumerator BZIP2#
-
enumerator SNAPPY#
-
enumerator ZLIB#
-
enumerator ZSTD#
-
enumerator AOCL_COMPRESSOR_ALGOS_NUM#
-
enumerator LZ4#
-
enum aocl_error_type#
Error codes supported by unified APIs of AOCL-Compression library.
Values:
-
enumerator ERR_MEMORY_ALLOC#
Memory allocation failure.
-
enumerator ERR_INVALID_INPUT#
Invalid input parameter provided.
-
enumerator ERR_UNSUPPORTED_METHOD#
Compression method not supported by the library.
-
enumerator ERR_EXCLUDED_METHOD#
Compression method excluded from this library build.
-
enumerator ERR_COMPRESSION_FAILED#
Failure during compression/decompression.
-
enumerator ERR_COMPRESSION_INVALID_OUTPUT#
Invalid compression/decompression output.
-
enumerator ERR_MEMORY_ALLOC#
Functions
-
int64_t aocl_llc_compress(aocl_compression_desc *handle, aocl_compression_type codec_type)#
Interface API to compress data.
Parameters
Direction
Description
handle
in,out
This acts as a handle for compression and decompression. For more information, refer to aocl_compression_desc.
codec_type
in
Select the algorithm to be used for compression, choose from aocl_compression_type.
- Returns:
Result
Description
Success
Number of bytes decompressed
Fail
ERR_COMPRESSION_FAILEDERR_COMPRESSION_INVALID_OUTPUT
-
int64_t aocl_llc_compressBound(aocl_compression_type codec_type, size_t inSize)#
Interface API to provide the maximum size that compression may output in a “worst case” scenario (input data not compressible).
This function is primarily useful for memory allocation purposes (destination buffer size).
Parameters
Direction
Description
codec_type
in
Select the algorithm to be used for compression, choose from aocl_compression_type.
inSize
in
The size of input data to be compressed in bytes.
Note
inSize cannot exceed maximum supported value for respective codec_type.
- Returns:
Result
Description
Success
Returns an upper bound on the compressed size.
Fail
ERR_COMPRESSION_FAILED
-
int64_t aocl_llc_decompress(aocl_compression_desc *handle, aocl_compression_type codec_type)#
Interface API to decompress data.
Parameters
Direction
Description
handle
in,out
This acts as a handle for compression and decompression. For more information, refer to aocl_compression_desc.
codec_type
in
Select the algorithm to be used for compression, choose from aocl_compression_type.
- Returns:
Result
Description
Success
Numbers of bytes decompressed
Fail
ERR_COMPRESSION_FAILEDERR_COMPRESSION_INVALID_OUTPUT
-
void aocl_llc_destroy(aocl_compression_desc *handle, aocl_compression_type codec_type)#
Interface API to destroy the compression method.
Parameters
Direction
Description
handle
in,out
This acts as a handle for compression and decompression. For more information, refer to aocl_compression_desc.
codec_type
in
Select the algorithm to be used for compression, choose from aocl_compression_type.
- Returns:
void
-
int32_t aocl_llc_setup(aocl_compression_desc *handle, aocl_compression_type codec_type)#
Interface API to setup the compression method.
Parameters
Direction
Description
handle
in,out
This acts as a handle for compression and decompression. For more information, refer to aocl_compression_desc.
codec_type
in
Select the algorithm to be used for compression, choose from aocl_compression_type.
- Returns:
Result
Description
Success
0
Fail
ERR_UNSUPPORTED_METHODERR_EXCLUDED_METHOD
-
int32_t aocl_llc_skip_rap_frame(char *src, int32_t src_size)#
Interface API to get the length of the RAP frame in the compressed stream.
Legacy single threaded decompressors can call this API to know how many bytes of the compressed stream to skip to get the format compliant compressed stream that they can decompress.
Parameters
Direction
Description
src
in
Input stream buffer pointer.
src_size
in
Input stream buffer size.
Note
Presence of RAP frame is determined by checking for the magic word: 0x434C4C5F4C434F41 (ASCII encoding of AOCL_LLC) at the start of the stream.
- Returns:
Result
Description
RAP_frame_length
Length of RAP frame bytes in src
0
If RAP frame does not exist
Fail
ERR_INVALID_INPUT
-
const char *aocl_llc_version(void)#
Interface API to get the compression library version string.
- Returns:
AOCL library version
-
struct aocl_compression_desc#
- #include <aocl_compression.h>
This acts as a handle for the compression and decompression of AOCL Compression library.
Public Members
-
uint64_t cSize#
Size of compressed output
-
float cSpeed#
Speed of compression
-
uint64_t cTime#
Time to compress input
-
uint64_t dSize#
Size of decompressed output
-
float dSpeed#
Speed of decompression
-
uint64_t dTime#
Time to decompress input
-
char *inBuf#
Pointer to input buffer data
-
size_t inSize#
Input data length
-
size_t level#
Requested compression level
-
int measureStats#
Measure speed and size of compression/decompression
-
size_t memLimit#
Maximum memory limit for compression/decompression
-
int numMPIranks#
Number of available multi-core MPI ranks
-
int numThreads#
Number of threads available for multi-threading
-
int optLevel#
Optimization level:
0 - non-SIMD algorithmic optimizations,
1 - SSE2 optimizations,
2 - AVX optimizations,
3 - AVX2 optimizations,
4 - AVX512 optimizations
-
int optOff#
Turn off all optimizations
-
size_t optVar#
Additional variables or parameters
-
char *outBuf#
Pointer to output buffer data
-
size_t outSize#
Output data length
-
char *workBuf#
Pointer to temporary work buffer
-
uint64_t cSize#
-
enum aocl_compression_type#