It's a long thread, and it may sound comfusing at first, but once you get to the end you'll figure out what I'm talking about. I'm not going to use this in any project I'll be doing now (until I manage to figure out how to use a Command Prompt) but I just want to share my idea with the Sega-16 community.
there are two parts/steps of the compression format. Step 1, is like LSZZ compression, and is used to eliminate reocurring patterns in colors. Step 2, is like RLE and is there to expand every color to their correct legnth. It's that way because I noticed that the colors always repeat themselves in the same order, but the amount of times every individual color repeats itself always changes.
There are three different threads/lists of bits in this:
compressed list- thread of compressed data
semidecompressed list- data that has been decoded through the LSZZ part but not the RLE part
decompressed list- the final decompressed sprite
the first step:
take the next bit in the compressed list:
if 0:
the next four bits in the compressed list are the next pixel/color in semidecompressed list
if 1:
the next eight bits in the compressed list are in this format
SSSSSLLL
S-source
L-legnth
it subtracts S from the current position in the semidecompressed list, and copies every pixel from there to the front of the semidecompressed list for the legnth of L.
repeat this step until you reached the last pixel in the semidecompressed list
the second step
take the first pixel/color in the semidecompressed list, and move it into decompressed list.
take the next bit in the compressed list:
if 0: repeat last pixel/color in the decompressed list
if 1: move next pixel/color from the semidecompressed list into the decompressed list
grab the next bit in the compressed list and do the same until you reach the last pixel in the decompressed list

Reply With Quote


Death To MP3, 
