How to get miniz working.

mohammedahmed248
Posts: 1
Joined: Wed May 29, 2019 4:14 pm

How to get miniz working.

Postby mohammedahmed248 » Wed May 29, 2019 9:13 pm

Hey guys, I am very new to the ESP32 environment, so bear with me. I am wanting to compress/decompress a file in the ESP32, and I saw that a library called miniz is included in the idf. But I am honestly completely clueless on how to use this library, as there isn't an example for it. If anyone can help guide me in the right direction , I would greatly appreciate it. Thank you for your time!

User avatar
fasani
Posts: 195
Joined: Wed Jan 30, 2019 12:00 pm
Location: Barcelona
Contact:

Re: How to get miniz working.

Postby fasani » Wed Dec 11, 2019 9:13 am

There is an example on the IDF :

https://github.com/espressif/esp-idf/bl ... st_miniz.c

Now keep in mind that #include "esp32/rom/miniz.h" includes only the low level deflate / inflate methods.
I'm sending compressed data (led matrix video) from an Android app and I found Brotli to be a very reliable decompressor for ESP32. Check google's library with my fork to update headers and tests for ESP32 here:

https://github.com/martinberlin/brotli
epdiy collaborator | http://fasani.de Fan of Espressif MCUs and electronic design

flipatoms
Posts: 3
Joined: Mon Sep 23, 2019 8:45 pm

Re: How to get miniz working.

Postby flipatoms » Fri Oct 02, 2020 2:13 pm

I've managed to get miniz working in my project by inluding both .c and .h
Only problem is I don't have enough ram to run compress function.

Is there any plan to include a compression lib in esp-idf that will work out of the box without tweeking? (I think a lot of people will appreciate that)

We are running an IoT startup and need to send log data etc to AWS IOT. Would help a lot if we could compress log files before transfer.

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: How to get miniz working.

Postby ESP_Sprite » Fri Oct 02, 2020 2:49 pm

I don't think lack of ram is a problem that is easily solvable... due to the nature of zlib-style compression, the compressor needs to keep large chunks of data in RAM to compare incoming data with, to see if it can be replaced by a backreference.

flipatoms
Posts: 3
Joined: Mon Sep 23, 2019 8:45 pm

Re: How to get miniz working.

Postby flipatoms » Fri Oct 02, 2020 4:46 pm

I see. Though there seems to be a lot of people that got it running....

Anyone who know about other compression lib that is more lightweight?

nopnop2002
Posts: 46
Joined: Thu Oct 03, 2019 10:52 pm

Re: How to get miniz working.

Postby nopnop2002 » Tue Jan 23, 2024 10:13 am

>Anyone who know about other compression lib that is more lightweight?

zlib is more lightweight.

Works with ESP32C2 with small RAM.

https://github.com/nopnop2002/esp-idf-zlib

DrMickeyLauer
Posts: 105
Joined: Sun May 22, 2022 2:42 pm

Re: How to get miniz working.

Postby DrMickeyLauer » Tue Jan 23, 2024 2:17 pm

https://github.com/atomicobject/heatshrink claims to work with memory footprints of 50 bytes. I'm not sure how it compares in terms of compression size, but it's on my to-evaluate list.

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: How to get miniz working.

Postby ESP_Sprite » Wed Jan 24, 2024 8:52 am

DrMickeyLauer wrote:
Tue Jan 23, 2024 2:17 pm
https://github.com/atomicobject/heatshrink claims to work with memory footprints of 50 bytes. I'm not sure how it compares in terms of compression size, but it's on my to-evaluate list.
I used that a long time ago. It's pretty decent, albeit not as efficient as zlib.

Who is online

Users browsing this forum: No registered users and 123 guests