Giter Site home page Giter Site logo

drewcassidy / quicktex Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 2.0 30.09 MB

A project intended to add python bindings to rgbcx that somehow resulted in rewriting it entirely

License: Other

CMake 0.77% C++ 93.69% Python 5.54%
dds python dxt1 dxt5 cplusplus

quicktex's Introduction

Quicktex

A python library for using DDS files

Quicktex is a python library and command line tool for encoding and decoding DDS files. It is based on the RGBCX encoder, which is currently one of the highest quality S3TC encoders available. Quicktex has a python front end, but the encoding and decoding is all done in C++ for speed comparable to the original library.

Installation

From Wheel (Easiest)

To install, run

pip install quicktex

If you are on macOS, You need to install openMP from homebrew:

brew install libomp

From Source

To build from source, first clone this repo and cd into it, then run:

git submodule update --init
pip install .

and setuptools will take care of any dependencies for you.

If you are on macOS, it is recommended to first install openMP from homebrew to enable multithreading, since it is not included in the default Apple Clang install:

brew install libomp

The package also makes tests, stub generation, and docs available. To install the required dependencies for them, install with options like so:

pip install .[tests,stubs,docs]

Usage

Usage: quicktex [OPTIONS] COMMAND [ARGS]...

  Encode and Decode various image formats

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  decode  Decode DDS files to images.
  encode  Encode images to DDS files of the given format.

To decode DDS files to images, use the decode subdommand, along with a glob or a list of files to decode.

To encode images to DDS files, use the encode subcommand, plus an additional subcommand for the format. For example, quicktex encode bc1 bun.png will encode bun.png in the current directory to a bc1/DXT1 dds file next to it.

encode and decode both accept several common parameters:

  • -f, --flip / -F, --no-flip: Vertically flip image before/after converting. [default: True]
  • -r, --remove: Remove input images after converting.
  • -s, --suffix TEXT: Suffix to append to output filename(s). Ignored if output is a single file.
  • -o, --output: Output file or directory. If outputting to a file, input filenames must be only a single item. By default, files are converted in place.

quicktex's People

Contributors

dependabot[bot] avatar drewcassidy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

mecripp lisias

quicktex's Issues

DTX1 is decoded incorrectly

When using the code dds.read(pathlib.Path(path)).decode().save(target, format="png") to convert a DTX1 DDS file to PNG, it produces a wrong image. DXT1 supports fully transparent pixels, but those pixels are outputted as black.

GPU support

rewrite the algorithm to run on the GPU

  • Metal
  • OpenCL

SIMD support

Add SIMD support to the core rgbcx library

  • SSE1/2/3
  • AVX1/2
  • NEON
  • SVE1/2, if they ever manifest

ATI 1 is decoded incorrectly

ATI 1 is a single channel format.

When using the code dds.read(pathlib.Path(path)).decode().save(target, format="png") to convert an ATI 1 DDS file to PNG, it produces a wrong image. The saved image is of the format RGB = (0,0,0) with the alpha channel containing the channel of the DDS file.

Implement Python buffers for copy-less data transfers

Current implementation using bytes results in a copy operation when exchanging data between the C++ and Python sides, which might be a performance hit on large images. It should be possible to use Python buffer types to mitigate this

Support BC5_SNORM and BC7

I'd like to use this library, but it doesn't support certain DDS files, such as BC5_SNORM and any BC7 file. Is this something that will be supported in the future?

Extendible formats

Allow for easy addition of new file/texture formats instead of it all being hardcoded. For now, just make it work.

Dithering support

It should be possible to implement dithering at the selector finding step by adding an ordered dither pattern to the data.

Possible issues:

  • PSNR favors non-dithered data, so error value calculation may need to be changed, and benchmarking may be difficult
  • blocks with endpoints of different hues may end up looking strange with dithering applied

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.