be negative ans reverse the sort

This commit is contained in:
tonton th 2021-01-14 19:15:22 +01:00
parent 7da33bbd16
commit 785b521d4f

View File

@ -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] <inglob> <outdir> <nbsteep>");
* 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<argc; foo++)
fprintf(stderr, "%5d %s\n", foo, argv[foo]);
#endif
while ((opt = getopt(argc, argv, "E:F:hLS:vw:x:")) != -1) {
while ((opt = getopt(argc, argv, "E:F:hLnS:v")) != -1) {
switch(opt) {
case 'E': InFchain = optarg; break;
case 'F': OutFchain = optarg; break;
@ -278,8 +277,7 @@ while ((opt = getopt(argc, argv, "E:F:hLS:vw:x:")) != -1) {
exit(0);
case 'S': sort = atoi(optarg); break;
case 'v': verbosity++; break;
// OBSOLETE case 'w': inFx = atoi(optarg); break;
// OBSOLETE case 'x': outFx = atoi(optarg); break;
case 'n': negative = 1; break;
}
}