-
-
Notifications
You must be signed in to change notification settings - Fork 42
PackBits Compression
Michael R Sweet edited this page Mar 21, 2025
·
4 revisions
LPrint provides a pair of functions that implement the classic PackBits compression algorithm as defined in many places, including at https://en.wikipedia.org/wiki/PackBits:
-
lprintPackBitsAlloc: Allocate an output buffer large enough for a given input. -
lprintPackBitsCompress: Compress an input buffer.
unsigned char * // O - Pointer to compression buffer
lprintPackBitsAlloc(
size_t len) // I - Size of input bufferAllocate a PackBits compression buffer. Free the returned pointer with free()...
size_t // O - Number of compressed bytes
lprintPackBitsCompress(
unsigned char *dst, // I - Destination buffer
const unsigned char *src, // I - Source buffer
size_t len) // I - Number of source bytes (at least 3)PackBits compress some bytes to the destination buffer.
The destination should be allocated wth lprintPackBitsAlloc().