New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for embedded #237
Comments
|
Hi, we are starting to use If my solution seem acceptable to you, I can prepare a PR. And thanks for the wonderful library! |
|
@projectkk2glider have you tried png formats? these files seem to be even more demanding and I haven't been able to make the decoder work on the esp8266. I have implemented the library on Sming for the ESP8266 and can decode BPM, GIF and JPG (one decoder at a time). |
|
stb_image isn't really designed to be space efficient like embedded needs. it fully decodes intermediate steps so it uses like 1.5x as much memory as needed for jpg, and 2x as much memory for png, nevermind stack usage. |
|
With better stack management, it works well in the esp8266... |
|
With my change the stack usage is less than 8kB both for PNG and JPG. |
|
The thing is, on non-embedded platforms it's better to use the stack since you reduce heap fragmentation, so I'm not sure what the right thing to do is. |
|
An option then, but the code will become ugly. |
|
A fix for this was submitted: |
I am working on getting stb image library working on the popular esp8266 iot platform, which is an embedded system. Although ram is limited on such device, the library has a number of potential use for interface designs on small oled screens. For example to display WiFi status icons, etc.
So far, jpg and gif work to a certain extent, but PNG triggers a software watchdog reset caused likely but a stack overflow.
There are challenges, notably with regards to stack space which is limited on embedded systems. Ideally, the library should move away from large local variables and leverage malloc instead. If this could benefit others, I will submit a PR when I am done.
The text was updated successfully, but these errors were encountered: