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

Function main

examples/framework_example3/framework_example3.cpp:65–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 10

CMP_InitFrameworkFunction · 0.85
memsetFunction · 0.85
CMP_LoadTextureFunction · 0.85
CMP_CreateCompressMipSetFunction · 0.85
CMP_CreateBlockEncoderFunction · 0.85
CMP_FreeMipSetFunction · 0.85
CMP_CompressBlockXYFunction · 0.85
CMP_DestroyBlockEncoderFunction · 0.85
CMP_SaveTextureFunction · 0.85
timeStampsecFunction · 0.70

Tested by

no test coverage detected