0% found this document useful (0 votes)
877 views12 pages

PVR File Format - Specification

PVR File Format.Specification

Uploaded by

rsanchezsaez
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
877 views12 pages

PVR File Format - Specification

PVR File Format.Specification

Uploaded by

rsanchezsaez
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Proprietary

Imagination Technologies

PVR File Format Specification

Copyright Imagination Technologies Ltd. All Rights Reserved. This publication contains proprietary information which is subject to change without notice and is supplied 'as is' without warranty of any kind. Imagination Technologies and the Imagination Technologies logo are trademarks or registered trademarks of Imagination Technologies Limited. All other logos, products, trademarks and registered trademarks are the property of their respective owners.

Filename Version Issue Date Author

: : : :

PVR File Format.Specification.1.0.4.External.doc 1.0.4 External Issue (Package: PowerVR SDK REL_3.0@2149525) 30 Aug 2012 Imagination Technologies Ltd

PVR File Format

Revision .

Imagination Technologies

Proprietary

Contents
1. Introduction .................................................................................................................................3 1.1. Document Overview ...........................................................................................................3 1.2. Specification Version ..........................................................................................................3 Format Description .....................................................................................................................4 2.1. Header Format....................................................................................................................4 2.1.1. Version .....................................................................................................................4 2.1.2. Flags.........................................................................................................................4 2.1.3. Pixel Format .............................................................................................................5 2.1.4. Colour Space............................................................................................................6 2.1.5. Channel Type ...........................................................................................................6 2.1.6. Height .......................................................................................................................6 2.1.7. Width ........................................................................................................................6 2.1.8. Depth ........................................................................................................................6 2.1.9. Num. Surfaces..........................................................................................................6 2.1.10. Num. Faces ..............................................................................................................6 2.1.11. MIP-Map Count ........................................................................................................7 2.1.12. Meta Data Size.........................................................................................................7 2.2. Meta Data Format...............................................................................................................8 2.2.1. FourCC .....................................................................................................................8 2.2.2. Key ...........................................................................................................................8 2.2.3. Data Size ..................................................................................................................8 2.2.4. Data ..........................................................................................................................8 2.2.5. Pre-Defined Meta Data.............................................................................................9 2.3. Texture Data .....................................................................................................................10 2.3.1. Texture Data Structure ...........................................................................................10 Contact Details..........................................................................................................................11

2.

3.

List of Figures
Figure 2-1 File Layout ............................................................................................................................. 4

Revision .

Specification

Proprietary

Imagination Technologies

1. Introduction
1.1. 1.2. Document Overview Specification Version
The purpose of this document is to act as a specification for the PVR file format.

PVR specification version: 3.0.0

PVR File Format

Revision .

Imagination Technologies

Proprietary

2. Format Description
PVR files contain three elements: One Header, of 52 bytes length. Zero or more meta-data elements, whose length can be determined from the header.

One texture data element, whose length can be determined from the header. The file is laid out as follows:

Figure 2-1 File Layout

2.1.
Name
Version Flags

Header Format
Size(bytes)
4 4 8 4 4 4 4 4 4 4 4 4

Data Format
Unsigned 32bit Integer Unsigned 32bit Integer Unsigned 64bit Integer Unsigned 32bit Integer Unsigned 32bit Integer Unsigned 32bit Integer Unsigned 32bit Integer Unsigned 32bit Integer Unsigned 32bit Integer Unsigned 32bit Integer Unsigned 32bit Integer Unsigned 32bit Integer

Pixel Format Colour Space Channel Type Height Width Depth Num. Surfaces Num. Faces MIP-Map Count Meta Data Size

2.1.1.

Version

Version contains the version of the PVR header format. The exact value of Version will be one of the following depending upon the endianess of the file, and the computer reading it: 0x03525650, if endianess does not match 0x50565203, if endianess does match

2.1.2.

Flags

The purpose of the Flags field is to allow for future proofing of the header format, giving the format the ability to specify flags that can dictate how the texture data is stored. The following flags are currently supported: Name
No Flag Pre-multiplied

