Giter Site home page Giter Site logo

bcdec's Introduction

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 of either 32bit float or 16bit "half" per component (96bit or 48bit 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
    • optimized BC6H by moving unquantize out of the loop
    • Split BC6H decompression function into 'half' and 'float' variants

bcdec's People

Contributors

iorange avatar aras-p avatar linkmauve avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.