Compare commits

...

5 Commits

Author SHA1 Message Date
tth
dbee9eea6e renaming a func 2021-03-29 11:59:24 +02:00
tth
3b0fc047ad cleanup 2021-03-29 10:41:15 +02:00
tth
7cf56ea70a not ready for primetime 2021-03-29 10:36:59 +02:00
tth
f3c9d85c73 oups... 2021-03-28 19:33:02 +02:00
tth
6e410e5f50 experiment on incrustation 2021-03-28 18:52:03 +02:00
11 changed files with 174 additions and 10 deletions

5
.gitignore vendored
View File

@ -76,3 +76,8 @@ Fonderie/singlepass
Fonderie/crapdef.h Fonderie/crapdef.h
Fonderie/crapstr.h Fonderie/crapstr.h
experiment/assemblage
experiment/*.fimg
experiment/*.pnm
experiment/*.o

View File

@ -30,7 +30,7 @@ if (foo) {
return foo; return foo;
} }
incrustation_0(pimg, &copy, 0); incrustation_vignette(pimg, &copy, 0);
fimg_copy_data(&copy, pimg); fimg_copy_data(&copy, pimg);

View File

@ -24,7 +24,7 @@ extern int verbosity;
/* /*
* please, add some parameters ! * please, add some parameters !
*/ */
int incrustation_0(FloatImg *src, FloatImg *dst, int k) int incrustation_vignette(FloatImg *src, FloatImg *dst, int k)
{ {
int x, y, x4, y4; int x, y, x4, y4;
float rgb[3]; float rgb[3];

View File

@ -3,7 +3,7 @@
* --------------------------------------------------- * ---------------------------------------------------
*/ */
int incrustation_0(FloatImg *src, FloatImg *dst, int k); int incrustation_vignette(FloatImg *src, FloatImg *dst, int k);
int trinitron(FloatImg *pimg, int notused); int trinitron(FloatImg *pimg, int notused);
@ -16,10 +16,6 @@ int upside_down(FloatImg *pimg);
int des_bords_sombres_a(FloatImg *pimg, int offset); int des_bords_sombres_a(FloatImg *pimg, int offset);
int trinarize(FloatImg *pimg, int notused); // in sfx.c
int binarize(FloatImg *pimg, int notused);
int brotche_rand48_a(FloatImg *fimg, float ratio, float mval); int brotche_rand48_a(FloatImg *fimg, float ratio, float mval);
int brotche_rand48_b(FloatImg *fimg, float ratio, float mval); int brotche_rand48_b(FloatImg *fimg, float ratio, float mval);
int colors_brotcher(FloatImg *fimg, float fval); int colors_brotcher(FloatImg *fimg, float fval);

View File

@ -176,7 +176,7 @@ if (foo) {
foo = fimg_clone(&image, &dest, 1); foo = fimg_clone(&image, &dest, 1);
foo = fimg_copy_data(&image, &dest); foo = fimg_copy_data(&image, &dest);
incrustation_0(&image, &dest, 0); incrustation_vignette(&image, &dest, 0);
fimg_export_picture(&dest, "foo.png", 0); fimg_export_picture(&dest, "foo.png", 0);

View File

@ -1 +1,16 @@
# plasma experiment
#  experiments
COPT = -Wall -fpic -g -DDEBUG_LEVEL=0 -lm
DEPS = ../floatimg.h ../libfloatimg.a Makefile
LIBS = -ltiff -lpnglite -lcfitsio
all: assemblage
incrustator.o: incrustator.c incrustator.h Makefile
gcc -c $(COPT) $<
assemblage: assemblage.c Makefile incrustator.o
gcc $(COPT) $< incrustator.o ../libfloatimg.a $(LIBS) -o $@

View File

@ -1 +1,3 @@
# PLASMA EXPERIMENT
# ASSEMBLAGE

76
experiment/assemblage.c Normal file
View File

@ -0,0 +1,76 @@
/*
* assemblage experimental
*/
#include <stdio.h>
#include <stdlib.h>
#include "../floatimg.h"
#include "incrustator.h"
int verbosity;
/* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */
int premier_essai(int largeur, int hauteur, char *outname)
{
FloatImg grande, incrust;
int foo;
foo = fimg_create(&grande, largeur, hauteur, FIMG_TYPE_RGB);
if (foo) {
fprintf(stderr, "%s: Kkrkr %d pour create grande\n", __func__, foo);
return -1;
}
fimg_vdeg_a(&grande, 2345);
foo = fimg_create(&incrust, 640, 480, FIMG_TYPE_RGB);
if (foo) {
fprintf(stderr, "%s: Kkrkr %d pour create incrust\n", __func__, foo);
return -1;
}
// fimg_drand48(&incrust, 13.37);
foo = fimg_load_from_dump("foo.fimg", &incrust);
if (foo) {
fprintf(stderr, "%s: err %d loading image\n", __func__, foo);
return -1;
}
foo = incrustator_0(&incrust, &grande, 333, 333, 0);
if (foo) {
fprintf(stderr, "%s: Kkrkr %d sur incrustator_0\n", __func__, foo);
return -1;
}
foo = fimg_export_picture(&grande, outname, 0);
if (foo) {
fprintf(stderr, "%s: error %d export '%s'\n", __func__,
foo, outname);
return -1;
}
fimg_destroy(&incrust); fimg_destroy(&grande);
return 0;
}
/* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */
int main(int argc, char *argv[])
{
int foo;
verbosity = 2;
fimg_print_version(1);
foo = premier_essai(1280, 1024, "out.pnm");
if (foo) {
fprintf(stderr, "EPIC FAIL %s\n", argv[0]);
exit(1);
}
return 0;
}
/* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */

9
experiment/essai.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
make assemblage
grabvidseq -vv -n 4 -p 3.3333 -o foo.fimg
./assemblage -v
display out.pnm

54
experiment/incrustator.c Normal file
View File

@ -0,0 +1,54 @@
/*
* incrustator experimental
*/
#include <stdio.h>
#include <string.h>
#include "../floatimg.h"
#include "incrustator.h"
extern int verbosity;
/* ---------------------------------------------------------------- */
int incrustator_0(FloatImg *psrc, FloatImg *pdst,
int xpos, int ypos, int flags)
{
int y, srcpos, dstpos, szl;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %d %d 0x%04X\n", __func__, psrc, pdst,
xpos, ypos, flags);
#endif
if (verbosity > 1) {
fimg_describe(psrc, "source");
fimg_describe(pdst, "destination");
}
/* check boudaries */
if ( (xpos < 0) || (xpos > pdst->width - psrc->width) ||
(ypos < 0) || (ypos > pdst->height - psrc->height) ) {
fprintf(stderr, "%s: boudary error\n", __func__);
return -2;
}
/* move all the data by looping over lines */
srcpos = 0;
dstpos = (ypos * pdst->width) + xpos;
szl = psrc->width * sizeof(float);
for (y=0; y<psrc->height; y++) {
// fprintf(stderr, " %7d %7d %7d\n", y, srcpos, dstpos);
memcpy(pdst->R + dstpos, psrc->R + srcpos, szl);
memcpy(pdst->G + dstpos, psrc->G + srcpos, szl);
memcpy(pdst->B + dstpos, psrc->B + srcpos, szl);
srcpos += psrc->width;
dstpos += pdst->width;
}
return 0;
}
/* ---------------------------------------------------------------- */

7
experiment/incrustator.h Normal file
View File

@ -0,0 +1,7 @@
/*
* incrustator experimental
*/
int incrustator_0(FloatImg *psrc, FloatImg *pdst,
int xpos, int ypos, int flags);