• Stars
    star
    880
  • Rank 51,881 (Top 2 %)
  • Language
    C
  • License
    Apache License 2.0
  • Created over 9 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The Arm ASTC Encoder, a compressor for the Adaptive Scalable Texture Compression data format.

About

This is the official repository for the Arm® Adaptive Scalable Texture Compression (ASTC) Encoder, astcenc, a command-line tool for compressing and decompressing images using the ASTC texture compression standard.

The ASTC format

The ASTC compressed data format, developed by Arm® and AMD, has been adopted as an official extension to the Open GL®, OpenGL ES, and Vulkan® graphics APIs. It provides a major step forward in terms of both the image quality at a given bitrate, and the format and bitrate flexibility available to content creators. This allows more assets to use compression, often at a reduced bitrate compared to other formats, reducing memory storage and bandwidth requirements.

Read the ASTC Format Overview for a quick introduction to the format, or read the full Khronos Data Format Specification for all the details.

License

This project is licensed under the Apache 2.0 license. By downloading any component from this repository you acknowledge that you accept terms specified in the LICENSE.txt file.

Encoder feature support

The encoder supports compression of low dynamic range (BMP, JPEG, PNG, TGA) and high dynamic range (EXR, HDR) images, as well as a subset of image data wrapped in the DDS and KTX container formats, into ASTC or KTX format output images.

The decoder supports decompression of ASTC or KTX format input images into low dynamic range (BMP, PNG, TGA), high dynamic range (EXR, HDR), or DDS and KTX wrapped output images.

The encoder allows control over the compression time/quality tradeoff with exhaustive, thorough, medium, fast, and fastest encoding quality presets.

The encoder allows compression time and quality analysis by reporting the compression time, and the Peak Signal-to-Noise Ratio (PSNR) between the input image and the compressed output.

ASTC format support

The astcenc compressor supports generation of images for all three profiles allowed by the ASTC specification:

  • 2D Low Dynamic Range (LDR profile)
  • 2D LDR and High Dynamic Range (HDR profile)
  • 2D and 3D, LDR and HDR (Full profile)

It also supports all of the ASTC block sizes and compression modes, allowing content creators to use the full spectrum of quality-to-bitrate options ranging from 0.89 bits/pixel up to 8 bits/pixel.

Prebuilt binaries

Release build binaries for the astcenc stable releases are provided in the GitHub Releases page.

Latest 4.x stable release: 4.4

Latest 3.x stable release: 3.7

Binaries are provided for 64-bit builds on Windows, macOS, and Linux. The builds of the astcenc are provided as multiple binaries, each tuned for a specific SIMD instruction set.

For x86-64 we provide, in order of increasing performance:

  • astcenc-sse2 - uses SSE2
  • astcenc-sse4.1 - uses SSE4.1 and POPCNT
  • astcenc-avx2 - uses AVX2, SSE4.2, POPCNT, and F16C

The x86-64 SSE2 builds will work on all x86-64 machines, but it is the slowest of the three. The other two require extended CPU instruction set support which is not universally available, but each step gains ~15% more performance.

For Apple silicon macOS devices we provide:

  • astcenc-neon - uses NEON

Repository branches

The main branch is an active development branch for the compressor. It aims to be a stable branch for the latest major release series, but as it is used for ongoing development expect it to have some volatility. We recommend using the latest stable release tag for production development.

The 3.x branch is a stable branch for the 3.x release series. It is no longer under active development, but is a supported branch that continues to get backported bug fixes.

The 1.x and 2.x branches are stable branches for older releases. They are no longer under active development or getting bug fixes.

Any other branches you might find are development branches for new features or optimizations, so might be interesting to play with but should be considered transient and unstable.

Getting started

Open a terminal, change to the appropriate directory for your system, and run the astcenc encoder program, like this on Linux or macOS:

./astcenc

... or like this on Windows:

astcenc

Invoking astcenc -help gives an extensive help message, including usage instructions and details of all available command line options. A summary of the main encoder options are shown below.

Compressing an image

Compress an image using the -cl \ -cs \ -ch \ -cH modes. For example:

astcenc -cl example.png example.astc 6x6 -medium

This compresses example.png using the LDR color profile and a 6x6 block footprint (3.56 bits/pixel). The -medium quality preset gives a reasonable image quality for a relatively fast compression speed, so is a good starting point for compression. The output is stored to a linear color space compressed image, example.astc.

