THE FLM FILE FORMAT
===================


FILE STRUCTURE
~~~~~~~~~~~~~~
FAST uses a ".flm" file to store grabbed Screen Machine II images. Every FLM file consists of the following main elements:
   - header
   - YUV raw image data with different byte ordering
   - icon of the image
   - additional text (optional)

Header:
The Header is described in the figure FLM Header.

Image Data:
The image data consists of a certain number of rows depending on the YUV mode and the equal number of lines, like the original video. The modes are described in the figure The YUV Modes

Icon:
Each FLM file has an icon of its image. The icon always has the same size and format (60x80, YUV mode 0).

Text:
You may add text to the image of any length. The length and position of the text are described in the FLM Header.

  HEADER
  {
     IMAGE RAW DATA
  }
  {
     ICON
  }
  OPTIONAL TEXT





FLM HEADER
~~~~~~~~~~

 0   Signature LSB           S
 1                           M
 2                           1
 3                           .
 4   Signature MSB           0
 5   Text End
 6   Icon Offset LSB
 7
 8
 9   Icon Offset MSB
10   Image Width LSB
11   Image Width MSB
12   Image Height LSB
13   Image Height MSB
14   YUV Mode
15   YUV Length LSB
16   YUV Lenght MSB
17   Y Bits
18   U Bits
19   V Bits
20   Compression Mode
21   Old Compression
22   Source Mode LSB
23   Source Mode MSB
24   Icon Lenght LSB
25   Icon Lenght MSB
26   Text Offset LSB
27
28
29   Text Offset MSB
30   Text Lenght LSB
31   Text Lenght MSB
32   Contrast LSB
33   Contrast MSB
34   Brightness LSB
35   Brightness MSB
36   Saturation LSB
37   Saturation MSB
38   Hue LSB
39   Hue MSB
40   Red LSB
41   Red MSB
42   Green LSB
43   Green MSB
44   Blue LSB
45   Blue MSB
46   Reserved LSB
47
.
.
.
63   Reserved MSB


Native PC byte ordering, 64 Bytes. The first five bytes always contains the string "SM1.0"



THE YUV MODE AND DATA FORMAT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A FBAS signal (Video and TV) consists of two "channels", one for the luminance Y and one for the two chrominance U red and V blue signals. The green component is calculated out of the other two chrominance information. Most video systems use the YUV format, so Screen Machine does. Therefore the fastes way to save an image is to store it in the original YUV format.

YUV Mode 0, rarely used
Mode Factor = 1.5
Ordering: Y1 Y2 V1234 U1234 Y3 Y4
Video Pixel: 4

YUV Mode 1, greyscale
Mode Factor = 1.0
Ordering: Y1
Video Pixel: 1

YUV Mode 2, similar to mode 6
Mode Factor = 2.0
Ordering: Y1 Y2 V12 U12
Video Pixel: 2

YUV Mode 3, largest, but best quality
Mode Factor = 3.0
Ordering: Y1 V1 U1
Video Pixel: 1

YUV Mode 6, Current used format!
Mode Factor = 2.0
Ordering: Y1 U12 Y2 V12
Video Pixel: 2


YUV Image Data Lenght:  video pixel x mode factor x lines = bytes

FLM File Lenght:    Header:      64         bytes
                  + Image:     vp*mf*l      bytes
                  + Text:    text length    bytes
                  + Icon:       7680        bytes
                  ===============================
                           absolute Lenght  bytes
