Texture Compression using PVRTC#
Modern applications have become graphically intensive. Certain types of software, such as games or navigation aids, often need large amounts of textures to represent a scene with satisfying quality. Texture compression can save or allow better use of bandwidth, power, and memory without noticeably losing graphical quality. Therefore, it should be used as much as possible.
PowerVR hardware offers a specific proprietary form of texture compression called PVRTC. It uses a sophisticated amplitude modulation scheme to compress textures. Texture data is encoded as two low-resolution images along with a full resolution, low bit-precision modulation signal. More information can be found in the whitepaper Fenney, S. (2003) ‘Texture Compression Using Low-Frequency Signal Modulation’, SIGGRAPH Conference.
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. It also boasts a very high image quality for competitive compression ratios of 4 bits per pixel (PVRTC 4bpp) and 2 bits per pixel (PVRTC 2bpp).
PVRTexTool#
PVRTexTool is a utility for compressing textures, which ensures the lowest possible texture memory overhead at application run-time. The PVRTexTool package includes a library, command-line and GUI tools, and a set of plug-ins. Plug-ins are available for Autodesk 3ds Max, Autodesk Maya, and Adobe Photoshop.
![../_images/perf-rec-7.jpg](../_images/perf-rec-7.jpg)
Each component is capable of converting to a variety of popular compressed texture formats such as PVRTC and ETC, as well as all core texture formats for a variety of different APIs. They also include a number of advanced features to pre-process the image data – for example, border generation, colour bleeding, and normal map generation.
Textures can be saved to DDS, KTX, or PVR formats. PVR is Imagination Technologies’s PowerVR texture container format, which comes with the following benefits:
Full public specification.
Support for custom metadata.
Complete and optimised resource loading code with other PowerVR tools.
Other key features of PVRTexTool include:
Support for all core texture formats in OpenGL ES, Vulkan, and DirectX 11.1.
Support for PVRTC, ASTC, ETC, and DXT compression.
Pre-processing functions for efficient texture rendering.
Normal map generation.
Composition and visualisation of cubemaps.
Optimised font-to-texture creation.
Texture array creation.
Note
Texture arrays are allocated as contiguous blocks of memory. In OpenGL ES only, modifying any texel within any element of the array will cause the driver to ghost the entire texture array. The KHR_debug
logging will report when these ghosting events occur. In Vulkan, all synchronisation is under the application’s control.
Why use PVRTC?#
In any given situation, the best texture format to use is the one that gives the required image quality at the highest rate of compression. The smaller the size of the texture data, the less bandwidth is required for texture fetches. This reduces power consumption, can increase performance, and allows for more textures to be used for the same budget.
The smallest RGB and RGBA format currently available on all PowerVR Graphics Cores is PVRTC 2bpp, and therefore it should be considered for every texture in an application. Larger formats such as PVRTC 4bpp should only be used if the image quality provided by a particular PVRTC 2bpp image does not have sufficient quality. On the latest PowerVR graphics cores, ASTC compression is also available.
Performance improvement#
The smaller memory footprint of PVRTC means less data is transferred from memory to the graphics core, allowing for major bandwidth savings. In situations where memory bandwidth is the limiting factor in an application’s performance, PVRTC can provide a significant boost. PVRTC also improves cache efficiency, because it takes less space to store the data in the cache. This can reduce the number of cache evictions and improve cache hit-rate.
Power consumption#
Memory accesses are one of the primary causes of increased power consumption on mobile devices where battery life is of the utmost importance. The bandwidth savings and better cache performance resulting from the use of PVRTC both contribute to decreasing the quantity and magnitude of memory accesses. These in turn, reduce the power an application.
Image file compression versus texture compression#
Developers are familiar with compressed image file formats such as JPG. It is important to be aware of the distinction between these forms of storage compression, and the texture compression discussed in this document.
The primary requirement of storage compression schemes is that files compressed using them should occupy as small an amount of storage in a file system as possible. There is no requirement that the data stays compressed while in use. The result is that storage-based image file formats tend to produce very small file sizes, often for very high (or lossless) image quality, but at the cost of immediate decompression on use. This immediate decompression, usually to 24/32bpp, means that the image while small on disk, consumes large amounts of bandwidth and memory at runtime.
Texture compression schemes such as PVRTC are designed to be directly usable by the graphics core. The texture data exists in storage in memory, and is transferred to the graphics hardware itself in the compressed format. The only step in which full-precision colour values are extracted from a compressed state is when dedicated texture sampling hardware inside the graphics accelerator passes texel values to the shader processing units.
![../_images/perf-rec-9.jpg](../_images/perf-rec-9.jpg)
This allows all the advantages mentioned above, but puts some limits on the form the compression technique may take. To allow for direct use by the graphics accelerator, a texture format should be optimised for random access, with a minimal size of data from which to retrieve each texel’s values. Consequently, texture compression schemes are usually fixed bitrate with very high data locality. Image file formats are not constrained by these requirements, and can often achieve higher compression ratios and image quality for a given data size.