Search code examples
stm32lossless-compression

Looking for a data compression implementation in C without dynamic allocation for STM32


I'm looking for a lossless data compression algorithm implementation that can run on a STM32L4. The data is ECG curves (so basically a set of 16 bits numerical values that are relatively close from one another).

I've found different implementations, for example miniz but they all use dynamic memory allocation (which I want to avoid) and are also pretty complicated and resource consuming.

I've read this post but there isn't really an answer. I'd like to avoid to modify an existing implementation to get rid of dynamic allocation, since this functionality (data compression) is not my main priority.

I don't need a fancy state of the art algorithm, but rather a simple, resource limited algorithm to save some bandwith when sending my data over the air, even if the compression ratio is not the best.

Do you have any idea of an algorithm that may fit ?


Solution

  • I was using https://github.com/pfalcon/uzlib

    It uses malloc but it very easy to amend and use fixed size buffers.

    Take a look a try.