bconstanzo: this is a fork of K0lb3's work focused on improving performance by adding some Cython magic (types, which took a bit of effort to get right). Since it completely removes python from the hot loop (and almost all of the decompression function) it achieves some nice speedups (6-8 times faster). Any bottlenecks would then be inside the C++ functions, or your compilers ability to optimize said code.
The main reason I'm making this fork is that iLEAPP had the astc_decomp module as a bottleneck at the time of release, and I worked a couple of weeks into improving it. There may be better alternatives for ASTC decompression out there.
K0lb3's original readme follows:
ASTC_Decomp
An ASTC decoder for PIL.
The decoder uses richgel999/astc_dec to decompress the ASTC blocks.
Installation
- Cython required
PIP
pip install astc_decomp
Manual
python setup.py install
Usage
Arguments
- block_width: - Block width, in pixels.
- block_height: - Block height, in pixels.
- is_srgb: - If isSRGB is true, the spec requires the decoder to scale the LDR 8-bit endpoints to 16-bit before interpolation slightly differently, which will lead to different outputs. So be sure to set it correctly (ideally it should match whatever the encoder did). (optional arg, default : False)
PIL.Image decoder
from PIL import Image
import astc_decomp
#needs to be imported once in the active code, so that the codec can register itself
astc_data : bytes
block_width : int
block_height : int
is_srgb : bool = False
img = Image.frombytes('RGBA', size, astc_data, 'astc', (block_width, block_height, is_srgb))
raw decoder
from astc_decomp import decompress_astc
# ASTC to RGBA
rgba_data = decompress_astc(astc_data : bytes, width : int, height : int, block_width : int, block_height : int, is_srgb : bool = False)
Release files for astc-decomp-faster 1.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| astc_decomp_faster-1.1.5.tar.gz | 175.5 kB | Details |
Built distributions (wheels)
Total release size: 1.5 MB
Release files / astc_decomp_faster-1.1.5.tar.gz
| Download URL | astc_decomp_faster-1.1.5.tar.gz |
|---|---|
| Size | 175.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c84865c97231996a9a4f12c9f4d676633808afe62f4df230dfd740ee7d3054b4
|
|
BLAKE2b-256 checksum How to use checksums |
460c9175a74d7dfb5743b027b97dc15127802d882cb1154b779fe857801ca325
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / astc_decomp_faster-1.1.5-cp314-cp314-win_amd64.whl
| Download URL | astc_decomp_faster-1.1.5-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 80.4 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
10be93c238843d09eb1bbf7fc92f66dd8f969dfc9fc216896a44da2856e291f2
|
|
BLAKE2b-256 checksum How to use checksums |
7232ac3afcf24ad65e20ca01a35296c366650eb3b282c16e7d9d11ed2f5c9698
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Release files / astc_decomp_faster-1.1.5-cp314-cp314-macosx_10_15_universal2.whl
| Download URL | astc_decomp_faster-1.1.5-cp314-cp314-macosx_10_15_universal2.whl |
|---|---|
| Size | 186.8 kB |
| Tags | CPython 3.14 macOS 10.15+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
ca7678b90a4fe580df1841c18d7d620a5693329f8fb645f98eb7f90b22b15227
|
|
BLAKE2b-256 checksum How to use checksums |
000d34a1b77c62a95a9261191b8b6a16f6dee2c26368457fec9d63b7b55b2bea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Release files / astc_decomp_faster-1.1.5-cp313-cp313-win_amd64.whl
| Download URL | astc_decomp_faster-1.1.5-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 78.2 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f91d99ed5604e866c2753f1ab0d2b3d30c555937ff2505c785a62c4648606e41
|
|
BLAKE2b-256 checksum How to use checksums |
de47723e65635ba67bffcdadd2de71aacf10c0ffd3057c83a16ffc884dbca5c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.14
|
Release files / astc_decomp_faster-1.1.5-cp313-cp313-macosx_10_13_universal2.whl
| Download URL | astc_decomp_faster-1.1.5-cp313-cp313-macosx_10_13_universal2.whl |
|---|---|
| Size | 185.8 kB |
| Tags | CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
27a43bfffeff9ce8811b89badb3f5a6663f5386f6f7e9da6aef534e8ec292405
|
|
BLAKE2b-256 checksum How to use checksums |
6bbffc568756e12a14f84b7431caa07ba05c2e4785876c4652edef92cb0efc0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.14
|
Release files / astc_decomp_faster-1.1.5-cp312-cp312-win_amd64.whl
| Download URL | astc_decomp_faster-1.1.5-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 78.4 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
641ff01c06904e61f3c257d7587e3757905adfe63c1e2a869ee3d3b8222cea69
|
|
BLAKE2b-256 checksum How to use checksums |
791f8cf34d28a39342627511cce88121f8a41c8d0190909b44d3f6bfcb8c50ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / astc_decomp_faster-1.1.5-cp312-cp312-macosx_10_13_universal2.whl
| Download URL | astc_decomp_faster-1.1.5-cp312-cp312-macosx_10_13_universal2.whl |
|---|---|
| Size | 187.2 kB |
| Tags | CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
94eeca992bdfe4a33b666e097452b532936e7cad061bd2f313f8271fca0eb1ea
|
|
BLAKE2b-256 checksum How to use checksums |
40b17754fef6cf79a6e02fe644786de4506d13fb6c246c2f27e842c946ea7def
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / astc_decomp_faster-1.1.5-cp311-cp311-win_amd64.whl
| Download URL | astc_decomp_faster-1.1.5-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 77.9 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
3f08e6ae79c4729a0f7d98b36d38eb2ac23eac353bc7dd071591784a871abe64
|
|
BLAKE2b-256 checksum How to use checksums |
f8713ae34336b3e0e63eb9003eaec31a59d4e9f493f46e34d16b0b95451d9709
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / astc_decomp_faster-1.1.5-cp311-cp311-macosx_10_9_universal2.whl
| Download URL | astc_decomp_faster-1.1.5-cp311-cp311-macosx_10_9_universal2.whl |
|---|---|
| Size | 185.7 kB |
| Tags | CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
b88967cf84a24b0730182762eeba518b4f500c2422b3fcb0d5a33016ab24fc45
|
|
BLAKE2b-256 checksum How to use checksums |
78ca6c2506ac957a6ea03d9624f5eb7847305628a5818bd53e2bd8db79e785f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / astc_decomp_faster-1.1.5-cp310-cp310-win_amd64.whl
| Download URL | astc_decomp_faster-1.1.5-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 77.7 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a2a832fa3f9809d27177df36769944230044a3f1456c25e924406d02da10d472
|
|
BLAKE2b-256 checksum How to use checksums |
2f8ad3ae5062c421e97a2431559d63fde7d47a0ee0563aeb6cf6adaeb90fca72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.11
|
Release files / astc_decomp_faster-1.1.5-cp310-cp310-macosx_10_9_universal2.whl
| Download URL | astc_decomp_faster-1.1.5-cp310-cp310-macosx_10_9_universal2.whl |
|---|---|
| Size | 186.4 kB |
| Tags | CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
853ec21004e02bab157262964b4aafcf6f85ef6afbacad387b5151d7c9e6bca4
|
|
BLAKE2b-256 checksum How to use checksums |
a2d648e424a84b29e0e9b9c17aa9f7aae3a3678b38477775183474d9f0a52074
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.11
|