Does anybody knows a png decoder implemented in pure C, to port it to RLP?
I want to download and show map tiles that is compressed png images.
I’ve tried to use a LodePNG
It compiles succesfully for G400 via emBlocks but does not work for some reason (board reboots). May be because there is a references used or another thing that is unsupported by RLP.
I don’t know how it is possible to debug or test a RLP code thus it is seems very hard to me to get it work.
Another idea is to port Skewworks PNG Support Library to native code (because at least I’m sure it works correct with my type of png).
I just looked at the code. Did you change maloc to use the provided rlp extension?
This is in the code…
/The malloc, realloc and free functions defined here with “lodepng_” in front
of the name, so that you can easily change them to others related to your
platform if needed. Everything else in the code calls these. Pass
-DLODEPNG_NO_COMPILE_ALLOCATORS to the compiler, or comment out #define LODEPNG_COMPILE_ALLOCATORS in the header, to disable the ones here and
define them in your own project’s source files without needing to change
lodepng source code. Don’t forget to remove “static” if you copypaste them
Yes, I did a simple function to flip a bitmap that works fine.
Also RLP->malloc and free functions are new for me thus I’ve created a test function like allocate memory, write some array to it, read this array back, free memory. This is also works as expected.
I should try to compile and debug this code within the Atmel avr studio IDE. As it seems this ide can compile C sources with respect to target MCU architecture, thus I believe, it can help me to find a root cause of a bug.
If there will be no results then I will share my code for community to rewiew
The crash reason was that you cannot just define such big array as
int array[1024 * 30];
(because of stack limitation ?)
After this hardcoded array was replaced with a dynamic allocation this crash was gone.
There was also few more minor bugs, so after two hours of debugging it finally has drawed a valid image to my screen.
I had not meassured the decode time, but I think it is about 0.2 - 0.5 sec for 256x256 compressed PNG image.