The modes available are:

  • -cl : use the linear LDR color profile.
  • -cs : use the sRGB LDR color profile.
  • -ch : use the HDR color profile, tuned for HDR RGB and LDR A.
  • -cH : use the HDR color profile, tuned for HDR RGBA.

Decompressing an image

Decompress an image using the -dl \ -ds \ -dh \ -dH modes. For example:

astcenc -dh example.astc example.tga

This decompresses example.astc using the full HDR feature profile, storing the decompressed output to example.tga.

The modes available mirror the options used for compression, but use a d prefix. Note that for decompression there is no difference between the two HDR modes, they are both provided simply to maintain symmetry across operations.

Measuring image quality

Review the compression quality using the -tl \ -ts \ -th \ -tH modes. For example:

astcenc -tl example.png example.tga 5x5 -thorough

This is equivalent to using using the LDR color profile and a 5x5 block size to compress the image, using the -thorough quality preset, and then immediately decompressing the image and saving the result. This can be used to enable a visual inspection of the compressed image quality. In addition this mode also prints out some image quality metrics to the console.

The modes available mirror the options used for compression, but use a t prefix.

Experimenting

Efficient real-time graphics benefits from minimizing compressed texture size, as it reduces memory footprint, reduces memory bandwidth, saves energy, and can improve texture cache efficiency. However, like any lossy compression format there will come a point where the compressed image quality is unacceptable because there are simply not enough bits to represent the output with the precision needed. We recommend experimenting with the block footprint to find the optimum balance between size and quality, as the finely adjustable compression ratio is one of major strengths of the ASTC format.

The compression speed can be controlled from -fastest, through -fast, -medium and -thorough, up to -exhaustive. In general, the more time the encoder has to spend looking for good encodings the better the results, but it does result in increasingly small improvements for the amount of time required.

There are many other command line options for tuning the encoder parameters which can be used to fine tune the compression algorithm. See the command line help message for more details.

Documentation

The ASTC Format Overview page provides a high level introduction to the ASTC texture format, how it encodes data, and why it is both flexible and efficient.

The Effective ASTC Encoding page looks at some of the guidelines that should be followed when compressing data using astcenc. It covers:

  • How to efficiently encode data with fewer than 4 channels.
  • How to efficiently encode normal maps, sRGB data, and HDR data.
  • Coding equivalents to other compression formats.

The ASTC Developer Guide document (external link) provides a more detailed guide for developers using the astcenc compressor.

The .astc File Format page provides a light-weight specification for the .astc file format and how to read or write it.

The Building ASTC Encoder page provides instructions on how to build astcenc from the sources in this repository.

The Testing ASTC Encoder page provides instructions on how to test any modifications to the source code in this repository.

Support

If you have issues with the astcenc encoder, or questions about the ASTC texture format itself, please raise them in the GitHub issue tracker.

If you have any questions about Arm GPUs, application development for Arm GPUs, or general mobile graphics development or technology please submit them on the Arm Community graphics forums.


Copyright © 2013-2023, Arm Limited and contributors. All rights reserved.

More Repositories

1

ComputeLibrary

The Compute Library is a set of computer vision and machine learning functions optimised for both Arm CPUs and GPUs using SIMD technologies.
C++
2,539
star
2

arm-trusted-firmware

Read-only mirror of Trusted Firmware-A
C
1,690
star
3

CMSIS_5

CMSIS Version 5 Development Repository
C
1,327
star
4

armnn

Arm NN ML Software. The code here is a read-only mirror of https://review.mlplatform.org/admin/repos/ml/armnn
C++
1,162
star
5

ML-KWS-for-MCU

Keyword spotting on Arm Cortex-M Microcontrollers
C
1,040
star
6

abi-aa

Application Binary Interface for the Arm® Architecture
HTML
673
star
7

vulkan_best_practice_for_mobile_developers

Vulkan best practice for mobile developers
C++
564
star
8

CMSIS-FreeRTOS

FreeRTOS adaptation for CMSIS-RTOS Version 2
C
502
star
9

optimized-routines

Optimized implementations of various library functions for ARM architecture processors
C
486
star
10

CMSIS_4

Cortex Microcontroller Software Interface Standard (V4 no longer maintained)
C
451
star
11

mango

Parallel Hyperparameter Tuning in Python
Jupyter Notebook
396
star
12

ML-examples

Arm Machine Learning tutorials and examples
C++
371
star
13

LLVM-embedded-toolchain-for-Arm

