Skip to content

Animation Format

Gavin Jancke edited this page Aug 30, 2020 · 7 revisions

The Expressive Pixels Animation format is a simple palletized compression codec based on Intra-frame coding optimized for minimal CPU processing and communications overhead in small embedded systems. Two kinds of frame types exist in the codec, 'I' (Intra-coded) key frames, and 'P' (Predicted picture) difference frames, the determination of which frame is used is based on the differential size of pixels between successive frames - if the encoding of differential pixels and their locations is larger than the keyframe itself, and an 'I' frame is encoded. Two further meta frame types exist, 'D' delay frames which pause the animation for a set number of milliseconds, and 'F' fade frames which initiate a fade over a set number of milliseconds. The format can also be extended to interleave additional payload types.

High level structure

An animation exported by the Expressive Pixels authoring application consists of a Header describing characteristics of the animation, a Palette section containing the colors used in the animation frames, and the Frame bytes for the animation frames themselves.

Header

Item Description
frameCount 16-bit integer containing the frame count in the animation
loopCount 8-bit integer containing the number of times the animation loops before completion
frameRate 8-bit integer containing the number of frames per second the frames are rendered at
cbPalette 16-bit integer containing the count in bytes of the palette size for colors used in the animation
cbFrames 32-bit integer containing the count in bytes of the total bytes used for animation frames in the animation

Palette

The Palette section contains the colors used in the animation, in 3-byte, RGB format

Frames

Each frame begins with an 8-bit frameType field, marking the frame as an 'I' intra-coded frame, 'P' predicted picture frame, 'D' delay period, and 'F' fadeout period. Each frame type has its own respective format following per the diagram above. The frames format can be extended with non-colliding frameType identifiers such as that for sound triggering.