Tiny Stuff

From MultimediaWiki
Revision as of 04:48, 1 May 2008 by Ivo (talk | contribs) (clarify)
Jump to navigation Jump to search

  • Company: David Mumper
  • Extensions: .tny, .tn1, .tn2, .tn3

Tiny Stuff is an image compression format used on the Atari ST.

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

File format

typedef tinystuff_file {
 uint8_t resolution;           /* 0 = low (320x200x16), 1 = medium (640x200x4), 2 = high (640x400x2) */
                               /* 3 = low and color animation is present, 4 = idem for medium, 5 = idem for high */
 struct {
  uint8_t animation_limits;    /* High nibble = start limit, low nibble = end limit */
  uint8_t animation_dirspeed;  /* negative = left, positive = right, timebase 1/60 */
  uint16_t duration;           /* number of iterations */
 } optional_animation_info;    /* if resolution < 3, this is not present */

 uint16_t palette[16];
 uint16_t number_of_control_bytes;
 uint16_t number_of_data_words;

 uint8_t control_bytes[];
 uint16_t data_words[];
} tinystuff_file;

Decompression algorithm

Unlike most other RLE variants, the control bytes and data are stored non-interleaved.

x refers to the current control byte, d and d+1 refer to the current and next data word:

x <  0    -x literal words
x == 0    d times d+1
x == 1    d literal words
x >  1    x times d

Uncompressed data format

The uncompressed data consists of four sets of 20 vertical columns. Each column is 16-bits wide.

for (set=0; set<4; set++)
  for (column=set; column<80; column++)
    for (scanline=0; scanline<200; scanline++) { }

Medium and high resolution data are handled as if they were low resolution.