Compression library

hi all, i would like to know any compression library that gives out put in .zip format that works in ARM cortex M4

is any one done compression (.zip) in any controller and store the zip file in SD card?

let me know is possible

thanks in advance

I’ve never used compression on an embedded project, but let’s see if we can come up with something. Some considerations:

  • What are you trying to compress? Different kinds and amounts of data can be optimized in different ways.
  • How many resources do you have available in your system? There is usually a compromise between RAM, CPU usage, etc., and somethings just simply don’t fit on embedded constraints.
  • What framework and language are you using?

As a wild guess, check this for example.

Thanks for your reply,
i am using STM32 F411 discovery board to develop with 128K byte SRAM, and data size is small approximately 2 K Byte

i checked the link you shared and is like string compression, but i need to compress a data file and the output format will be in .zip

i am using ARM Keil and STM32 IDE

@viedana do you have any idea?

I don’t have any experience with STM32 programming, do you develop the firmware in C, C++, or something else…?

Consider that such 2KB size might be a little too small to take advantage of .zip compression, I’d suggest you to try and compress that “data file” on your PC and see if you get any benefits, or if it ends up being larger. Preferably, try to compress it with open source tools, so if you find a method/configuration that works for you, you can try and find what library they use.

And again, different kinds of “data files” can be compressed differently. A general purpose compression algorithm might try to look at “entropy” and general ideas of the binary data, but this data means nothing to the algorithm. A specific algorithm might recognize particular redundant details on the data that might be trimmed off. Also there are “lossy” and “non-lossy” compressions, the latter being a little more efficient on space at the cost of altering the information (think of JPEG or MP4 for example).

Hi Viedana thanks for your reply, actually i want to POST some sensor data to server, the client server only take the data in .zip format that why i need to compress data in to zip, i found different libraries(zlib, mzip etc) for doing that, but all are working with a file system the controller i am using is not supporting local file system (exept FAT FS), i want a buffer to buffer compression, no need to store the data

Oooh, ok, that’s terrible! Hmmm, haven’t tried, but have you check miniz? There seems to be an implementation to more easily create zip “files”. It probably would be a lot of work, but it seems to be portable to an embedded device, since for example the ESP32 dev-team looks to be using it for something.