More interface changes, update bindings.

Move globals to Compress class, to do CUDA initialization only once.
enableCUDA is broken, will be fixed later tonight.
This commit is contained in:
castano 2008-01-26 02:46:12 +00:00
parent 07d82f3ab2
commit d2105f922c
13 changed files with 228 additions and 186 deletions

View File

@ -5,6 +5,7 @@ ADD_SUBDIRECTORY(squish)
SET(NVTT_SRCS
nvtt.h
nvtt.cpp
Compressor.h
nvtt_wrapper.h
nvtt_wrapper.cpp
CompressDXT.h

View File

@ -215,7 +215,7 @@ void nv::compressDXT1(const Image * image, const OutputOptions::Private & output
fit.setMetric(compressionOptions.colorWeight.x(), compressionOptions.colorWeight.y(), compressionOptions.colorWeight.z());
fit.Compress(&block);
// @@ Use iterative cluster fit algorithm to improve error in highest quality mode.
// @@ Use iterative cluster fit algorithm to improve error in production quality mode.
if (outputOptions.outputHandler != NULL) {
outputOptions.outputHandler->writeData(&block, sizeof(block));

View File

@ -91,7 +91,7 @@ void CompressionOptions::setColorWeights(float red, float green, float blue, flo
m.colorWeight.set(red, green, blue, alpha);
}
/*
/// Enable or disable CUDA compression.
void CompressionOptions::enableHardwareCompression(bool enable)
{
@ -103,6 +103,7 @@ void CompressionOptions::enableCudaCompression(bool enable)
{
m.useCuda = enable;
}
*/
/// Set color mask to describe the RGB/RGBA format.

0
src/nvtt/Compressor.cpp Normal file
View File

43
src/nvtt/Compressor.h Normal file
View File

@ -0,0 +1,43 @@
// Copyright NVIDIA Corporation 2008 -- Ignacio Castano <icastano@nvidia.com>
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
#ifndef NV_TT_COMPRESSOR_H
#define NV_TT_COMPRESSOR_H
#include "nvtt.h"
namespace nvtt
{
struct Compressor::Private
{
Private() {}
bool cudaSupported;
bool cudaEnabled;
};
} // nvtt namespace
#endif // NV_TT_COMPRESSOR_H

View File

@ -208,11 +208,6 @@ bool InputOptions::setMipmapData(const void * data, int width, int height, int d
/// Describe the format of the input.
void InputOptions::setFormat(InputFormat format, /*deprecated*/bool alphaTransparency)
{
m.inputFormat = format;
//m.alphaTransparency = alphaTransparency;
}
void InputOptions::setFormat(InputFormat format)
{
m.inputFormat = format;
@ -386,21 +381,3 @@ int InputOptions::Private::realMipmapCount() const
}
// Called everytime max extents or rounding mode changes.
int InputOptions::Private::firstMipmap(int face) const
{
nvCheck(images != NULL);
// @@ Find the last image that's not NULL and is greater than target extents.
uint first = 0;
for (uint f = 0; f < mipmapCount; f++)
{
}
return first;
}

View File

@ -87,7 +87,6 @@ namespace nvtt
void computeTargetExtents() const;
int realMipmapCount() const;
int firstMipmap(int face) const;
};

View File

@ -31,13 +31,6 @@ OutputOptions::OutputOptions() : m(*new OutputOptions::Private())
reset();
}
OutputOptions::OutputOptions(OutputHandler * oh, ErrorHandler * eh) : m(*new OutputOptions::Private())
{
reset();
outputHandler = oh;
errorHandler = eh;
}
OutputOptions::~OutputOptions()
{
delete &m;
@ -50,10 +43,6 @@ void OutputOptions::reset()
m.outputHandler = NULL;
m.errorHandler = NULL;
m.outputHeader = true;
outputHandler = NULL;
errorHandler = NULL;
outputHeader = true;
}
@ -61,26 +50,26 @@ void OutputOptions::reset()
void OutputOptions::setFileName(const char * fileName)
{
m.fileName = fileName;
outputHandler = NULL;
m.outputHandler = NULL;
}
/// Set output handler.
void OutputOptions::setOutputHandler(OutputHandler * outputHandler)
{
m.fileName.reset();
this->outputHandler = outputHandler;
m.outputHandler = outputHandler;
}
/// Set error handler.
void OutputOptions::setErrorHandler(ErrorHandler * errorHandler)
{
this->errorHandler = errorHandler;
m.errorHandler = errorHandler;
}
/// Set output header.
void OutputOptions::setOutputHeader(bool outputHeader)
{
this->outputHeader = outputHeader;
m.outputHeader = outputHeader;
}
@ -111,15 +100,3 @@ void OutputOptions::Private::closeFile() const
}
}
void nvtt::initOptions(OutputOptions * outputOptions)
{
nvDebugCheck(outputOptions != NULL);
OutputOptions::Private & pimpl = outputOptions->m;
pimpl.outputHandler = outputOptions->outputHandler;
pimpl.errorHandler = outputOptions->errorHandler;
pimpl.outputHeader = outputOptions->outputHeader;
}

