File: mng-play-proposal-20070905 It is proposed to register an playlist MNG chunk: PLAY. In this proposal, the new chunk name is shown in its private form (second letter lowercase, PlAY). Until the proposal is approved, the private form must be used in any test implementations. It is proposed to document the PLAY chunk in the MNG 1.0 Specification, Version 1.0.1, as follows: A. Change document version to 1.0.1. B. Add paragraph 4.3.6 4.3.6. PlAY Playlist Chunk 4.3.6.1 Overview The PlAY chunk contains a compressed "play list" which provides instructions to the decoder for constructing animation layers from pieces of previously defined objects. 4.3.6.2 Terminology The "frame" is the MNG frame where the layers are are to be written. The "layer" is a pixel array with dimensions specified by the "frame_width" and "frame_height" parameters of the MHDR chunk. Conceptually, each tile is constructed in a layer and passed back to the MNG viewer. A "tile" is a pixel array copied from an object and used to construct a layer. 4.3.6.3 PlAY Chunk structure The PlAY chunk contains a 1-byte header followed by one or more 31-byte layer structures. The header gives the compression method: byte 0 compression_method (byte) 0: deflate 1 layer_structure_array[n] (n > 0; n * 31 bytes): layer (compressed) structures Each layer is a tile combined with a transparent background to form a layer of size (frame_width, frame_height), from the MHDR chunk. Each layer is initialized to a transparent (RGBA(0,0,0,0)) rectangle. The layer structure array is always compressed according to the specified compression method. A layer is described by a structure of 31 bytes: byte 0 object (unsigned int) Object ID of source image 2 delta mode (unsigned byte) 0: dimensions and offsets are absolute 1: dimensions and offsets are deltas from the previous layer's values from the same or a preceding PLAY chunk 3 x (unsigned int) Left of tile pixels 7 y (unsigned int) Top of tile pixels 11 width (unsigned int) Width of tile pixels 15 height (unsigned int) Height of tile pixels 19 x_offset (signed int) X offset of tile destination 23 y_offset (signed int) Y offset of tile destination 27 delay (unsigned int) interframe delay The layer data identifies a rectangle (x,y,width,height) in the object containing pixels of a tile. X and y are measured from the upper left corner of the object from which the tile is extracted. The location and clipping boundaries from the DEFI chunk for the object are ignored. This tile is composited on the layer with its upper left corner at position (x_offset, y_offset), measured from the upper left corner of the layer. Any part of the tile outside the object must be treated as transparent. Any part of the tile which extends outside the layer must be ignored. The tile width or height may be zero, in which case the layer contains all transparent pixels. The first layer of the first PLAY chunk in an AniPNG datastream must specify absolute values of the dimensions and offsets. The delay is measured in ticks_per_second from the MHDR chunk, and it overrides but does not replace the value from the FRAM chunk. Even if a layer's tile is entirely outside the layer, the delay for the resulting empty layer must be handled in the same way as if it were inside the frame. The decoder must handle the layers as specified in the MNG FRAM chunk. This might or might not involve inserting background layers between them or coalescing zero-delay layers together into one frame, and the usual clipping to layer and frame boundaries must be done. 4.3.6.4 PlAY recommendations for encoders Tall vs wide layouts Typically the best compression is obtained when a PNG image is very wide and not very tall, with similar tiles adjacent. C. Add to the Appendix: Revision History * 30 Sept 2007 (version 1.0.1): * Added the PlAY animation chunk.