PNG decoder

Talk about development tools here

Moderator: BigEvilCorporation

Post Reply
mic_
Very interested
Posts: 265
Joined: Tue Aug 12, 2008 12:26 pm
Location: Sweden
Contact:

PNG decoder

Post by mic_ » Sat Nov 28, 2009 8:58 pm

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.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sat Nov 28, 2009 9:37 pm

Cool! Very neat stuff. :D

mic_
Very interested
Posts: 265
Joined: Tue Aug 12, 2008 12:26 pm
Location: Sweden
Contact:

Post by mic_ » Sun Nov 29, 2009 4:08 pm

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

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sun Nov 29, 2009 5:01 pm

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:

mic_
Very interested
Posts: 265
Joined: Tue Aug 12, 2008 12:26 pm
Location: Sweden
Contact:

Post by mic_ » Sun Nov 29, 2009 5:14 pm

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.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sun Nov 29, 2009 7:58 pm

32X and Saturn... that's handy. I've got my 32X toolchain setup to compile Saturn as well (using lapetus as the main SDK).

Post Reply