PVR: Difference between revisions

From Vita Developer wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 1: Line 1:
[[Category:Software]]<noinclude>[[Category:Main]]</noinclude>
[[Category:Software]]<noinclude>[[Category:Main]]</noinclude>
<div style="float:right">[[File:Texture-Icon-AA.JPG|100px|thumb|left|Standard model image widely used]]</div>


<div style="color: #ffffff; background-color: #505652; border: 1px solid #808000; padding: 5px; {{box-shadow|4px|4px|8px|#b0b090}}">
<div style="color: #ffffff; background-color: #505652; border: 1px solid #808000; padding: 5px; {{box-shadow|4px|4px|8px|#b0b090}}">

Revision as of 15:02, 28 July 2015


Standard model image widely used

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

03 PVRTC ATITC ETC1 BC1 comparison.png
  • 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 (PowerVR SDK REL_3.5) consists of:

Header
52 bytes
Meta Data (optional)
variable
Texture Data
variable

Sony uses a custom header.

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:
  • 00: No flag has been set
  • 02: Colour values within the texture have been pre-multiplied by the alpha values.
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:
  • 0: Texture data is in the Linear RGB colour space
  • 1: Texture data is in the Standard RGB colour space
0x14 0x04 00 00 00 00 0 Channel Type:
0x18 0x08 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 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:
  • 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 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.

‘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 = 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 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.

‘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.

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

Tools