tutorials | game

Create ASTC Textures Faster With the New astcenc 2.0 Open Source Compression Tool

writer img alt

Peter Harris

Adaptive Scalable Texture Compression (ASTC) is an advanced lossy texture compression format, developed by Arm and AMD and released as royalty-free open standard by the Khronos Group. It supports a wide range of 2D and 3D color formats with a flexible choice of bitrates, enabling content creators to compress almost any texture asset, using a level of compression appropriate to their quality and performance requirements.

ASTC is increasingly becoming the texture compression format of choice for mobile 3D applications using the OpenGL ES and Vulkan APIs. ASTC’s high compression ratios are a perfect match for the mobile market that values smaller download sizes and optimized memory usage to improve energy efficiency and battery life.

ASTC 2D Color Formats and Bitrates

astcenc 2.0

The ‘astcenc’ ASTC compression tool was first developed by Arm while ASTC was progressing through the Khronos standardization process seven years ago. astcenc has become widely used as the de facto reference encoder for ASTC, as it leverages all format features, including the full set of available block sizes and color profiles, to deliver high-quality encoded textures that are possible when effectively using ASTC’s flexible capabilities.

Today, Arm is delighted to announce astcenc 2.0! This is a major update which provides multiple significant improvements for middleware and content creators.

Apache 2.0 Open Source License

The original astcenc software was released under an Arm End User License Agreement. To make it easier for developers to use, adapt, and contribute to astcenc development, including integration of the compressor into application runtimes, Arm relicensed the astcenc 1.X source code on GitHub in January 2020 under the standard Apache 2.0 open source license.

The new astcenc 2.0 source code is now also available on GitHub under Apache 2.0.

Compression Performance

astcenc 1.X emphasized high image quality over fast compression speed. Some developers have told Arm they would love to use astcenc for its superior image quality, but compression was too slow to use in their tooling pipelines. The importance of this was reflected in the recent ASTC developer survey organized by Khronos where developer responses rated compression speed above image quality in the list of factors that determine texture format choices.

For version 2.0, Arm reviewed the heuristics and quality refinement passes used by the astcenc compressor—optimizing those that were adding value and removing those that simply didn’t justify their added runtime cost. In addition, hand-coded vectorized code was added to the most compute intensive sections of the codec, supporting SSE4.2 and AVX2 SIMD instruction sets.

Overall, these optimizations have resulted in up to 3x faster compression times when using AVX2, while typically losing less than 0.1 dB PSNR in image quality. A very worthwhile tradeoff for most developers.

astcenc 2.0 - Significantly Faster ASTC Encoding

Command Line Improvements

The tool now supports a clearer set of compression modes that directly map to ASTC format profiles exposed by the Khronos API support and API extensions.

Textures compressed using the LDR compression modes (linear or sRGB) will be compatible with all hardware implementing OpenGL ES 3.2, the OpenGL ES KHR_texture_compression_astc_ldr extension, or the Vulkan ASTC optional feature.

Textures compressed using the HDR compression mode will require hardware implementing an appropriate API extension, such as KHR_texture_compression_astc_hdr.

In addition, astcenc 2.0 now supports commonly requested input and output file formats:

  • Loading LDR images in BMP, JPEG, PNG, and TGA formats
  • Loading HDR images in OpenEXR and Radiance HDR formats
  • Loading compressed textures in the “.astc” file format provided by astcenc, and the DDS and KTX container formats
  • Storing LDR images into BMP, PNG, and TGA formats
  • Storing HDR images into OpenEXR and Radiance HDR formats
  • Storing compressed texturesinto the “.astc” file format provided by astcenc, and the DDS or KTX container formats

Core Codec Library

Finally, the core codec is now separable from the command line front-end logic, enabling the astcenc compressor to be integrated directly into applications as a library.

The core codec library interface API provides a programmatic mechanism to manage codec configuration, texture compression, and texture decompression. This API enables use of the core codec library to process data stored in memory buffers, leaving file management to the application. It supports parallel processing for compression of a single image with multiple threads or compressing multiple images in parallel.

Using astcenc 2.0

You can download astcenc 2.0 on GitHub today, with full source code and pre-built binaries available for Windows, macOS, and Linux hosts.

For more information about using the tool, please refer to the project documentation:

  • Getting started: learn about the high-level operation of the compressor.
  • Format overview: learn about the ASTC data format and how the underlying encoding works.
  • Efficient encoding: learn about using the command line to effectively compress textures, and the encoding and sampling needed to get functional equivalents to other texture formats that exist on the market today.

Arm have also published an ASTC guide, which gives an overview of the format and some of the available tools, including astcenc .

If you have any questions, feedback, or pull requests, please get in touch via the GitHub issue tracker or the Arm Mali developer community forums:

Khronos® and Vulkan® are registered trademarks, and ANARI™, WebGL™, glTF™, NNEF™, OpenVX™, SPIR™, SPIR-V™, SYCL™, OpenVG™ and 3D Commerce™ are trademarks of The Khronos Group Inc. OpenXR™ is a trademark owned by The Khronos Group Inc. and is registered as a trademark in China, the European Union, Japan and the United Kingdom. OpenCL™ is a trademark of Apple Inc. and OpenGL® is a registered trademark and the OpenGL ES™ and OpenGL SC™ logos are trademarks of Hewlett Packard Enterprise used under license by Khronos. All other product names, trademarks, and/or company names are used solely for identification and belong to their respective owners.