Value
0 0x02

Description
No flag has been set. When this flag is set, colour values within the texture have been pre-multiplied by the alpha values.

Revision .

Specification

Proprietary

Imagination Technologies

2.1.3.

Pixel Format

Pixel Format is a 64bit unsigned integer containing the pixel format of the texture data. Where the most significant 4 bytes have been set to 0 the least significant 4 bytes will contain a 32bit unsigned integer value identifying the pixel format. The values are as follows: Formats
PVRTC 2bpp RGB PVRTC 2bpp RGBA PVRTC 4bpp RGB PVRTC 4bpp RGBA PVRTC-II 2bpp PVRTC-II 4bpp ETC1 DXT1 DXT2 DXT3 DXT4 DXT5 BC1 BC2 BC3 BC4 BC5 BC6 BC7 UYVY YUY2 BW1bpp R9G9B9E5 Shared Exponent RGBG8888 GRGB8888 ETC2 RGB ETC2 RGBA ETC2 RGB A1 EAC R11 Unsigned EAC R11 Signed EAC RG11 Unsigned EAC RG11 Signed

Value
0 1 2 3 4 5 6 7 8 9 10 11 7 9 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

If the most significant 4 bytes contain a value, the full 8 bytes are used to determine the pixel format. The least significant 4 bytes contain the channel order, each byte containing a single character, or a null character if there are fewer than four channels; for example, {r,g,b,a} or {r,g,b,\0}. The most significant 4 bytes state the bit rate for each channel in the same order, each byte containing a single 8bit unsigned integer value, or zero if there are fewer than four channels; for example, {8,8,8,8} or {5,6,5,0}.

PVR File Format

Revision .

Imagination Technologies

Proprietary

2.1.4.

Colour Space

Colour Space is a 32bit unsigned integer that specifies which colour space the texture data is in. The two valid values are: Colour Space
Linear RGB sRGB

Value
0 1

Description
Texture data is in the Linear RGB colour space Texture data is in the Standard RGB colour space

2.1.5.

Channel Type

Channel Type is a 32bit unsigned integer that determines the data type of the colour channels within the texture data. Valid values are as follows: Data Type
Unsigned Byte Normalised Signed Byte Normalised Unsigned Byte Signed Byte Unsigned Short Normalised Signed Short Normalised Unsigned Short Signed Short Unsigned Integer Normalised Signed Integer Normalised Unsigned Integer Signed Integer Float

Value
0 1 2 3 4 5 6 7 8 9 10 11 12

2.1.6.

Height

Height is a 32bit unsigned integer representing the height of the texture stored in the texture data, in pixels.

2.1.7.

Width

Width is a 32bit unsigned integer representing the width of the texture stored in the texture data, in pixels.

2.1.8.

Depth

Depth is a 32bit unsigned integer representing the depth of the texture stored in the texture data, in pixels.

2.1.9.

Num. Surfaces

Num. Surfaces is used for texture arrays; it is a 32bit unsigned integer representing the number of surfaces within the texture array.

2.1.10.

Num. Faces

Num. Faces is a 32bit unsigned integer that represents the number of faces in a cube map.

Revision .

Specification

Proprietary

Imagination Technologies

2.1.11.

MIP-Map Count

MIP-Map Count is a 32bit unsigned integer representing the number of MIP-Map levels present including the top level; a value of one therefore means that only the top level texture exists.

2.1.12.

Meta Data Size

Meta Data Size is a 32bit unsigned integer representing the total size (in bytes) of all the meta data following the header.

PVR File Format

Revision .

Imagination Technologies

Proprietary

2.2.
Name FourCC Key

Meta Data Format


Size(bytes) 4 4 4 Variable Data Format Four Byte Array Unsigned 32bit Integer Unsigned 32bit Integer Variable

Data Size Data

Meta data allows for the creator of a PVR to store custom information within the PVR file relating to the storage

2.2.1.

FourCC

