Page 1 of 1

PNG decoder

Posted: Sat Nov 28, 2009 8:58 pm
by mic_
As I mentioned in my post about my libjpeg port I had also started porting libpng. And now here's the result: http://jiggawatt.org/badc0de/dpng32x.zip


The modified libpng & libz sources: http://jiggawatt.org/badc0de/lpng_lz-32x.zip
To make the libraries, first enter the zlib-1.2.3 directory and do make libz.a. Then enter the lp140b106 directory and do make -f makefile.32x libpng.a.

Again, the heap boundaries for the allocator are hardcoded. I let libpng use 0x0601F000..0x0602EFFF and zlib use 0x0602F000..0x0603EFFF.

Posted: Sat Nov 28, 2009 9:37 pm
by Chilly Willy
Cool! Very neat stuff. :D

Posted: Sun Nov 29, 2009 4:08 pm
by mic_
I realized that I probably should define PNG_NO_FLOATING_POINT_SUPPORTED and PNG_NO_MNG_FEATURES when building libpng. :?

Floating point math is only used for stuff like gamma correction which I didn't use in the decoding demo anyway, but getting rid of the floating point emulation code reduced the size of the library by about 10% at least.. And it no longer requires libm or libg.

Here's the new version of the demo + libpng.a: http://jiggawatt.org/badc0de/dpng32x-2.zip

Posted: Sun Nov 29, 2009 5:01 pm
by Chilly Willy
Every little bit helps. This isn't a PC where the ram is considered infinite.

That's half the fun of programming old consoles - remembering the days when 64 KB was considered "huge". :lol:

Posted: Sun Nov 29, 2009 5:14 pm
by mic_
Yep. Actually, now it's down to 111 kB (compared to the 166 kB of the first version). The code is ROM though, but 128 kB of RAM are reserved for the heaps that the two libraries can allocate memory from when they are used.

The current libpng/zlib sources can be found here: http://jiggawatt.org/badc0de/lpng_lz-32x_sat.zip. It's now the same for 32X and Saturn, just with different makefiles. And build instructions are included in the files named README_32X_SATURN.TXT.

Posted: Sun Nov 29, 2009 7:58 pm
by Chilly Willy
32X and Saturn... that's handy. I've got my 32X toolchain setup to compile Saturn as well (using lapetus as the main SDK).