From 7cf56ea70a5582205156855e8ae3ea5445724a2c Mon Sep 17 00:00:00 2001 From: tth Date: Mon, 29 Mar 2021 10:36:59 +0200 Subject: [PATCH] not ready for primetime --- experiment/assemblage.c | 12 +++++++++--- experiment/essai.sh | 9 +++++++++ experiment/incrustator.c | 4 +++- 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100755 experiment/essai.sh diff --git a/experiment/assemblage.c b/experiment/assemblage.c index 368df04c..6cca8038 100644 --- a/experiment/assemblage.c +++ b/experiment/assemblage.c @@ -22,7 +22,7 @@ if (foo) { fprintf(stderr, "%s: Kkrkr %d pour create grande\n", __func__, foo); return -1; } -fimg_vdeg_a(&grande, 13.37); +fimg_vdeg_a(&grande, 2345); foo = fimg_create(&incrust, 640, 480, FIMG_TYPE_RGB); if (foo) { @@ -31,8 +31,12 @@ if (foo) { } // 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, 100, 100, 0); +foo = incrustator_0(&incrust, &grande, 333, 333, 0); if (foo) { fprintf(stderr, "%s: Kkrkr %d sur incrustator_0\n", __func__, foo); return -1; @@ -45,6 +49,8 @@ if (foo) { return -1; } +fimg_destroy(&incrust); fimg_destroy(&grande); + return 0; } /* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */ @@ -52,7 +58,7 @@ int main(int argc, char *argv[]) { int foo; -verbosity = 1; +verbosity = 2; fimg_print_version(1); diff --git a/experiment/essai.sh b/experiment/essai.sh new file mode 100755 index 00000000..6e497114 --- /dev/null +++ b/experiment/essai.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +make assemblage + +grabvidseq -vv -n 4 -p 3.3333 -o foo.fimg + +./assemblage -v + +display out.pnm diff --git a/experiment/incrustator.c b/experiment/incrustator.c index 6f6f076a..eed2e455 100644 --- a/experiment/incrustator.c +++ b/experiment/incrustator.c @@ -36,15 +36,17 @@ if ( (xpos < 0) || (xpos > pdst->width - psrc->width) || /* move all the data by looping over lines */ srcpos = 0; +dstpos = (ypos * pdst->width) + xpos; szl = psrc->width * sizeof(float); for (y=0; yheight; y++) { - dstpos = ((y + ypos) * pdst->width) + xpos; // 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;