pipdeprod next-gen is coming

This commit is contained in:
tonton th 2021-01-08 22:57:45 +01:00
parent 33338e7597
commit 47dbf6ea1a
7 changed files with 201 additions and 20 deletions

View File

@ -4,20 +4,20 @@
#
COPT = -g -fpic -no-pie -Wall -DDEBUG_LEVEL=0 -Werror=parentheses
LIBS = ../libfloatimg.a -lpnglite -lm -lz
LIBS = ../libfloatimg.a -ltiff -lpnglite -lm -lz -lcfitsio
OBJS = fonctions.o sfx.o crapulator.o glitches.o metriques.o \
filterstack.o
filterstack.o single.o
DEPS = fonctions.h crapulator.h metriques.h glitches.h sfx.h \
filterstack.h crapdef.h crapstr.h
filterstack.h crapdef.h crapstr.h single.h
all: fonderie interpolator t
# ---------------------------------------------------------
t: t.c Makefile ${OBJS}
gcc ${COPT} $< ${OBJS} ${LIBS} -ltiff -lcfitsio -o $@
gcc ${COPT} $< ${OBJS} ${LIBS} -o $@
# ---------------------------------------------------------
#
@ -33,7 +33,7 @@ interpolator: interpolator.c ${DEPS} ${OBJS} Makefile
# ---------------------------------------------------------
#
# some files are generated, sorry.
# some files are magically generated, sorry.
#
crapdef.h: crapulors.liste Makefile craplist2h.awk
./craplist2h.awk < $< | tee $@
@ -54,6 +54,9 @@ fonctions.o: fonctions.c fonctions.h Makefile
sfx.o: sfx.c ${DEPS} Makefile
gcc ${COPT} -c $<
single.o: single.c ${DEPS} Makefile
gcc ${COPT} -c $<
filterstack.o: filterstack.c ${DEPS} Makefile
gcc ${COPT} -c $<

View File

