Skip to main content

ASTC decoder for PIL (just faster)

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

astc_decomp_faster-1.1.2.tar.gz (167.2 kB view details)

Uploaded Source

Built Distributions

astc_decomp_faster-1.1.2-cp312-cp312-win_amd64.whl (86.8 kB view details)

Uploaded CPython 3.12 Windows x86-64

astc_decomp_faster-1.1.2-cp311-cp311-win_amd64.whl (86.2 kB view details)

Uploaded CPython 3.11 Windows x86-64

astc_decomp_faster-1.1.2-cp311-cp311-win32.whl (73.6 kB view details)

Uploaded CPython 3.11 Windows x86

astc_decomp_faster-1.1.2-cp310-cp310-win_amd64.whl (86.2 kB view details)

Uploaded CPython 3.10 Windows x86-64

astc_decomp_faster-1.1.2-cp310-cp310-win32.whl (74.0 kB view details)

Uploaded CPython 3.10 Windows x86

astc_decomp_faster-1.1.2-cp39-cp39-win_amd64.whl (86.7 kB view details)

Uploaded CPython 3.9 Windows x86-64

astc_decomp_faster-1.1.2-cp39-cp39-win32.whl (74.7 kB view details)

Uploaded CPython 3.9 Windows x86

astc_decomp_faster-1.1.2-cp38-cp38-win_amd64.whl (86.8 kB view details)

Uploaded CPython 3.8 Windows x86-64

astc_decomp_faster-1.1.2-cp38-cp38-win32.whl (74.6 kB view details)

Uploaded CPython 3.8 Windows x86

astc_decomp_faster-1.1.2-cp37-cp37m-win_amd64.whl (86.8 kB view details)

Uploaded CPython 3.7m Windows x86-64

astc_decomp_faster-1.1.2-cp37-cp37m-win32.whl (73.8 kB view details)

Uploaded CPython 3.7m Windows x86

File details

Details for the file astc_decomp_faster-1.1.2.tar.gz.

File metadata

  • Download URL: astc_decomp_faster-1.1.2.tar.gz
  • Upload date:
  • Size: 167.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for astc_decomp_faster-1.1.2.tar.gz
Algorithm Hash digest
SHA256 5d818992a2f680a41f4c79e603da59d941ef59091a730bd852627641ab7fb1c9
MD5 fa63ee43b1e1fa3454e43ceaa25b13ba
BLAKE2b-256 bbb7a1dca9c21867bc32644163829a1b13e9a35594d43d744e9204759d1d3a91

See more details on using hashes here.

File details

Details for the file astc_decomp_faster-1.1.2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for astc_decomp_faster-1.1.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 51b6756f42617460f01bf863332b7e054ae3b5dc12e2756df84d7f241f194895
MD5 21ab34ea730dc37ed62e74abefc16a08
BLAKE2b-256 fcdd72c791c35955b5792baab01d91c3c684a333a43d0f31ea5fe691ab20d703

See more details on using hashes here.

File details

Details for the file astc_decomp_faster-1.1.2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for astc_decomp_faster-1.1.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c2261534803d487855af03b8f17ba38e9b5d1921e50780f6ab0d3db341a17bed
MD5 d5530e2af3b4dfddcac36cf20522a2d3
BLAKE2b-256 741a5b6ee3cf02d3ca75b2a09afd700d864d7afd74b606af60ac29beef7f486f

See more details on using hashes here.

File details

Details for the file astc_decomp_faster-1.1.2-cp311-cp311-win32.whl.

File metadata

File hashes

Hashes for astc_decomp_faster-1.1.2-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 fd448d2232db802b4fa99fcbcef39c2c5e7d2bb7478d05eaf232543cf5af9fee
MD5 94a61c69bdc40261f3e68cab2d15bba3
BLAKE2b-256 5574e0439a4d739c210c0231f7073a6e3a7a8272974d8e0f73674f373d8075f8

