Compare commits

...

4 Commits

Author SHA1 Message Date
321b12dd9a cleanup 2021-01-06 11:47:55 +01:00
de3a50cc1d jacky tuning 2021-01-05 22:55:34 +01:00
46fad56471 cleanup some useless code 2021-01-03 20:34:10 +01:00
8425496f3f usefull comment 2021-01-03 17:56:41 +01:00
5 changed files with 44 additions and 49 deletions

View File

@ -1,5 +1,10 @@
#!/usr/bin/awk -f #!/usr/bin/awk -f
#
# this utility script make a file who
# is includet by 'crapulator.h'
#
BEGIN { BEGIN {
print "// -----------------------------------" print "// -----------------------------------"
print "// generated file, do not edit by hand !" print "// generated file, do not edit by hand !"

View File

@ -1,5 +1,9 @@
#!/usr/bin/awk -f #!/usr/bin/awk -f
#
# this utility script make a file who
# is includet by 'crapulator.c'
#
BEGIN { BEGIN {
print "// -----------------------------------" print "// -----------------------------------"
print "// generated file, do not edit by hand"; print "// generated file, do not edit by hand";

View File

@ -82,13 +82,6 @@ if (1 != step) fprintf(stderr, "\tstep is %d\n", step);
(void)fimg_timer_set(0); (void)fimg_timer_set(0);
#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
memset(&globbuf, 0, sizeof(glob_t)); memset(&globbuf, 0, sizeof(glob_t));
foo = glob(pattern, 0, NULL, &globbuf); foo = glob(pattern, 0, NULL, &globbuf);
if (foo) { if (foo) {
@ -191,8 +184,8 @@ int foo, opt;
int fifosize = 10; int fifosize = 10;
char *in_pattern = "capture/?????.fimg"; char *in_pattern = "capture/?????.fimg";
char *out_dir = "p8"; char *out_dir = "p8";
int in_effect = 0; // OBSOLETE int in_effect = 0;
int out_effect = 0; // OBSOLETE int out_effect = 0;
int steps = 1; int steps = 1;
int blanks = 20; int blanks = 20;
char *InFchain = "0"; char *InFchain = "0";
@ -223,10 +216,10 @@ while ((opt = getopt(argc, argv, "B:E:F:ghI:LO:s:T:vw:x:")) != -1) {
break; break;
case 'v': verbosity++; case 'v': verbosity++;
break; break;
case 'w': in_effect = atoi(optarg); // OBSOLETE case 'w': in_effect = atoi(optarg);
break; // OBSOLETE break;
case 'x': out_effect = atoi(optarg); // OBSOLETE case 'x': out_effect = atoi(optarg);
break; // OBSOLETE break;
case 's': steps = atoi(optarg); case 's': steps = atoi(optarg);
break; break;
} }
@ -248,8 +241,8 @@ if (foo) {
exit(1); exit(1);
} }
foo = demarre_la_machine(in_pattern, out_dir, fifosize, in_effect, foo = demarre_la_machine(in_pattern, out_dir, fifosize, 0,
out_effect, steps, blanks); 0, steps, blanks);
fprintf(stderr, "retour du big-run de la machine -> %d\n", foo); fprintf(stderr, "retour du big-run de la machine -> %d\n", foo);
return 0; return 0;

View File

@ -173,7 +173,7 @@ static int x_delta(float dy, float phy)
{ {
float param, fv; float param, fv;
param = dy + phy; param = dy + phy;
fv = 9.999*sin(param) + 6.666*sin(param*3) + 3.333*sin(param*5); fv = 12.11*sin(param+0.22) + 8.5*sin(param*3.02) + 0.42*sin(param*5.1);
return (int)fv; return (int)fv;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
@ -193,7 +193,7 @@ fprintf(stderr, ">>> %s ( %p %d %f %f )\n", __func__, picz,
#endif #endif
h = picz->height; w = picz->width; h = picz->height; w = picz->width;
#define BB 4 #define BB 2
for (y=BB; y<h-BB; y++) { for (y=BB; y<h-BB; y++) {
dy = (float)y * omega; /* normalize vertical position */ dy = (float)y * omega; /* normalize vertical position */

View File

@ -71,8 +71,8 @@ for (idx=0; idx<nombre; idx++) {
filename = ptr_glob->gl_pathv[idx]; filename = ptr_glob->gl_pathv[idx];
foo = get_float_metric_from_file(filename, &metrique, method); foo = get_float_metric_from_file(filename, &metrique, method);
if (foo) { if (foo) {
fprintf(stderr, "%s: err %d get metric of '%s'\n", __func__, fprintf(stderr, "%s: err %d get metric of '%s'\n",
foo, filename); __func__, foo, filename);
return -1; return -1;
} }
if (verbosity) if (verbosity)
@ -119,7 +119,7 @@ int iarray[3];
char *cptr, line[200]; char *cptr, line[200];
float coef, value; float coef, value;
double meanmetric; double meanmetric;
IdxValue *idx_values; IdxValue *idx_values; /* gni? */
fprintf(stderr, " interpolate from '%s' to '%s' with %d steps.\n", fprintf(stderr, " interpolate from '%s' to '%s' with %d steps.\n",
pattern, outdir, Nsteps); pattern, outdir, Nsteps);
@ -147,10 +147,12 @@ if (FIMG_TYPE_RGB != iarray[2]) {
exit(1); /* BLAM! */ exit(1); /* BLAM! */
} }
#if 0
if (infx) fprintf(stderr, "\tin fx #%d\n", infx); if (infx) fprintf(stderr, "\tin fx #%d\n", infx);
else fprintf(stderr, "\tno in fx\n"); else fprintf(stderr, "\tno in fx\n");
if (outfx) fprintf(stderr, "\tout fx #%d\n", outfx); if (outfx) fprintf(stderr, "\tout fx #%d\n", outfx);
else fprintf(stderr, "\tno out fx\n"); else fprintf(stderr, "\tno out fx\n");
#endif
w = iarray[0], h = iarray[1]; w = iarray[0], h = iarray[1];
fprintf(stderr, "first image size : %dx%d\n", w, h); fprintf(stderr, "first image size : %dx%d\n", w, h);
@ -178,14 +180,8 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
} }
value = idx_values[idx].value; value = idx_values[idx].value;
/* here, insert the input filter */ /* here was the input filter */
if (infx) {
foo = crapulator(&B, infx, value);
}
else {
foo = filterstack_run(0, &B, 0); foo = filterstack_run(0, &B, 0);
}
if (foo) { if (foo) {
fprintf(stderr, "%s: input fx fail %d\n", __func__, foo); fprintf(stderr, "%s: input fx fail %d\n", __func__, foo);
exit(1); exit(1);
@ -195,14 +191,6 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
coef = (float)step / (float)Nsteps; coef = (float)step / (float)Nsteps;
fimg_interpolate(pSecond, pFirst, &Out, coef); fimg_interpolate(pSecond, pFirst, &Out, coef);
/* here we can insert the OUTPUT filter */
// foo = crapulator(&Out, outfx, value);
//if (foo) {
// fprintf(stderr, "\n%s: out fx %d failure %d\n",
// __func__, outfx, foo);
// exit(1);
// }
foo = filterstack_run(1, &Out, 0); foo = filterstack_run(1, &Out, 0);
if (foo) { if (foo) {
fprintf(stderr, "run filt stack--> %d\n", foo); fprintf(stderr, "run filt stack--> %d\n", foo);
@ -245,12 +233,17 @@ puts("usage:\n\tinterpolator [options] <inglob> <outdir> <nbsteep>");
* the options of 'fonderie' software ? * the options of 'fonderie' software ?
*/ */
puts("options:"); puts("options:");
puts("\t-S nn\tmysterious sort"); puts("\t-S nn\t\tmysterious sort");
puts("\t-F i:j\tfilter chain"); puts("\t-E i:bla:k\tinput filter chain");
puts("\t-L\tlist available filters"); puts("\t-F name:j\toutput filter chain");
puts("\t-w nn\tinput effect"); puts("\t-L\t\tlist available filters");
puts("\t-x nn\toutput effect"); // OBSOLETE puts("\t-w nn\t\tinput effect");
puts("\t-v\tincrease verbosity"); // OBSOLETE puts("\t-x nn\t\toutput effect");
puts("\t-v\t\tincrease verbosity");
if (verbosity) {
list_crapulors("available filters");
}
exit(0); exit(0);
} }
@ -260,8 +253,8 @@ int main (int argc, char *argv[])
int foo; int foo;
int nbrsteps = 9; int nbrsteps = 9;
int opt; int opt;
int inFx = 0; // int inFx = 0;
int outFx = 0; // int outFx = 0;
int sort = 0; int sort = 0;
char *InFchain = "0"; char *InFchain = "0";
char *OutFchain = "0"; char *OutFchain = "0";
@ -286,14 +279,14 @@ while ((opt = getopt(argc, argv, "E:F:hLS:vw:x:")) != -1) {
exit(0); exit(0);
case 'S': sort = atoi(optarg); break; case 'S': sort = atoi(optarg); break;
case 'v': verbosity++; break; case 'v': verbosity++; break;
case 'w': inFx = atoi(optarg); break; // OBSOLETE case 'w': inFx = atoi(optarg); break;
case 'x': outFx = atoi(optarg); break; // OBSOLETE case 'x': outFx = atoi(optarg); break;
} }
} }
//#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, "%s: argc = %d, optind = %d\n", argv[0], argc, optind); fprintf(stderr, "%s: argc = %d, optind = %d\n", argv[0], argc, optind);
//#endif #endif
if (3 != (argc-optind)) { if (3 != (argc-optind)) {
fprintf(stderr, "args: [options] <inglob> <outdir> <nbsteep>\n"); fprintf(stderr, "args: [options] <inglob> <outdir> <nbsteep>\n");
@ -320,7 +313,7 @@ if (verbosity > 1) {
nbrsteps = atoi(argv[optind+2]); nbrsteps = atoi(argv[optind+2]);
foo = interpolator(argv[optind], argv[optind+1], nbrsteps, foo = interpolator(argv[optind], argv[optind+1], nbrsteps,
inFx, outFx, sort); 0, 0, sort);
fprintf(stderr, "interpolator give us a %d score\n", foo); fprintf(stderr, "interpolator give us a %d score\n", foo);