| 75 | } |
| 76 | |
| 77 | int main(int argc, const char* argv[]) |
| 78 | { |
| 79 | #ifdef _WIN32 |
| 80 | double start_time = timeStampsec(); |
| 81 | #endif |
| 82 | if (argc < 4) |
| 83 | { |
| 84 | std::printf("Example2.exe SourceFile BCnFormat1 BCnFormat2 Quality\n"); |
| 85 | std::printf("This example shows how to compress a single image into two\n"); |
| 86 | std::printf("different BCn compression formats using multi threading\n"); |
| 87 | std::printf("Quality is in the range of 0.0 to 1.0\n"); |
| 88 | std::printf("When using DLL builds make sure the Compressonator_xx_DLL.dll is in exe path\n"); |
| 89 | std::printf("Usage: Example2.exe ruby.dds BC1 BC7 0.05\n"); |
| 90 | std::printf("this will generate a result_0.dds for BC1\n"); |
| 91 | std::printf("and result_1.dds for BC7\n"); |
| 92 | return 0; |
| 93 | } |
| 94 | |
| 95 | // Note: No error checking is done on user arguments, so all parameters must be correct in this example |
| 96 | // (files must exist, values correct format, etc..) |
| 97 | const char* pszSourceFile = argv[1]; |
| 98 | CMP_FORMAT destFormat[MXT]; |
| 99 | CMP_FLOAT fQuality; |
| 100 | |
| 101 | destFormat[0] = ParseFormat(argv[2]); |
| 102 | destFormat[1] = ParseFormat(argv[3]); |
| 103 | |
| 104 | if ((destFormat[0] == CMP_FORMAT_Unknown) || (destFormat[1] == CMP_FORMAT_Unknown)) |
| 105 | { |
| 106 | std::printf("Error: Unsupported BCn destination format\n"); |
| 107 | return 0; |
| 108 | } |
| 109 | |
| 110 | if (destFormat[0] == destFormat[1]) |
| 111 | { |
| 112 | std::printf("Error: Please try two different BCn formats for this example\n"); |
| 113 | return 0; |
| 114 | } |
| 115 | |
| 116 | try |
| 117 | { |
| 118 | fQuality = std::stof(argv[4]); |
| 119 | if (fQuality < 0.0f) |
| 120 | { |
| 121 | fQuality = 0.0f; |
| 122 | std::printf("Warning: Quality setting is out of range using 0.0\n"); |
| 123 | } |
| 124 | if (fQuality > 1.0f) |
| 125 | { |
| 126 | fQuality = 1.0f; |
| 127 | std::printf("Warning: Quality setting is out of range using 1.0\n"); |
| 128 | } |
| 129 | } |
| 130 | catch (...) |
| 131 | { |
| 132 | std::printf("Error: Unable to process quality setting\n"); |
| 133 | return -1; |
| 134 | } |
nothing calls this directly
no test coverage detected