PNG repurposes normal text-compression techniques & tweaks imagery to match. So Pngle (which Papyrix might use to render images) vendors Miniz.
Miniz implements Adler32 (checksum operating upon chunks of 8 bytes shuffled around) & CRC32 (accelerated via a lookup table for nybbles) error-detection.
It includes multiple initializers & a reset routine, & exposes a version number.
After some validation a toplevel deflate routine carefully splits the stream to hand to an underlying compressor.
1/
There's a routine to carefully clear some state. There's a routine to (admittedly poorly) overestimate how much memory it might decompress to. And there's abstractions for running a bytearray through this library.
Then there's equivalent routines for a decompressor.
Beneath these Miniz offers a "tinfl" library to do the actual logic!
tinfl has macros for managing memory, error reporting, & reading in data. Possibly Huffman-decompressing as it does so.
2/?