Compare commits
No commits in common. "54ee71119d4c7eb10f863db17a3cf71b3764ba03" and "7c1ad9633a10ab7d17f309353bdc6bf56da11ef1" have entirely different histories.
54ee71119d
...
7c1ad9633a
@ -1,6 +1,5 @@
|
||||
#
|
||||
# compilation de la fonderie, du crapulator
|
||||
# et de tout le crap...
|
||||
# compilation de la fonderie
|
||||
#
|
||||
|
||||
COPT = -g -no-pie -Wall -DDEBUG_LEVEL=0 -Werror=parentheses
|
||||
|
@ -53,9 +53,6 @@ return 0;
|
||||
* This is the main filter engine
|
||||
* used both for input and output
|
||||
*/
|
||||
|
||||
#define DEBUG_THIS_CRAP 1
|
||||
|
||||
int crapulator(FloatImg *image, int idFx, float fval)
|
||||
{
|
||||
int retval;
|
||||
@ -70,13 +67,11 @@ fprintf(stderr, ">>> %s ( %p %d %f )\n", __func__,
|
||||
|
||||
retval = 0;
|
||||
|
||||
#if DEBUG_THIS_CRAP
|
||||
if (666==count) {
|
||||
flag_debug = 1;
|
||||
fprintf(stderr, "DEBUG PT 1 in %s:%d\n", __func__, __LINE__);
|
||||
fimg_save_as_png(image, "crap_before.png", 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (idFx) {
|
||||
case 0: /* DO NOTHING */
|
||||
@ -122,13 +117,9 @@ switch (idFx) {
|
||||
case 11:
|
||||
retval = trinarize(image, 0);
|
||||
break;
|
||||
case 24: /* experiment ! */
|
||||
retval = des_bords_sombres_a(image, 260);
|
||||
break;
|
||||
/* --- WTF -- */
|
||||
case 25:
|
||||
/* please make this function more tweakable */
|
||||
retval = vertical_singlitch(image, 290+rand()%35,
|
||||
fval, 0.18, 0);
|
||||
retval = vertical_singlitch(image, 250+rand()%15 , fval, 18, 0);
|
||||
break;
|
||||
default :
|
||||
fprintf(stderr, "%s : effect #%d invalid\n",
|
||||
@ -136,15 +127,12 @@ switch (idFx) {
|
||||
return -77;
|
||||
}
|
||||
|
||||
#if DEBUG_THIS_CRAP
|
||||
if (flag_debug) {
|
||||
fprintf(stderr, "DEBUG PT 2 in %s:%d\n", __func__, __LINE__);
|
||||
fimg_save_as_png(image, "crap_after.png", 0);
|
||||
flag_debug = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
count++;
|
||||
count++; flag_debug = 0;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ int create_fifo(int nbslot, int w, int h, int t);
|
||||
* funcs in 'sfx.c'
|
||||
*/
|
||||
|
||||
int des_bords_sombres_a(FloatImg *pimg, int offset);
|
||||
int trinarize(FloatImg *pimg, int notused);
|
||||
int binarize(FloatImg *pimg, int notused);
|
||||
|
||||
|
@ -17,7 +17,7 @@ int verbosity;
|
||||
int convert_to_gray;
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
int traite_une_image(FloatImg *image, int proc, int step, char *outd)
|
||||
int traite_une_image(FloatImg *image, int proc, int step)
|
||||
{
|
||||
static int numero;
|
||||
int foo;
|
||||
@ -29,7 +29,10 @@ if (foo) {
|
||||
fprintf(stderr, "%s: err %d on insert\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
sprintf(ligne, "%s/%05d.png", outd, numero);
|
||||
sprintf(ligne, "p8/%05d.png", numero);
|
||||
/* ^^^
|
||||
XXX hardcoded value ? wtf ?
|
||||
*/
|
||||
foo = export_fifo(ligne, proc, step);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: err %d on export\n", __func__, foo);
|
||||
@ -39,8 +42,7 @@ numero++; /* VERY IMPORTANT :) */
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
int insert_blank(FloatImg *image, int nbre, int pproc,
|
||||
float fval, char *outd)
|
||||
int insert_blank(FloatImg *image, int nbre, int pproc, float fval)
|
||||
{
|
||||
int idx, foo;
|
||||
|
||||
@ -48,7 +50,7 @@ fimg_clear(image);
|
||||
for (idx=0; idx<nbre; idx++) {
|
||||
fimg_vdeg_a(image, fval);
|
||||
// brotche_rand48_b(image, drand48()*0.10, 1e5);
|
||||
if ((foo=traite_une_image(image, pproc, 1, outd))) {
|
||||
if ((foo=traite_une_image(image, pproc, 1))) {
|
||||
fprintf(stderr, "%s : err %d from 'traite_une_image'\n",
|
||||
__func__, foo);
|
||||
break;
|
||||
@ -89,11 +91,6 @@ else fprintf(stderr, "\tno out fx\n");
|
||||
|
||||
memset(&globbuf, 0, sizeof(glob_t));
|
||||
foo = glob(pattern, 0, NULL, &globbuf);
|
||||
if (foo) {
|
||||
fprintf(stderr, "glob failure %d\n", foo);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fprintf(stderr, "glob '%s' -> %d, %ld files found\n", pattern, foo,
|
||||
globbuf.gl_pathc);
|
||||
|
||||
@ -118,7 +115,7 @@ foo = create_fifo(szfifo, width, height, FIMG_TYPE_RGB);
|
||||
fprintf(stderr, "init fifo (%d slots) --> %d\n", szfifo, foo);
|
||||
|
||||
/* XXX inject a few strange pics in the fifo */
|
||||
insert_blank(&input, BLANK, outfx, maxvalue, outdir);
|
||||
insert_blank(&input, BLANK, outfx, maxvalue);
|
||||
|
||||
for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
||||
cptr = globbuf.gl_pathv[idx];
|
||||
@ -136,16 +133,16 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
||||
fprintf(stderr, "%s crapulator -> %d\n", __func__, foo);
|
||||
exit(1);
|
||||
}
|
||||
foo = traite_une_image(&input, outfx, step, outdir);
|
||||
foo = traite_une_image(&input, outfx, step);
|
||||
if (foo) {
|
||||
fprintf(stderr, "traitement %s -> %d WTF?\n", cptr, foo);
|
||||
break;
|
||||
}
|
||||
fprintf(stderr, "\t%5d / %5ld\r", idx, globbuf.gl_pathc);
|
||||
fprintf(stderr, "\t%5d\r", idx);
|
||||
}
|
||||
fputs("\n", stderr);
|
||||
|
||||
insert_blank(&input, BLANK*2, outfx, maxvalue, outdir);
|
||||
insert_blank(&input, BLANK*2, outfx, maxvalue);
|
||||
|
||||
/*
|
||||
* PLEASE, FLUSH THE FIFO !
|
||||
@ -215,11 +212,6 @@ while ((opt = getopt(argc, argv, "ghI:O:s:T:vw:x:")) != -1) {
|
||||
}
|
||||
}
|
||||
|
||||
if (verbosity) {
|
||||
fprintf(stderr, "input glob %s\n", in_pattern);
|
||||
fprintf(stderr, "output dir %s\n", out_dir);
|
||||
}
|
||||
|
||||
foo = demarre_la_machine(in_pattern, out_dir, fifosize, in_effect,
|
||||
out_effect, steps);
|
||||
fprintf(stderr, "retour du big-run de la machine -> %d\n", foo);
|
||||
|
@ -164,7 +164,7 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
||||
/* OK try it ... */
|
||||
foo = crapulator(&B, infx, value/2.0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: input fx fail %d\n", __func__, foo);
|
||||
fprintf(stderr, "in fx crapulator failure %d\n", foo);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -175,8 +175,8 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
||||
/* 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);
|
||||
fprintf(stderr, "\nout fx %d crapulator failure %d\n",
|
||||
outfx, foo);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -17,38 +17,6 @@
|
||||
*/
|
||||
extern int verbosity;
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
/* nouveau du 20 novembre 2020, pour encoder une vidz du vernissage
|
||||
* du festival Sauvageonnes de Mixart-Myrys */
|
||||
int des_bords_sombres_a(FloatImg *pimg, int offset)
|
||||
{
|
||||
float coef;
|
||||
int xpos, lidx, y;
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
for (y=0; y<pimg->height; y++) {
|
||||
lidx = y * pimg->width;
|
||||
for (xpos=0; xpos<offset; xpos++) {
|
||||
coef = (float)xpos / (float)offset;
|
||||
pimg->R[xpos+lidx] *= coef;
|
||||
pimg->G[xpos+lidx] *= coef;
|
||||
pimg->B[xpos+lidx] *= coef;
|
||||
pimg->R[(pimg->width-xpos)+lidx] *= coef;
|
||||
pimg->G[(pimg->width-xpos)+lidx] *= coef;
|
||||
pimg->B[(pimg->width-xpos)+lidx] *= coef;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
int trinarize(FloatImg *pimg, int notused)
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ for (iter=0; iter<72; iter++) {
|
||||
if (foo) abort();
|
||||
}
|
||||
|
||||
sprintf(buff, "/tmp/out%03d.png", iter);
|
||||
sprintf(buff, "out%03d.png", iter);
|
||||
foo = fimg_save_as_png(&image, buff, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "err %d saving to '%s'\n", foo, PNG);
|
||||
|
Loading…
Reference in New Issue
Block a user