DVM Movie

Also Known As: Magic Software DVM


Type Animation
Colors 16 or 256
Compression Pixel packing
Maximum Image Size NA
Multiple Images Per File Yes
Numerical Format Little-endian
Originator Magic Software
Platform MS-DOS
Supporting Applications Magic Software
See Also FLI

Usage
Storage of small animations and movies.

Comments
A minimal animation format that is of interest mainly because of its simplicity.

Vendor specifications are available for this format.

Code fragments are available for this format.

Sample images are available for this format.


DVM is an animation format created in support of Magic Software. There are several revisions of the format: 1.0, 2.0, 3.0, and 3.1. Appended to the documentation on which this article was based was the following curious statement:

The DVM format was created by Magic Software and may only be modified by members of Magic Software.

We wish Magic Software well in the enforcement of this policy.

Contents:
File Organization
File Details
For Further Information

File Organization

DVM files are binary and consist of a header followed by a palette (in v1.0 and higher) and bitmap data organized into a series of frames.

File Details

The v1.0 file header consists of the following:

typedef struct _DVM_HEADER
{
   char ID[3];       /* File ID "DVM" */
   char Size;        /* Q, F, or V */
   char Info;        /* Flags */
   WORD Wait;        /* Time (ms) to wait between frames */
   WORD Char_count;  /* Number of characters in text, if present */
   char[];           /* Text string, if present */
} DVM_HEADER;

For v2.0 and higher, the following header is used:

typedef struct _DVM_HEADER
{
   char ID[3];       /* File ID "DVM" */
   char Size;        /* Q, F, or V */
   char Version;     /* High nibble is major version, low nibble is minor */
   char Info;        /* Flags */
   WORD Wait;        /* Time (ms) to wait between frames */
   WORD Char_count;  /* Number of characters in text, if present */
   char[Char_count]; /* Text string, if present */
} DVM_HEADER;

The Size field may contain either the characters Q, F, or V, representing Quarter screen, Full screen, and higher Versions, respectively.

The Info field consists of the following flags:

Bit 0

NA

Bit 1

NA

Bit 2

NA

Bit 3

Set if text exists

Bit 4

Set for 256 color (otherwise 16 color)

Bit 5

Set for enhanced palette (otherwise standard palette)

Bit 6

Set for compressed frames

Bit 7

Set for full screen (320x200), otherwise quarter screen (160x100)

Versions 2.0 and higher add support for both 320x200 and 160x100 images. Versions 3.0 and higher add support for both 16- and 256-color images, and versions 3.1 and higher support text. Versions 1.0 or higher should use an enhanced palette.

The enhanced palette may contain either 16 or 256 colors. The 16-color palette is organized as 48 consecutive bytes of RGB data. Only the bottom six bits of each byte are significant. The 256-color palette is 768 bytes long and consists of 256 RGB colors. Colors run from 0 to 0xff.

The standard palette is not contained in the file but must be constructed algorithmically by the rendering application. In C pseudocode, this is:

typedef struct _RGB { BYTE r,g,b; } RGB;
RGB palette[256];
SHORT i,r,g,b;
for(i = 0;i <= 15;i++)
{
   palette[i].r = 
      palette[i].g = 
         palette[i].b = (BYTE)(ROUND((DOUBLE)i * 4.2));
}
for(r = 0;r <= 5;r++)
{
   for(g = 0;g <= 5;g++)
      {
      for(b = 0;b <= 5;b++)
         {
         palette[r*36+g+b+16].r = (BYTE)(ROUND((DOUBLE)r * 12.6));
         palette[r*36+g+b+16].g = (BYTE)(ROUND((DOUBLE)g * 12.6));
         palette[r*36+g+b+16].b = (BYTE)(ROUND((DOUBLE)b * 12.6));
         }
      }
}
for(i = 0;i <= 7;i++)
{
   palette[232 + i].r = (BYTE)(i * 9);
   palette[232 + i].g = (BYTE)0;
   palette[232 + i].b = (BYTE)0;
   palette[240 + i].r = (BYTE)0;
   palette[240 + i].g = (BYTE)(i * 9);
   palette[240 + i].b = (BYTE)0;
   palette[248 + i].r = (BYTE)0;
   palette[248 + i].g = (BYTE)0;
   palette[248 + i].b = (BYTE)(i * 9);
}

Following the palette is the frame data. The frame origin is in the upper left of the image, and lines are stored in order.

Frames may be compressed in a simple version of pixel packing, where bytes of the source data are stored in nibbles of the bytes written to the file. The high-order nibble of the data in the file is extracted first and represents the current byte in the data stream. The low-order nibble of the data byte in the file represents the next byte in the data stream.

For Further Information

For additional information about the DVM movie format, contact:

Bert Greevenbosch
Magic Software Rotterdam
Rotterdam, The Netherlands
Voice: +31-10-4215920
Email: bert@caiw.nl



Copyright © 1996, 1994 O'Reilly & Associates, Inc. All Rights Reserved.

Hosted by uCoz