In this paper, you will find the file format specifications for a class ofanimation files that fall in the "FLIC" file category. These include:FLI files (Autodesk Animator)FLC files (Autodesk Animator Pro)FLH & FLT files (DTA)CEL files (Autodesk Animator)FLX files (Tempra Pro, Mathematica Inc.)FLX files (U-Lead, 3DStudio MAX)Extensions by Pro Motion (Cosmigo)Extensions by EGI (CompuPhase)The original FLIC file format was described by its author (Jim Kent) inDr. Dobb's Journal, March 1993. The original purpose ofthis document was to document the modifications and extensions thatEGI (a FLIC compiler and player engine) adds tothe FLIC file format, but since then it has grown to include all otherextensions and variations as well. As you may not have Jim Kent's article, allstandard file information is included in this paper as well.There are two "official" types of FLIC files: FLIand FLC (the names of these types refer to the filename extensions). The FLIfiles are the older format and are limited to a resolution of 320200.The FLC file format adds configurable resolution and better compression.FLX files are a slight variation on the standard FLC format. Actually, thereare two FLX file formats with slight differences. Both formats use32768 colours in a packed RGB format (15-bpp, each pixel takes two bytes).The first FLX format was defined for "Tempra Pro" by Mathematica Inc. Theformat used by 3DStudio MAX (Discreet Inc.) also has the extension FLX buttheir format is more like that of 15-bpp FLH files. Where distinction is needed,this paper refers to "Tempra FLX" or to "Autodesk FLX" formats (Discreet isaffiliated to Autodesk).Both "Tempra FLX" and "Autodesk FLX" formats use the RLE compression thatwas originally designed for 8-bpp FLC files, which is a sub-optimal solution.To improve the compression and to make the file format more flexible withregard to colour depth, Dave K. Mason defined new chunk types for his DTAprogram, in addition to tagging the new format with a new "type" ID and newextensions (FLH and FLT) as to avoid confusion. A few other programs, notablyEGI, also support the DTA chunks and type IDs.CEL files, finally, are actually either FLI or FLC files with a differentextension and one more chunk in the "prefix data" (a kind of optional header).OverviewA FLIC file stores a number of frames. Every frame contains an image andpossibly a palette, a label, or other data. Usually, a FLIC file contains aring frame at the end, so that the animation can be played repeatedly withouta perceptible pause between the last frame and the first (the unpacking of thefirst frame, a complete image, is generally slower than a delta frame update).A FLIC file that contains segments (EGI extension) optionally contains a ringframe per segment.FLIC files are structured in a hierarchy of chunks. A chunk contains afixed part and a variable part. The fixed part of every chunk contains thetype and the size of the chunk. The rest of the chunk has no fixed format; itall depends on the chunk type. The purpose of the chunked structure is toallow new chunks to be added without breaking existing FLIC players. A readerthat does not understand some chunk type can just skip it (using theinformation from the fixed part of the chunk). The figure below shows thehierarchy of chunks in a FLIC file.All "word" (two bytes) or "double word" (four bytes) values are stored inLittle Endian (this is the byte order used by the Intel 80x86 and Pentiumprocessor series).Overview of the FLIC file structureFile header general file informationPrefix chunk FLC files only Cel data chunk CEL files (identical to FLC files) Frame chunk overlay frame, EGI files only overlay pixel data Cel data chunk overlay origin and transparent colour overlay label Path map EGI files onlySegment table chunk EGI files only Segment chunk information of every segment, EGI files only symbolic names of segments, EGI files onlyHuffman table chunk EGI files onlyScript chunk EGI files onlyFrame chunk standard frame Postage stamp icon, FLC files only compressed or uncompressed Cel data chunk frame origin, EGI files only colour data compressed in various ways transparency information, EGI files only symbolic or numeric labels, EGI files only Region chunk region of frame changes, EGI files only Wave audio chunk digitized audio, EGI files only User string chunk general purpose data, EGI files only Key palette key frame data, EGI files only Key image key frame data, EGI files onlyRing frame chunk frame that cycles back see above see above see above see above Region chunk see above Wave audio chunk see above User string chunk see above is one of either: "256" colour palette palette with 8-bpp RGB entries "64" colour palette palette with 6-bpp RGB entries is one of either: Black frame full black frame Uncompressed full frame uncompressed pixel block Full frame RLE compressed, EGI also supports Huffman/BWT Delta frame (old style) RLE compressed Delta frame (new style) RLE compressed, EGI also supports Huffman/BWT HiColor/True Color frame DTA and EGI only is one of either: Bitmap mask chunk EGI files only Multilevel mask chunk EGI files only Region mask chunk EGI files only is one of either: Label chunk EGI files only Extended label chunk EGI files only The file headerA FLIC file starts with a 128-byte header, seethe figure below for a C structure. Thetype field contains:0xAF11For FLI files0xAF12For standard FLC files (with an8-bit colour depth). FLX files (both "Tempra FLX" and "Autodesk FLX") alsouse this header type.0xAF44For FLIC files witha colour depth other than 8. The DTA program (by Dave K. Mason) makesFLIC files with a colour depth of 1, 15, 16 or 24 bits per pixel.EGI version 3.0 (and later) supports 16-bpp FLIC files.0xAF30For FLIC files thatuse Huffman or BWT compression. These FLIC files can also havea colour resolution that is different from 8 bits per pixel.0xAF31For FLIC files thatuse "frame shift" compression. These FLIC files may use additional compressionschemes like Huffman and BWT; They can also have a colour resolution that isdifferent from 8 bits per pixel.???Password protected FLIC files have ascrambled type field, so that previous versions of EGI and otherFLIC readers will identify them as invalid (or unknown)FLIC files.For FLI files, the delay between two frames is in increments of1/70 second; FLC files specify the speed in milliseconds.The header for a FLI file does not contain the offset of thefirst and second frames; the first frame is assumed to start directly behindthe file header (no "prefix", "segment table" or "Huffman table" chunks) andthe offset to the second frame is easily computed once you read in the headerof the first frame. The purpose of storing the offset to the second frame isthat, after playing the ring frame, the next frame to display is thesecond frame of the animation.Autodesk Animator Pro also stores the MS-DOS formatted date and time stampsof the initial creation and last update of the FLIC file, as wellas the serial number of the copy of the Animator Pro program that made/updatedthe file (in the creator and updater fields). Otherutilities set the creator field to:0Unknown (Pro Motion, DTA, VFD or other)0x45474900EGI0x464c4942FlicLib0x42494c46FlicLib - release 20x41544542Micrografx Simply3D0x30314c46Discreet 3DStudio MAXThe frames field in the FLIC file header does notinclude the ring frame that loops back to the beginning of the animation.The flags field is used internally by Autodesk Animator Pro. If aFLIC file is written to disk and closed correctly, Animator Prosets this field to 3. Several other utilities set it to zero.The FLIC file headertypedef struct DWORD size; /* Size of FLIC including this header */ WORD type; /* File type 0xAF11, 0xAF12, 0xAF30, 0xAF44, ... */ WORD frames; /* Number of frames in first segment */ WORD width; /* FLIC width in pixels */ WORD height; /* FLIC height in pixels */ WORD depth; /* Bits per pixel (usually 8) */ WORD flags; /* Set to zero or to three */ DWORD speed; /* Delay between frames */ WORD reserved1; /* Set to zero */ DWORD created; /* Date of FLIC creation (FLC only) */ DWORD creator; /* Serial number or compiler id (FLC only) */ DWORD updated; /* Date of FLIC update (FLC only) */ DWORD updater; /* Serial number (FLC only), see creator */ WORD aspect_dx; /* Width of square rectangle (FLC only) */ WORD aspect_dy; /* Height of square rectangle (FLC only) */ WORD ext_flags; /* EGI: flags for specific EGI extensions */ WORD keyframes; /* EGI: key-image frequency */ WORD totalframes; /* EGI: total number of frames (segments) */ DWORD req_memory; /* EGI: maximum chunk size (uncompressed) */ WORD max_regions; /* EGI: max. number of regions in a CHK_REGION chunk */ WORD transp_num; /* EGI: number of transparent levels */ BYTE reserved2[24]; /* Set to zero */ DWORD oframe1; /* Offset to frame 1 (FLC only) */ DWORD oframe2; /* Offset to frame 2 (FLC only) */ BYTE reserved3[40]; /* Set to zero */ FLIC_HEADER; The modifications that EGI made to the FLIC file header are subtler.Not only are there a few added fields, but you must also decide whether thefields are valid: First verify that the FLIC file is created by EGI. If the "creator" fieldof the FLIC file header is not equal to 0x45474900, the ext_flagsfield is not valid. The ext_flags field indicates what extensions were used. If this value iszero (no extensions) the file is a "compatible" FLC file. bit meaning0file contains segments (segment table present)1file contains key images at regular intervals2all frames have an identity palette3file is Huffman compressed4file is BWT-Huffman compressed5bitmap masks are present6multilevel masks are present7region data is present8file is password protected9animation file contains digitized audio10animation file contains a script11region masks are present12animation file contains overlays13file is frame-shift compressed If the script contains "segment" instructions, the EGI compiler produces a segmenttable. The segment table will come right after the FLIC header. Bit 0 of the"ext_flags" field indicates whether there is a segment table in the file. In a segmented file, the "frames" field is set to the number of framesin the first segment (excluding the optional ring frame). Likewise, thefields for the offsets to the first and second frames ("oframe1" and"oframe2") are set to those of the first segment. The totalframes field is the total number of frames in all segments,including all ring frames.Chunks and subchunksEvery chunk starts with a 6-byte header, that contains the size (fourbytes) and the type (two bytes) for the chunk. All chunks sizes should berounded up to an even number of bytes. The values of the main levelchunks are above 0xF100, values of the subchunks are below 100(decimal). As you can see in figure "Overview of the FLIC file structure",nearly all of the subchunks appear in the "frame" chunk.Chunks types are indicated in the FLIC file with a two-bytevalue, but Jim Kent's article tagged names on those values (these names appearto be extracted from the Animator Pro source code). For ease of writing, I usethe same names, in the same glorious ALL UPPER CAPS" that hasbecome common in discussing the FLIC file format.Overview of all chunks 3 CEL_DATA registration and transparency 4 COLOR_256 256-level colour palette 7 DELTA_FLC (FLI_SS2) delta image, word oriented RLE 11 COLOR_64 64-level colour palette 12 DELTA_FLI (FLI_LC) delta image, byte oriented RLE 13 BLACK full black frame (rare) 15 BYTE_RUN (FLI_BRUN) full image, byte oriented RLE 16 FLI_COPY uncompressed image (rare) 18 PSTAMP postage stamp (icon of the first frame) 25 DTA_BRUN full image, pixel oriented RLE 26 DTA_COPY uncompressed image 27 DTA_LC delta image, pixel oriented RLE 31 LABEL frame label 32 BMP_MASK bitmap mask 33 MLEV_MASK multilevel mask 34 SEGMENT segment information 35 KEY_IMAGE key image, similar to BYTE_RUN / DTA_BRUN 36 KEY_PAL key palette, similar to COLOR_256 37 REGION region of frame differences 38 WAVE digitized audio 39 USERSTRING general purpose user data 40 RGN_MASK region mask 41 LABELEX extended frame label (includes symbolic name) 42 SHIFT scanline delta shifts (compression) 43 PATHMAP path map (segment transitions) 0xF100 PREFIX_TYPE prefix chunk 0xF1E0 SCRIPT_CHUNK embedded "Small" script 0xF1FA FRAME_TYPE frame chunk 0xF1FB SEGMENT_TABLE segment table chunk 0xF1FC HUFFMAN_TABLE Huffman compression table chunk The rest of the document discusses these chunks and subchunks in detail.On the right of the caption for each chunk type is the product for whichthis chunk is valid. Autodesk Animator is not mentioned explicitly, becausethere exist (to my knowledge) no chunks that only Animatorsupports.allPREFIX_TYPEThe prefix chunk contains (undocumented) settings and cel data. It usuallyappears in .CEL files.typedef struct DWORD size; /* Size of the chunk, including subchunks */ WORD type; /* Chunk type: 0xF100 */ WORD chunks; /* Number of subchunks */ BYTE reserved[8]; /* Reserved, set to 0 */ PREFIX_HDR; all, EGI 3+, EGI 4CEL_DATAtypedef struct DWORD size; /* Size of the chunk, always 64 */ WORD type; /* Chunk type: 3 */ short center_x; /* Coordinates of the cel centre or origin */ short center_y; WORD stretch_x; /* Stretch amounts */ WORD stretch_y; WORD rot_x; /* Rotation in x-axis (always 0) */ WORD rot_y; /* Rotation in y-axis (always 0) */ WORD rot_z; /* z-axis rotation, 0-5760=0-360 degrees */ WORD cur_frame; /* Current frame in cel file */ BYTE reserved1[2]; /* Reserved, set to 0 */ WORD transparent; /* Transparent colour index */ WORD overlay[16]; /* Frame overlay numbers */ BYTE reserved2[6] /* Reserved, set to 0 */ CEL_DATA; The CEL_DATA chunk is usually not present in FLCfiles. Intermediate files used by Autodesk Animator Pro with the.CEL extension usually contain a CEL_DATA in theprefix chunk. The CEL files have the same format asFLC files.EGI version 3.0 and later may generate CEL_DATA chunks inside normalframes; i.e. outside the prefix chunk. EGI uses the CEL_DATA chunkto hold the origin of the frame. Sprite animation toolkits can use the originof a frame for run-time "registration" of the frame. (Registration is a termthat animators use to mean the correct positioning of a frame in relation tothe other frames and to the background image.)EGI uses only the center_x and center_y fieldsof the structure. The center_x field gives the horizontal offsetof the origin relative to the left edge of the frame. The center_yfield is the vertical offset of the origin relative to the top edge, where apositive value points downwards.In EGI 4.0, the overlay array holds up to 16 labels of overlays that canapply to a frame. When an element in this array is zero, this means "no overlay".The FLIC player chooses one of these overlays (or none) as thedefault overlay. Which overlay it chooses depends on the "overlay index" thatone selects in the player. If the overlay index is zero, no overlay is displayed;if it is 1, the first overlay listed in the array is used, and so on.EGI 3+SCRIPT_CHUNKEGI supports embedded run-time scripts in FLIC files that arewritten in the "pawn" language.The compiled P-code is added to the FLIC file. The format of the compiled P-code and aninstruction reference can be found in the Small manual (available on-line asa PDF document on the Small language page mentioned earlier).Specific functions in the run-time script execute on "events" in theFLIC animation, such as reaching the last frame of the segment(this is the frame before the ring frame). The currently defined event functionsare: Function Description@FlicClose()Called when the animation is closed@FlicFrame(framenumber)Called after each frame is decoded@FlicLabel(label)Called when a label was reached@FlicLastFrame()Called when the animation reaches its last frame of the current segment@FlicLButtonDown(x, y)Called when the left mouse button is pressed in the animated frame@FlicLButtonUp(x, y)Called when the left mouse button is released in the animated frame@FlicOpen()Called when the animation is opened@FlicPlay()Called when the animation is starts playing@FlicRButtonDown(x, y)Called when the right mouse button is pressed in the animated frame@FlicRButtonUp(x, y)Called when the right mouse button is released in the animated frame@FlicSegment(segmentnumber)Called when a new segment has just started@FlicStop()Called when the animation is stopped explicitlyEGI 1+SEGMENT_TABLEtypedef struct DWORD size; /* Size of this chunk, including subchunks */ WORD type; /* Chunk type: 0xF1FB */ WORD segments; /* Number of SEGMENT chunks that follow */ SEGMENT_TABLE; If a segment table is present, it overrules the values in theheader (number of frames, offsets to the first andsecond frames).The segment table contains a series of SEGMENT chunks, one forevery segment in the FLIC file. As of EGI version 4.0, the segment table alsostores LABELEX chunks that hold symbolic names for the segments. Thenumeric value of each LABELEX chunk must match the (numeric) label ofexactly one of the SEGMENT chunks. The name of the LABELEX chunkthen gives the symbolic name for the segment.EGI 1+SEGMENTtypedef struct DWORD size; /* Size of this chunk (always 32 bytes) */ WORD type; /* Subchunk type: 34 */ WORD label; /* Label of the segment (user value) */ BYTE reserved1[2]; /* Reserved, set to zero */ WORD cont_image; /* "continued from" image id */ WORD last_image; /* id of the last image of this segment */ WORD flags; /* Flags */ WORD frames; /* Number of frames in the segment */ DWORD oframe1; /* File offset to frame 1 of the segment */ DWORD oframe2; /* File offset to frame 2 */ WORD next_segment; /* segment number of segment to proceed with */ WORD repeat; /* repeat count (0=indefinitely) */ BYTE reserved2[2]; /* Reserved, set to zero */ SEGMENT; The flags field contains four bit flags: Bit Meaning 0 the segment contains a ring frame 1 the first frame contains a full image 2 the "next_segment" field of the structure is valid 3 audio must be synchronized with the animation If bit 1 is set, the first frame contains either a full image, or a deltaimage plus a key image. In other words, bit 1 indicates whether the segmentis a "launch point". See the EGI compiler instruction launch_pointfor more details.The frames field does not include the ring frame (if a ringframe is present).In a FLIC file has multiple segments and some of the segmentsare "continued" from other segments (see the compiler instructioncontinued_from), a frame may contain both a full image (the keyimage) and a delta image. The EGI player uses the cont_image andlast_image fields to determine whether it can use the delta image(whose decoding is usually quicker than a full image), or whether it mustdecode the full image instead.When creating the FLIC file, the EGI compiler assigns eachpicture a unique number. It stores the number of the last image in a segmentin the last_image field of the SEGMENT structure.When you add a continued_from instruction to the segment, thecompiler copies the last_image field of the segment that wasspecified in the continued_from instruction to thecont_image field of the current segment. The compiler thenproceeds to create a delta image given the first image of the current segmentand the last image of the "continued from" segment. A segment that is notcontinued from another segment has a value of 0xFFFF in thecont_image field.The EGI player goes the opposite route. Assuming that the player justdisplayed the last frame of a segment, and at that moment you switch toanother segment: if the last_image field of the current segmentis the same as the cont_image of the next field, the playerdecodes the delta image of the new segment. Otherwise it decodes the keyimage.EGI 1+HUFFMAN_TABLEtypedef struct DWORD size; /* Size of this chunk */ WORD type; /* Chunk type: 0xF1FC */ WORD codelength; /* Maximum length of the Huffman codes */ WORD numcodes; /* The number of codes */ BYTE reserved[6]; /* Must be set to zero */ /* The following three fields are repeated "numcodes" times */ WORD code; /* Huffman code */ BYTE length; /* Length of the Huffman code */ BYTE value; /* Byte value represented by the Huffman code */ HUFFMAN_TABLE; See the paper "EGI compression schemes" forinformation on the Huffman compression algorithm. This chunk is only presentif bit 3 of the ext_flags of theFLIC file header is set.allFRAME_TYPEThis chunk is defined by Autodesk Animator, but Pro Motion and EGI extend it.
Cosmigo Pro Motion V4 7 Rare
2ff7e9595c
Comments