Skip to content
/ bcdec Public

Small header-only C library to decompress any BC compressed image

License

Notifications You must be signed in to change notification settings

iOrange/bcdec

Repository files navigation

bcdec

Small header-only C library to decompress any BC compressed image inspired by incredible stb libaries (http://nothings.org/stb)

Written by Sergii "iOrange" Kudlai in 2022.

This library provides functions to decompress blocks of BC compressed images.

This library does not allocate memory and is trying to use as less stack as possible.

The library was never optimized specifically for speed but for the overall size.
It has zero external dependencies and is not using any runtime functions.

Supported BC formats:

  • BC1 (also known as DXT1) + it's "binary alpha" variant BC1A (DXT1A)
  • BC2 (also known as DXT3)
  • BC3 (also known as DXT5)
  • BC4 (also known as ATI1N)
  • BC5 (also known as ATI2N)
  • BC6H (HDR format)
  • BC7

BC1/BC2/BC3/BC7 are expected to decompress into 4*4 RGBA blocks 8bit per component (32bit pixel)
BC4/BC5 are expected to decompress into 4*4 R/RG blocks 8bit per component (8bit and 16bit pixel)
BC6H is expected to decompress into 4*4 RGB blocks 32bit float per component (96bit pixel)


You will also find included test program that converts compressed DDS files into TGA/HDR.
It is a good start to learn on how to use the bcdec library.
It comes with some test images in the test_images folder and a batch script test_bcdec.bat to run over them.


Used HDRI image "Lythwood Room" from https://polyhaven.com/a/lythwood_room licensed under CC0 license.


CREDITS:

  • Aras Pranckevičius (@aras-p)
    • BC1/BC3 decoders optimizations (up to 3x the speed)
    • BC6H/BC7 bits pulling routines optimizations

About

Small header-only C library to decompress any BC compressed image

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy