Spectrum 512: Difference between revisions

From MultimediaWiki
Jump to navigation Jump to search
m (move generic remark up)
(describe compressed format)
Line 16: Line 16:


==Spectrum 512 Compressed==
==Spectrum 512 Compressed==
typedef spectrum512_compressed_file {
  uint16_t magic;                  /* "SP" */
  uint16_t reserved;                /* always 0 */
  uint32_t data_length;            /* length of compressed image data */
  uint32_t palette_length;          /* length of compressed palettes */
  uint8_t data[];
  uint8_t palettes[];
} spectrum512_compressed_file;
Image data is compressed by [[RLE]].
    0 <= x <= 127        x+1 literals
-128 <= x <=  -1        -x+2 times next byte
Each plane is stored separately, i.e. 199 scanlines of plane 0, 199 scanlines of plane 1, et cetera.
Just like uncompressed .spu files, there are 199 * 3 palettes of 16 entries.
Each palette is compressed separately.
A compressed palette:
typedef compressed_palette {
  uint16_t map;                    /* bit = 1, color is present; bit = 0, color is black (0x0000) */
  uint16_t colors[];
} compressed palette;
Bit 0 of '''map''' refers to palette entry 0 and so on.
Bit 0 and bit 15 should always be zero. The background is always black and palette entry 15 is unused.
This results in 15 * 3 + 1 = 46 colors per scanline.


==Spectrum 512 Smooshed==
==Spectrum 512 Smooshed==
Line 22: Line 50:


==Image Data==
==Image Data==
The image data is stored in a planar format.
Uncompressed image data (.spu files) is stored in a planar format.


[[Image:Atarist_lowres.png]]
[[Image:Atarist_lowres.png]]

Revision as of 09:42, 27 April 2008

Spectrum 512 was an image drawing program for the Atari ST.

16-bit words are stored in big-endian order.

Spectrum 512 Uncompressed

typedef spectrum512_file {
 uint16_t data[16000];             /* first 80 words (first scanline) is unused and should be zeroes */
 uint16_t palettes[199 * 3 * 16];  /* 199 scanlines, 3 palettes per scanline, 16 entries per palette */
} spectrum512_file;

Spectrum 512 Compressed

typedef spectrum512_compressed_file {
 uint16_t magic;                   /* "SP" */
 uint16_t reserved;                /* always 0 */
 uint32_t data_length;             /* length of compressed image data */
 uint32_t palette_length;          /* length of compressed palettes */
 uint8_t data[];
 uint8_t palettes[];
} spectrum512_compressed_file;

Image data is compressed by RLE.

   0 <= x <= 127        x+1 literals
-128 <= x <=  -1        -x+2 times next byte

Each plane is stored separately, i.e. 199 scanlines of plane 0, 199 scanlines of plane 1, et cetera.

Just like uncompressed .spu files, there are 199 * 3 palettes of 16 entries. Each palette is compressed separately. A compressed palette:

typedef compressed_palette {
 uint16_t map;                    /* bit = 1, color is present; bit = 0, color is black (0x0000) */
 uint16_t colors[];
} compressed palette;

Bit 0 of map refers to palette entry 0 and so on. Bit 0 and bit 15 should always be zero. The background is always black and palette entry 15 is unused. This results in 15 * 3 + 1 = 46 colors per scanline.

Spectrum 512 Smooshed

Palettes

Image Data

Uncompressed image data (.spu files) is stored in a planar format.

Atarist lowres.png