more work on the Fonderie

This commit is contained in:
tth 2021-05-11 10:36:55 +02:00
parent daeb4c72a7
commit cc79dd5152
10 changed files with 80 additions and 12 deletions

View File

@ -11,6 +11,9 @@ BEGIN {
print "// -----------------------------------" print "// -----------------------------------"
} }
# $1 is the badly brain-designed numeric id
# $2 is the user name of the filter
{ {
printf "#define CR_%s (%d)\n", $2, $1 printf "#define CR_%s (%d)\n", $2, $1
} }

View File

@ -11,6 +11,10 @@ BEGIN {
print "Crapulor CrapL[] = {"; print "Crapulor CrapL[] = {";
} }
# $1 is the badly brain-designed numeric id
# $2 is the user name of the filter
# $3 and $4 are two not used parameters
#
{ {
printf " { CR_%s, \"%s\", %d, %f }, // id=%d\n", printf " { CR_%s, \"%s\", %d, %f }, // id=%d\n",
$2, $2, $3, $4, $1; $2, $2, $3, $4, $1;

View File

@ -157,7 +157,7 @@ return retval;
* processor. * processor.
*/ */
#define DEBUG_THIS_CRAP 100 #define DEBUG_THIS_CRAP 0
int crapulator(FloatImg *image, int idFx, float fval) int crapulator(FloatImg *image, int idFx, float fval)
{ {
@ -273,6 +273,9 @@ switch (idFx) {
case CR_bsombra: /* experiment ! */ case CR_bsombra: /* experiment ! */
retval = des_bords_sombres_a(image, 160); retval = des_bords_sombres_a(image, 160);
break; break;
case CR_bsombrb: /* experiment ! */
retval = des_bords_sombres_b(image, 160);
break;
case CR_vsglitch: case CR_vsglitch:
/* please make this function more tweakable */ /* please make this function more tweakable */
retval = vertical_singlitch(image, 290+rand()%45, retval = vertical_singlitch(image, 290+rand()%45,

View File

@ -23,12 +23,13 @@
22 sqrt 1 0.0 22 sqrt 1 0.0
23 pow2 1 0.0 23 pow2 1 0.0
24 bsombra 1 1.0 24 bsombra 1 1.0
25 vsglitch 1 1.0 25 bsombrb 1 1.0
26 rndblks 1 1.0 26 rndblks 1 1.0
27 shiftln0 1 1.0 27 shiftln0 1 1.0
28 qsortrgb 2 1.0 28 qsortrgb 2 1.0
30 multidots 100 1.333 30 multidots 100 1.333
31 diagonal 1 1.0 31 diagonal 1 1.0
32 vsglitch 1 1.0
42 nothing 42 3.1415926 42 nothing 42 3.1415926
45 hilightr 1 1.717 45 hilightr 1 1.717
99 message 1 1.0 99 message 1 1.0

View File

@ -249,7 +249,7 @@ if (foo) {
exit(1); exit(1);
} }
if (verbosity) { if (verbosity > 1) {
filterstack_list(0, "input"); filterstack_list(0, "input");
filterstack_list(1, "ouput"); filterstack_list(1, "ouput");
fprintf(stderr, ".\n"); fprintf(stderr, ".\n");

View File

@ -16,6 +16,24 @@
extern int verbosity; extern int verbosity;
/* -------------------------------------------------------------- */
/* 10 mai 2021 a Terre Blanque */
int microglitch(FloatImg *pimg, int notused)
{
int surface;
int offset, idx;
surface = pimg->width * pimg->height;
for (idx=0; idx<10000; idx++) {
offset = rand() % surface;
pimg->R[offset] *= 0.8;
pimg->G[offset] *= 0.8;
pimg->B[offset] *= 0.8;
}
return 0;
}
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
/* nouveau du 32 decembre 2020, endless september */ /* nouveau du 32 decembre 2020, endless september */
int do_something(FloatImg *pimg, int notused) int do_something(FloatImg *pimg, int notused)

View File

@ -2,6 +2,8 @@
* glitches.h * glitches.h
*/ */
int microglitch(FloatImg *pimg, int notused);
int do_something(FloatImg *pimg, int notused); int do_something(FloatImg *pimg, int notused);
int plot_multidots(FloatImg *picture, int notused); int plot_multidots(FloatImg *picture, int notused);

View File

@ -287,7 +287,7 @@ fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pimg, offset);
#endif #endif
if (offset<0 || offset>=pimg->width) { if (offset<0 || offset>=pimg->width) {
fprintf(stderr, "%s offset %d is bad\n", __func__, offset); fprintf(stderr, "%s: offset %d is bad\n", __func__, offset);
return -66; return -66;
} }
@ -309,6 +309,23 @@ for (y=0; y<pimg->height; y++) {
return 0; return 0;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
/* nouveau Mon 10 May 2021 08:46:02 PM CEST
* chez Eric 1KA */
int des_bords_sombres_b(FloatImg *pimg, int offset)
{
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pimg, offset);
#endif
if (offset<0 || offset>=pimg->width) {
fprintf(stderr, "%s: offset %d is bad\n", __func__, offset);
return -66;
}
return -1;
}
/* -------------------------------------------------------------- */
/* /*
* int binarize(FloatImg *pimg, int notused) was now in * int binarize(FloatImg *pimg, int notused) was now in
* funcs/sfx2.c * funcs/sfx2.c

View File

@ -15,6 +15,7 @@ int mirror_split(FloatImg *pimg, int kaboo);
int upside_down(FloatImg *pimg); int upside_down(FloatImg *pimg);
int des_bords_sombres_a(FloatImg *pimg, int offset); int des_bords_sombres_a(FloatImg *pimg, int offset);
int des_bords_sombres_b(FloatImg *pimg, int offset);
int brotche_rand48_a(FloatImg *fimg, float ratio, float mval); int brotche_rand48_a(FloatImg *fimg, float ratio, float mval);
int brotche_rand48_b(FloatImg *fimg, float ratio, float mval); int brotche_rand48_b(FloatImg *fimg, float ratio, float mval);

View File

@ -15,6 +15,7 @@
#include "crapulator.h" #include "crapulator.h"
#include "filterstack.h" #include "filterstack.h"
#include "single.h" #include "single.h"
#include "glitches.h"
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
@ -23,11 +24,11 @@
int verbosity; int verbosity;
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
int run_the_singlepass(char *globber, char *destdir, int run_the_singlepass(char *globber, char *destdir, int duplic,
int fchain, int outfmt) int fchain, int outfmt)
{ {
FloatImg image = { 0 }; FloatImg image = { 0 };
int idx, foo; int idx, foo, loop;
glob_t globbuf; glob_t globbuf;
char *fname; char *fname;
double elapsed; double elapsed;
@ -98,10 +99,17 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
return foo; return foo;
} }
foo = single_push_picture(&image); /* HERE WE CAN REPEAT THE INSERT OF THE PICZ */
if (foo) { for (loop=0; loop<duplic; loop++) {
fprintf(stderr, "error %d on push_picture\n", foo); foo = single_push_picture(&image);
return foo; if (foo) {
fprintf(stderr, "error %d on push_picture\n", foo);
return foo;
}
if (loop) {
/* this is just a wip XXX */
microglitch(&image, loop);
}
} }
} }
@ -129,6 +137,7 @@ puts("\t-F\tdefine:the:filter:chain");
puts("\t-g\tinput glob pattern"); puts("\t-g\tinput glob pattern");
puts("\t-L\tlist available filters"); puts("\t-L\tlist available filters");
puts("\t-O\t/output/directory (default ./p8)"); puts("\t-O\t/output/directory (default ./p8)");
puts("\t-r N\trepetiiing factor");
// puts("\t-s\tdo single test"); // puts("\t-s\tdo single test");
puts("\t-v\tspit more messages"); puts("\t-v\tspit more messages");
@ -144,6 +153,7 @@ char *globbing = "./capture/?????.fimg";
char *outdir = "./p8"; char *outdir = "./p8";
// char *outtype = ".png"; // char *outtype = ".png";
int do_xper = 0; int do_xper = 0;
int repeat = 1;
fprintf(stderr, "*** %s : compiled %s %s\n", __FILE__, fprintf(stderr, "*** %s : compiled %s %s\n", __FILE__,
__DATE__, __TIME__); __DATE__, __TIME__);
@ -154,7 +164,7 @@ if (argc < 2) {
help(); help();
} }
while ((opt = getopt(argc, argv, "hF:g:LO:svx")) != -1) { while ((opt = getopt(argc, argv, "hF:g:LO:r:svx")) != -1) {
switch (opt) { switch (opt) {
case 'h': help(); break; case 'h': help(); break;
@ -167,6 +177,8 @@ while ((opt = getopt(argc, argv, "hF:g:LO:svx")) != -1) {
case 'O': outdir = optarg; break; case 'O': outdir = optarg; break;
case 'r': repeat = atoi(optarg); break;
case 'v': verbosity++; break; case 'v': verbosity++; break;
case 'x': do_xper = 1; break; case 'x': do_xper = 1; break;
@ -178,6 +190,11 @@ while ((opt = getopt(argc, argv, "hF:g:LO:svx")) != -1) {
} }
if (repeat < 1) {
fprintf(stderr, "%s: loop %d invalid\n", argv[0], repeat);
exit(2);
}
foo = parse_filter_chain(FILTERS, filterchain); foo = parse_filter_chain(FILTERS, filterchain);
if (foo) { if (foo) {
fprintf(stderr, "err %d in parse_filter_chain\n", foo); fprintf(stderr, "err %d in parse_filter_chain\n", foo);
@ -189,11 +206,13 @@ if (verbosity) {
fprintf(stderr, "\tinput glob %s\n", globbing); fprintf(stderr, "\tinput glob %s\n", globbing);
fprintf(stderr, "\tfilter chain %s\n", filterchain); fprintf(stderr, "\tfilter chain %s\n", filterchain);
fprintf(stderr, "\toutput dir %s\n", outdir); fprintf(stderr, "\toutput dir %s\n", outdir);
fprintf(stderr, "\trepeat %d\n", repeat);
// fprintf(stderr, "\toutput type %s\n", outtype); // fprintf(stderr, "\toutput type %s\n", outtype);
fprintf(stderr, "\tdo xper %d\n", do_xper); fprintf(stderr, "\tdo xper %d\n", do_xper);
} }
foo = run_the_singlepass(globbing, outdir, FILTERS, FILE_TYPE_PNG); foo = run_the_singlepass(globbing, outdir, repeat,
FILTERS, FILE_TYPE_PNG);
fprintf(stderr, "\n\tRun the single pass --> %d\n", foo); fprintf(stderr, "\n\tRun the single pass --> %d\n", foo);
return 0; return 0;