is fonderie ok ?
This commit is contained in:
parent
c9de7cdc80
commit
e0d154c37e
@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
COPT = -g -pg -no-pie -Wall -DDEBUG_LEVEL=0 -Werror=parentheses
|
||||
COPT = -g -no-pie -Wall -DDEBUG_LEVEL=0 -Werror=parentheses
|
||||
LIBS = -lfloatimg -lpnglite -lm
|
||||
OBJS = fonctions.o sfx.o crapulator.o
|
||||
DEPS = fonctions.h crapulator.h
|
||||
|
@ -10,8 +10,8 @@ de **films flous**.
|
||||
Le programme principal, utilisé à partir de la ligne de commande
|
||||
avec une foule d'options aux mnémoniques abscons.
|
||||
|
||||
Rassurez-vous, en général ils sont wrappables dans des scripts
|
||||
shell. Il est même possible un jour qu'ils puissent lire des
|
||||
Rassurez-vous, en général il est wrappable dans des scripts
|
||||
écrits en Bash. Il est même possible un jour qu'ils puissent lire des
|
||||
paramètres dans `$(env)`.
|
||||
|
||||
```
|
||||
@ -45,16 +45,17 @@ GLOB=${GRABDIR}'/?????.fimg'
|
||||
|
||||
${FONDEUR} -v -T 40 -I "$GLOB" -w 10 -x 0
|
||||
```
|
||||
|
||||
Ensuite il suffit d'encoder toutes les images générées dans
|
||||
`p8/` (répertoire de sortie par défaut
|
||||
avec une incantation de ffmpeg :
|
||||
|
||||
```
|
||||
ffmpeg -nostdin \
|
||||
-loglevel error \
|
||||
-y -r 30 -f image2 -i p8/%05d.png \
|
||||
-c:v libx264 -pix_fmt yuv420p \
|
||||
foo.mp4
|
||||
ffmpeg -nostdin \
|
||||
-loglevel error \
|
||||
-y -r 30 -f image2 -i p8/%05d.png \
|
||||
-c:v libx264 -pix_fmt yuv420p \
|
||||
foo.mp4
|
||||
```
|
||||
|
||||
## crapulator.c
|
||||
|
@ -55,8 +55,8 @@ return 0;
|
||||
*/
|
||||
int crapulator(FloatImg *image, int idFx, float fval)
|
||||
{
|
||||
int retval, foo;
|
||||
FloatImg imgtmp;
|
||||
int retval;
|
||||
// FloatImg imgtmp;
|
||||
static int count = 0;
|
||||
int flag_debug = 0;
|
||||
|
||||
@ -116,6 +116,10 @@ switch (idFx) {
|
||||
}
|
||||
break;
|
||||
|
||||
case 10:
|
||||
retval = binarize(image, 0);
|
||||
break;
|
||||
|
||||
default :
|
||||
fprintf(stderr, "%s : effect #%d invalid\n",
|
||||
__func__, idFx);
|
||||
|
@ -41,13 +41,13 @@ numero++; /* VERY IMPORTANT :) */
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
int insert_blank(FloatImg *image, int nbre, int pproc)
|
||||
int insert_blank(FloatImg *image, int nbre, int pproc, float fval)
|
||||
{
|
||||
int idx, foo;
|
||||
|
||||
fimg_clear(image);
|
||||
for (idx=0; idx<nbre; idx++) {
|
||||
fimg_vdeg_a(image, 16.64);
|
||||
fimg_vdeg_a(image, fval);
|
||||
// brotche_rand48_b(image, drand48()*0.10, 1e5);
|
||||
if ((foo=traite_une_image(image, pproc, 1))) {
|
||||
fprintf(stderr, "%s : err %d from 'traite_une_image'\n",
|
||||
@ -61,7 +61,7 @@ puts("");
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
#define BLANK 40
|
||||
#define BLANK 30
|
||||
|
||||
int demarre_la_machine(char *pattern, char *outdir, int szfifo,
|
||||
int infx, int outfx, int step)
|
||||
@ -71,11 +71,12 @@ glob_t globbuf;
|
||||
char *cptr;
|
||||
FloatImg input;
|
||||
double fin;
|
||||
float maxvalue;
|
||||
int datas[3];
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( '%s' -> '%s' %d )\n", __func__,
|
||||
pattern, outdir, szfifo);
|
||||
fprintf(stderr, ">>> %s ( '%s' -> '%s' %d eff:%d:%d)\n", __func__,
|
||||
pattern, outdir, szfifo, infx, outfx);
|
||||
#endif
|
||||
|
||||
if (1 != step) fprintf(stderr, "\tstep is %d\n", step);
|
||||
@ -94,21 +95,29 @@ fprintf(stderr, "glob '%s' -> %d, %ld files found\n", pattern, foo,
|
||||
|
||||
/* get the size of the inputs images */
|
||||
foo = fimg_fileinfos(globbuf.gl_pathv[0], datas);
|
||||
width = datas[0];
|
||||
height = datas[1];
|
||||
width = datas[0]; height = datas[1];
|
||||
fprintf(stderr, "image size %dx%d\n", width, height);
|
||||
|
||||
fimg_create(&input, width, height, 3);
|
||||
|
||||
/* get the maximum value of the first pic */
|
||||
foo = fimg_load_from_dump(globbuf.gl_pathv[0], &input);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: err %d loading %s\n",
|
||||
__func__, foo, globbuf.gl_pathv[0]);
|
||||
exit(1);
|
||||
}
|
||||
maxvalue = fimg_get_maxvalue(&input);
|
||||
fprintf(stderr, "maxvalue %f\n", maxvalue);
|
||||
|
||||
foo = create_fifo(szfifo, width, height, FIMG_TYPE_RGB);
|
||||
fprintf(stderr, "init fifo (%d slots) --> %d\n", szfifo, foo);
|
||||
|
||||
fimg_create(&input, width, height, 3);
|
||||
|
||||
/* XXX inject a few stange pics in the fifo */
|
||||
insert_blank(&input, BLANK, outfx);
|
||||
/* XXX inject a few strange pics in the fifo */
|
||||
insert_blank(&input, BLANK, outfx, maxvalue);
|
||||
|
||||
for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
||||
|
||||
cptr = globbuf.gl_pathv[idx];
|
||||
|
||||
/* first step : read the current grabed picz from disk,
|
||||
and put it in our private buffer */
|
||||
foo = fimg_load_from_dump(cptr, &input);
|
||||
@ -116,7 +125,6 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
||||
fprintf(stderr, "load #%d from dump -> %d\n", idx, foo);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* ========================= */
|
||||
/* FSCKING INPUT FILTER HERE */
|
||||
foo = crapulator(&input, infx, 0.42);
|
||||
@ -124,7 +132,6 @@ 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);
|
||||
if (foo) {
|
||||
fprintf(stderr, "traitement %s -> %d WTF?\n", cptr, foo);
|
||||
@ -132,10 +139,13 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
||||
}
|
||||
fprintf(stderr, "\t%5d\r", idx);
|
||||
}
|
||||
|
||||
fputs("\n", stderr);
|
||||
|
||||
insert_blank(&input, BLANK, outfx);
|
||||
insert_blank(&input, BLANK*2, outfx, maxvalue);
|
||||
|
||||
/*
|
||||
* PLEASE, FLUSH THE FIFO !
|
||||
*/
|
||||
|
||||
fin = fimg_timer_get(0);
|
||||
if (idx) {
|
||||
|
@ -21,8 +21,7 @@ extern int verbosity;
|
||||
int binarize(FloatImg *pimg, int notused)
|
||||
{
|
||||
float mm[6], mR, mG, mB;
|
||||
int foo, x, y;
|
||||
float rgb[3];
|
||||
int foo, size;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pimg, notused);
|
||||
@ -34,19 +33,17 @@ mG = (mm[3] - mm[2]) / 2.0;
|
||||
mB = (mm[5] - mm[4]) / 2.0;
|
||||
|
||||
if (verbosity > 1)
|
||||
fprintf(stderr, "%s: %f %f %f\n", __func__, mR, mG, mB);
|
||||
fprintf(stderr, "%s: %f %f %f\n", __func__, mR, mG, mB);
|
||||
|
||||
for (y=0; y<pimg->height; y++) {
|
||||
for (x=0; x<pimg->width; x++) {
|
||||
fimg_get_rgb(pimg, x, y, rgb);
|
||||
if (rgb[0] < mR) rgb[0] = mm[0];
|
||||
else rgb[0] = mm[1];
|
||||
if (rgb[1] < mG) rgb[1] = mm[2];
|
||||
else rgb[1] = mm[3];
|
||||
if (rgb[2] < mB) rgb[2] = mm[4];
|
||||
else rgb[2] = mm[5];
|
||||
fimg_put_rgb(pimg, x, y, rgb);
|
||||
}
|
||||
size = pimg->width * pimg->height;
|
||||
|
||||
for (foo=0; foo<size; foo++) {
|
||||
if (pimg->R[foo] < mR) pimg->R[foo] = mm[0];
|
||||
else pimg->R[foo] = mm[1];
|
||||
if (pimg->G[foo] < mG) pimg->G[foo] = mm[2];
|
||||
else pimg->G[foo] = mm[3];
|
||||
if (pimg->B[foo] < mB) pimg->B[foo] = mm[4];
|
||||
else pimg->B[foo] = mm[5];
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user