@ -118,8 +118,6 @@ fprintf(stderr, ">>> %s ( %p %d %f )\n", __func__,
image, idFx, fval);
#endif
retval = 0;
#if DEBUG_THIS_CRAP
static int count = 0;
int flag_debug = 0;
@ -130,6 +128,8 @@ if (666==count) {
}
#endif
retval = 0;
switch (idFx) {
case CR_none: /* DO NOTHING */
retval = 0; break;

View File

@ -1,5 +1,10 @@
#!/bin/bash
# ------------------------------------------------------------
liste_filtres ()
{
FILTRES="5:6:13 15 2:2 5:9:8 4:25 8:13:13:7 10:1 25:25:25:25 13:14:13"
rm /tmp/fstack*.png
@ -18,7 +23,29 @@ do
$I
done
exit
convert -delay 100 /tmp/fstack*.png foo.gif
}
# ------------------------------------------------------------
essai_single ()
{
MP4="/home/tth/Essais/FondageDePlomb/foo.mp4"
echo '*** essai single ***'
rm /tmp/x8/*.png
time ./t -v -F rnd48b:water:liss2x2 -x
ffmpeg -nostdin \
-loglevel error \
-y -r 30 -f image2 -i /tmp/x8/%05d.png \
-c:v libx264 -pix_fmt yuv420p \
$MP4
}
# ------------------------------------------------------------
# MAIN
essai_single
# ------------------------------------------------------------

View File

@ -118,7 +118,7 @@ for (idx=0; idx<f_stacks[numid].count; idx++) {
fv = f_stacks[numid].slots[idx].fval;
if (verbosity > 1)
fprintf(stderr, "%d : effect %2d on %p\n",
fprintf(stderr, "run %d : effect %2d on %p\n",
idx, eff, target);
foo = crapulator(target, eff, fv);

129
Fonderie/single.c Normal file
View File

@ -0,0 +1,129 @@
/*
SINGLE
experimental and/or testing code, do not use in
production.
*/
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include "../floatimg.h"
#include "sfx.h"
#include "filterstack.h"
#include "crapulator.h"
#include "single.h"
/* -------------------------------------------------------------- */
/*
* singleton/private variables
*/
static int nextpng, counter;
static char *destination;
/* -------------------------------------------------------------- */
int single_init(int next, char *dest, char *sfxchain)
{
int foo;
struct stat stbuf;
fprintf(stderr, ">>> %s ( %d '%s' )\n", __func__, next, dest);
nextpng = next;
foo = stat(dest, &stbuf);
if (foo) {
perror("stat dest dir");
return -2;
}
// fprintf(stderr, "\t%s type = %04x\n", dest, stbuf.st_mode & S_IFMT);
if (S_IFDIR != (stbuf.st_mode & S_IFMT)) {
fprintf(stderr, "! %s must be a directory\n", dest);
return -3;
}
destination = dest;
return 0;
}
/* -------------------------------------------------------------- */
int single_push_picture(FloatImg *pimg)
{
int foo;
char line[1000], buff[100];
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p )\n", __func__, pimg);
#endif
strncpy(line, destination, 100);
if ('/' != line[strlen(line)-1]) {
fprintf(stderr, "adding '/'\n");
strcat(line, "/");
}
// fprintf(stderr, " destdir = '%s'\n", line);
sprintf(buff, "%05d.png", nextpng);
strcat(line, buff);
// fprintf(stderr, "writing %p to '%s'\n", pimg, line);
foo = fimg_export_picture(pimg, line, 0);
if (foo) {
fprintf(stderr, "%s: err %d on export\n", __func__, foo);
return foo;
}
nextpng++;
return 0;
}
/* -------------------------------------------------------------- */
/*
* test-only function !
*/
int essayer_single(char *globpattern, char *destdir, int chain)
{
FloatImg image;
int idx, foo;
fprintf(stderr, ">>> %s ( '%s' '%s' %d )\n", __func__,
globpattern, destdir, chain);
foo = fimg_create(&image, 640, 480, 3);
if (foo) {
fprintf(stderr, "erreur %d creation image\n", foo);
return foo;
}
fimg_vdeg_a(&image, (double)3.141592654);
foo = single_init(0, destdir, "none");
if (foo) {
fprintf(stderr, "erreur %d single_init\n", foo);
return foo;
}
filterstack_list(chain, "essai du single");
for (idx=0; idx<666; idx++) {
foo = filterstack_run(chain, &image, 0);
if (foo) {
fprintf(stderr, "%s: filterstack run --> %d\n",
__func__, foo);
return foo;
}
foo = single_push_picture(&image);
if (foo) {
fprintf(stderr, "erreur %d push picture\n", foo);
return foo;
}
}
return -1;
}
/* -------------------------------------------------------------- */

21
Fonderie/single.h Normal file
View File

@ -0,0 +1,21 @@
/*
SINGLE
experimental and/or testing code, do not use in
production.
*/
/* -------------------------------------------------------------- */
int single_init(int next, char *dest, char *sfxchain);
int single_push_picture(FloatImg *pimg);
/* -------------------------------------------------------------- */
/*
* test function
*/
int essayer_single(char *globpattern, char *destdir, int K);
/* -------------------------------------------------------------- */

View File

@ -12,6 +12,7 @@
#include "sfx.h"
#include "filterstack.h"
#include "crapulator.h"
#include "single.h"
/* ----------------------------------------------------------- */
@ -81,14 +82,9 @@ int foo;
fprintf(stderr, "EXPERIMENT\n");
list_crapulors("experiment");
foo = essayer_single("capture/???42.fimg", "/tmp/x8/", STK);
#if 0
foo = crap_number_from_name("cos01");
fprintf(stderr, "name cos01 -> %d\n", foo);
foo = crap_number_from_name("xxxxx");
fprintf(stderr, "name xxxxx -> %d\n", foo);
#endif
fprintf(stderr, "essayer single -> %d\n", foo);
exit(0); /* back to real world */
}
@ -97,10 +93,11 @@ exit(0); /* back to real world */
int main(int argc, char *argv[])
{
int foo;
int opt;
int opt, do_xper = 0;
char *filterchain = "0";
char *infile = "mire.fimg";
char *outfile = "out.png";
char *outdir = "/tmp/x8/";
fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", __FILE__,
__DATE__, __TIME__);
@ -116,7 +113,7 @@ while ((opt = getopt(argc, argv, "hF:i:Lo:vx")) != -1) {
exit(0);
case 'o': outfile = optarg; break;
case 'v': verbosity++; break;
case 'x': experiment(); break;
case 'x': do_xper = 1; break;
default: exit(1);
}
}
@ -131,6 +128,10 @@ if (foo) {
exit(1);
}
if (do_xper) {
experiment();
}
foo = essai_filterstack(infile, outfile);
if (foo) {
fprintf(stderr, "err %d in essai_filterstack\n", foo);