Compare commits

...

3 Commits

Author SHA1 Message Date
ceefa63d1d last commit for this week 2021-01-10 22:52:33 +01:00
ccfe50e838 + qsortrgb 2021-01-10 16:40:49 +01:00
169ace3d25 optimize or futurbug ?" 2021-01-10 15:17:54 +01:00
9 changed files with 127 additions and 64 deletions

View File

@ -225,8 +225,13 @@ switch (idFx) {
retval = multilines_shift_0(image, 11, 120);
break;
case CR_qsortrgb:
// fprintf(stderr, "!!! %d !!!\n", idFx);
retval = fimg_qsort_rgb_b(image, image, 0);
break;
case CR_message:
fprintf(stderr, "### message from pid %d, fv=%f ###\n",
fprintf(stderr, "### msg from pid %d, fval=%f ###\n",
getpid(), fval);
retval = 0;
break;

View File

@ -24,6 +24,7 @@
25 vsglitch 1 1.0
26 rndblks 1 1.0
27 shiftln0 1 1.0
28 qsortrgb 2 1.0
42 nothing 42 3.14159
99 message 1 1.0
-1 end 1 1.0

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

View File

@ -20,6 +20,28 @@
*/
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' */
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;
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;
pimg->R[off] = fvals[0];
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 bouger_les_pixels(FloatImg *pimg, int kaboo);

View File

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

View File

@ -2,7 +2,6 @@
SINGLE
experimental and/or testing code, do not use in
production.
*/
/* -------------------------------------------------------------- */
@ -10,12 +9,8 @@
int single_init(int next, char *dest, char *sfxchain);
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;
}
/* ----------------------------------------------------------- */
/*
* 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)
{
puts("yolo!");
puts("\t-F\tdefine:the:filter:chain");
puts("\t-L\tlist available filters");
puts("\t-i\tinfile.fimg");
puts("\t-o\tinfile.xxx");
exit(0);
}
/* ----------------------------------------------------------- */
void experiment(void)
int experiment(void)
{
int foo;
FloatImg image, dest;
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 */
}
@ -96,7 +162,7 @@ int foo;
int opt, do_xper = 0;
char *filterchain = "0";
char *infile = "mire.fimg";
char *outfile = "out.png";
char *outfile = PNG;
char *outdir = "/tmp/x8/";
fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", __FILE__,
@ -130,6 +196,7 @@ if (foo) {
if (do_xper) {
experiment();
return 0;
}
foo = essai_filterstack(infile, outfile);

View File

@ -36,7 +36,9 @@ if (fimg_images_not_compatible(psrc, pdst)) {
return -8;
}
foo = fimg_copy_data(psrc, pdst);
if (psrc != pdst) { /* optimize or futurbug ? */
foo = fimg_copy_data(psrc, pdst);
}
szimg = pdst->width * pdst->height;
fprintf(stderr, "%s : %d pixels\n", __func__, szimg);