Jump to content

CPS3 Tile / Sprite Data Compression


Alpha

Recommended Posts

sfiiibg5pb9.png

 

CPS3 emulation is seriously picked up speed! Yesterday it was sounds, backgrounds, and now it's sprite data compression.

 

CPS3 uses compressed data for it’s BG tiles and Sprite Data. The system has a ‘DMA’ list in Video RAM, and when given the command the video hardware will process this list, and copy + decompress graphic data from the FlashROMs into Video RAM for use by the game.

 

The compression initially looked rather complex, but actually turns out to be much more simple than first thought (although emulation still isn’t perfect)

 

The basics of it are simple. The first command in the DMA list is a special command, telling the chip to upload a 256 byte table to its internal memory. The Compressed data contains 8 bit values from 00 - FF. Byte with 0×80 set (0×80 - 0xFF) are treated as a lookup into the table it uploaded, replacing one byte, with one word from the table. This allows them to compress the 128 most common words to a single byte instead of a word, thus saving 50%.

 

After that there is an RLE stage, bytes with 0×40 set are command bytes, telling the chip to repeat the next byte a certain number of tiles. What you’re left with is a series of values between 0×00 and 0×3f, giving 6bpp (64 colour) sprite / bg tiles.

 

What isn’t quite understood is what happens if there is an RLE command byte followed by an RLE command byte, or if RLE is applied to a 0×80 byte, does it just affect the first value in the table, or do both get repeated etc.

 

Here are some screenshots, they’re not quite as good as ElSemi’s, probably due to a bug in the code I’m using right now. Also I’ve had to disable the text layer palette for now because MAME can’t handle over 0×10000 colours in a palette without custom drawing functions.

The progress has truly become a beautiful sight to see! Keep up the great work Haze, ElSemi, and all the developers.

 

»» More Screenshots & Original Post

Edited by Robert
Link to comment
Share on other sites

I have no idea what was on GC's mind. -_-

For some reason I got them mixed up. I realized it later in the day, but never got to editing my post. :crybaby:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...