mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2024-11-28 03:24:16 +01:00
Add some more flag support to unix command line tool...
This commit is contained in:
parent
588f58b237
commit
add2f6fd96
@ -1,18 +1,68 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "TexComp.h"
|
||||
|
||||
void PrintUsage() {
|
||||
fprintf(stderr, "Usage: tc [-s|-t <num>] <imagefile>\n");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
if(argc != 2) {
|
||||
fprintf(stderr, "Usage: %s <imagefile>\n", argv[0]);
|
||||
int fileArg = 1;
|
||||
|
||||
int quality = 50;
|
||||
int numThreads = 1;
|
||||
bool bUseSIMD = false;
|
||||
|
||||
bool knowArg = false;
|
||||
do {
|
||||
knowArg = false;
|
||||
|
||||
if(strcmp(argv[fileArg], "-s") == 0) {
|
||||
fileArg++;
|
||||
bUseSIMD = true;
|
||||
knowArg = true;
|
||||
}
|
||||
|
||||
if(strcmp(argv[fileArg], "-t") == 0) {
|
||||
fileArg++;
|
||||
|
||||
if(fileArg == argc || (numThreads = atoi(argv[fileArg])) < 1) {
|
||||
PrintUsage();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fileArg++;
|
||||
knowArg = true;
|
||||
}
|
||||
|
||||
if(strcmp(argv[fileArg], "-q") == 0) {
|
||||
fileArg++;
|
||||
|
||||
if(fileArg == argc || (quality = atoi(argv[fileArg])) < 1) {
|
||||
PrintUsage();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fileArg++;
|
||||
knowArg = true;
|
||||
}
|
||||
|
||||
} while(knowArg);
|
||||
|
||||
if(fileArg == argc) {
|
||||
PrintUsage();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ImageFile file (argv[1]);
|
||||
ImageFile file (argv[fileArg]);
|
||||
|
||||
SCompressionSettings settings;
|
||||
settings.bUseSIMD = bUseSIMD;
|
||||
settings.iNumThreads = numThreads;
|
||||
|
||||
CompressedImage *ci = CompressImage(file, settings);
|
||||
|
||||
// Cleanup
|
||||
|
Loading…
Reference in New Issue
Block a user