last commit for this week

This commit is contained in:
tonton th 2021-01-10 22:52:33 +01:00
parent ccfe50e838
commit ceefa63d1d
6 changed files with 117 additions and 62 deletions

View File

@ -3,27 +3,29 @@
# ------------------------------------------------------------ # ------------------------------------------------------------
liste_filtres () essai_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" FILTRES=$(./t -L | awk 'NR>1 { print $1 }' | sort)
rm /tmp/fstack*.png rm /tmp/fstack*.png
SRC=$(ls -rt1 $HOME/Essais/FondageDePlomb/capture/* | tail -1)
for F in $FILTRES for F in $FILTRES
do do
I="/tmp/fstack-"$F".png" I="/tmp/fstack-"$F".png"
echo ; echo ==== $I echo ; echo ======== $I
./t -F $F ./t -v -i $SRC -F $F -o foo.png
txt=$(printf "[%-10s]" $F) txt=$(printf "( %-10s )" $F)
convert foo.png -pointsize 24 -kerning 0 \ convert foo.png -pointsize 48 -kerning 0 \
-fill Gray80 -undercolor Gray20 \ -fill Gray80 -undercolor Gray20 \
-font Courier-Bold \ -font Courier-Bold \
-annotate +0+23 "$txt" \ -annotate +10+50 "$txt" \
$I $I
done done
convert -delay 100 /tmp/fstack*.png foo.gif
echo ; echo "making gif89a..."
convert -delay 200 /tmp/fstack*.png foo.gif
} }
# ------------------------------------------------------------ # ------------------------------------------------------------
essai_single () essai_single ()
@ -46,6 +48,6 @@ ffmpeg -nostdin \
# ------------------------------------------------------------ # ------------------------------------------------------------
# MAIN # MAIN
essai_single essai_filtres
# ------------------------------------------------------------ # ------------------------------------------------------------

View File

@ -20,6 +20,28 @@
*/ */
extern int verbosity; extern int verbosity;
/* -------------------------------------------------------------- */
int incrustation_0(FloatImg *src, FloatImg *dst, int k)
{
int x, y, x4, y4;
float rgb[3];
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, src, dst, k);
#endif
x4 = dst->width / 4, y4 = dst->height / 4;
for (y=0; y<y4; y++) {
for (x=0; x<x4; x++) {
fimg_get_rgb(src, x*4, y*4, rgb);
fimg_put_rgb(dst, x+9, y+9, rgb);
}
}
return -1;
}
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
/* nouveau du premier dimanche de 2020 'nextgen' */ /* nouveau du premier dimanche de 2020 'nextgen' */
static int pixel_trinitron(FloatImg *pimg, int pos[4], float *fvals) static int pixel_trinitron(FloatImg *pimg, int pos[4], float *fvals)
@ -27,7 +49,7 @@ static int pixel_trinitron(FloatImg *pimg, int pos[4], float *fvals)
int x, y, off; int x, y, off;
for (y=pos[1]; y<pos[1]+pos[3]; y++) { for (y=pos[1]; y<pos[1]+pos[3]; y++) {
for (x=pos[0]; x<pos[0]+pos[2]; x++) { for (x=pos[0]+1; x<pos[0]+pos[2]-1; x++) {
off = (y*pimg->width) + x; off = (y*pimg->width) + x;
pimg->R[off] = fvals[0]; pimg->R[off] = fvals[0];
pimg->G[off] = fvals[1]; pimg->G[off] = fvals[1];

View File

@ -3,6 +3,9 @@
* --------------------------------------------------- * ---------------------------------------------------
*/ */
int incrustation_0(FloatImg *src, FloatImg *dst, int k);
int trinitron(FloatImg *pimg, int notused); int trinitron(FloatImg *pimg, int notused);
int bouger_les_pixels(FloatImg *pimg, int kaboo); int bouger_les_pixels(FloatImg *pimg, int kaboo);

View File

@ -81,48 +81,14 @@ nextpng++;
return 0; return 0;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
/* int single_print_state(char *title, int k)
* test-only function !
*/
int essayer_single(char *globpattern, char *destdir, int chain)
{ {
FloatImg image; #if DEBUG_LEVEL
int idx, foo; fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, title, k);
#endif
fprintf(stderr, ">>> %s ( '%s' '%s' %d )\n", __func__, fprintf(stderr, "nextpng %d\n", nextpng);
globpattern, destdir, chain); fprintf(stderr, "counter %d\n", counter);
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; return -1;
} }

View File

@ -2,7 +2,6 @@
SINGLE SINGLE
experimental and/or testing code, do not use in experimental and/or testing code, do not use in
production. production.
*/ */
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
@ -10,12 +9,8 @@
int single_init(int next, char *dest, char *sfxchain); int single_init(int next, char *dest, char *sfxchain);
int single_push_picture(FloatImg *pimg); int single_push_picture(FloatImg *pimg);
int single_print_state(char *title, int k);
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
/*
* test function
*/
int essayer_single(char *globpattern, char *destdir, int K);
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */

View File

@ -67,24 +67,90 @@ fimg_destroy(&image);
return 0; return 0;
} }
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/*
* test-only function !
foo = essayer_single("capture/???42.fimg", "/tmp/x8/", STK);
fprintf(stderr, "essayer single -> %d\n", foo);
*/
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;
}
/* ----------------------------------------------------------- */
int help(void) int help(void)
{ {
puts("yolo!"); puts("yolo!");
puts("\t-F\tdefine:the:filter:chain");
puts("\t-L\tlist available filters"); puts("\t-L\tlist available filters");
puts("\t-i\tinfile.fimg");
puts("\t-o\tinfile.xxx");
exit(0); exit(0);
} }
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
void experiment(void) int experiment(void)
{ {
int foo; int foo;
FloatImg image, dest;
fprintf(stderr, "EXPERIMENT\n"); fprintf(stderr, "EXPERIMENT\n");
foo = essayer_single("capture/???42.fimg", "/tmp/x8/", STK); foo = fimg_create_from_dump("01137.fimg", &image);
if (foo) {
fprintf(stderr, "%s: err %d on create\n", __func__, foo);
return -1;
}
fprintf(stderr, "essayer single -> %d\n", foo); foo = fimg_clone(&image, &dest, 1);
foo = fimg_copy_data(&image, &dest);
incrustation_0(&image, &dest, 0);
fimg_export_picture(&dest, "foo.png", 0);
exit(0); /* back to real world */ exit(0); /* back to real world */
} }
@ -96,7 +162,7 @@ int foo;
int opt, do_xper = 0; int opt, do_xper = 0;
char *filterchain = "0"; char *filterchain = "0";
char *infile = "mire.fimg"; char *infile = "mire.fimg";
char *outfile = "out.png"; char *outfile = PNG;
char *outdir = "/tmp/x8/"; char *outdir = "/tmp/x8/";
fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", __FILE__, fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", __FILE__,
@ -130,6 +196,7 @@ if (foo) {
if (do_xper) { if (do_xper) {
experiment(); experiment();
return 0;
} }
foo = essai_filterstack(infile, outfile); foo = essai_filterstack(infile, outfile);