Add -a flag to unix command line tool as well

This commit is contained in:
Pavel Krajcevski 2013-03-07 02:31:21 -05:00
parent 9a5e0d197d
commit e150d4ee18

View file

@ -58,6 +58,7 @@ void PrintUsage() {
fprintf(stderr, "\t-n <num>\tCompress the image num times and give the average time and PSNR. Default: 1\n"); fprintf(stderr, "\t-n <num>\tCompress the image num times and give the average time and PSNR. Default: 1\n");
fprintf(stderr, "\t-simd\t\tUse SIMD compression path\n"); fprintf(stderr, "\t-simd\t\tUse SIMD compression path\n");
fprintf(stderr, "\t-t <num>\tCompress the image using <num> threads. Default: 1\n"); fprintf(stderr, "\t-t <num>\tCompress the image using <num> threads. Default: 1\n");
fprintf(stderr, "\t-a \t\tCompress the image using synchronization via atomic operations. Default: Off\n");
fprintf(stderr, "\t-j <num>\tUse <num> blocks for each work item in a worker queue threading model. Default: (Blocks / Threads)\n"); fprintf(stderr, "\t-j <num>\tUse <num> blocks for each work item in a worker queue threading model. Default: (Blocks / Threads)\n");
} }
@ -90,6 +91,7 @@ int main(int argc, char **argv) {
int numCompressions = 1; int numCompressions = 1;
bool bUseSIMD = false; bool bUseSIMD = false;
bool bSaveLog = false; bool bSaveLog = false;
bool bUseAtomics = false;
bool knowArg = false; bool knowArg = false;
do { do {
@ -161,6 +163,13 @@ int main(int argc, char **argv) {
continue; continue;
} }
if(strcmp(argv[fileArg], "-a") == 0) {
fileArg++;
bUseAtomics = true;
knowArg = true;
continue;
}
} while(knowArg && fileArg < argc); } while(knowArg && fileArg < argc);
if(fileArg == argc) { if(fileArg == argc) {
@ -187,6 +196,7 @@ int main(int argc, char **argv) {
SCompressionSettings settings; SCompressionSettings settings;
settings.bUseSIMD = bUseSIMD; settings.bUseSIMD = bUseSIMD;
settings.bUseAtomics = bUseAtomics;
settings.iNumThreads = numThreads; settings.iNumThreads = numThreads;
settings.iQuality = quality; settings.iQuality = quality;
settings.iNumCompressions = numCompressions; settings.iNumCompressions = numCompressions;