nice xperimental option

This commit is contained in:
tonton Th 2020-02-17 01:27:33 +01:00
parent 6a2b37d4e3
commit d0b7ddfd91

View File

@ -19,7 +19,8 @@ typedef struct {
int nbarg;
} Fx;
enum fxid { Fx_cos01, Fx_cos010, Fx_pow2, Fx_sqrt, Fx_gray0, Fx_halfsz0 };
enum fxid { Fx_cos01=5, Fx_cos010, Fx_pow2, Fx_sqrt, Fx_gray0, Fx_halfsz0,
Fx_xper };
Fx fx_list[] = {
{ "cos01", Fx_cos01, 0 },
@ -28,6 +29,7 @@ Fx fx_list[] = {
{ "sqrt", Fx_sqrt, 0 },
{ "gray0", Fx_gray0, 0 },
{ "halfsz0", Fx_halfsz0, 0 },
{ "xper", Fx_xper, 0 },
{ NULL, 0, 0 }
};
@ -42,15 +44,39 @@ fprintf(stderr, ">>> %s ( '%s' )\n", __func__, txt);
#endif
for (n=0, fx=fx_list; fx->name; fx++, n++) {
#if DEBUG_LEVEL
#if DEBUG_LEVEL > 1
fprintf(stderr, "-> %3d %s\n", n, fx->name);
#endif
if (!strcmp(fx->name, txt)) {
return n;
}
}
return -1; /* NOT FOUND */
}
/* --------------------------------------------------------------------- */
int do_experiment(FloatImg *S, FloatImg *D, float kf)
{
int foo;
return -1;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %f )\n", __func__, S, D, kf);
#endif
foo = fimg_copy_data(S, D);
if (foo) {
fprintf(stderr, "%s err %d copy data %p -> %p\n", __func__,
foo, S, D);
return -98;
}
foo = fimg_killcolors_a(D, kf);
if (foo) {
fprintf(stderr, "%s err %d killcolors %p %f\n", __func__,
foo, S, kf);
return -98;
}
return 0;
}
/* --------------------------------------------------------------------- */
static void help(int lvl)
@ -113,6 +139,10 @@ switch (act) {
fimg_to_gray(&src); fimg_copy_data(&src, &dest);
break;
case Fx_xper:
do_experiment(&src, &dest, maxval); break;
case Fx_halfsz0:
fprintf(stderr, "not implemented\n");
return -3;