2

I have stream of binary data that I want to 'decompress' at run-time. The data is compressed off-target so there is no constraint on compression in time/space. When it comes to decompression at run-time I need to be able to save memory not only by decompressed data but also the decompression code size should not exceed more than around 10KB.

Any suggestions on the kinds of simple decompression algorithms/ libraries in C? I am ready to compromise on compression ratio for data, also in time for decompression.

2 Answers 2

6

Try lz4. About 2K bytes of code for decompression, and wicked fast.

Sign up to request clarification or add additional context in comments.

4 Comments

How did you determine it was only 2KB of code for decompression? I'd like to make use of that. My attempts of compiling out compression for lz4 resulted in a 66KB liblz4.a.
@Pillager225 I deleted all but the required lines from lz4.c for one instantiation of the decompression code. I just did it again, and the resulting .o file is 1696 bytes. The actual compiled code must be less than that.
I didn't spot it in the source distribution, so either it's there and I missed it, or if not there, perhaps @Cyan could add compilation options for decompression-only code.
Right on man. Thanks for the guidance. I need frame support, so I'll keep on it, but confirmation 10 years later is promising. Thank you.
1

I would recommend LZO Compression. I have used it very successfully. It has excellent decompression speed (that's what its optimized for) and some implementations can even decompress into the same buffer where the data is stored (if its stored at the end).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.