forked from tTh/FloatImg
add -a option for absolute value of op result
This commit is contained in:
parent
7586423d23
commit
bb2b3b72de
@ -36,7 +36,7 @@ mkfimg: mkfimg.c $(DEPS)
|
||||
gcc $(COPT) $< ../libfloatimg.a -lm -o $@
|
||||
|
||||
fimgops: fimgops.c $(DEPS)
|
||||
gcc $(COPT) $< ../libfloatimg.a -o $@
|
||||
gcc $(COPT) $< ../libfloatimg.a -lm -o $@
|
||||
|
||||
fimgfx: fimgfx.c $(DEPS)
|
||||
gcc $(COPT) $< ../libfloatimg.a \
|
||||
|
@ -66,6 +66,7 @@ static void help(int lj)
|
||||
|
||||
puts("usage:\n\tfimgops [options] A.fimg B.fimg operator D.fimg");
|
||||
puts("options:");
|
||||
puts("\t-a\t\texport absolute value");
|
||||
// puts("\t-g convert output to gray");
|
||||
printf("\t-k N.N\t\tset float value (def=%.3f)\n", global_fvalue);
|
||||
puts("\t-v\t\tincrease verbosity");
|
||||
@ -107,13 +108,15 @@ return foo;
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int foo, opt, action;
|
||||
int absolute = 0;
|
||||
char *operator;
|
||||
FloatImg srcA, srcB, dest;
|
||||
|
||||
global_fvalue = 0.5;
|
||||
|
||||
while ((opt = getopt(argc, argv, "hk:v")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "ahk:v")) != -1) {
|
||||
switch(opt) {
|
||||
case 'a': absolute = 1; break;
|
||||
case 'g': break;
|
||||
case 'h': help(0); break;
|
||||
case 'k': global_fvalue = atof(optarg); break;
|
||||
@ -182,6 +185,11 @@ if (foo) {
|
||||
operator, foo);
|
||||
}
|
||||
|
||||
if (absolute) {
|
||||
if (verbosity) fprintf(stderr, "compute abs of %p\n", &dest);
|
||||
fimg_absolute(&dest);
|
||||
}
|
||||
|
||||
foo = fimg_dump_to_file(&dest, argv[optind+3], 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "dumping datas to file give us a %d\n", foo);
|
||||
|
Loading…
Reference in New Issue
Block a user