FourCC is a four byte identifier (consisting of single byte characters or integers) whose value, combined with the value of Key, is used to determine how Data should be handled. The values {P, V, R, 0} to {P, V, R, 255} (and there numerical equivalents) are reserved and must not be used except as described in this specification.

2.2.2.

Key

Key is an unsigned 32bit integer, which, when coupled with FourCC determines how Data should be handled.

2.2.3. 2.2.4.

Data Size Data

Data Size is an unsigned 32bit integer representing the size of Data in bytes.

Data is an array of user defined information of size determined from Data Size of a data type and purpose determined from the value of FourCC and Key.

Revision .

Specification

Proprietary

Imagination Technologies

2.2.5.

Pre-Defined Meta Data

The following meta data elements are pre-defined by this specification: FourCC P, V, R, 3 Key 0 Data Size Variable Data Description An array of integers describing the position and sizes of each texture within a texture atlas. Each sequence of four integers represent the information for a single texture within the atlas and appear in the order: 1. X Position 2. Y Position 3. Width 4. Height Specifies that the file contains normal map information. The 8 bytes are in the form of a 32bit float representing the scale of the normal map, followed by a four character array describing the order of the channels, for example {x, y, z, h}. Use of h as the representation for a given channel denotes that the channel in question contains the original height map. Specifies that the file contains a cube map, and the order of the faces within that cube map. The 6 bytes represent a six character string; this string shows the order the cube map faces are stored in the texture data, for example XxYyZz. Uppercase letters refer to a positive axis position; while lowercase refer to a negative axis position. Not all axes must be present. Specifies the logical orientation of the texture within the texture data. This does not affect the mapping from pixels to texture coordinates. Each byte is a boolean value representing the orientation for a single axis in the order X, Y, Z. The values are as follows: X Axis o Non-zero value = X values increase to the left o Zero value = X values increase to the right Y Axis o Non-zero value = Y values increase upwards o Zero value = Y values increase downwards Z Axis o Non-zero value = Z values increase outwards o Zero value = Z values increase inwards

P, V, R, 3

P, V, R, 3

P, V, R, 3

P, V, R, 3

12

Specifies whether the texture has a border. The 12 bytes are broken down into three unsigned 32bit integers. The three integers represent the size of the border of the image, in pixels, on the X, Y and Z axes respectively. These values are used to offset texture reads by the size of the border in order to obtain the actual texture data. It should be noted that only three border sizes are given, this means that the border size for X is applied to both the left and right of the image, Y to the top and bottom, and Z to the front and back.

PVR File Format

Revision .

Imagination Technologies

Proprietary

2.3.

Texture Data

The remainder of the file, after the header and meta data, is texture data. The format and size of this texture data can be found in the header (see Section 2.1 Header Format).

2.3.1.

Texture Data Structure

The texture data is laid out as follows:


for each MIP-Map Level in MIP-Map Count for each Surface in Num. Surfaces for each Face in Num. Faces for each Slice in Depth for each Row in Height for each Pixel in Width Byte data[Size_Based_On_PixelFormat] end end end end end end

Revision .

10

Specification

Proprietary

Imagination Technologies

3. Contact Details
For further support contact: [email protected] PowerVR Developer Technology Imagination Technologies Ltd. Home Park Estate Kings Langley Herts, WD4 8LZ United Kingdom Tel: +44 0) 1923 260511 Fax: +44 0) 1923 277463 Alternatively, you can use the PowerVR Insider forums: www.imgtec.com/forum For more information about PowerVR or Imagination Technologies Ltd. visit our web pages at: www.imgtec.com

PVR File Format

11

Revision .

Imagination Technologies

Proprietary

Imagination Technologies, the Imagination Technologies logo, AMA, Codescape, Ensigma, IMGworks, I2P, PowerVR, PURE, PURE Digital, MeOS, Meta, MBX, MTX, PDP, SGX, UCC, USSE, VXD and VXE are trademarks or registered trademarks of Imagination Technologies Limited. All other logos, products, trademarks and registered trademarks are the property of their respective owners.

Revision .

12

Specification

You might also like