View File

@ -45,9 +45,12 @@ namespace nvtt
}
// Output data.
virtual void writeData(const void * data, int size)
virtual bool writeData(const void * data, int size)
{
stream.serialize(const_cast<void *>(data), size);
//return !stream.isError();
return true;
}
nv::StdOutputStream stream;
@ -59,16 +62,13 @@ namespace nvtt
nv::Path fileName;
mutable OutputHandler * outputHandler;
mutable ErrorHandler * errorHandler;
mutable bool outputHeader;
ErrorHandler * errorHandler;
bool outputHeader;
bool openFile() const;
void closeFile() const;
};
// @@ temporary hack to copy public attributes to pimpl.
void initOptions(OutputOptions * outputOptions);
} // nvtt namespace

View File

@ -33,12 +33,14 @@
#include <nvimage/Quantize.h>
#include <nvimage/NormalMap.h>
#include "CompressDXT.h"
#include "FastCompressDXT.h"
#include "CompressRGB.h"
#include "Compressor.h"
#include "InputOptions.h"
#include "CompressionOptions.h"
#include "OutputOptions.h"
#include "CompressDXT.h"
#include "FastCompressDXT.h"
#include "CompressRGB.h"
#include "cuda/CudaUtils.h"
#include "cuda/CudaCompressDXT.h"
@ -97,79 +99,86 @@ namespace
// compress
//
static void outputHeader(const InputOptions::Private & inputOptions, const OutputOptions::Private & outputOptions, const CompressionOptions::Private & compressionOptions)
static bool outputHeader(const InputOptions::Private & inputOptions, const OutputOptions::Private & outputOptions, const CompressionOptions::Private & compressionOptions)
{
// Output DDS header.
if (outputOptions.outputHandler != NULL && outputOptions.outputHeader)
if (outputOptions.outputHandler == NULL || !outputOptions.outputHeader)
{
DDSHeader header;
header.setWidth(inputOptions.targetWidth);
header.setHeight(inputOptions.targetHeight);
int mipmapCount = inputOptions.realMipmapCount();
nvDebugCheck(mipmapCount > 0);
header.setMipmapCount(mipmapCount);
if (inputOptions.textureType == TextureType_2D) {
header.setTexture2D();
}
else if (inputOptions.textureType == TextureType_Cube) {
header.setTextureCube();
}
/*else if (inputOptions.textureType == TextureType_3D) {
header.setTexture3D();
header.setDepth(inputOptions.targetDepth);
}*/
if (compressionOptions.format == Format_RGBA)
{
header.setPitch(4 * inputOptions.targetWidth);
header.setPixelFormat(compressionOptions.bitcount, compressionOptions.rmask, compressionOptions.gmask, compressionOptions.bmask, compressionOptions.amask);
}
else
{
header.setLinearSize(computeImageSize(inputOptions.targetWidth, inputOptions.targetHeight, compressionOptions.bitcount, compressionOptions.format));
if (compressionOptions.format == Format_DXT1 || compressionOptions.format == Format_DXT1a) {
header.setFourCC('D', 'X', 'T', '1');
}
else if (compressionOptions.format == Format_DXT3) {
header.setFourCC('D', 'X', 'T', '3');
}
else if (compressionOptions.format == Format_DXT5) {
header.setFourCC('D', 'X', 'T', '5');
}
else if (compressionOptions.format == Format_DXT5n) {
header.setFourCC('D', 'X', 'T', '5');
if (inputOptions.isNormalMap) header.setNormalFlag(true);
}
else if (compressionOptions.format == Format_BC4) {
header.setFourCC('A', 'T', 'I', '1');
}
else if (compressionOptions.format == Format_BC5) {
header.setFourCC('A', 'T', 'I', '2');
if (inputOptions.isNormalMap) header.setNormalFlag(true);
}
}
// Swap bytes if necessary.
header.swapBytes();
nvStaticCheck(sizeof(DDSHeader) == 128 + 20);
if (header.hasDX10Header())
{
outputOptions.outputHandler->writeData(&header, 128 + 20);
}
else
{
outputOptions.outputHandler->writeData(&header, 128);
}
// Revert swap.
header.swapBytes();
return true;
}
DDSHeader header;
header.setWidth(inputOptions.targetWidth);
header.setHeight(inputOptions.targetHeight);
int mipmapCount = inputOptions.realMipmapCount();
nvDebugCheck(mipmapCount > 0);
header.setMipmapCount(mipmapCount);
if (inputOptions.textureType == TextureType_2D) {
header.setTexture2D();
}
else if (inputOptions.textureType == TextureType_Cube) {
header.setTextureCube();
}
/*else if (inputOptions.textureType == TextureType_3D) {
header.setTexture3D();
header.setDepth(inputOptions.targetDepth);
}*/
if (compressionOptions.format == Format_RGBA)
{
header.setPitch(4 * inputOptions.targetWidth);
header.setPixelFormat(compressionOptions.bitcount, compressionOptions.rmask, compressionOptions.gmask, compressionOptions.bmask, compressionOptions.amask);
}
else
{
header.setLinearSize(computeImageSize(inputOptions.targetWidth, inputOptions.targetHeight, compressionOptions.bitcount, compressionOptions.format));
if (compressionOptions.format == Format_DXT1 || compressionOptions.format == Format_DXT1a) {
header.setFourCC('D', 'X', 'T', '1');
}
else if (compressionOptions.format == Format_DXT3) {
header.setFourCC('D', 'X', 'T', '3');
}
else if (compressionOptions.format == Format_DXT5) {
header.setFourCC('D', 'X', 'T', '5');
}
else if (compressionOptions.format == Format_DXT5n) {
header.setFourCC('D', 'X', 'T', '5');
if (inputOptions.isNormalMap) header.setNormalFlag(true);
}
else if (compressionOptions.format == Format_BC4) {
header.setFourCC('A', 'T', 'I', '1');
}
else if (compressionOptions.format == Format_BC5) {
header.setFourCC('A', 'T', 'I', '2');
if (inputOptions.isNormalMap) header.setNormalFlag(true);
}
}
// Swap bytes if necessary.
header.swapBytes();
uint headerSize = 128;
if (header.hasDX10Header())
{
nvStaticCheck(sizeof(DDSHeader) == 128 + 20);
headerSize = 128 + 20;
}
bool writeSucceed = outputOptions.outputHandler->writeData(&header, headerSize);
if (!writeSucceed && outputOptions.errorHandler != NULL)
{
outputOptions.errorHandler->error(Error_FileWrite);
}
// Revert swap.
header.swapBytes();
return writeSucceed;
}
@ -636,13 +645,16 @@ static bool compress(const InputOptions::Private & inputOptions, const OutputOpt
if (!outputOptions.openFile())
{
if (outputOptions.errorHandler) outputOptions.errorHandler->error(Error_FileOpen);
// @@ Should return here?
return false;
}
inputOptions.computeTargetExtents();
// Output DDS header.
outputHeader(inputOptions, outputOptions, compressionOptions);
if (!outputHeader(inputOptions, outputOptions, compressionOptions))
{
return false;
}
for (uint f = 0; f < inputOptions.faceCount; f++)
{
@ -658,18 +670,43 @@ static bool compress(const InputOptions::Private & inputOptions, const OutputOpt
}
/// Compress the input texture with the given compression options.
bool nvtt::compress(const InputOptions & inputOptions, const OutputOptions & outputOptions, const CompressionOptions & compressionOptions)
Compressor::Compressor() : m(*new Compressor::Private())
{
m.cudaSupported = cuda::isHardwarePresent();
m.cudaEnabled = true;
// @@ Do CUDA initialization here.
}
Compressor::~Compressor()
{
// @@ Free CUDA resources here.
}
void Compressor::enableCudaAceleration(bool enable)
{
if (m.cudaSupported)
{
m.cudaEnabled = enable;
}
}
bool Compressor::isCudaAcelerationEnabled() const
{
return m.cudaEnabled;
}
/// Compress the input texture with the given compression options.
bool Compressor::process(const InputOptions & inputOptions, const CompressionOptions & compressionOptions, const OutputOptions & outputOptions) const
{
// @@ Hack this is necessary because of the pimpl transition.
initOptions(const_cast<OutputOptions *>(&outputOptions));
return ::compress(inputOptions.m, outputOptions.m, compressionOptions.m);
}
/// Estimate the size of compressing the input with the given options.
int nvtt::estimateSize(const InputOptions & inputOptions, const CompressionOptions & compressionOptions)
int Compressor::estimateSize(const InputOptions & inputOptions, const CompressionOptions & compressionOptions) const
{
const Format format = compressionOptions.m.format;
const uint bitCount = compressionOptions.m.bitcount;
@ -706,10 +743,10 @@ const char * nvtt::errorString(Error e)
{
switch(e)
{
case Error_Unknown:
return "Unknown error";
case Error_InvalidInput:
return "Invalid input";
case Error_UserInterruption:
return "User interruption";
case Error_UnsupportedFeature:
return "Unsupported feature";
case Error_CudaError:
@ -718,9 +755,6 @@ const char * nvtt::errorString(Error e)
return "Error opening file";
case Error_FileWrite:
return "Error writing through output handler";
case Error_Unknown:
//default:
return "Unknown error";
}
return "Invalid error";

View File

@ -98,9 +98,6 @@ namespace nvtt
NVTT_API void setQuality(Quality quality);
NVTT_API void setColorWeights(float red, float green, float blue, float alpha = 1.0f);
NVTT_DEPRECATED void enableHardwareCompression(bool enable);
NVTT_API void enableCudaCompression(bool enable);
NVTT_API void setExternalCompressor(const char * name);
// Set color mask to describe the RGB/RGBA format.
@ -187,7 +184,6 @@ namespace nvtt
NVTT_API bool setMipmapData(const void * data, int w, int h, int d = 1, int face = 0, int mipmap = 0);
// Describe the format of the input.
NVTT_DEPRECATED void setFormat(InputFormat format, bool alphaTransparency);
NVTT_API void setFormat(InputFormat format);
// Set the way the input alpha channel is interpreted.
@ -203,9 +199,6 @@ namespace nvtt
NVTT_API void setMipmapping(bool generateMipmaps, MipmapFilter filter = MipmapFilter_Box, int maxLevel = -1);
NVTT_API void setKaiserParameters(float width, float alpha, float stretch);
// Set quantization options.
NVTT_DEPRECATED void setQuantization(bool colorDithering, bool alphaDithering, bool binaryAlpha, int alphaThreshold = 127);
// Set normal map options.
NVTT_API void setNormalMap(bool b);
NVTT_API void setConvertToNormalMap(bool convert);
@ -236,17 +229,16 @@ namespace nvtt
virtual void mipmap(int size, int width, int height, int depth, int face, int miplevel) = 0;
/// Output data. Compressed data is output as soon as it's generated to minimize memory allocations.
virtual void writeData(const void * data, int size) = 0;
virtual bool writeData(const void * data, int size) = 0;
};
/// Error codes.
enum Error
{
Error_Unknown,
Error_InvalidInput,
Error_UserInterruption,
Error_UnsupportedFeature,
Error_CudaError,
Error_Unknown,
Error_FileOpen,
Error_FileWrite,
};
@ -266,7 +258,6 @@ namespace nvtt
struct OutputOptions
{
NVTT_API OutputOptions();
NVTT_DEPRECATED OutputOptions(OutputHandler * oh, ErrorHandler * eh);
NVTT_API ~OutputOptions();
// Set default options.
@ -278,25 +269,37 @@ namespace nvtt
NVTT_API void setErrorHandler(ErrorHandler * errorHandler);
NVTT_API void setOutputHeader(bool outputHeader);
OutputHandler * outputHandler;
ErrorHandler * errorHandler;
bool outputHeader;
//private:
struct Private;
Private & m;
};
/// Texture compressor.
struct Compressor
{
NVTT_API Compressor();
NVTT_API ~Compressor();
NVTT_API void enableCudaAceleration(bool enable);
NVTT_API bool isCudaAcelerationEnabled() const;
// Main entrypoint of the compression library.
NVTT_API bool process(const InputOptions & inputOptions, const CompressionOptions & compressionOptions, const OutputOptions & outputOptions) const;
// Estimate the size of compressing the input with the given options.
NVTT_API int estimateSize(const InputOptions & inputOptions, const CompressionOptions & compressionOptions) const;
//private:
struct Private;
Private & m;
};
// Main entrypoint of the compression library.
NVTT_API bool compress(const InputOptions & inputOptions, const OutputOptions & outputOptions, const CompressionOptions & compressionOptions);
// Estimate the size of compressing the input with the given options.
NVTT_API int estimateSize(const InputOptions & inputOptions, const CompressionOptions & compressionOptions);
// Return string for the given error.
// Return string for the given error code.
NVTT_API const char * errorString(Error e);
} // nvtt namespace
#endif // NV_TT_H

View File

@ -3,7 +3,7 @@
#include "nvtt_wrapper.h"
// Input Options
// InputOptions class.
NvttInputOptions * nvttCreateInputOptions()
{
return new nvtt::InputOptions();
@ -44,7 +44,6 @@ void nvttSetInputOptionsGamma(NvttInputOptions * inputOptions, float inputGamma,
inputOptions->setGamma(inputGamma, outputGamma);
}
void nvttSetInputOptionsWrapMode(NvttInputOptions * inputOptions, NvttWrapMode mode)
{
inputOptions->setWrapMode((nvtt::WrapMode)mode);
@ -106,7 +105,7 @@ void nvttSetInputOptionsRoundMode(NvttInputOptions * inputOptions, NvttRoundMode
}
// Compression Options
// CompressionOptions class.
NvttCompressionOptions * nvttCreateCompressionOptions()
{
return new nvtt::CompressionOptions();
@ -132,10 +131,10 @@ void nvttSetCompressionOptionsColorWeights(NvttCompressionOptions * compressionO
compressionOptions->setColorWeights(red, green, blue, alpha);
}
void nvttEnableCompressionOptionsCudaCompression(NvttCompressionOptions * compressionOptions, NvttBoolean enable)
/*void nvttEnableCompressionOptionsCudaCompression(NvttCompressionOptions * compressionOptions, NvttBoolean enable)
{
compressionOptions->enableCudaCompression(enable != NVTT_False);
}
}*/
void nvttSetCompressionOptionsPixelFormat(NvttCompressionOptions * compressionOptions, unsigned int bitcount, unsigned int rmask, unsigned int gmask, unsigned int bmask, unsigned int amask)
{
@ -148,7 +147,7 @@ void nvttSetCompressionOptionsQuantization(NvttCompressionOptions * compressionO
}
// Output Options
// OutputOptions class.
NvttOutputOptions * nvttCreateOutputOptions()
{
return new nvtt::OutputOptions();
@ -180,17 +179,19 @@ void nvttSetOutputOptionsOutputHandler(NvttOutputOptions * outputOptions, nvttOu
*/
// Main entrypoints.
NvttBoolean nvttCompress(const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions, const NvttOutputOptions * outputOptions)
// Compressor class.
NvttBoolean nvttCompress(const NvttCompressor * compressor, const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions, const NvttOutputOptions * outputOptions)
{
return (NvttBoolean)nvtt::compress(*inputOptions, *outputOptions, *compressionOptions);
return (NvttBoolean)compressor->process(*inputOptions, *compressionOptions, *outputOptions);
}
int nvttEstimateSize(const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions)
int nvttEstimateSize(const NvttCompressor * compressor, const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions)
{
return nvtt::estimateSize(*inputOptions, *compressionOptions);
return compressor->estimateSize(*inputOptions, *compressionOptions);
}
// Global functions.
const char * nvttErrorString(NvttError e)
{
return nvtt::errorString((nvtt::Error)e);

View File

@ -51,10 +51,12 @@
typedef struct nvtt::InputOptions NvttInputOptions;
typedef struct nvtt::CompressionOptions NvttCompressionOptions;
typedef struct nvtt::OutputOptions NvttOutputOptions;
typedef struct nvtt::Compressor NvttCompressor;
#else
typedef struct NvttInputOptions NvttInputOptions;
typedef struct NvttCompressionOptions NvttCompressionOptions;
typedef struct NvttOutputOptions NvttOutputOptions;
typedef struct NvttCompressor NvttCompressor;
#endif
/// Supported compression formats.
@ -169,8 +171,9 @@ extern "C" {
//typedef void (* nvttErrorHandler)(NvttError e);
//typedef void (* nvttOutputHandler)(const void * data, int size);
//typedef void (* nvttImageHandler)(int size, int width, int height, int depth, int face, int miplevel);
// Input Options
// InputOptions class.
NVTT_API NvttInputOptions * nvttCreateInputOptions();
NVTT_API void nvttDestroyInputOptions(NvttInputOptions * inputOptions);
@ -194,7 +197,7 @@ NVTT_API void nvttSetInputOptionsMaxExtents(NvttInputOptions * inputOptions, int
NVTT_API void nvttSetInputOptionsRoundMode(NvttInputOptions * inputOptions, NvttRoundMode mode);
// Compression Options
// CompressionOptions class.
NVTT_API NvttCompressionOptions * nvttCreateCompressionOptions();
NVTT_API void nvttDestroyCompressionOptions(NvttCompressionOptions * compressionOptions);
@ -206,7 +209,7 @@ NVTT_API void nvttSetCompressionOptionsPixelFormat(NvttCompressionOptions * comp
NVTT_API void nvttSetCompressionOptionsQuantization(NvttCompressionOptions * compressionOptions, NvttBoolean colorDithering, NvttBoolean alphaDithering, NvttBoolean binaryAlpha, int alphaThreshold);
// Output Options
// OutputOptions class.
NVTT_API NvttOutputOptions * nvttCreateOutputOptions();
NVTT_API void nvttDestroyOutputOptions(NvttOutputOptions * outputOptions);
@ -216,15 +219,18 @@ NVTT_API void nvttSetOutputOptionsOutputHeader(NvttOutputOptions * outputOptions
//NVTT_API void nvttSetOutputOptionsOutputHandler(NvttOutputOptions * outputOptions, nvttOutputHandler outputHandler, nvttImageHandler imageHandler);
// Main entrypoint of the compression library.
NVTT_API NvttBoolean nvttCompress(NvttInputOptions * inputOptions, NvttCompressionOptions * compressionOptions, NvttOutputOptions * outputOptions);
// Estimate the size of compressing the input with the given options.
NVTT_API int nvttEstimateSize(NvttInputOptions * inputOptions, NvttCompressionOptions * compressionOptions);
// Compressor class.
NVTT_API NvttCompressor * nvttCreateCompressor();
NVTT_API void nvttDestroyCompressor(NvttCompressor * compressor);
// Return string for the given error.
NVTT_API NvttBoolean nvttCompress(const NvttCompressor * compressor, const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions, const NvttOutputOptions * outputOptions);
NVTT_API int nvttEstimateSize(const NvttCompressor * compressor, const NvttInputOptions * inputOptions, const NvttCompressionOptions * compressionOptions);
// Global functions.
NVTT_API const char * nvttErrorString(NvttError e);
#ifdef __cplusplus
} // extern "C"
#endif