Metadata Format

A summary of the different elements which make up the metadata block of PVR files

Metadata allows for the creator of a PVR file to store custom information within the PVR file relating to the storage.

FourCC (Four-byte array)Key (Unsigned 32-bit integer)Data Size (Unsigned 32-bit integer)DataPadding

FourCC (Four-byte array)

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 their numerical equivalents) are reserved and must not be used except as described in this specification.

The FourCC metadata elements are defined as shown below.

FourCC

Key

Data Size

Data Description

‘P’, ‘V’, ‘R’, 3

0

Variable

An array of integers describing the position and sizes of each texture within a texture atlas. Each sequence of four integers represents the information for a single texture within the atlas and appear in the order:

  1. X Position
  2. Y Position
  3. Width
  4. Height

‘P’, ‘V’, ‘R’, 3

1

8

Specifies that the file contains normal map information. The 8 bytes are in the form of a 32-bit 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.

‘P’, ‘V’, ‘R’, 3

2

6

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.

‘P’, ‘V’, ‘R’, 3

3

3

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
    • Non-zero value = X values increase to the left
    • Zero value = X values increase to the right
  • Y Axis
    • Non-zero value = Y values increase upwards
    • Zero value = Y values increase downwards
  • Z Axis
    • Non-zero value = Z values increase outwards
    • Zero value = Z values increase inwards

‘P’, ‘V’, ‘R’, 3

4

12

Specifies whether the texture has a border. The 12 bytes are broken down into three unsigned 32-bit 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.

‘P’, ‘V’, ‘R’, 3

5

Variable

Specifies that this block contains padding data. The size of data varies in order to align the texture data with a convenient block boundary. The contents of data are left undefined. This block should be skipped during parsing.

‘P’, ‘V’, ‘R’, 3

6

4

Specifies per-channel the variable type data i.e. EPVRTVariableType. If this data is present then the Channel Type specified in the header is overridden by these values. This data is useful when the texture format contains channels of varying variable types.

Key (Unsigned 32-bit integer)

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

Data Size (Unsigned 32-bit integer)

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

Data

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.

Padding

Padding is a block of undefined data that can be used to ensure Data aligns with block boundaries. This block is not always defined and depends on the value of FourCC