diff options
author | Merov Linden <merov@lindenlab.com> | 2014-01-01 17:13:06 -0800 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2014-01-01 17:13:06 -0800 |
commit | 218d305c443d4e5ddba03c6f4a988924939d805d (patch) | |
tree | 8e0f52ca037139a8d66960afaca8a75b5326ec52 | |
parent | 08a798bb1d88708765041adf21a784911842f101 (diff) |
ACME-1236 : WIP : add an optional filter parameter to llimage_libtest
-rwxr-xr-x | indra/integration_tests/llimage_libtest/llimage_libtest.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp index cbd6ccebbf..d1535bf3cf 100755 --- a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp +++ b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp @@ -83,9 +83,10 @@ static const char USAGE[] = "\n" " -rev, --reversible\n" " Set the compression to be lossless (reversible in j2c parlance).\n" " Only valid for output j2c images.\n" -" -f, --filter <name>\n" -" Apply the filter <name> to the input images.\n" -" Note: so far, only grayscale and sepia are supported.\n" +" -f, --filter <name> [<param>]\n" +" Apply the filter <name> to the input images using the optional param (float) value.\n" +" Notes: - 'grayscale' and 'sepia' are supported (no param).\n" +" - 'saturate' uses the param: param < 1.0 will desaturate the colors, param > 1.0 will saturate them.\n" " -log, --logmetrics <metric>\n" " Log performance data for <metric>. Results in <metric>.slp\n" " Note: so far, only ImageCompressionTester has been tested.\n" @@ -354,6 +355,7 @@ int main(int argc, char** argv) int levels = 0; bool reversible = false; std::string filter_name = ""; + double filter_param = 0.0; // Init whatever is necessary ll_init_apr(); @@ -530,7 +532,6 @@ int main(int argc, char** argv) else if (!strcmp(argv[arg], "--filter") || !strcmp(argv[arg], "-f")) { // '--filter' needs to be specified with a named filter argument - // Note: for the moment, only sepia and grayscale are supported if ((arg + 1) < argc) { filter_name = argv[arg+1]; @@ -545,7 +546,17 @@ int main(int argc, char** argv) arg += 1; // Skip that arg now we know it's a valid test name if ((arg + 1) == argc) // Break out of the loop if we reach the end of the arg list break; - } + // --filter can also have an optional parameter + std::string value_str; + value_str = argv[arg+1]; // Check the next arg + if (value_str[0] != '-') // If it's not another argument, it's a filter parameter value + { + filter_param = atof(value_str.c_str()); + arg += 1; // Skip that arg now we used it as a valid filter param + if ((arg + 1) == argc) // Break out of the loop if we reach the end of the arg list + break; + } + } } else if (!strcmp(argv[arg], "--analyzeperformance") || !strcmp(argv[arg], "-a")) { @@ -604,7 +615,7 @@ int main(int argc, char** argv) } else if (filter_name == "saturate") { - raw_image->filterSaturate(2.0f); + raw_image->filterSaturate((float)(filter_param)); } // Save file |