Topic : ATARI ST Picture formats
Author : David Baggett/Jan K⌐upka
Version : atari_gf.hyp 0.01 (17/09/96)
Subject : Documentation/File formats
Nodes : 52
Index Size : 1328
HCP-Version : 3
Compiled on : Atari
@charset : atarist
@lang :
@default :
@help :
@options : -i -s +y +z
@width : 75Spectrum 512 Smooshed *.SPS
This format compresses Spectrum 512 pictures better than the standard
method. There are at least two programs that support this format,
SPSLIDEX and ANISPEC, although the two seem to differ slightly in their
interpretation of the format.
One point of interest: Shamus McBride deciphered this format without
an ST!
1 wordword = 2 bytes
5350 (hex) ("SP")
1 wordword = 2 bytes
0 (reserved for future use)
1 longlong = 4 bytes
length of data bit map
1 longlong = 4 bytes
length of color bit map
<= ? bytes compressed data bit map
<= ? bytes compressed color bit map
< ? bytes total
Data compression:
Compression is via a modified RLERLE = Run Length Encoding
scheme, similar to that used in
Spectrum Compressed (*.SPC) pictures.
The data map is stored as a sequence of records. Each record consists
of a header byte followed by one or more data bytes. The meaning of the
header byte is as follows:
For a given header byte, x (unsigned):
0 <= x <= 127 Use the next byte x + 3 times
128 <= x <= 255 Use the next x - 128 + 1 bytes literally
(no repetition)
There are two kinds of *.SPS files.
The data may appear in the same order as *.SPC files (SPSLIDEX format?):
1. Picture data, bit plane 0, scan lines 1 - 199
2. Picture data, bit plane 1, scan lines 1 - 199
3. Picture data, bit plane 2, scan lines 1 - 199
4. Picture data, bit plane 3, scan lines 1 - 199
The second variant (ANISPEC format?) encodes the data as byte wide
vertical strips:
Picture data, bit plane 0, scan line 1, columns 0 - 7.
Picture data, bit plane 0, scan line 2, columns 0 - 7.
Picture data, bit plane 0, scan line 3, columns 0 - 7.
. . .
Picture data, bit plane 0, scan line 199, columns 0 - 7.
Picture data, bit plane 0, scan line 1, columns 8 - 15.
Picture data, bit plane 0, scan line 2, columns 8 - 15.
. . .
Picture data, bit plane 0, scan line 199, columns 312 - 319.
Picture data, bit plane 1, scan line 1, columns 0 - 7.
. . .
Picture data, bit plane 3, scan line 198, columns 312 - 319
Picture data, bit plane 3, scan line 199, columns 312 - 319.
A for loop to process that data would look like
for (plane = 0; plane < 4; plane++)
for (x = 0; x < 320; x += 8)
for (y = 1; y < 200; y++)
for (x1 = 0; x1 < 8; x1++)
image[y, x + x1] = ...
Color map compression:
Color map compression is similar to *.SPC color map compression, but
the map is compressed as a string of bits, rather than words. There are
597 records (one for each palette). Each record is composed of a 14-bit
header followed by a number of 9-bit palette entries. The 14-bit header
specifies which palette entries follow (1 = included, 0 = not included).
The most significant bit of the header refers to palette entry 1, while
the least significant bit refers to palette 14. Palette entries 0 and 15
are forced to black (zero). Each palette entry is encoded as "rrrgggbbb".
The format of the palette is described above in the section on
uncompressed Spectrum pictures (*.SPU).