|
|
|
@ -5,6 +5,7 @@ |
|
|
|
|
#include <stdio.h> |
|
|
|
|
#include <stdlib.h> |
|
|
|
|
#include <unistd.h> |
|
|
|
|
#include <string.h> |
|
|
|
|
|
|
|
|
|
#include "../floatimg.h" |
|
|
|
|
#include "glitches.h" |
|
|
|
@ -17,9 +18,9 @@ int verbosity; |
|
|
|
|
int convert_to_gray; /* WTF ? */ |
|
|
|
|
|
|
|
|
|
#define PNG "out.png" |
|
|
|
|
#define W 512 |
|
|
|
|
#define H 256 |
|
|
|
|
#define LMAX 249.9999 |
|
|
|
|
#define W 800 |
|
|
|
|
#define H 600 |
|
|
|
|
#define LMAX 255.0 |
|
|
|
|
#define TIMER 1 |
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------- */ |
|
|
|
@ -28,43 +29,83 @@ int essai_filterstack(FloatImg *pimg) |
|
|
|
|
{ |
|
|
|
|
int foo; |
|
|
|
|
|
|
|
|
|
foo = filterstack_init(4); |
|
|
|
|
if (foo) { |
|
|
|
|
fprintf(stderr, "filterstack init --> %d\n", foo); |
|
|
|
|
return foo; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
foo = filterstack_add(5, 1, 1.0); |
|
|
|
|
if (foo) { |
|
|
|
|
fprintf(stderr, "filterstack add 1 --> %d\n", foo); |
|
|
|
|
return foo; |
|
|
|
|
} |
|
|
|
|
foo = filterstack_add(13, 1, 1.0); |
|
|
|
|
filterstack_list(__func__); |
|
|
|
|
|
|
|
|
|
foo = filterstack_run(pimg, 0); |
|
|
|
|
if (foo) { |
|
|
|
|
fprintf(stderr, "filterstack add 2 --> %d\n", foo); |
|
|
|
|
fprintf(stderr, "filterstack run --> %d\n", foo); |
|
|
|
|
return foo; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
filterstack_list(); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
/* ----------------------------------------------------------- */ |
|
|
|
|
int parse_filter_chain(char *argument) |
|
|
|
|
{ |
|
|
|
|
char *cptr; |
|
|
|
|
int value, foo; |
|
|
|
|
|
|
|
|
|
foo = filterstack_run(pimg, 0); |
|
|
|
|
fprintf(stderr, "\n%s: arg = '%s'\n", __func__, argument); |
|
|
|
|
|
|
|
|
|
foo = filterstack_init(4); |
|
|
|
|
if (foo) { |
|
|
|
|
fprintf(stderr, "filterstack run --> %d\n", 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); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
filterstack_list(__func__); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
/* ----------------------------------------------------------- */ |
|
|
|
|
int help(void) |
|
|
|
|
{ |
|
|
|
|
puts("yolo!"); |
|
|
|
|
exit(0); |
|
|
|
|
} |
|
|
|
|
/* ----------------------------------------------------------- */ |
|
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) |
|
|
|
|
{ |
|
|
|
|
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 |
|
|
|
|
|
|
|
|
|
verbosity = 2; |
|
|
|
|
fimg_print_version(1); |
|
|
|
|
parse_filter_chain(filterchain); |
|
|
|
|
|
|
|
|
|
foo = fimg_create(&image, W, H, FIMG_TYPE_RGB); |
|
|
|
|
if (foo) { |
|
|
|
|