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

Function main

examples/framework_example2/framework_example2.cpp:65–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65int main(int argc, char* argv[])
66{
67 bool bAbortCompression = false;
68
69 if (argc < 4)
70 {
71 std::printf("Example2.exe SourceFile DestFile Quality\n");
72 std::printf("This example shows how to compress a single image\n");
73 std::printf("to a compression format using a quality setting with HPC BC7 encoding\n");
74 std::printf("Quality is in the range of 0.0 to 1.0\n");
75 std::printf("When using DLL builds make sure the CMP_Framework_xx_DLL.dll is in exe path\n");
76 std::printf("usage: Example2.exe ruby.dds ruby_bc7.dds 1.0\n");
77 std::printf("this will generate a high quality compressed ruby file in BC7 format\n");
78 return 0;
79 }
80
81 // please note the params are not checked for errors
82 const char* pszSourceFile = argv[1];
83 const char* pszDestFile = argv[2];
84 CMP_FLOAT fQuality;
85
86 try
87 {
88 fQuality = std::stof(argv[3]);
89 if (fQuality < 0.0f)
90 {
91 fQuality = 0.0f;
92 std::printf("Warning: Quality setting is out of range using 0.0\n");
93 }
94 if (fQuality > 1.0f)
95 {
96 fQuality = 1.0f;
97 std::printf("Warning: Quality setting is out of range using 1.0\n");
98 }
99 }
100 catch (...)
101 {
102 std::printf("Error: Unable to process quality setting\n");
103 return -1;
104 }
105
106 //--------------------------
107 // Init frameworks
108 // plugin and IO interfaces
109 //--------------------------
110 CMP_InitFramework();
111
112 //=================================================================================
113 // You can optionally use a 4th argv to set a destFormat other then the example BC7
114 // just add additional encoder dll's is in the example binary path.
115 // example: to use BC1 add CMP_BC1_MD.dll.
116 // You can edit CopyFiles.bat to add additional libs to the correct build folders of this application.
117 //
118 // CMP_FORMAT destFormat = CMP_ParseFormat(argv[4]);
119 //===================================================================================
120 CMP_FORMAT destFormat = CMP_FORMAT_BC7;
121
122 //-------------------------------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 7

CMP_InitFrameworkFunction · 0.85
memsetFunction · 0.85
CMP_LoadTextureFunction · 0.85
CMP_ProcessTextureFunction · 0.85
CMP_FreeMipSetFunction · 0.85
CMP_SaveTextureFunction · 0.85
timeStampsecFunction · 0.70

Tested by

no test coverage detected