Header Format#

The header contains information about the data stored in a PVR file. This header information gives all of the details required to understand and process the data in the file.

This section details the different elements that make up the header. The diagram below illustrates the elements and their relative sizes.

../_images/pvr-header.jpg

Version (Unsigned 32-bit Integer)#

Version contains the version of the PVR header format.

The exact value of Version will be one of the following depending on the endianness of the file and the computer reading it:

  • 0x03525650, if endianness does match.

  • 0x50565203, if endianness does not match.

Flags (Unsigned 32-bit Integer)#

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 currently supported flags are:

Name

Value

Description

No Flag

0

No flag has been set.

Pre-multiplied

0x02

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

Pixel Format (Unsigned 64-bit Integer)#

Pixel Format is a 64-bit unsigned integer containing the pixel format of the texture data, where the most significant 4 bytes have been set to ‘0’ and the least significant 4 bytes will contain a 32-bit unsigned integer value identifying the pixel format.

The valid values are:

Formats

Value

PVRTC 2bpp RGB

0

PVRTC 2bpp RGBA

1

PVRTC 4bpp RGB

2

PVRTC 4bpp RGBA

3

PVRTC-II 2bpp

4

PVRTC-II 4bpp

5

ETC1

6

DXT1 / BC1

7

DXT2

8

DXT3 / BC2

9

DXT4

10

DXT5 / BC3

11

BC4

12

BC5

13

BC6

14

BC7

15

UYVY

16

YUY2

17

BW1bpp

18

R9G9B9E5 Shared Exponent

19

RGBG8888

20

GRGB8888

21

ETC2 RGB

22

ETC2 RGBA

23

ETC2 RGB A1

24

EAC R11

25

EAC RG11

26

ASTC_4x4

27

ASTC_5x4

28

ASTC_5x5

29

ASTC_6x5

30

ASTC_6x6

31

ASTC_8x5

32

ASTC_8x6

33

ASTC_8x8

34

ASTC_10x5

35

ASTC_10x6

36

ASTC_10x8

37

ASTC_10x10

38

ASTC_12x10

39

ASTC_12x12

40

ASTC_3x3x3

41

ASTC_4x3x3

42

ASTC_4x4x3

43

ASTC_4x4x4

44

ASTC_5x4x4

45

ASTC_5x5x4

46

ASTC_5x5x5

47

ASTC_6x5x5

48

ASTC_6x6x5

49

ASTC_6x6x6

50

BASISU_ETC1S

51

BASISU_UASTC

52

RGBM

53

RGBD

54

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 8-bit unsigned integer value, or zero if there are fewer than four channels. For example, {8, 8, 8, 8} or {5, 6, 5, 0}.

Colour Space (Unsigned 32-bit Integer)#

Colour Space is a 32-bit unsigned integer that specifies which colour space the texture data is in.

The two valid values are:

Colour Space

Value

Description

Linear RGB

0

Texture data is in the Linear RGB colour space

sRGB

1

Texture data is in the Standard RGB colour space

Channel Type (Unsigned 32-bit Integer)#

Channel Type is a 32-bit unsigned integer that determines the data type of the colour channels within the texture data.

Valid values are:

Data Type

Value

Unsigned Byte Normalised

0

Signed Byte Normalised

1

Unsigned Byte

2

Signed Byte

3

Unsigned Short Normalised

4

Signed Short Normalised

5

Unsigned Short

6

Signed Short

7

Unsigned Integer Normalised

8

Signed Integer Normalised

9

Unsigned Integer

10

Signed Integer

11

Signed Float

12

Unsigned Float

13

Height (Unsigned 32-bit Integer)#

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

Width (Unsigned 32-bit Integer)#

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

Depth (Unsigned 32-bit Integer)#

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

Num. Surfaces (Unsigned 32-bit Integer)#

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

Num. Faces (Unsigned 32-bit Integer)#

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

MIP-Map Count (Unsigned 32-bit Integer)#

MIP-Map Count is a 32-bit 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.

Meta Data Size (Unsigned 32-bit Integer)#

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