PNG Proposed sTER chunk, draft 20060316 File: png-proposed-sTER-chunk-20060316.txt Status of this Memo This document is an informal draft of the PNG development group. Comments on this document can be sent to the PNG specification maintainers at png-mng-misc@lists.sourceforge.net Distribution of this memo is unlimited. At present, the latest version of this document is available on the World Wide Web from ftp://ftp.simplesystems.org/pub/libpng/png-group/documents/. Notices Copyright (C) 2006 Glenn Randers-Pehrson Permission is granted to copy and distribute this document for any purpose and without charge, provided that the copyright notice and this notice are preserved, and that any substantive changes or deletions from the original are clearly marked. Abstract This document describes a special-purpose chunk type that has been proposed for use in various PNG (Portable Network Graphics) and related multi-image applications. It has not yet been approved for registration by the PNG developers, and therefore is experimental and its format is subject to change. The proposed chunk is (with an unregistered name that can be used in test implementations shown in parentheses): sTER (stER). sTER proposal It is proposed to add the following section to the document "Extensions to the PNG 1.2 Specification, Version 1.2.0" 3.6. sTER Indicator of Stereo Image When present, the sTER chunk indicates that the datastream contains a stereo pair of subimages within a single PNG image. The sTER chunk contains: Mode: 1 byte (reserved; must be zero) The sTER chunk with mode==0 indicates that the datastream contains two subimages, encoded within a single PNG image. They are arranged side-by-side, with the left subimage intended for presentation to the right eye and the right subimage intended for presentation to the left eye. The left edge of the right subimage must be on a column that is evenly divisible by eight, so that if interlacing is employed the two images will have coordinated interlacing. Padding columns between the two subimages must be introduced by the encoder if necessary. The two subimages must have the same dimensions after removal of any padding. Decoders that are aware of the sTER chunk may display the two images in any suitable manner. Decoders that are not aware of the sTER chunk, and those that recognize the chunk but choose not to treat stereo pairs differently from regular PNG images, will naturally display them side-by-side in a manner suitable for cross-eyed viewing. If present, the sTER chunk must appear before the first IDAT chunk. For compatibility with software not supporting the sTER chunk, the padding pixels must also be valid indexes in case of palette image even if they are never used. Given an image with width W the subimage width and inter-subimage padding may be calculated as follows, where REM is the mathematical remainder operation: subimage-padding := (8 - (W REM 8)) REM 8 subimage-width := (W - subimage-padding) / 2 error if (W - 2 x subimage-width) > 7 These calculations may be simplified to the following C language expressions: subimage_padding = (-W) & 0x07; subimage_width = (W - subimage_padding) >> 1; if (W - 2 * subimage_width) > 7) error; There is no provision for interlaced images where left and right-eye scanlines are offset from each other. Decoders can expect that the samples in the left and right subimages are cosited, such that the subimages and their centers are coincident at the projection plane. The decoder can assume that the left and right subimages are intended to be presented directly to the right and left eyes of the user/viewer without independent scaling, rotation or displacement. I.e., the subimages will be presented at the same size in the same relative position and orientation to each eye of the viewer. Encoders should use the pHYs chunk to indicate the pixel's size ratio when it is not 1:1. sTER proposal It is proposed to add the following paragraphs to the document "MNG (Multiple-image Network Graphics) Format, Version 1.0": At the end of the list in Paragraph 4.2.3, IHDR, PNG chunks, IEND, add another bullet: * If the PNG sTER chunk appears in the top-level MNG datastream with mode==0, any sTER chunk appearing in the PNG datastream must be ignored. If not, then the decoder must handle the sTER chunk in the same manner as it handles them in standalone PNG or JNG datastreams. At the end of Paragraph 4.6, Ancillary PNG chunks, add another bullet: * sTER This PNG chunk is also defined at the MNG top level. When active, with mode==0, it takes precedence over any sTER chunk found in embedded PNG or JNG datastreams. It has the same meaning as a PNG sTER chunk except that it applies to each subsequent subframe rather than to a single PNG image, and the image dimensions and padding are determined from the subframe boundaries instead of from the PNG IHDR data. An empty top-level sTER chunk nullifies any prior top-level sTER chunk. Encoders should use the pHYg chunk or the MAGN chunk to indicate the pixel's size ratio when it is not 1:1. In paragraph 5.2, Ancillary JNG chunks, after the word "sCAL", add ", sTER". Add paragraph 10.8, Interlacing and the sTER chunk It is recommended that when the sTER chunk is active and the two images are conveyed in separate PNG or JNG datastreams, interlacing not be used. Contributors Names of contributors not already listed in the PNG specification are presented in alphabetical order: * Adeluc, www.adeluc.com, png@adeluc.com Editor * Glenn Randers-Pehrson, glennrp@users.sourceforge.net End of PNG sTER Chunk Proposal. Expires 16 Sept 2006.