Reference¶
Binary Data¶
-
BIN
bin_create(MEM_SCOPE mem, unsigned char *data, size_t len)¶ Create a binary data block.
- Return
- A binary data block.
- Remark
- There is no requirement to use the same memory scope that was used for allocation of the data. However, it is good practice to do so. BIN is only useful for returning a binary block from a function, including the length.
- Parameters
mem: A memory scope to own the memory.data: The binary data. It must already be allocated.len: The length of the binary data block in bytes.
-
unsigned char *
bin_data(BIN bin)¶ Get the binary data from a binary data block.
- Return
- The binary data.
- Parameters
bin: The binary data block.
Compression¶
-
BIN
bin_compress(MEM_SCOPE mem, unsigned char *data, size_t length)¶ Compress a block data.
- Return
- A block of compressed data.
- Parameters
mem: A memory scope to own the result.data: A pointer to the data to compress.length: The length of the data to compress.
-
BIN
bin_expand(MEM_SCOPE mem, unsigned char *data, size_t length)¶ Expand (decompress) a block of previously compressed data.
- Return
- The data block restored from compressed state.
- Parameters
mem: A memory scope to own the result.data: A pointer to the data to decompress.length: The length of the compressed data to decompress.
-
BIN
rle_encode(MEM_SCOPE mem, unsigned char *data, size_t length)¶ Encode a block of data using run length encoding.
- Return
- A block of run length encoded binary data.
- Parameters
mem: A memory scope to own the result.data: A pointer to the data to run length encode.length: The length of the data to encode.
-
BIN
rle_decode(MEM_SCOPE mem, unsigned char *data, size_t length)¶ Decode a block of data previous encoded using run length encoding.
- Return
- The data block restored from run length encoded state.
- Parameters
mem: A memory scope to own the result.data: A pointer to the data to decode.length: The length of the encoded data.
-
BIN
lz77_encode(MEM_SCOPE mem, unsigned char *data, size_t length)¶ Encode a block of data using back reference pointers (LZ77).
- Return
- A block of LZ77 encoded binary data.
- Parameters
mem: A memory scope to own the result.data: A pointer to the data to run length encode.length: The length of the data to encode.
-
BIN
lz77_decode(MEM_SCOPE mem, unsigned char *data, size_t length)¶ Decode a block of data previous encoded using back reference pointers (LZ77).
- Return
- The data block restored from LZ77 encoded state.
- Parameters
mem: A memory scope to own the result.data: A pointer to the data to decode.length: The length of the encoded data.
-
BIN
huffman_encode(MEM_SCOPE mem, unsigned char *data, size_t length)¶ Encode a block of data using Huffman.
- Return
- A block of Huffman encoded binary data.
- Parameters
mem: A memory scope to own the result.data: A pointer to the data to run length encode.length: The length of the data to encode.
-
BIN
huffman_decode(MEM_SCOPE mem, unsigned char *data, size_t length)¶ Decode a block of data previous encoded using Huffman.
- Return
- The data block restored from Huffman encoded state.
- Parameters
mem: A memory scope to own the result.data: A pointer to the data to decode.length: The length of the encoded data.
