forked from tTh/FloatImg
better testing of interpolate func
This commit is contained in:
parent
e454404f97
commit
219bd36cc2
37
lib/t.c
37
lib/t.c
@ -53,7 +53,9 @@ return 0;
|
||||
int essai_interpolate(int k)
|
||||
{
|
||||
FloatImg A, B, C;
|
||||
int foo;
|
||||
int foo, idx;
|
||||
char ligne[200];
|
||||
float fval;
|
||||
|
||||
foo = fimg_create(&A, WI, HI, FIMG_TYPE_RGB);
|
||||
if (foo) {
|
||||
@ -75,14 +77,21 @@ if (foo) {
|
||||
return foo;
|
||||
}
|
||||
|
||||
foo = fimg_interpolate(&A, &B, &C, 0.5);
|
||||
if (foo) {
|
||||
#define NB 16
|
||||
for (idx=0; idx<NB; idx++) {
|
||||
fval = (float)idx / (float)NB;
|
||||
if (verbosity) fprintf(stderr, "%4d %f\n", idx, fval);
|
||||
foo = fimg_interpolate(&A, &B, &C, fval);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s err interpolate %d\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
foo = fimg_save_as_pnm(&C, "interpolate.pnm", 0);
|
||||
|
||||
sprintf(ligne, "polate-%02d.pnm", idx);
|
||||
foo = fimg_save_as_pnm(&C, ligne, 0);
|
||||
}
|
||||
/*
|
||||
$ convert -delay 10 polate-* foo.gif ; animate foo.gif
|
||||
*/
|
||||
fimg_destroy(&A); fimg_destroy(&B); fimg_destroy(&C);
|
||||
|
||||
return 0;
|
||||
@ -223,19 +232,23 @@ while ((opt = getopt(argc, argv, "gn:v")) != -1) {
|
||||
case 'g': gray++; break;
|
||||
case 'n': foo=atoi(optarg); break;
|
||||
case 'v': verbosity++; break;
|
||||
default:
|
||||
fprintf(stderr, "%s: oh, %c is a bad opt.\n",
|
||||
argv[0], opt);
|
||||
exit(5);
|
||||
}
|
||||
}
|
||||
|
||||
if (verbosity) fimg_print_version(0);
|
||||
|
||||
foo = essai_normalize();
|
||||
fprintf(stderr, "retour essai normalize -> %d\n", foo);
|
||||
// foo = essai_normalize();
|
||||
// fprintf(stderr, "retour essai normalize -> %d\n", foo);
|
||||
|
||||
foo = essai_contraste("quux.fimg");
|
||||
fprintf(stderr, "retour essai contraste -> %d\n", foo);
|
||||
// foo = essai_contraste("quux.fimg");
|
||||
// fprintf(stderr, "retour essai contraste -> %d\n", foo);
|
||||
|
||||
foo = essai_clone_et_copy(0);
|
||||
fprintf(stderr, "retour essai clone'n'copy -> %d\n", foo);
|
||||
// foo = essai_clone_et_copy(0);
|
||||
// fprintf(stderr, "retour essai clone'n'copy -> %d\n", foo);
|
||||
|
||||
foo = essai_interpolate(0);
|
||||
fprintf(stderr, "retour essai interpolate -> %d\n", foo);
|
||||
|
@ -84,7 +84,7 @@ switch (action) {
|
||||
case OP_SUB:
|
||||
foo = fimg_sub_3(A, B, D); break;
|
||||
case OP_MIX:
|
||||
if (verbosity) fprintf(stderr, "%s: fvalue is %f\n",
|
||||
if (verbosity) fprintf(stderr, "%s:mix: fvalue is %f\n",
|
||||
__func__, global_fvalue);
|
||||
foo = fimg_interpolate(A, B, D, global_fvalue);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user