MCPcopy Create free account
hub / github.com/GPUOpen-Tools/compressonator / main

Function main

examples/core_example1/coreexample.cpp:248–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248int main(int argc, char* argv[])
249{
250 unsigned char imgBuffer[64] = {0}; // Results buffer for decompressed shape0_RGBA
251 unsigned short imgBufferF16[48] = {0}; // Results buffer for decompressed shape0_RGBAF16
252 unsigned char imgBuffer1[16] = {0}; // Results buffer for decompressed single channel 1
253 unsigned char imgBuffer2[16] = {0}; // Results buffer for decompressed single channel 2
254 char imgBuffer1s[16] = {0}; // Results buffer for decompressed single signed channel
255 char imgBuffer2s[16] = {0}; // Results buffer for decompressed single signed channel
256
257 unsigned char cmpBuffer8[8] = {0}; // Compression buffer for BC1 and BC4 Codecs
258 unsigned char cmpBuffer16[16] = {0}; // Compression buffer for BC5,BC6 and BC7
259 char cmpBuffer8s[8] = {0}; // Compression buffer for BC4s Codecs
260
261 //===================================================================
262 // Example #1 of how to set compress and decompress for BCn codecs
263 //===================================================================
264
265 //==================================================================================
266 // BC1 Example: using default options settings
267 // This example show 2 ways to call the compress and decompress API
268 // one is using C++ convention with n optional parameter, which is null
269 // for "C" compilers the third parameters must be set to null
270 // Examples to use the third option parameter is shown in Example #2 and Example #3
271 // For the remaining codec examples, "C" parameter examples are shown
272 // They will work for C++ compilers also
273 //==================================================================================
274
275#ifdef __cplusplus
276 CompressBlockBC1(shape0_RGBA, 16, cmpBuffer8);
277 DecompressBlockBC1(cmpBuffer8, imgBuffer);
278#else
279 CompressBlockBC1(shape0_RGBA, 16, cmpBuffer8, NULL);
280 DecompressBC1(cmpBuffer8, imgBuffer, NULL);
281#endif
282 ShowResults("BC1", shape0_RGBA, imgBuffer);
283
284 //============
285 // BC2 Example
286 //=============
287 CompressBlockBC2(shape0_RGBA, 16, cmpBuffer16, NULL);
288 DecompressBlockBC2(cmpBuffer16, imgBuffer, NULL);
289 ShowResults("BC2", shape0_RGBA, imgBuffer);
290
291 //=============
292 // BC3 Example
293 //=============
294 CompressBlockBC3(shape0_RGBA, 16, cmpBuffer16, NULL);
295 DecompressBlockBC3(cmpBuffer16, imgBuffer, NULL);
296 ShowResults("BC3", shape0_RGBA, imgBuffer);
297
298 //==============
299 // BC4 Example
300 //==============
301 CompressBlockBC4(shape_1, 4, cmpBuffer8, NULL);
302 DecompressBlockBC4(cmpBuffer8, imgBuffer, NULL);
303 ShowResults1("BC4", shape_1, imgBuffer);
304
305 //==============================

Callers

nothing calls this directly

Calls 15

CompressBlockBC1Function · 0.85
DecompressBlockBC1Function · 0.85
ShowResultsFunction · 0.85
CompressBlockBC2Function · 0.85
DecompressBlockBC2Function · 0.85
CompressBlockBC3Function · 0.85
DecompressBlockBC3Function · 0.85
CompressBlockBC4Function · 0.85
DecompressBlockBC4Function · 0.85
ShowResults1Function · 0.85
CompressBlockBC4SFunction · 0.85
DecompressBlockBC4SFunction · 0.85

Tested by

no test coverage detected