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 "// -----------------------------------"
}
# $1 is the badly brain-designed numeric id
# $2 is the user name of the filter
{
printf "#define CR_%s (%d)\n", $2, $1
}

View File

@ -11,6 +11,10 @@ BEGIN {
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",
$2, $2, $3, $4, $1;

View File

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

View File

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

View File

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

View File

@ -16,6 +16,24 @@
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 */
int do_something(FloatImg *pimg, int notused)

View File

@ -2,6 +2,8 @@
* glitches.h
*/
int microglitch(FloatImg *pimg, int notused);
int do_something(FloatImg *pimg, 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
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;
}
@ -309,6 +309,23 @@ for (y=0; y<pimg->height; y++) {
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
* funcs/sfx2.c

View File

@ -15,6 +15,7 @@ int mirror_split(FloatImg *pimg, int kaboo);
int upside_down(FloatImg *pimg);
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_b(FloatImg *fimg, float ratio, float mval);

View File

@ -15,6 +15,7 @@
#include "crapulator.h"
#include "filterstack.h"
#include "single.h"
#include "glitches.h"
/* ----------------------------------------------------------- */
@ -23,11 +24,11 @@
int verbosity;
/* ----------------------------------------------------------- */
int run_the_singlepass(char *globber, char *destdir,
int run_the_singlepass(char *globber, char *destdir, int duplic,
int fchain, int outfmt)
{
FloatImg image = { 0 };
int idx, foo;
int idx, foo, loop;
glob_t globbuf;
char *fname;
double elapsed;
@ -98,10 +99,17 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
return foo;
}
foo = single_push_picture(&image);
if (foo) {
fprintf(stderr, "error %d on push_picture\n", foo);
return foo;
/* HERE WE CAN REPEAT THE INSERT OF THE PICZ */
for (loop=0; loop<duplic; loop++) {
foo = single_push_picture(&image);
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-L\tlist available filters");
puts("\t-O\t/output/directory (default ./p8)");
puts("\t-r N\trepetiiing factor");
// puts("\t-s\tdo single test");
puts("\t-v\tspit more messages");
@ -144,6 +153,7 @@ char *globbing = "./capture/?????.fimg";
char *outdir = "./p8";
// char *outtype = ".png";
int do_xper = 0;
int repeat = 1;
fprintf(stderr, "*** %s : compiled %s %s\n", __FILE__,
__DATE__, __TIME__);
@ -154,7 +164,7 @@ if (argc < 2) {
help();
}
while ((opt = getopt(argc, argv, "hF:g:LO:svx")) != -1) {
while ((opt = getopt(argc, argv, "hF:g:LO:r:svx")) != -1) {
switch (opt) {
case 'h': help(); break;
@ -167,6 +177,8 @@ while ((opt = getopt(argc, argv, "hF:g:LO:svx")) != -1) {
case 'O': outdir = optarg; break;
case 'r': repeat = atoi(optarg); break;
case 'v': verbosity++; 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);
if (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, "\tfilter chain %s\n", filterchain);
fprintf(stderr, "\toutput dir %s\n", outdir);
fprintf(stderr, "\trepeat %d\n", repeat);
// fprintf(stderr, "\toutput type %s\n", outtype);
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);
return 0;