is filterstack really ok ?
This commit is contained in:
132
Fonderie/t.c
132
Fonderie/t.c
@@ -25,87 +25,13 @@ int convert_to_gray; /* WTF ? */
|
||||
|
||||
/* ----------------------------------------------------------- */
|
||||
|
||||
int essai_filterstack(FloatImg *pimg)
|
||||
{
|
||||
int foo;
|
||||
|
||||
|
||||
filterstack_list(__func__);
|
||||
|
||||
foo = filterstack_run(pimg, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "filterstack run --> %d\n", foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* ----------------------------------------------------------- */
|
||||
int parse_filter_chain(const char *argument)
|
||||
{
|
||||
char *cptr;
|
||||
int value, foo;
|
||||
|
||||
fprintf(stderr, "\n%s: arg = '%s'\n", __func__, argument);
|
||||
|
||||
foo = filterstack_init(4);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: filterstack init --> %d\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
cptr = strtok(argument, ":");
|
||||
fprintf(stderr, "cptr %p\n", cptr);
|
||||
if (NULL==cptr) break;
|
||||
argument = NULL;
|
||||
fprintf(stderr, " parsing '%s'\n", cptr);
|
||||
if (1 == sscanf(cptr, "%d", &value)) {
|
||||
foo = filterstack_add(value, 1, 1.0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: err %d add\n",
|
||||
__func__, foo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (verbosity) filterstack_list(__func__);
|
||||
return 0;
|
||||
}
|
||||
/* ----------------------------------------------------------- */
|
||||
int help(void)
|
||||
{
|
||||
puts("yolo!");
|
||||
exit(0);
|
||||
}
|
||||
/* ----------------------------------------------------------- */
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int essai_filterstack(void)
|
||||
{
|
||||
int foo;
|
||||
FloatImg image;
|
||||
double debut, fin;
|
||||
int opt;
|
||||
char *filterchain = "0";
|
||||
|
||||
fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", __FILE__,
|
||||
__DATE__, __TIME__);
|
||||
fimg_print_version(2);
|
||||
|
||||
while ((opt = getopt(argc, argv, "hF:v")) != -1) {
|
||||
switch(opt) {
|
||||
case 'h': help(); break;
|
||||
case 'F': filterchain = optarg;
|
||||
break;
|
||||
case 'v': verbosity++; break;
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s : argc = %d, optind = %d\n", argv[0], argc, optind);
|
||||
#endif
|
||||
|
||||
parse_filter_chain(filterchain);
|
||||
filterstack_list(__func__);
|
||||
|
||||
foo = fimg_create_from_dump("mire.fimg", &image);
|
||||
if (foo) {
|
||||
@@ -113,12 +39,16 @@ if (foo) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
srand(getpid());
|
||||
srand(getpid()); srand48(getpid());
|
||||
|
||||
debut = fimg_timer_set(TIMER);
|
||||
foo = essai_filterstack(&image);
|
||||
|
||||
foo = filterstack_run(&image, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "essai filterstack --> %d\n", foo);
|
||||
fprintf(stderr, "filterstack run --> %d\n", foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
fin = fimg_timer_set(TIMER);
|
||||
|
||||
foo = fimg_save_as_png(&image, "foo.png", 0);
|
||||
@@ -130,6 +60,50 @@ fprintf(stderr, "elapsed %f\n", fin-debut);
|
||||
|
||||
fimg_destroy(&image);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* ----------------------------------------------------------- */
|
||||
int help(void)
|
||||
{
|
||||
puts("yolo!");
|
||||
exit(0);
|
||||
}
|
||||
/* ----------------------------------------------------------- */
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int foo;
|
||||
int opt;
|
||||
char *filterchain = "0";
|
||||
|
||||
fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", __FILE__,
|
||||
__DATE__, __TIME__);
|
||||
fimg_print_version(2);
|
||||
|
||||
while ((opt = getopt(argc, argv, "hF:v")) != -1) {
|
||||
switch(opt) {
|
||||
case 'h': help(); break;
|
||||
case 'F': filterchain = optarg; break;
|
||||
case 'v': verbosity++; break;
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s : argc = %d, optind = %d\n", argv[0], argc, optind);
|
||||
#endif
|
||||
|
||||
foo = parse_filter_chain(filterchain);
|
||||
if (foo) {
|
||||
fprintf(stderr, "err %d in parse_filter_chain\n", foo);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
foo = essai_filterstack();
|
||||
if (foo) {
|
||||
fprintf(stderr, "err %d in essai_filterstack\n", foo);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user