nvtt
|
Compression context. More...
#include <nvtt.h>
Public Member Functions | |
NVTT_API | Context (bool enableCuda=true) |
Create a compression context. | |
NVTT_API void | enableCudaAcceleration (bool enable) |
Enable CUDA acceleration; initializes CUDA if not already initialized. | |
NVTT_API bool | isCudaAccelerationEnabled () const |
Check if CUDA acceleration is enabled. | |
NVTT_API bool | outputHeader (const Surface &img, int mipmapCount, const CompressionOptions &compressionOptions, const OutputOptions &outputOptions) const |
Write the Container's header to the output. | |
NVTT_API bool | compress (const Surface &img, int face, int mipmap, const CompressionOptions &compressionOptions, const OutputOptions &outputOptions) const |
Compress the Surface and write the compressed data to the output. | |
NVTT_API int | estimateSize (const Surface &img, int mipmapCount, const CompressionOptions &compressionOptions) const |
Returns the total compressed size of mips 0...mipmapCount-1 , without compressing the image. | |
NVTT_API void | quantize (Surface &tex, const CompressionOptions &compressionOptions) const |
Quantize a Surface to the number of bits per channel of the given format. | |
NVTT_API bool | outputHeader (const CubeSurface &cube, int mipmapCount, const CompressionOptions &compressionOptions, const OutputOptions &outputOptions) const |
Write the Container's header to the output. | |
NVTT_API bool | compress (const CubeSurface &cube, int mipmap, const CompressionOptions &compressionOptions, const OutputOptions &outputOptions) const |
Compress the CubeSurface and write the compressed data to the output. | |
NVTT_API int | estimateSize (const CubeSurface &cube, int mipmapCount, const CompressionOptions &compressionOptions) const |
Returns the total compressed size of mips 0...mipmapCount-1 , without compressing the image. | |
NVTT_API bool | outputHeader (TextureType type, int w, int h, int d, int mipmapCount, bool isNormalMap, const CompressionOptions &compressionOptions, const OutputOptions &outputOptions) const |
Write the Container's header to the output. | |
NVTT_API bool | compress (int w, int h, int d, int face, int mipmap, const float *rgba, const CompressionOptions &compressionOptions, const OutputOptions &outputOptions) const |
Compress raw data and write the compressed data to the output. | |
NVTT_API int | estimateSize (int w, int h, int d, int mipmapCount, const CompressionOptions &compressionOptions) const |
Returns the total compressed size of mips 0...mipmapCount-1 , without compressing the image. | |
NVTT_API bool | compress (const BatchList &lst, const CompressionOptions &compressionOptions) const |
Batch processing compression interface. | |
NVTT_API void | enableTiming (bool enable, int detailLevel=1) |
Enables performance measurement. May introduce additional synchronization. | |
NVTT_API TimingContext * | getTimingContext () |
Returns a TimingContext containing recorded compression performance information. | |
Compression context.
NVTT_API nvtt::Context::Context | ( | bool | enableCuda = true | ) |
Create a compression context.
enableCuda | If true, enables CUDA acceleration (same as calling enableCudaAcceleration() ). |
NVTT_API bool nvtt::Context::compress | ( | const BatchList & | lst, |
const CompressionOptions & | compressionOptions ) const |
Batch processing compression interface.
Compresses multiple inputs in a row, improving performance. Outputs data to each item's OutputHandler
.
NVTT_API bool nvtt::Context::compress | ( | const CubeSurface & | cube, |
int | mipmap, | ||
const CompressionOptions & | compressionOptions, | ||
const OutputOptions & | outputOptions ) const |
Compress the CubeSurface and write the compressed data to the output.
cube | The CubeSurface. |
mipmap | Ignored. |
compressionOptions | Specifies the compression format. |
outputOptions | Specifies how to output the data. |
NVTT_API bool nvtt::Context::compress | ( | const Surface & | img, |
int | face, | ||
int | mipmap, | ||
const CompressionOptions & | compressionOptions, | ||
const OutputOptions & | outputOptions ) const |
NVTT_API bool nvtt::Context::compress | ( | int | w, |
int | h, | ||
int | d, | ||
int | face, | ||
int | mipmap, | ||
const float * | rgba, | ||
const CompressionOptions & | compressionOptions, | ||
const OutputOptions & | outputOptions ) const |
Compress raw data and write the compressed data to the output.
Note that this only supports CPU compression. For GPU support and more options, please see nvtt_lowlevel.h.
face | Ignored. |
mipmap | Ignored. |
rgba | Color data. Assumed to be non-interleaved; i.e. the value of channel c, pixel (x, y, z) is rgba[((c*d + z)*h + y)*w + x] . |
compressionOptions | Specifies the compression format. |
outputOptions | Specifies how to output the data. |
NVTT_API void nvtt::Context::enableTiming | ( | bool | enable, |
int | detailLevel = 1 ) |
Enables performance measurement. May introduce additional synchronization.
NVTT_API int nvtt::Context::estimateSize | ( | const CubeSurface & | cube, |
int | mipmapCount, | ||
const CompressionOptions & | compressionOptions ) const |
Returns the total compressed size of mips 0...mipmapCount-1
, without compressing the image.
Note that this does not include the container header, and mips are assumed to be tightly packed.
For instance, call this with mipmapCount = cube.countMipmaps()
and add the size of the DDS header to get the size of a DDS file with a CubeSurface and a full mip chain.
cube | The CubeSurface. |
mipmapCount | The number of mips (each with size max(1, s/2) of the previous) in the mip chain to be compressed. |
compressionOptions | Specifies the compression format. |
NVTT_API int nvtt::Context::estimateSize | ( | const Surface & | img, |
int | mipmapCount, | ||
const CompressionOptions & | compressionOptions ) const |
Returns the total compressed size of mips 0...mipmapCount-1
, without compressing the image.
Note that this does not include the container header, and mips are assumed to be tightly packed.
For instance, call this with mipmapCount = img.countMipmaps()
and add the size of the DDS header to get the size of a DDS file with a surface and a full mip chain.
img | The Surface. |
mipmapCount | The number of mips (each with size max(1, s/2) of the previous) in the mip chain to be compressed. |
compressionOptions | Specifies the compression format. |
NVTT_API int nvtt::Context::estimateSize | ( | int | w, |
int | h, | ||
int | d, | ||
int | mipmapCount, | ||
const CompressionOptions & | compressionOptions ) const |
Returns the total compressed size of mips 0...mipmapCount-1
, without compressing the image.
Note that this does not include the container header, and mips are assumed to be tightly packed.
For instance, call this with mipmapCount = nvtt::countMipmaps()
and add the size of the DDS header to get the size of a DDS file with a CubeSurface and a full mip chain.
w | Width. |
h | Height. |
d | Depth. |
mipmapCount | The number of mips (each with size max(1, s/2) of the previous) in the mip chain to be compressed. |
compressionOptions | Specifies the compression format. |
NVTT_API TimingContext * nvtt::Context::getTimingContext | ( | ) |
Returns a TimingContext containing recorded compression performance information.
NVTT_API bool nvtt::Context::outputHeader | ( | const CubeSurface & | cube, |
int | mipmapCount, | ||
const CompressionOptions & | compressionOptions, | ||
const OutputOptions & | outputOptions ) const |
Write the Container's header to the output.
cube | The CubeSurface to read sizes from. |
mipmapCount | The number of mipmaps in the container. |
NVTT_API bool nvtt::Context::outputHeader | ( | const Surface & | img, |
int | mipmapCount, | ||
const CompressionOptions & | compressionOptions, | ||
const OutputOptions & | outputOptions ) const |
Write the Container's header to the output.
mipmapCount | The number of mipmaps in the container. |
NVTT_API bool nvtt::Context::outputHeader | ( | TextureType | type, |
int | w, | ||
int | h, | ||
int | d, | ||
int | mipmapCount, | ||
bool | isNormalMap, | ||
const CompressionOptions & | compressionOptions, | ||
const OutputOptions & | outputOptions ) const |
Write the Container's header to the output.
mipmapCount | The number of mipmaps in the container. |
NVTT_API void nvtt::Context::quantize | ( | Surface & | tex, |
const CompressionOptions & | compressionOptions ) const |
Quantize a Surface to the number of bits per channel of the given format.
This shouldn't be called unless you're confident you want to do this. Compressors quantize automatically, and calling this will cause compression to minimize error with respect to the quantized values, rather than the original image.