DFF.TXT

DFF.TXT


Remove Frame

Paul Mace Software Inc.
400 Willaimson Way
Ashland OR 97520

DFF File Format

I don't do vertical run length encoding, because I always thought the
overhead was not worth it, particularly for DFF playback.

DFF has 8 bytes per frame for a window of thwere the changes take place.
The actual difference data is 80 to FF is count of number of bytes to move,
0 to 3F is skip count, and 40 to 7F is RLE count. If a count is zero
(80, 40, and 0) the following word is the count (mostly for big skips).
This is definitely not how I'd do it now, but I threw it together 4 or
5 years ago and never wanted to change it and make all my users convert 
their files.

unsigned int dffcnt;       // number of frames in DFF file
unsigned char numbits;     // number of bits per pixel
unsigned char numpl;       // number of bit planes

struct 
   {
   unsigned long dffpos;   // position of frame in file
   unsigned long dfflen;   // width and height of frame
   int xsize;              // width and height of frame
   int ysize;
   int xoff;               // offset relative to 0,0 of frame data
   int yoff;

} list[dffcnt];

The dffpos offsets are relative to the end of the header, so the offset
for th first frame is usually zero and the data is right after the last 
structure in list[]. The actual DFF data is stored one scanline at a
time (no skips or fills across scanlines). The rectangles defined for 
each frame can be different (and virtually always are different).

Something to keep in mind is that the DFF format does not include
palette information, so there may be a first frame which has palette 
information usually stored as a GIF, PIC, or PCX. The first frame can
be stored in the DFF (effectively a difference with nothing). But if
one stores the first frame in the DFF, there is no way to currently include
a palette. Do people often use PCX, PIC, or GIF file for the first frame
and name it the same as the DFF.

In some unusual cases, the DFF is intended to start playing on a generated
screen, so the first frame may not exist in file form. But that's very
unusual. Also DFF's can be generated for two pages, so the actual DFF
file is the difference sequence:

1 dif 2  (difference between frames 1 and 2)
1 dif 3
2 dif 4
3 dif 5
4 dif 6
5 dif 7

this is really only for 16 color modes.

Plus I support XOR'D DFFs where all the difference information is XOR for
playing the DFF forwards or backwards. Sadly I didn't put in any kind of
flag or bit field for this information, so there is no way to know that a
DFF is XOR or 2-page without asking the user. But the vast majority of 
DFF's are neither 2-page nor XOR.


Steven Belsky
Paul Mace Software