A project dedicated to building LLVM toolchain for 32-bit Arm embedded targets.
CMake
331
star
14

opengl-es-sdk-for-android

OpenGL ES SDK for Android
CSS
325
star
15

SCALE-Sim

Python
296
star
16

Arm-2D

2D Graphic Library optimized for Cortex-M processors
C
295
star
17

CMSIS-DSP

CMSIS-DSP embedded compute library for Cortex-M and Cortex-A
C
277
star
18

Tool-Solutions

Tutorials & examples for Arm software development tools.
C
217
star
19

EndpointAI

C++
216
star
20

SCP-firmware

Read-only mirror of System Control Processor (SCP) firmware
C
205
star
21

vulkan-sdk

Github repository for the Vulkan SDK
C
199
star
22

lisa

Linux Integrated System Analysis
Jupyter Notebook
192
star
23

HWCPipe

Hardware counters interface
C++
188
star
24

u-boot

Clone of upstream U-Boot repo with patches for Arm development boards
C
177
star
25

CMSIS-NN

CMSIS-NN Library
C
173
star
26

CMSIS-Driver

Repository of microcontroller peripheral driver implementing the CMSIS-Driver API specification
C
165
star
27

android-nn-driver

C++
151
star
28

CMSIS_6

CMSIS version 6 (successor of CMSIS_5)
C
149
star
29

ML-zoo

Python
149
star
30

workload-automation

A framework for automating workload execution and measurement collection on ARM devices.
Python
138
star
31

gator

Sources for Arm Streamline's gator daemon
C++
121
star
32

keyword-transformer

Official implementation of the Keyword Transformer: https://arxiv.org/abs/2104.00769
Jupyter Notebook
116
star
33

ebbr

Embedded Base Boot Requirements Specification
PostScript
113
star
34

perfdoc

A cross-platform Vulkan layer which checks Vulkan applications for best practices on Arm Mali devices.
C++
112
star
35

linux

C
95
star
36

asl-interpreter

Example implementation of Arm's Architecture Specification Language (ASL)
OCaml
94
star
37

MDK-Middleware

MDK-Middleware (file system, network and USB components) source code for Arm Cortex-M using CMSIS-Drivers and CMSIS-RTOS2 APIs.
C
93
star
38

sbsa-acs

ARM Enterprise: SBSA Architecture Compliance Suite
C
88
star
39

sesr

Super-Efficient Super Resolution
Python
87
star
40

mobile-studio-integration-for-unity

Mobile Studio tool integration with C# scripting for the Unity game engine.
C
86
star
41

CSAL

Coresight Access Library
C
78
star
42

progress64

PROGRESS64 is a C library of scalable functions for concurrent programs, primarily focused on networking applications.
C
70
star
43

psa-arch-tests

Tests for verifying implementations of TBSA-v8M and the PSA Certified APIs
C
66
star
44

CMSIS-RTX

RTX5 real time kernel for Arm Cortex-based embedded systems (spin-off from CMSIS_5)
C
64
star
45

Cloud-IoT-Core-Kit-Examples

Example projects and code are supplied to support the Arm-based IoT Kit for Cloud IoT Core
Python
62
star
46

developer

GTM related documentation
C++
61
star
47

cmsis-pack-eclipse

CMSIS-Pack Eclipse Plug-ins
Java
60
star
48

trappy

This repository has moved to https://gitlab.arm.com/tooling/trappy
Python
60
star
49

ethos-n-driver-stack

Driver stack (including user space libraries, kernel module and firmware) for the Arm® Ethos™-N NPU
C++
59
star
50

AVH-GetStarted

DEPRECATED - use instead AVH_CI_Template
C
58
star
51

CMSIS-CV

Computer Vision library for IoT
C++
54
star
52

acle

Arm C Language Extensions (ACLE)
Python
52
star
53

arm-systemready

Arm SystemReady
Shell
52
star
54

patrace

C++
52
star
55

tarmac-trace-utilities

Tools for analyzing and browsing Tarmac instruction traces.
C++
47
star
56

devlib

Library for interaction with and instrumentation of remote devices.
Python
47
star
57

speculation-barrier

This project provides a header file which contains wrapper macros for the __builtin_load_no_speculate builtin function defined at https://www.arm.com/security-update This builtin function defines a speculation barrier, which can be used to limit the conditions under which a value which has been loaded can be used under speculative execution.
Objective-C
44
star
58

arm-enterprise-acs

ARM Enterprise ACS
C
42
star
59

