Page 1 of 1

JPEG decoder

Posted: Sat Nov 28, 2009 5:27 pm
by mic_
I've built a version of libjpeg for the 32X so I thought I should post it here.

Decoding demo ROM plus source code and a prebuilt version of libjpeg.a (tested and works on a real 32X): http://jiggawatt.org/badc0de/djpeg32x.zip


And here are my modified libjpeg sources: http://jiggawatt.org/badc0de/jpeg-7-32x.zip

To build the library just do make -f makefile.unix libjpeg.a
If you're on a non-Windows system you'll have to rebuild ansi2knr first with your regular gcc, i.e:
gcc ansi2knr.c
make -f makefile.unix libjpeg.a

I borrowed the memory allocator from the Wolf32X sources. Since bss_end isn't known at the time when the library is built I just hardcoded the heap address (you can find it in jdapimin.c - look for the call to MSYS_Init). The library should work on the Saturn as well if you modify the heap start/endpoint and rebuild it.

Note that I've removed the compression parts of the library in the makefile since I only considered the decompression routines to be relevant.

Posted: Sat Nov 28, 2009 7:23 pm
by TmEE co.(TM)
This is pretty cool :D

it would have been fun if you'd show the decoding process rather than showing black and then the result :P

Posted: Sat Nov 28, 2009 7:46 pm
by mic_
Well, go ahead and modify read_JPEG_file to flip the frame buffer every once in a while if you want to :wink:

I decided to start porting libpng as well. I've managed to build libpng (and libz) for the 32X already, as well as a decoding test much like the one I did for JPEG. It's not working properly though, so I'll have to do some debugging.

Posted: Sun Dec 06, 2009 9:29 pm
by mic_
I've cleaned up the library code a bit so that there's now a single archive for both the 32X and Saturn, with different makefiles depending on your target: http://jiggawatt.org/badc0de/jpeg-7-32x_sat.zip

Use:

make -f makefile.32x libjpeg.a

or

make -f makefile.saturn libjpeg.a