Metadata Format#

Metadata allows you to store custom information within the PVR file relating to the storage.

../_images/pvr-metadata.jpg

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.

Note that only three border sizes are given, which 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, 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, such as some depth stencil formats.

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

7

Variable

See below this table.

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

8

4

A single floating point value which specifies the maximum range PVRTexLib used when encoding to RGB{M/D} texture formats. This value is used to when decoding the RGB{M/D} texture data. RGBM decoding: MAX_RANGE * sample.rgb * sample.a. RGBD decoding: ((MAX_RANGE / 255.0) / sample.a) * sample.rgb.

FourCC {‘P’, ‘V’, ‘R’, 3} Key ‘7’ - Data Description#

Specifies the global and image description data used for decoding Binomial ETC1S and UASTC super-compression encoding schemes. The layout of the global data is as follows:

Offset

Size

Field

0

2

Endpoint Count

2

2

Selector Count

4

4

Endpoints Byte Length

8

4

Selectors Byte Length

12

4

Tables Byte Length

16

4

Extended Byte Length

Image description data begins immediately after the global data and is repeated image count times. Image descriptions are ordered the in the same way as the compressed images in the PVR file. The layout of the image description data is as follows:

Offset (first image)

Size

Field

20

4

Image Flags

24

4

RGB Slice Byte Offset

28

4

RGB Slice Byte Length

32

4

Alpha Slice Byte Offset

36

4

Alpha Slice Byte Length

Endpoint, selector, table and extended data are stored immediately after the final image description – that is, 20 + (20 * image count) bytes. The length of each data block is defined in the global data.

Key (Unsigned 32-bit integer)#

Key is an unsigned 32-bit integer. When coupled with FourCC, it 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. Its size is determined from Data Size, and its purpose is 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.