From 785b521d4fd74c21389afc447007e96f40dda96e Mon Sep 17 00:00:00 2001 From: tonton th Date: Thu, 14 Jan 2021 19:15:22 +0100 Subject: [PATCH] be negative ans reverse the sort --- Fonderie/interpolator.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Fonderie/interpolator.c b/Fonderie/interpolator.c index d38ba674..4a3c5da4 100644 --- a/Fonderie/interpolator.c +++ b/Fonderie/interpolator.c @@ -33,9 +33,14 @@ typedef struct { float value; /* from metric analyse */ } IdxValue; +static int negative = 0; + static int cmp_idxvalues(const void *pa, const void *pb) { -return ( ((IdxValue *)pa)->value > ((IdxValue *)pb)->value); +if (negative) + return ( ((IdxValue *)pa)->value < ((IdxValue *)pb)->value); +else + return ( ((IdxValue *)pa)->value > ((IdxValue *)pb)->value); } int tentative_triage(glob_t *ptr_glob, IdxValue **ptr_idxval, @@ -123,6 +128,8 @@ IdxValue *idx_values; /* gni? */ fprintf(stderr, " interpolate from '%s' to '%s' with %d steps.\n", pattern, outdir, Nsteps); +if (negative) fprintf(stderr, "%s: negative on\n", __func__); + memset(&globbuf, 0, sizeof(glob_t)); foo = glob(pattern, 0, NULL, &globbuf); fprintf(stderr, "globbing '%s' -> %d, %d files found\n", @@ -146,13 +153,6 @@ if (FIMG_TYPE_RGB != iarray[2]) { exit(1); /* BLAM! */ } -#if 0 -if (infx) fprintf(stderr, "\tin fx #%d\n", infx); -else fprintf(stderr, "\tno in fx\n"); -if (outfx) fprintf(stderr, "\tout fx #%d\n", outfx); -else fprintf(stderr, "\tno out fx\n"); -#endif - w = iarray[0], h = iarray[1]; fprintf(stderr, "first image size : %dx%d\n", w, h); @@ -232,12 +232,11 @@ puts("usage:\n\tinterpolator [options] "); * the options of 'fonderie' software ? */ puts("options:"); -puts("\t-S nn\t\tmysterious sort"); puts("\t-E i:bla:k\tinput filter chain"); puts("\t-F name:j\toutput filter chain"); +puts("\t-n\t\tmake negative"); +puts("\t-S nn\t\tmysterious sort"); puts("\t-L\t\tlist available filters"); -// OBSOLETE puts("\t-w nn\t\tinput effect"); -// OBSOLETE puts("\t-x nn\t\toutput effect"); puts("\t-v\t\tincrease verbosity"); if (verbosity) { @@ -268,7 +267,7 @@ for (foo=0; foo