nvtt: nvtt/nvtt_lowlevel.h Source File

nvtt

Loading...
Searching...
No Matches
nvtt_lowlevel.h
Go to the documentation of this file.
1// Copyright (c) 2015 ~ 2019 NVIDIA Corporation
2//
3// Permission is hereby granted, free of charge, to any person
4// obtaining a copy of this software and associated documentation
5// files (the "Software"), to deal in the Software without
6// restriction, including without limitation the rights to use,
7// copy, modify, merge, publish, distribute, sublicense, and/or sell
8// copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following
10// conditions:
11//
12// The above copyright notice and this permission notice shall be
13// included in all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22// OTHER DEALINGS IN THE SOFTWARE.
23
47
48#ifndef nvtt_lowlevel_h
49#define nvtt_lowlevel_h
50
51#include <stddef.h>
52#include <stdint.h>
53
54#ifdef _DOXYGEN_
56#define NVTT_API
60#define NVTT_DEPRECATED_API
61#endif
62
63// Function linkage
64#if NVTT_SHARED
65
66#if defined _WIN32 || defined WIN32 || defined __NT__ || defined __WIN32__ || defined __MINGW32__
67# ifdef NVTT_EXPORTS
68# define NVTT_API __declspec(dllexport)
69# else
70# define NVTT_API __declspec(dllimport)
71# endif
72#endif
73
74#if defined __GNUC__ >= 4
75# ifdef NVTT_EXPORTS
76# define NVTT_API __attribute__((visibility("default")))
77# endif
78#endif
79
80#endif // NVTT_SHARED
81
82#if !defined NVTT_API
83# define NVTT_API
84#endif
85
86#if !defined NVTT_DEPRECATED_API
87# define NVTT_DEPRECATED_API [[deprecated]] NVTT_API
88#endif
89
90namespace nvtt
91{
93 NVTT_API bool isCudaSupported();
94
108 NVTT_API void useCurrentDevice();
109
110 struct TimingContext;
111
114 enum ValueType
115 {
116 UINT8,
117 SINT8,
118 FLOAT32,
119 FLOAT16
120 };
121
123 enum ChannelOrder
124 {
125 Red = 0,
126 Green = 1,
127 Blue = 2,
128 Alpha = 3,
129 Zero = 4,
130 One = 5
131 };
132
134 struct RefImage
135 {
136 const void *data;
137 int width = 0;
138 int height = 0;
139 int depth = 1;
140 int num_channels = 4;
141 ChannelOrder channel_swizzle[4] = { Red,Green,Blue,Alpha };
142 bool channel_interleave = true;
143 };
144
147 struct CPUInputBuffer
148 {
154 NVTT_API CPUInputBuffer(const RefImage* images, ValueType value_type, int numImages=1, int tile_w=4, int tile_h=4,
155 float WeightR=1.0f, float WeightG=1.0f, float WeightB=1.0f, float WeightA=1.0f, nvtt::TimingContext *tc = nullptr, unsigned* num_tiles = nullptr);
156
158 NVTT_API ~CPUInputBuffer();
159
161 NVTT_API int NumTiles() const;
162
164 NVTT_API void TileSize(int& tile_w, int& tile_h) const;
165
167 NVTT_API ValueType Type() const;
168
170 NVTT_API void* GetTile(int i, int& vw, int& vh) const;
171
172 struct Private;
173 Private *m;
174 };
175
178 struct GPUInputBuffer
179 {
185 NVTT_API GPUInputBuffer(const RefImage* images, ValueType value_type, int numImages = 1, int tile_w = 4, int tile_h = 4,
186 float WeightR = 1.0f, float WeightG = 1.0f, float WeightB = 1.0f, float WeightA = 1.0f, nvtt::TimingContext *tc = nullptr, unsigned* num_tiles = nullptr);
187
192 NVTT_API GPUInputBuffer(const CPUInputBuffer& cpu_buf, int begin = 0, int end = -1, nvtt::TimingContext *tc = nullptr);
193
195 NVTT_API ~GPUInputBuffer();
196
198 NVTT_API int NumTiles() const;
199
201 NVTT_API void TileSize(int& tile_w, int& tile_h) const;
202
204 NVTT_API ValueType Type() const;
205
206 struct Private;
207 Private *m;
208 };
209
211 // @@ I wish I had distinguished between "formats" and compressors.
216 // @@ Having multiple enums for the same ids only creates confusion. Clean this up.
217 enum Format
218 {
219 // No block-compression (linear).
220 Format_RGB,
221 Format_RGBA = Format_RGB,
222
223 // DX9 formats.
224 Format_DXT1,
225 Format_DXT1a,
226 Format_DXT3,
227 Format_DXT5,
228 Format_DXT5n,
229
230 // DX10 formats.
231 Format_BC1 = Format_DXT1,
232 Format_BC1a = Format_DXT1a,
233 Format_BC2 = Format_DXT3,
234 Format_BC3 = Format_DXT5,
235 Format_BC3n = Format_DXT5n,
236 Format_BC4,
237 Format_BC4S,
238 Format_ATI2,
239 Format_BC5,
240 Format_BC5S,
241
242 Format_DXT1n,
243 Format_CTX1,
244
245 Format_BC6U,
246 Format_BC6S,
247
248 Format_BC7,
249
250 //Format_BC5_Luma, // Two DXT alpha blocks encoding a single float.
270 Format_BC3_RGBM,
271
272 // 14 ASTC LDR Formats
273 // Added by Fei Yang
274 Format_ASTC_LDR_4x4,
275 Format_ASTC_LDR_5x4,
276 Format_ASTC_LDR_5x5,
277 Format_ASTC_LDR_6x5,
278 Format_ASTC_LDR_6x6,
279 Format_ASTC_LDR_8x5,
280 Format_ASTC_LDR_8x6,
281 Format_ASTC_LDR_8x8,
282 Format_ASTC_LDR_10x5,
283 Format_ASTC_LDR_10x6,
284 Format_ASTC_LDR_10x8,
285 Format_ASTC_LDR_10x10,
286 Format_ASTC_LDR_12x10,
287 Format_ASTC_LDR_12x12,
288
289 Format_Count,
290
293 Format_Unset = 255
294 };
295
301 enum PixelType
302 {
303 PixelType_UnsignedNorm = 0,
304 PixelType_SignedNorm = 1,
305 PixelType_UnsignedInt = 2,
306 PixelType_SignedInt = 3,
307 PixelType_Float = 4,
308 PixelType_UnsignedFloat = 5,
309 PixelType_SharedExp = 6,
310 };
311
328 enum Quality
329 {
330 Quality_Fastest,
331 Quality_Normal,
332 Quality_Production,
333 Quality_Highest,
334 };
335
338 static const uint32_t EncodeSettings_Version_1 = 1;
339
341 enum EncodeFlags : uint32_t
342 {
343 EncodeFlags_None = 0,
345 EncodeFlags_UseGPU = 1 << 0,
349 EncodeFlags_OutputToGPUMem = 1 << 1,
353 EncodeFlags_Opaque = 1 << 2
354 };
355
387 struct EncodeSettings
388 {
393 uint32_t sType = EncodeSettings_Version_1;
395 Format format = Format_Unset;
397 Quality quality = Quality_Normal;
400 PixelType rgb_pixel_type = (PixelType)0;
402 TimingContext *timing_context = nullptr;
406 uint32_t encode_flags = EncodeFlags_UseGPU;
407
410 NVTT_API EncodeSettings& SetFormat(Format _format);
411 NVTT_API EncodeSettings& SetQuality(Quality _quality);
412 NVTT_API EncodeSettings& SetRGBPixelType(PixelType _rgb_pixel_type);
413 NVTT_API EncodeSettings& SetTimingContext(TimingContext *_timing_context);
415 NVTT_API EncodeSettings& SetUseGPU(bool _use_gpu);
417 NVTT_API EncodeSettings& SetOutputToGPUMem(bool _to_device_mem);
419 NVTT_API EncodeSettings& SetIsOpaque(bool _is_opaque);
420 };
421
451 NVTT_API bool nvtt_encode(const CPUInputBuffer& input, void* output, const EncodeSettings& settings);
452
486 NVTT_API bool nvtt_encode(const GPUInputBuffer& input, void* output, const EncodeSettings& settings);
487
494
496
518 NVTT_DEPRECATED_API void nvtt_encode_bc1(const CPUInputBuffer& input, bool fast_mode, void* output, bool useGpu = false, bool to_device_mem = false, nvtt::TimingContext *tc = nullptr);
519
539 NVTT_DEPRECATED_API void nvtt_encode_bc1(const GPUInputBuffer& input, bool fast_mode, void* output, bool to_device_mem = true, nvtt::TimingContext *tc = nullptr);
540
542
544
569 NVTT_DEPRECATED_API void nvtt_encode_bc1a(const CPUInputBuffer& input, bool fast_mode, void* output, bool useGpu = false, bool to_device_mem = false, nvtt::TimingContext *tc = nullptr);
570
587 NVTT_DEPRECATED_API void nvtt_encode_bc1a(const GPUInputBuffer& input, void* output, bool to_device_mem = true, nvtt::TimingContext *tc = nullptr);
588
590
592
617 NVTT_DEPRECATED_API void nvtt_encode_bc2(const CPUInputBuffer& input, bool fast_mode, void* output, bool useGpu = false, bool to_device_mem = false, nvtt::TimingContext *tc = nullptr);
618
635 NVTT_DEPRECATED_API void nvtt_encode_bc2(const GPUInputBuffer& input, void* output, bool to_device_mem = true, nvtt::TimingContext *tc = nullptr);
636
638
640
665 NVTT_DEPRECATED_API void nvtt_encode_bc3(const CPUInputBuffer& input, bool fast_mode, void* output, bool useGpu = false, bool to_device_mem = false, nvtt::TimingContext *tc = nullptr);
666
683 NVTT_DEPRECATED_API void nvtt_encode_bc3(const GPUInputBuffer& input, void* output, bool to_device_mem = true, nvtt::TimingContext *tc = nullptr);
684
686
688
705 NVTT_DEPRECATED_API void nvtt_encode_bc3n(const CPUInputBuffer& input, int qualityLevel, void* output, nvtt::TimingContext *tc = nullptr);
706
708
710
723 NVTT_DEPRECATED_API void nvtt_encode_bc3_rgbm(const CPUInputBuffer& input, void* output, nvtt::TimingContext *tc = nullptr);
724
726
728
752 NVTT_DEPRECATED_API void nvtt_encode_bc4(const CPUInputBuffer& input, bool slow_mode, void* output, bool useGpu = false, bool to_device_mem = false, nvtt::TimingContext *tc = nullptr);
753
770 NVTT_DEPRECATED_API void nvtt_encode_bc4(const GPUInputBuffer& input, void* output, bool to_device_mem = true, nvtt::TimingContext *tc = nullptr);
771
773
775
799 NVTT_DEPRECATED_API void nvtt_encode_bc4s(const CPUInputBuffer& input, bool slow_mode, void* output, bool useGpu = false, bool to_device_mem = false, nvtt::TimingContext *tc = nullptr);
800
817 NVTT_DEPRECATED_API void nvtt_encode_bc4s(const GPUInputBuffer& input, void* output, bool to_device_mem = true, nvtt::TimingContext *tc = nullptr);
818
820
822
846 NVTT_DEPRECATED_API void nvtt_encode_ati2(const CPUInputBuffer& input, bool slow_mode, void* output, bool useGpu = false, bool to_device_mem = false, nvtt::TimingContext *tc = nullptr);
847
864 NVTT_DEPRECATED_API void nvtt_encode_ati2(const GPUInputBuffer& input, void* output, bool to_device_mem = true, nvtt::TimingContext *tc = nullptr);
865
867
869
893 NVTT_DEPRECATED_API void nvtt_encode_bc5(const CPUInputBuffer& input, bool slow_mode, void* output, bool useGpu = false, bool to_device_mem = false, nvtt::TimingContext *tc = nullptr);
894
911 NVTT_DEPRECATED_API void nvtt_encode_bc5(const GPUInputBuffer& input, void* output, bool to_device_mem = true, nvtt::TimingContext *tc = nullptr);
912
914
916
940 NVTT_DEPRECATED_API void nvtt_encode_bc5s(const CPUInputBuffer& input, bool slow_mode, void* output, bool useGpu = false, bool to_device_mem = false, nvtt::TimingContext *tc = nullptr);
941
958 NVTT_DEPRECATED_API void nvtt_encode_bc5s(const GPUInputBuffer& input, void* output, bool to_device_mem = true, nvtt::TimingContext *tc = nullptr);
959
961
963
994 NVTT_DEPRECATED_API void nvtt_encode_bc7(const CPUInputBuffer& input, bool slow_mode, bool imageHasAlpha, void* output, bool useGpu = false, bool to_device_mem = false, nvtt::TimingContext *tc = nullptr);
995
1016 NVTT_DEPRECATED_API void nvtt_encode_bc7(const GPUInputBuffer& input, bool imageHasAlpha, void* output, bool to_device_mem = true, nvtt::TimingContext *tc = nullptr);
1017
1019
1021
1047 NVTT_DEPRECATED_API void nvtt_encode_bc6h(const CPUInputBuffer& input, bool slow_mode, bool is_signed, void* output, bool useGpu = false, bool to_device_mem = false, nvtt::TimingContext *tc = nullptr);
1048
1067 NVTT_DEPRECATED_API void nvtt_encode_bc6h(const GPUInputBuffer& input, bool is_signed, void* output, bool to_device_mem = true, nvtt::TimingContext *tc = nullptr);
1068
1070
1072
1098 NVTT_DEPRECATED_API void nvtt_encode_astc(const CPUInputBuffer& input, int qualityLevel, bool imageHasAlpha, void* output, bool useGpu = false, bool to_device_mem= false, nvtt::TimingContext *tc = nullptr);
1099
1122 NVTT_DEPRECATED_API void nvtt_encode_astc(const GPUInputBuffer& input, int qualityLevel, bool imageHasAlpha, void* output, bool to_device_mem = true, nvtt::TimingContext *tc = nullptr);
1123
1125}
1126
1127#endif // nvtt_lowlevel_h
nvtt
Namespace for all public non-macro NVTT fields.
Definition nvtt.h:52
nvtt::nvtt_encode_bc3_rgbm
NVTT_DEPRECATED_API void nvtt_encode_bc3_rgbm(const CPUInputBuffer &input, void *output, nvtt::TimingContext *tc=nullptr)
nvtt::ChannelOrder
ChannelOrder
Name of channels for defining a swizzling.
Definition nvtt_lowlevel.h:124
nvtt::isCudaSupported
NVTT_API bool isCudaSupported()
Check if CUDA is supported by the run-time environment.
nvtt::nvtt_encode_bc2
NVTT_DEPRECATED_API void nvtt_encode_bc2(const CPUInputBuffer &input, bool fast_mode, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr)
nvtt::nvtt_encode_bc4
NVTT_DEPRECATED_API void nvtt_encode_bc4(const CPUInputBuffer &input, bool slow_mode, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr)
nvtt::nvtt_encode_bc5
NVTT_DEPRECATED_API void nvtt_encode_bc5(const CPUInputBuffer &input, bool slow_mode, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr)
nvtt::useCurrentDevice
NVTT_API void useCurrentDevice()
Tells NVTT to always use an application-set device rather than selecting its own.
nvtt::Quality
Quality
Quality modes.
Definition nvtt_lowlevel.h:329
nvtt::nvtt_encode_bc3n
NVTT_DEPRECATED_API void nvtt_encode_bc3n(const CPUInputBuffer &input, int qualityLevel, void *output, nvtt::TimingContext *tc=nullptr)
nvtt::nvtt_encode_bc3
NVTT_DEPRECATED_API void nvtt_encode_bc3(const CPUInputBuffer &input, bool fast_mode, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr)
nvtt::Format
Format
Supported block-compression formats, including compressor variants.
Definition nvtt_lowlevel.h:218
nvtt::Format_BC2
@ Format_BC2
DX10 - BC2 (DXT3) format.
Definition nvtt_lowlevel.h:233
nvtt::Format_RGBA
@ Format_RGBA
Linear RGBA format.
Definition nvtt_lowlevel.h:221
nvtt::Format_BC3_RGBM
@ Format_BC3_RGBM
Definition nvtt_lowlevel.h:270
nvtt::Format_ASTC_LDR_8x5
@ Format_ASTC_LDR_8x5
ASTC - LDR - format, tile size 8x5.
Definition nvtt_lowlevel.h:279
nvtt::Format_ASTC_LDR_10x8
@ Format_ASTC_LDR_10x8
ASTC - LDR - format, tile size 10x8.
Definition nvtt_lowlevel.h:284
nvtt::Format_BC6U
@ Format_BC6U
DX10 - BC6 format (three-channel HDR, unsigned)
Definition nvtt_lowlevel.h:245
nvtt::Format_BC6S
@ Format_BC6S
DX10 - BC6 format (three-channel HDR, signed)
Definition nvtt_lowlevel.h:246
nvtt::Format_ASTC_LDR_10x5
@ Format_ASTC_LDR_10x5
ASTC - LDR - format, tile size 10x5.
Definition nvtt_lowlevel.h:282
nvtt::Format_ASTC_LDR_5x5
@ Format_ASTC_LDR_5x5
ASTC - LDR - format, tile size 5x5.
Definition nvtt_lowlevel.h:276
nvtt::Format_BC7
@ Format_BC7
DX10 - BC7 format (four channels, UNORM)
Definition nvtt_lowlevel.h:248
nvtt::Format_ASTC_LDR_10x6
@ Format_ASTC_LDR_10x6
ASTC - LDR - format, tile size 10x6.
Definition nvtt_lowlevel.h:283
nvtt::Format_BC5
@ Format_BC5
DX10 - BC5U format (two channels, unsigned)
Definition nvtt_lowlevel.h:239
nvtt::Format_ASTC_LDR_6x6
@ Format_ASTC_LDR_6x6
ASTC - LDR - format, tile size 6x6.
Definition nvtt_lowlevel.h:278
nvtt::Format_BC1
@ Format_BC1
DX10 - BC1 (DXT1) format.
Definition nvtt_lowlevel.h:231
nvtt::Format_BC3n
@ Format_BC3n
DX10 - BC3 (DXT5) normal format for improved compression, storing a normal (x, y, z) as (1,...
Definition nvtt_lowlevel.h:235
nvtt::Format_ASTC_LDR_12x10
@ Format_ASTC_LDR_12x10
ASTC - LDR - format, tile size 12x10.
Definition nvtt_lowlevel.h:286
nvtt::Format_DXT1
@ Format_DXT1
DX9 - DXT1 format.
Definition nvtt_lowlevel.h:224
nvtt::Format_DXT5
@ Format_DXT5
DX9 - DXT5 format.
Definition nvtt_lowlevel.h:227
nvtt::Format_ASTC_LDR_5x4
@ Format_ASTC_LDR_5x4
ASTC - LDR - format, tile size 5x4.
Definition nvtt_lowlevel.h:275
nvtt::Format_ATI2
@ Format_ATI2
DX10 - ATI2 format, similar to BC5U, channel order GR instead of RG.
Definition nvtt_lowlevel.h:238
nvtt::Format_ASTC_LDR_8x6
@ Format_ASTC_LDR_8x6
ASTC - LDR - format, tile size 8x6.
Definition nvtt_lowlevel.h:280
nvtt::Format_DXT1n
@ Format_DXT1n
Not supported.
Definition nvtt_lowlevel.h:242
nvtt::Format_ASTC_LDR_12x12
@ Format_ASTC_LDR_12x12
ASTC - LDR - format, tile size 12x12.
Definition nvtt_lowlevel.h:287
nvtt::Format_DXT3
@ Format_DXT3
DX9 - DXT3 format.
Definition nvtt_lowlevel.h:226
nvtt::Format_BC3
@ Format_BC3
DX10 - BC3 (DXT5) format.
Definition nvtt_lowlevel.h:234
nvtt::Format_ASTC_LDR_4x4
@ Format_ASTC_LDR_4x4
ASTC - LDR - format, tile size 4x4.
Definition nvtt_lowlevel.h:274
nvtt::Format_DXT1a
@ Format_DXT1a
DX9 - DXT1 with binary alpha.
Definition nvtt_lowlevel.h:225
nvtt::Format_BC1a
@ Format_BC1a
DX10 - BC1 (DXT1) format.
Definition nvtt_lowlevel.h:232
nvtt::Format_RGB
@ Format_RGB
Linear RGB format.
Definition nvtt_lowlevel.h:220
nvtt::Format_Unset
@ Format_Unset
Definition nvtt_lowlevel.h:293
nvtt::Format_BC4
@ Format_BC4
DX10 - BC4U (ATI1) format (one channel, unsigned)
Definition nvtt_lowlevel.h:236
nvtt::Format_BC5S
@ Format_BC5S
DX10 - BC5S format (two channels, signed)
Definition nvtt_lowlevel.h:240
nvtt::Format_DXT5n
@ Format_DXT5n
DX9 - DXT5 normal format. Stores a normal (x, y, z) as (R, G, B, A) = (1, y, 0, x).
Definition nvtt_lowlevel.h:228
nvtt::Format_ASTC_LDR_6x5
@ Format_ASTC_LDR_6x5
ASTC - LDR - format, tile size 6x5.
Definition nvtt_lowlevel.h:277
nvtt::Format_ASTC_LDR_8x8
@ Format_ASTC_LDR_8x8
ASTC - LDR - format, tile size 8x8.
Definition nvtt_lowlevel.h:281
nvtt::Format_BC4S
@ Format_BC4S
DX10 - BC4S format (one channel, signed)
Definition nvtt_lowlevel.h:237
nvtt::Format_ASTC_LDR_10x10
@ Format_ASTC_LDR_10x10
ASTC - LDR - format, tile size 10x10.
Definition nvtt_lowlevel.h:285
nvtt::Format_CTX1
@ Format_CTX1
Not supported.
Definition nvtt_lowlevel.h:243
nvtt::nvtt_encode_astc
NVTT_DEPRECATED_API void nvtt_encode_astc(const CPUInputBuffer &input, int qualityLevel, bool imageHasAlpha, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr)
nvtt::nvtt_encode_bc4s
NVTT_DEPRECATED_API void nvtt_encode_bc4s(const CPUInputBuffer &input, bool slow_mode, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr)
nvtt::EncodeFlags
EncodeFlags
Encode flags for EncodeSettings.
Definition nvtt_lowlevel.h:342
nvtt::EncodeFlags_OutputToGPUMem
@ EncodeFlags_OutputToGPUMem
Definition nvtt_lowlevel.h:349
nvtt::EncodeFlags_Opaque
@ EncodeFlags_Opaque
Definition nvtt_lowlevel.h:353
nvtt::EncodeFlags_UseGPU
@ EncodeFlags_UseGPU
Compress on the GPU if CUDA is available, instead of the CPU.
Definition nvtt_lowlevel.h:345
nvtt::nvtt_encode_bc7
NVTT_DEPRECATED_API void nvtt_encode_bc7(const CPUInputBuffer &input, bool slow_mode, bool imageHasAlpha, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr)
nvtt::nvtt_encode_bc1a
NVTT_DEPRECATED_API void nvtt_encode_bc1a(const CPUInputBuffer &input, bool fast_mode, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr)
nvtt::nvtt_encode_bc5s
NVTT_DEPRECATED_API void nvtt_encode_bc5s(const CPUInputBuffer &input, bool slow_mode, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr)
nvtt::PixelType
PixelType
Pixel value types.
Definition nvtt_lowlevel.h:302
nvtt::PixelType_UnsignedNorm
@ PixelType_UnsignedNorm
Used to indicate a DXGI_..._UNORM format.
Definition nvtt_lowlevel.h:303
nvtt::PixelType_UnsignedInt
@ PixelType_UnsignedInt
Not supported yet.
Definition nvtt_lowlevel.h:305
nvtt::PixelType_Float
@ PixelType_Float
Used to indicate a DXGI_..._FLOAT format.
Definition nvtt_lowlevel.h:307
nvtt::PixelType_SignedInt
@ PixelType_SignedInt
Not supported yet.
Definition nvtt_lowlevel.h:306
nvtt::PixelType_UnsignedFloat
@ PixelType_UnsignedFloat
Used to indicate a DXGI_..._UF16 format. Unused.
Definition nvtt_lowlevel.h:308
nvtt::PixelType_SharedExp
@ PixelType_SharedExp
Shared exponent. Only supported for DXGI_FORMAT_R9G9B9E5_SHAREDEXP.
Definition nvtt_lowlevel.h:309
nvtt::PixelType_SignedNorm
@ PixelType_SignedNorm
Not supported yet.
Definition nvtt_lowlevel.h:304
nvtt::nvtt_encode_bc6h
NVTT_DEPRECATED_API void nvtt_encode_bc6h(const CPUInputBuffer &input, bool slow_mode, bool is_signed, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr)
nvtt::ValueType
ValueType
Definition nvtt_lowlevel.h:115
nvtt::SINT8
@ SINT8
8-bit signed integer. Can be casted to float by dividing by 127, with the exception that both -128 an...
Definition nvtt_lowlevel.h:117
nvtt::UINT8
@ UINT8
8-bit unsigned integer.
Definition nvtt_lowlevel.h:116
nvtt::FLOAT16
@ FLOAT16
IEEE 754 half-precision floating-point: 1 sign bit, 5 exponent bits, and 10 mantissa bits.
Definition nvtt_lowlevel.h:119
nvtt::FLOAT32
@ FLOAT32
IEEE 754 single-precision floating-point: 1 sign bit, 8 exponent bits, and 23 mantissa bits.
Definition nvtt_lowlevel.h:118
nvtt::nvtt_encode_ati2
NVTT_DEPRECATED_API void nvtt_encode_ati2(const CPUInputBuffer &input, bool slow_mode, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr)
nvtt::nvtt_encode
NVTT_API bool nvtt_encode(const CPUInputBuffer &input, void *output, const EncodeSettings &settings)
nvtt::nvtt_encode_bc1
NVTT_DEPRECATED_API void nvtt_encode_bc1(const CPUInputBuffer &input, bool fast_mode, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr)
NVTT_DEPRECATED_API
#define NVTT_DEPRECATED_API
These functions are accessible via the NVTT DLL, but there are better replacements for them,...
Definition nvtt_lowlevel.h:60
NVTT_API
#define NVTT_API
Functions with this macro are accessible via the NVTT DLL.
Definition nvtt_lowlevel.h:56
nvtt::CPUInputBuffer
Structure containing all the input images from host memory. The image data is reordered by tiles.
Definition nvtt_lowlevel.h:148
nvtt::CPUInputBuffer::GetTile
NVTT_API void * GetTile(int i, int &vw, int &vh) const
Get a pointer to the i-th tile. Mainly used internally.
nvtt::CPUInputBuffer::NumTiles
NVTT_API int NumTiles() const
The total number of tiles of the input buffer.
nvtt::CPUInputBuffer::CPUInputBuffer
NVTT_API CPUInputBuffer(const RefImage *images, ValueType value_type, int numImages=1, int tile_w=4, int tile_h=4, float WeightR=1.0f, float WeightG=1.0f, float WeightB=1.0f, float WeightA=1.0f, nvtt::TimingContext *tc=nullptr, unsigned *num_tiles=nullptr)
Construct a CPUInputBuffer from 1 or more RefImage structs.
nvtt::CPUInputBuffer::TileSize
NVTT_API void TileSize(int &tile_w, int &tile_h) const
Tile Size.
nvtt::CPUInputBuffer::Type
NVTT_API ValueType Type() const
Value type. The same as the input images used for creating this object.
nvtt::CPUInputBuffer::~CPUInputBuffer
NVTT_API ~CPUInputBuffer()
Destructor.
nvtt::EncodeSettings
Definition nvtt_lowlevel.h:388
nvtt::EncodeSettings::format
Format format
The desired compression format.
Definition nvtt_lowlevel.h:395
nvtt::EncodeSettings::timing_context
TimingContext * timing_context
Definition nvtt_lowlevel.h:402
nvtt::EncodeSettings::SetFormat
NVTT_API EncodeSettings & SetFormat(Format _format)
nvtt::EncodeSettings::SetOutputToGPUMem
NVTT_API EncodeSettings & SetOutputToGPUMem(bool _to_device_mem)
nvtt::EncodeSettings::quality
Quality quality
The desired compression quality.
Definition nvtt_lowlevel.h:397
nvtt::EncodeSettings::sType
uint32_t sType
Definition nvtt_lowlevel.h:393
nvtt::EncodeSettings::encode_flags
uint32_t encode_flags
Definition nvtt_lowlevel.h:406
nvtt::EncodeSettings::SetIsOpaque
NVTT_API EncodeSettings & SetIsOpaque(bool _is_opaque)
nvtt::EncodeSettings::SetUseGPU
NVTT_API EncodeSettings & SetUseGPU(bool _use_gpu)
nvtt::EncodeSettings::rgb_pixel_type
PixelType rgb_pixel_type
Definition nvtt_lowlevel.h:400
nvtt::GPUInputBuffer
Structure containing all the input images from device memory. The image data is reordered by tiles.
Definition nvtt_lowlevel.h:179
nvtt::GPUInputBuffer::GPUInputBuffer
NVTT_API GPUInputBuffer(const RefImage *images, ValueType value_type, int numImages=1, int tile_w=4, int tile_h=4, float WeightR=1.0f, float WeightG=1.0f, float WeightB=1.0f, float WeightA=1.0f, nvtt::TimingContext *tc=nullptr, unsigned *num_tiles=nullptr)
Construct a GPUInputBuffer from 1 or more RefImage structs.
nvtt::GPUInputBuffer::TileSize
NVTT_API void TileSize(int &tile_w, int &tile_h) const
Tile Size.
nvtt::GPUInputBuffer::~GPUInputBuffer
NVTT_API ~GPUInputBuffer()
Destructor.
nvtt::GPUInputBuffer::NumTiles
NVTT_API int NumTiles() const
The total number of tiles of the input buffer.
nvtt::GPUInputBuffer::Type
NVTT_API ValueType Type() const
Value type. The same as the input images of the CPUInputBuffer used for creating this object.
nvtt::GPUInputBuffer::GPUInputBuffer
NVTT_API GPUInputBuffer(const CPUInputBuffer &cpu_buf, int begin=0, int end=-1, nvtt::TimingContext *tc=nullptr)
Construct a GPUInputBuffer from a CPUInputBuffer.
nvtt::RefImage
Use this structure to reference each of the input images.
Definition nvtt_lowlevel.h:135
nvtt::RefImage::channel_interleave
bool channel_interleave
Whether the rgba channels are interleaved (r0, g0, b0, a0, r1, g1, b1, a1, ...)
Definition nvtt_lowlevel.h:142
nvtt::RefImage::data
const void * data
For CPUInputBuffer, this should point to host memory; for GPUInputBuffer, this should point to device...
Definition nvtt_lowlevel.h:136
nvtt::RefImage::num_channels
int num_channels
Number of channels the image has.
Definition nvtt_lowlevel.h:140
nvtt::RefImage::width
int width
Width of the image. This can be arbitrary, up to 65535.
Definition nvtt_lowlevel.h:137
nvtt::RefImage::height
int height
Height of the image. This can be arbitrary, up to 65535.
Definition nvtt_lowlevel.h:138
nvtt::RefImage::channel_swizzle
ChannelOrder channel_swizzle[4]
Channels order how the image is stored.
Definition nvtt_lowlevel.h:141
nvtt::RefImage::depth
int depth
Z-dimension of the images, usually 1.
Definition nvtt_lowlevel.h:139
nvtt::TimingContext
A TimingContext is a way to collect timing data from a number of functions, and report how much time ...
Definition nvtt.h:1722