No description
Find a file
2013-11-19 12:03:03 -05:00
Base Refactor CompressionJob struct. 2013-11-08 16:31:19 -05:00
BPTCEncoder Add hooks to NVTT bc7_export library if present on the users machine. Assumes that all of the cross platform problems are fixed for incorporation into FasTC... Otherwise the options to use NVTT are ignored. 2013-11-19 12:03:03 -05:00
CLTool Add hooks to NVTT bc7_export library if present on the users machine. Assumes that all of the cross platform problems are fixed for incorporation into FasTC... Otherwise the options to use NVTT are ignored. 2013-11-19 12:03:03 -05:00
CMakeModules Add hooks to NVTT bc7_export library if present on the users machine. Assumes that all of the cross platform problems are fixed for incorporation into FasTC... Otherwise the options to use NVTT are ignored. 2013-11-19 12:03:03 -05:00
Core Add hooks to NVTT bc7_export library if present on the users machine. Assumes that all of the cross platform problems are fixed for incorporation into FasTC... Otherwise the options to use NVTT are ignored. 2013-11-19 12:03:03 -05:00
DXTEncoder Refactor CompressionJob struct. 2013-11-08 16:31:19 -05:00
ETCEncoder Refactor CompressionJob struct. 2013-11-08 16:31:19 -05:00
GTest Add GTest framework 2013-08-30 12:53:44 -04:00
IO Fix assert to not cause warning in release and do some sane things... 2013-11-19 12:00:12 -05:00
PVRTCEncoder Refactor CompressionJob struct. 2013-11-08 16:31:19 -05:00
QtGUI
Windows@4feeeb6550 Catch up windows libs to their non-boost counterpart 2013-11-11 19:00:40 -05:00
.gitmodules Add submodule to keep track of windows include files and libraries 2013-01-27 12:14:55 -05:00
CMakeLists.txt Add hooks to NVTT bc7_export library if present on the users machine. Assumes that all of the cross platform problems are fixed for incorporation into FasTC... Otherwise the options to use NVTT are ignored. 2013-11-19 12:03:03 -05:00
README.md Update README.md 2013-11-12 11:41:27 -05:00

FasTC

A Fast Texture Compressor for a variety of formats. This compressor supports multi-threading via native Win32 threads on Windows and pthreads on other operating systems. It has been tested on Windows, OS X, and Ubuntu Linux.


Requirements:

CMake (2.8.8)
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 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 warnings during the build process under the Debug configuration). 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 supported by the compression format 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

This will compress image.png into the BPTC (BC7) format using 50 steps of simulated annealing without SIMD optimization or multithreading.

There are various run-time options available:

  • -v: Enabled verbosity, which reports Entropy, Mean Local Entropy, and MSSIM in addition to compression time and PSNR.
  • -f <fmt>: Specifies the format use for compression. fmt can be any one of the following:
  • -t: Specifies the number of threads to use for compression.
    • Default: 1
    • Formats: BPTC, ETC1, DXT1, DXT5
  • -l: Save an output log of various statistics during compression. This is mostly only useful for debugging.
    • Formats: BPTC
  • -q <num>: Use num steps of simulated annealing during each endpoint compression. Default is 50. Available only for BPTC.
    • Default: 50
    • Formats: BPTC
  • -n <num>: Perform num compressions in a row. This is good for testing metrics.
    • Default: 1
    • Formats: All
  • -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.
    • Formats: BPTC
  • -j <num>: This specifies the number of blocks that the compressor will request to crunch per thread. If this flag is not specified or set to zero, the image will be split up so that each thread compresses an equal share. 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.
    • Formats: BPTC, ETC1, DXT1, DXT5

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

If I wanted to compress a texture into PVRTC, I would invoke the following command:

CLTool/tc -f PVRTC path/to/image.png

[1] Compression code courtesy of Rich Geldreich
[2] Compression code courtesy of Intel. The idea implemented in this compressor was originally designed by J. M. P. Van Waveren