DeepFreeze

SystemVerilog
38
star
60

tf-issues

Issue tracking for the ARM Trusted Firmware project
36
star
61

scalpel

This is a PyTorch implementation of the Scalpel. Node pruning for five benchmark networks and SIMD-aware weight pruning for LeNet-300-100 and LeNet-5 is included.
Python
35
star
62

psa-api

Documentation source and development of the PSA Certified API
C
34
star
63

TZ-TRNG

TrustZone True Number Generator
C
33
star
64

AVH

AVH-FVP: Arm Virtual Hardware - Fixed Virtual Platform
C
32
star
65

CMSIS-View

Repository of CMSIS Software Pack for software event generation and input/output handling.
Go
32
star
66

perf-libs-tools

C
31
star
67

bob-build

Meta-build system using Blueprint and ninja
Go
30
star
68

CMSIS-DAP

CoreSight Debug Access Port (DAP) debug probe protocol reference implementation (spin-off from CMSIS_5)
C
30
star
69

mram_simulation_framework

MRAM magnetization simulation framework. s-LLGS python and verilog-a solvers for transients simulation and Fokker-planck equation solver for stochastic analysis
Python
28
star
70

bento-linker

A light-weight alternative to processes for microcontrollers.
C
27
star
71

toolchain-gnu-bare-metal

A toolchain sub-project dedicated to build GNU toolchain for 32-bit bare-metal targets
Shell
26
star
72

data

Machine-readable data describing Arm architecture and implementations. Includes JSON descriptions of implemented PMU events.
26
star
73

synchronization-benchmarks

Collection of synchronization micro-benchmarks and traces from infrastructure applications
C
26
star
74

libGPUInfo

A utility library for application developers to query the configuration of the Arm Immortalis GPU or Arm Mali GPU present in their system.
C++
24
star
75

cryptocell-312-runtime

CryptoCell 312 runtime code
C
24
star
76

CMSIS-Compiler

CMSIS Compiler support for Arm Compiler
C
24
star
77

vscode-cmsis-csolution

Extension support for VS Code CMSIS Project Extension
24
star
78

libddssec

DDS Security library - Project moved to https://gitlab.arm.com/libraries/libddssec
C
23
star
79

NXP_LPC

CMSIS Driver Implementations for the NXP LPC Microcontroller Series
C
23
star
80

golang-utils

Helpers and utilities for Golang in order to do actions not available in the standard library.
Go
23
star
81

AArch64cryptolib

AArch64cryptolib is a from scratch implementation of cryptographic primitives aiming for optimal performance on Arm A-class cores
C
23
star
82

AVH-TFLmicrospeech

Example: Micro speech for TensorFlow Lite
C
22
star
83

Shackleton-Framework

A generic genetic programming framework that aims to make genetic programming easier for a myriad of uses. Currently, the main target is to use the framework for code optimization in tandem with the LLVM framework.
C
22
star
84

CMSIS-Stream

CMSIS-Stream software component
Python
21
star
85

bart

Behavioural Analysis and Regression Toolkit
Python
20
star
86

PAF

PAF (the Physical Attack Framework) is a framework for analyzing physical attacks: fault injection and side channels
C++
20
star
87

HPCG_for_Arm

C++
20
star
88

armnn-mlperf

Arm mlperf.org benchmark port
C++
20
star
89

coresight-wire-protocol

Coresight Wire Protocol (CSWP) Server/Client and streaming trace examples.
HTML
18
star
90

ATP-Engine

C++
18
star
91

bsa-acs

Arm SystemReady : BSA Architecture Compliance Suite
C
17
star
92

ATS-Keyword

Smart Home Total Solution - Keyword Recognition
C
17
star
93

open-iot-sdk

Open-IoT-SDK - Home of the Total Solution applications.
C
16
star
94

vscode-keil-studio-pack

Extension pack for all VS Code extensions
16
star
95

CMSIS-RTOS2_Validation

Validation test suite for CMSIS-RTOS2 API implementations using Arm Virtual Hardware (AVH).
C
16
star
96

vr-sdk-for-android

VR SDK for Android
CSS
16
star
97

meabo

Multi-purpose multi-phase micro-benchmark
C
15
star
98

avhclient

Arm Virtual Hardware Client
Python
15
star
99

CMSIS-Driver_Validation

Test suite for verifying CMSIS-Driver implementations.
C
15
star
100

Methodology_for_ArmIE_SVE

C++
15
star