A fast texture compressor for various formats
Go to file
2013-09-30 12:46:23 -04:00
Base Keep track of the image size with the base image rather than the compressed image. It's not always the case that the image data is RGBA8 data. 2013-09-28 22:40:48 -04:00
BPTCEncoder Make the block index for the stat function the pointer reinterpreted as an integer. This way we know exactly what block it is because we simply need to sort the stats in the output log. 2013-09-28 22:39:27 -04:00
CLTool Add command line flags to choose between whether or not to use PVRTexLib or FasTC 2013-09-30 12:46:23 -04:00
CMakeModules Add default for PVRTexLib on linux 2013-09-24 17:44:11 -04:00
Core Add command line flags to choose between whether or not to use PVRTexLib or FasTC 2013-09-30 12:46:23 -04:00
GTest Add GTest framework 2013-08-30 12:53:44 -04:00
IO Fix some MSVC compiler snafus 2013-09-28 22:21:31 -04:00
PVRTCEncoder Add a hook into the PVRTexLib compressor if it's been found via cmake. 2013-09-30 12:38:09 -04:00
QtGUI Add license 2012-11-15 11:51:55 -05:00
Windows@326dfccf36 Added header files for libpng 1.5.13 in order to properly match the compiled libraries. 2013-03-07 02:34:09 -05:00
.gitmodules Add submodule to keep track of windows include files and libraries 2013-01-27 12:14:55 -05:00
CMakeLists.txt Initial decoupling of base library from core library. Includes a few formatting changes as well. 2013-09-13 19:36:37 -04:00
README.md Fix formatting issues on Readme.md 2013-03-27 21:39:38 -03:00

FasTC

A Fast Texture Compressor for the BPTC (a.k.a. BC7) format. This compressor supports multi-threading through Boost's threading API and runs on Windows, OS X, and Linux


Requirements:

CMake (2.8.8)
Boost (tested with v1.50 and higher)
libpng (1.5.13)
zlib (1.2.5)

Installation:

FasTC uses CMake to generate build files. The best way to do so is to create a separate build directory for compilation:

mkdir FasTC
cd FasTC
git clone git@github.com:Mokosha/FasTC.git src
mkdir build
cd build
cmake ../src -DCMAKE_BUILD_TYPE=Release
make

Once you do this you will be able to run some examples.

Using Visual Studio on Windows

Due to the C/C++ runtime requirements in Visual Studio, you must have a compiled version of each library that you wish to link to. In order to save time, I have uploaded various versions of Boost, libpng, and zlib to a submodule in the source directory. Before running the steps above, make sure to instantiate the submodule in git:

cd FasTC/src
git submodule init
git submodule update

This will download all of the Release versions of the necessary libraries (which means there will be linker errors during the build process). I have compiled versions for Visual Studio 2008, 2010, and 2012.

Testing:

Once the compressor is built, you may test it against any images you wish as long as their dimensions are multiples of four and they are in the png file format. If you'd like to convert from one format to another, I suggest taking a look at ImageMagick

The quickest test will be to simply run the compressor on a PNG image:

cd FasTC/build
make
CLTool/tc path/to/image.png

There are various run-time options available:

  • -t: Specifies the number of threads to use for compression. The default is one.
  • -l: Save an output log of various statistics during compression. This is mostly only useful for debugging.
  • -q <num>: Use num steps of simulated annealing during each endpoint compression. Default is 50
  • -n <num>: Perform num compressions in a row. This is good for testing metrics.
  • -a: Use a parallel algorithm that uses Fetch-And-Add and Test-And-Set to perform mutual exclusion and avoid synchronization primitives. This algorithm is very useful when compressing a list of textures. Cannot be used with the -j option.
  • -j <num>: This specifies the number of 4x4 blocks that the compressor will crunch per thread. The default is to split the image up so that each thread compresses an equal share of the image. However, for many images, certain blocks compress faster than others, and you might want a more fine grained control over how to switch between compressing different blocks.

As an example, if I wanted to test compressing a texture using no simulated annealing, 4 threads, and 32 blocks per job, I would invoke the following command:

CLTool/tc -q 0 -t 4 -j 32 path/to/image.png

If I wanted to compress a texture with the default amount of simulated annealing 100 times using the parallel algorithm with atomic synchronization primitives, I would invoke the following command:

CLTool/tc -n 100 -a path/to/image.png