PAL2YUV
by Eponasoft

This is a simple utility to generate a set of YUV values from a JASC-PAL, the
palette file format used by Paint Shop Pro.

Usage:
pal2yuv inputfile.pal

That's all there is to it. So, you go like this:

pal2yuv mypal.pal

and if the palette file is valid, you will get mypal.yuv in return, which can be
#included into your PC-FX source file. If you open mypal.yuv in a text editor,
you will see something like this:

const u16 mypal_pal[] = { a bunch of hex YUV values here };

PaL2YUV supports both 16 and 256 color palettes but they have to conform to the
JASC-PAL spec. Here's the format:

JASC-PAL
0100
16
255 0 255
0 40 89
etc etc

The first line is the JASC-PAL identifier. If this is missing, this will not
work... at all. Make sure it's there. The second line is the version number. It
is skipped, so you could put in other data there is you want, like a comment or
something, since PAL2YUV doesn't even check it. The third line is the number of
colors. This has to be 16 or 256 or PAL2YUV will tell you to bugger off. And
after that comes your RGB triads. You need all 16 or all 256, as I didn't bother
coding any kind of EOF conditions for bozos who can't adhere to specs. :P

I've included a couple of test palettes for you to try, one in 16 colors and the
other in 256 colors.

So that's about it. If you want to rebuild the source, just pick up a copy of
FreeBASIC and have at it. I compiled this in fbc 1.05 but it should work fine in
damn near any version.

Credits And Kudos:

Nodtveidt coded this
elmer provided the YUV correct formula and upgraded the whole bloody toolchain
trap15 made the original liberis
Ryphecha made mednafen
You somehow managed to read my whole doc, congrats :P

TEH ENDZ
