MCPcopy Create free account
hub / github.com/NVIDIA-RTX/RTXNTC / ProcessCommandLine

Function ProcessCommandLine

tools/cli/NtcCommandLine.cpp:84–481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82} g_options;
83
84bool ProcessCommandLine(int argc, const char** argv)
85{
86 const char* bcFormatString = nullptr;
87 const char* imageFormatString = nullptr;
88 const char* dimensionsString = nullptr;
89 const char* gdeflateString = nullptr;
90
91 struct argparse_option options[] = {
92 OPT_GROUP("Actions:"),
93 OPT_BOOLEAN('c', "compress", &g_options.compress, "Perform NTC compression"),
94 OPT_BOOLEAN('D', "decompress", &g_options.decompress, "Perform NTC decompression (implied when needed)"),
95 OPT_BOOLEAN('d', "describe", &g_options.describe, "Describe the contents of a compressed texture set"),
96 OPT_BOOLEAN('g', "generateMips", &g_options.generateMips, "Generate MIP level images before compression"),
97 OPT_STRING (0, "loadCompressed", &g_options.loadCompressedFileName, "Load compressed texture set from the specified file"),
98 OPT_STRING (0, "loadImages", &g_options.loadImagesPath, "Load channel images from the specified folder"),
99 OPT_STRING (0, "loadManifest", &g_options.loadManifestFileName, "Load channel images and their parameters using the specified JSON manifest file"),
100 OPT_BOOLEAN(0, "loadMips", &g_options.loadMips, "Load MIP level images from <loadImages>/mips/<texture>.<mip>.<ext> before compression"),
101 OPT_BOOLEAN(0, "optimizeBC", &g_options.optimizeBC, "Run slow BC compression and store acceleration info in the NTC package"),
102 OPT_BOOLEAN(0, "readManifestFromStdin", &g_options.readManifestFromStdin, "Load channel images using a JSON manifest passed through standard input (stdin)"),
103 OPT_STRING ('o', "saveCompressed", &g_options.saveCompressedFileName, "Save compressed texture set into the specified file"),
104 OPT_STRING ('i', "saveImages", &g_options.saveImagesPath, "Save channel images into the specified folder"),
105 OPT_STRING (0, "saveManifest", &g_options.saveManifestFileName, "Save a manifest JSON file (only for image inputs)"),
106 OPT_BOOLEAN(0, "saveMips", &g_options.saveMips, "Save MIP level images into <saveImages>/mips/ after decompression"),
107 OPT_BOOLEAN(0, "version", &g_options.printVersion, "Print version information and exit"),
108 OPT_HELP(),
109
110 OPT_GROUP("Basic compression options:"),
111 OPT_FLOAT ('b', "bitsPerPixel", &g_options.bitsPerPixel, "Request an optimal compression configuration for the provided BPP value"),
112 OPT_FLOAT (0, "maxBitsPerPixel", &g_options.maxBitsPerPixel, "Maximum BPP value to use in the compression parameter search"),
113 OPT_FLOAT ('p', "targetPsnr", &g_options.targetPsnr, "Perform compression parameter search to reach at least the provided PSNR value"),
114
115 OPT_GROUP("Custom latent shape selection:"),
116 OPT_INTEGER(0, "gridSizeScale", &g_options.gridSizeScale, "Ratio of source image size to high-resolution feature grid size"),
117 OPT_INTEGER(0, "numFeatures", &g_options.numFeatures, "Number of features"),
118
119 OPT_GROUP("Training process controls:"),
120 OPT_FLOAT (0, "gridLearningRate", &g_options.compressionSettings.gridLearningRate, "Maximum learning rate for the feature grid"),
121 OPT_INTEGER(0, "kPixelsPerBatch", &g_options.compressionSettings.kPixelsPerBatch, "Number of kilopixels from the image to process in one training step"),
122 OPT_FLOAT (0, "networkLearningRate", &g_options.compressionSettings.networkLearningRate, "Maximum learning rate for the MLP weights"),
123 OPT_INTEGER(0, "randomSeed", &g_options.compressionSettings.randomSeed, "Random seed, set to a nonzero value to get more stable compression results"),
124 OPT_BOOLEAN(0, "stableTraining", &g_options.compressionSettings.stableTraining, "Use a more expensive but more numerically stable training algorithm for reproducible results"),
125 OPT_INTEGER(0, "stepsPerIteration", &g_options.compressionSettings.stepsPerIteration, "Training steps between progress reports"),
126 OPT_INTEGER('S', "trainingSteps", &g_options.compressionSettings.trainingSteps, "Total training step count"),
127
128 OPT_GROUP("Output settings:"),
129 OPT_STRING ('B', "bcFormat", &bcFormatString, "Set or override the BCn encoding format, BC1-BC7"),
130 OPT_STRING ('F', "imageFormat", &imageFormatString, "Set the output file format for color images: Auto (default), BMP, JPG, TGA, PNG, PNG16, EXR"),
131 OPT_STRING (0, "dimensions", &dimensionsString, "Set the dimensions of the NTC texture set before compression, in the 'WxH' format"),
132 OPT_BOOLEAN(0, "dithering", &g_options.enableDithering, "Enable dithering for 8-bit output textures when decompressing with graphics APIs (default on, use --no-dithering)"),
133
134 OPT_GROUP("Advanced settings:"),
135 OPT_FLOAT (0, "bcPsnrThreshold", &g_options.bcPsnrThreshold, "PSNR loss threshold for BC7 optimization, in dB, default value is 0.2"),
136 OPT_INTEGER(0, "benchmark", &g_options.benchmarkIterations, "Number of iterations to run over compute passes for benchmarking"),
137 OPT_BOOLEAN(0, "discardMaskedOutPixels", &g_options.discardMaskedOutPixels, "Ignore contents of pixels where alpha mask is 0.0 (requires the AlphaMask semantic)"),
138 OPT_FLOAT (0, "experimentalKnob", &g_options.experimentalKnob, "A parameter for NTC development, normally has no effect"),
139 OPT_BOOLEAN(0, "matchBcPsnr", &g_options.matchBcPsnr, "Perform compression parameter search to reach the PSNR value that BCn encoding provides"),
140 OPT_FLOAT (0, "minBcPsnr", &g_options.minBcPsnr, "When using --matchBcPsnr, minimum PSNR value to use for NTC compression"),
141 OPT_FLOAT (0, "maxBcPsnr", &g_options.maxBcPsnr, "When using --matchBcPsnr, maximum PSNR value to use for NTC compression"),

Callers 1

mainFunction · 0.70

Calls 8

argparse_initFunction · 0.85
argparse_describeFunction · 0.85
argparse_parseFunction · 0.85
UpdateToolInputTypeFunction · 0.85
LowercaseStringFunction · 0.85
ParseImageContainerFunction · 0.85

Tested by

no test coverage detected