From 3859777c479d9afa5b167a47cd20a702d1354d54 Mon Sep 17 00:00:00 2001 From: Tonton Th Date: Wed, 4 Nov 2020 17:18:58 +0100 Subject: [PATCH] fonderie can now handle images of any size --- Fonderie/fonderie.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/Fonderie/fonderie.c b/Fonderie/fonderie.c index 022029b..7b1f137 100644 --- a/Fonderie/fonderie.c +++ b/Fonderie/fonderie.c @@ -28,19 +28,16 @@ if (foo) { fprintf(stderr, "%s: err %d on insert\n", __func__, foo); return foo; } - sprintf(ligne, "p8/%05d.png", numero); /* ^^^ XXX hardcoded value ? wtf ? */ - foo = export_fifo(ligne, proc, step); if (foo) { fprintf(stderr, "%s: err %d on export\n", __func__, foo); return foo; } numero++; /* VERY IMPORTANT :) */ - return 0; } /* -------------------------------------------------------------- */ @@ -49,12 +46,9 @@ int insert_blank(FloatImg *image, int nbre, int pproc) int idx, foo; fimg_clear(image); - for (idx=0; idx>> %s ( '%s' -> '%s' %d )\n", __func__, @@ -93,19 +87,24 @@ else fprintf(stderr, "\tno in fx\n"); if (outfx) fprintf(stderr, "\tout fx #%d\n", outfx); else fprintf(stderr, "\tno out fx\n"); -foo = create_fifo(szfifo, 640, 480, FIMG_TYPE_RGB); -fprintf(stderr, "init fifo (%d slots) --> %d\n", szfifo, foo); - -fimg_create(&input, 640, 480, 3); - -/* XXX inject a few stange pics in the fifo */ -insert_blank(&input, BLANK, outfx); - memset(&globbuf, 0, sizeof(glob_t)); foo = glob(pattern, 0, NULL, &globbuf); fprintf(stderr, "glob '%s' -> %d, %ld files found\n", pattern, foo, globbuf.gl_pathc); +/* get the size of the inputs images */ +foo = fimg_fileinfos(globbuf.gl_pathv[0], datas); +width = datas[0]; +height = datas[1]; + +foo = create_fifo(szfifo, width, height, FIMG_TYPE_RGB); +fprintf(stderr, "init fifo (%d slots) --> %d\n", szfifo, foo); + +fimg_create(&input, width, height, 3); + +/* XXX inject a few stange pics in the fifo */ +insert_blank(&input, BLANK, outfx); + for (idx=0; idx