I'm looking for a library (or algorithm) with public description and reference source code (in any language with a mainstream compiler targeting 32bit embedded CPUs like Cortex-M0), doing lossless data compression, with (from most to least critical)
- A well-defined stream interface supporting synchronous flushing (meaning that decompression of the flushed compressed stream yields the full input stream at time of flush). In this respect, zlib is fine, and Java's
- Decompression compatible with an embedded context. Make that max 10kB RAM for data, 30kB code, and no worse than 10 times slower than deflate. Constraining compression for compatibility with the decompression resources is OK. Compression resources are secondary.
- State-of-the-art compression ratio including for text payloads like JSON, XML of small size between flushes (0.2 to 20kB). The aforementioned deflate and friends start to show their age here. I have the vague impression ANS-class algorithms have an edge.
- Robust decompression code. The last thing I want is that some crafted compressed stream cause unspecified behavior, or worst a vulnerability. Zlib's changelog shows that's not easy. Well-handled exceptions on invalid compressed input are OK.
Note: the question was originaly asked on SO, and migration here strongly asked.