See more details on using hashes here.

File details

Details for the file astc_decomp_faster-1.1.2-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for astc_decomp_faster-1.1.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8f53d2e9d61ff2099fa0e76743d99e88df0a52e1eb94fedcd5db5c1d32f16b5e
MD5 dbc65d83daf0f8ce623ad34997e8600d
BLAKE2b-256 55c6cdbbc6be56f2f0aa99a1c5eebe5f964a708a7ed93f3cafc02508005ca9ab

See more details on using hashes here.

File details

Details for the file astc_decomp_faster-1.1.2-cp310-cp310-win32.whl.

File metadata

File hashes

Hashes for astc_decomp_faster-1.1.2-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 8c7ecb4047878af0957a151891eebaf5bfa97a3a25138176363b541e0314d3ca
MD5 29b2a3c071ecbf0eb68af8c48c5e7d98
BLAKE2b-256 447ffc0b9674152229c68a16f2367072b2d3729d9a4967cdc9b21d834523d32d

See more details on using hashes here.

File details

Details for the file astc_decomp_faster-1.1.2-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for astc_decomp_faster-1.1.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 217cf3de22eab019716fa5b059405b4222195ded36255eea4006c52f97357320
MD5 fae8b37d1d2fbbae7b38d659c9e2dcc3
BLAKE2b-256 c176c3f4df9ad402ce7a6f0b08488b21fd7477b2a8af9683592e0df7cfc77dfb

See more details on using hashes here.

File details

Details for the file astc_decomp_faster-1.1.2-cp39-cp39-win32.whl.

File metadata

File hashes

Hashes for astc_decomp_faster-1.1.2-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 af378a61bcd821778e4e415dd18f7e3e0a6b0cce4aaef66446b1ddddcbd6ad67
MD5 8d8e4023b08a0b353ffb39a8c96216db
BLAKE2b-256 ac3bf84e015929890cb2ef581a21f7b22e7028bca3096f95ab114d33584bd042

See more details on using hashes here.

File details

Details for the file astc_decomp_faster-1.1.2-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for astc_decomp_faster-1.1.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 d11fb865d6cbdf0c356fc66f93807f578bea1ddb29748ea62b26e99aba85cb0e
MD5 5277e77408268be786e86634138acaaa
BLAKE2b-256 98967414c79858dde3616426a849ab50e502a65a66f77e42eaf3be309eeb0118

See more details on using hashes here.

File details

Details for the file astc_decomp_faster-1.1.2-cp38-cp38-win32.whl.

File metadata

File hashes

Hashes for astc_decomp_faster-1.1.2-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 98e9b0904b3c983c154e68559ad855c28c476750f1061f4b32e54516bf3c5052
MD5 bcf8526b195c1d53e01f699ff4d3d32f
BLAKE2b-256 44433a321d9a10d3f51aa0503f36e0f935eef5319dbffa23795ecfc09965b113

See more details on using hashes here.

File details

Details for the file astc_decomp_faster-1.1.2-cp37-cp37m-win_amd64.whl.

File metadata

File hashes

Hashes for astc_decomp_faster-1.1.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 9d06bea9884c5852a91fd1e11a442a36c0eb2d99fbf626bba9040e35f9aebb03
MD5 45084fd2387312b3fb520a435ad68c96
BLAKE2b-256 38bbef493b2272058615e3023829edb6ababf70edd3ccedc49c5d732634812bf

See more details on using hashes here.

File details

Details for the file astc_decomp_faster-1.1.2-cp37-cp37m-win32.whl.

File metadata

File hashes

Hashes for astc_decomp_faster-1.1.2-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 e17a6d6c9626a5d2b5a23a1274858b7b9a048004164500251f1339fa9d34ee6d
MD5 fc893b2059d382a8a5aa9c6703f0502b
BLAKE2b-256 91b71ea950e07cbc1c32730a7ec4ea283a3f95b307aaaef2759f5520880e6a2a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page