PVR: Difference between revisions
m (→File format) |
m (→File format) |
||
Line 27: | Line 27: | ||
|- | |- | ||
|} | |} | ||
=== Header === | === Header === |
Revision as of 19:53, 29 July 2015
PowerVR Texture Compression files: PVRTC and PVRTC2 are a family of lossy, fixed-rate texture compression formats.
PowerVR is a division of Imagination Technologies (formerly VideoLogic) that develops hardware and software for 2D and 3D rendering, and more.
Features
- PVRTC supports both opaque (RGB) and translucent (RGBA) textures (unlike other formats such as S3TC that require a dedicated, larger form to support full alpha channels).
- competitive compression ratios.
File format
The PVR (.pvr) format (specification version 3.0.0) consists of:
Header 52 bytes (0x34) |
Meta Data (optional) variable |
Texture Data variable |
Header
Offset (h) | Size (h) | Example (h) | Value (conversion) | Notes |
PVR header | ||||
0x00 | 0x04 | 50 56 52 03 | "PVR " | Version: Contains the version of the PVR header format. |
0x04 | 0x04 | 00 00 00 00 | Flags:
| |
0x08 | 0x08 | 72 67 62 61 08 08 08 08 | "rgba" | Pixel Format: rgba + bit rate per channel |
0x10 | 0x04 | 00 00 00 00 | Colour Space:
| |
0x14 | 0x04 | 00 00 00 00 | 0 | Channel Type: |
0x18 | 0x04 | 00 01 00 00 | 256 | Height: width of the texture stored in the texture data, in pixels. |
0x1C | 0x04 | 00 01 00 00 | 256 | Width: width of the texture stored in the texture data, in pixels. |
0x20 | 0x04 | 01 00 00 00 | 1 | Depth: depth of the texture stored in the texture data, in pixels. |
0x24 | 0x04 | 01 00 00 00 | 1 | Num. Surfaces: number of surfaces within the texture array. |
0x28 | 0x04 | 01 00 00 00 | 1 | Num. Faces: number of faces in a cube map. |
0x2C | 0x04 | 01 00 00 00 | 1 | MIP-Map Count: number of MIP-Map levels present including the top level.
A value of one, therefore, means that only the top level texture exists. |
0x30 | 0x04 | 00 00 00 00 | 0 | Meta Data Size: allows for the creator of a PVR to store custom information within the PVR file relating to the storage. |
Pixel Format
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, e.g., {‘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, e.g., {8, 8, 8, 8} or {5, 6, 5, 0}.
Where the most significant 4 bytes have been set to ‘0’ and the least significant 4 bytes will contain a 32bit unsigned integer value identifying the pixel format
Formats | Value | |||
Identifier | ||||
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 | 7 | |||
DXT2 | 8 | |||
DXT3 | 9 | |||
DXT4 | 10 | |||
DXT5 | 11 | |||
BC1 | 7 | |||
BC2 | 9 | |||
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 |
Channel Type
the data type of the colour channels within the texture data.
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 |
Float | 12 |
Meta Data Format
FourCC 4 bytes |
Key 4 bytes |
Data Size 4 bytes |
Data variable |
Padding variable |
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 Pre-defined Medata Data section.
Pre-defined Medata Data
FourCC | Key | Data Size | Data Description | |
Pre-defined metadata | ||||
‘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:
| |
‘P’, ‘V’, ‘R’, 3 | 1 | 8 | 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, | |
‘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’. | |
‘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.
| |
‘P’, ‘V’, ‘R’, 3 | 4 | 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. | |
‘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. |
Key
is an unsigned 32bit integer, which, when coupled with ‘FourCC’ determines how ‘Data’ should be handled.
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’.
Padding
8 bytes or more, if defined.
Texture Data
- http://web.onetel.net.uk/~simonnihal/assorted3d/fenney03texcomp.pdf PVRTC algorithm: Texture Compression using Low-Frequency Signal Modulation
- http://blog.imgtec.com/powervr/understanding-powervr-series5xt-pvrtc-pvrtc2-and-texture-compression-part-6 overview
Tools
- http://community.imgtec.com/developers/powervr/tools/ suite of utilities and docs