first working version of singlepass
This commit is contained in:
parent
0d536187fd
commit
35e7354396
1
.gitignore
vendored
1
.gitignore
vendored
@ -70,6 +70,7 @@ Fonderie/*.gif
|
||||
Fonderie/fonderie
|
||||
Fonderie/interpolator
|
||||
Fonderie/t
|
||||
Fonderie/singlepass
|
||||
Fonderie/crapdef.h
|
||||
Fonderie/crapstr.h
|
||||
|
||||
|
@ -99,6 +99,19 @@ Un logiciel dont l'inspiration vient du passé et les améliorations
|
||||
d'une résidence à Terre-Blanque, ça ne peut pas être complètement
|
||||
malsain.
|
||||
|
||||
```
|
||||
*** interpolator.c : compiled by tTh, Jan 12 2021 16:18:58
|
||||
*** FloatImg library, alpha v116 (Dec 27 2020, 22:39:28)
|
||||
INTERPOLATOR
|
||||
usage:
|
||||
interpolator [options] <inglob> <outdir> <nbsteep>
|
||||
options:
|
||||
-S nn mysterious sort
|
||||
-E i:bla:k input filter chain
|
||||
-F name:j output filter chain
|
||||
-L list available filters
|
||||
-v increase verbosity
|
||||
```
|
||||
|
||||
|
||||
## Conclusion
|
||||
|
@ -22,7 +22,7 @@ int foo;
|
||||
|
||||
fimg_clone(pimg, ©, 1);
|
||||
|
||||
foo = fimg_qsort_rgb_b(pimg, ©, 0);
|
||||
foo = fimg_qsort_rgb_a(pimg, ©, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: err qsort rgb = %d\n", __func__, foo);
|
||||
return foo;
|
||||
@ -209,7 +209,7 @@ switch (idFx) {
|
||||
image->height/20);
|
||||
break;
|
||||
case CR_water:
|
||||
retval = bouger_les_pixels(image, 8);
|
||||
retval = bouger_les_pixels(image, 12);
|
||||
break;
|
||||
case CR_mirsplit:
|
||||
retval = mirror_split(image, 0);
|
||||
|
@ -28,24 +28,24 @@ echo ; echo "making gif89a..."
|
||||
convert -delay 200 /tmp/fstack*.png foo.gif
|
||||
}
|
||||
# ------------------------------------------------------------
|
||||
essai_single ()
|
||||
essai_singlepass ()
|
||||
{
|
||||
MP4="/home/tth/Essais/FondageDePlomb/foo.mp4"
|
||||
INPUT="/home/tth/Essais/FondageDePlomb/capture/?[23]???.fimg"
|
||||
FILTRE="classtrial:liss3x3"
|
||||
INPUT="/home/tth/Essais/FondageDePlomb/capture/???[04]0.fimg"
|
||||
FILTRE="water:water:liss3x3"
|
||||
OUTDIR="/tmp/x8/"
|
||||
|
||||
echo '********* essai single *********'
|
||||
|
||||
rm $OUTDIR/*.png
|
||||
|
||||
rm /tmp/x8/*.png
|
||||
time ./singlepass -v -g "$INPUT" -F $FILTRE -O $OUTDIR -s
|
||||
|
||||
time ./t -v -g "$INPUT" -F $FILTRE -s
|
||||
|
||||
echo ; echo "encoding to " $MP4
|
||||
echo ; echo "encoding picz to " $MP4
|
||||
|
||||
ffmpeg -nostdin \
|
||||
-loglevel error \
|
||||
-y -r 30 -f image2 -i /tmp/x8/%05d.png \
|
||||
-y -r 25 -f image2 -i /tmp/x8/%05d.png \
|
||||
-c:v libx264 -pix_fmt yuv420p \
|
||||
$MP4
|
||||
|
||||
@ -53,6 +53,6 @@ ffmpeg -nostdin \
|
||||
# ------------------------------------------------------------
|
||||
# MAIN
|
||||
|
||||
essai_single
|
||||
essai_singlepass
|
||||
|
||||
# ------------------------------------------------------------
|
||||
|
@ -233,7 +233,7 @@ for (;;) {
|
||||
}
|
||||
}
|
||||
|
||||
if (verbosity) filterstack_list(numid, __func__);
|
||||
if (verbosity > 1) filterstack_list(numid, __func__);
|
||||
return 0;
|
||||
}
|
||||
/* ----------------------------------------------------------- */
|
||||
|
@ -79,14 +79,6 @@ int foo, type;
|
||||
|
||||
foo = faire_la_somme(&g_fifo, NULL, step);
|
||||
|
||||
/* BEGIN GRUIK CODE */
|
||||
extern int convert_to_gray;
|
||||
/* END OF THE KLUGE */
|
||||
if (convert_to_gray) {
|
||||
fimg_to_gray(&g_fifo.total);
|
||||
// fprintf(stderr, "%p gray-washed\n", &fifo.total);
|
||||
}
|
||||
|
||||
if (postproc)
|
||||
foo = crapulator(&g_fifo.total, postproc, 0.0);
|
||||
else
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "filterstack.h"
|
||||
|
||||
int verbosity;
|
||||
int convert_to_gray;
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
int traite_une_image(FloatImg *image, int proc, int step, char *outd)
|
||||
@ -168,7 +167,7 @@ puts("\tFONDERIE\noptions:");
|
||||
|
||||
puts("\t-E\tinput:filter:chain");
|
||||
puts("\t-F\toutput:filter:chain");
|
||||
puts("\t-g\tconvert to gray");
|
||||
// puts("\t-g\tconvert to gray");
|
||||
puts("\t-I\tinput glob pattern");
|
||||
puts("\t-L\tlist available filters");
|
||||
puts("\t-O\toutput directory");
|
||||
@ -201,7 +200,7 @@ while ((opt = getopt(argc, argv, "B:E:F:ghI:LO:s:T:vw:x:")) != -1) {
|
||||
case 'F': OutFchain = optarg; break;
|
||||
case 'B': blanks = atoi(optarg);
|
||||
break;
|
||||
case 'g': convert_to_gray = 1;
|
||||
case 'g': // convert_to_gray = 1;
|
||||
break;
|
||||
case 'h': help();
|
||||
break;
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "filterstack.h"
|
||||
|
||||
int verbosity;
|
||||
int convert_to_gray; /* needed by fonctions.c */
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
/* on va essayer de trier l'ordre d'apparition des images
|
||||
|
@ -242,6 +242,7 @@ for (x=0; x<pimg->width; x++) {
|
||||
|| ny>=pimg->height )
|
||||
continue;
|
||||
|
||||
/* XXX optimize here ? */
|
||||
fimg_get_rgb(pimg, nx, ny, rgb);
|
||||
fimg_put_rgb(pimg, x, y, rgb);
|
||||
|
||||
|
@ -31,7 +31,10 @@ int single_init(int next, char *dest, int fxchain)
|
||||
int foo;
|
||||
struct stat stbuf;
|
||||
|
||||
fprintf(stderr, ">>> %s ( %d '%s' )\n", __func__, next, dest);
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %d '%s' %d )\n", __func__,
|
||||
next, dest, fxchain);
|
||||
#endif
|
||||
|
||||
nextpng = next;
|
||||
chainfilter = fxchain;
|
||||
@ -95,6 +98,10 @@ fprintf(stderr, " chainfilter %d\n", chainfilter);
|
||||
|
||||
fprintf(stderr, " destination %s\n", destination);
|
||||
|
||||
if (k) {
|
||||
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
|
@ -7,17 +7,101 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <glob.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
#include "crapulator.h"
|
||||
#include "filterstack.h"
|
||||
#include "single.h"
|
||||
|
||||
/* ----------------------------------------------------------- */
|
||||
|
||||
#define FILTERS 0
|
||||
|
||||
int verbosity;
|
||||
|
||||
/* ----------------------------------------------------------- */
|
||||
int run_the_singlepass(char *globber, char *destdir, int fchain)
|
||||
{
|
||||
FloatImg image = { 0 };
|
||||
int idx, foo;
|
||||
glob_t globbuf;
|
||||
char *fname;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( '%s' '%s' %d )\n", __func__,
|
||||
globber, destdir, fchain);
|
||||
#endif
|
||||
|
||||
// filterstack_list(fchain, "Run the single pass");
|
||||
|
||||
foo = single_init(0, destdir, fchain);
|
||||
if (foo) {
|
||||
fprintf(stderr, "erreur %d single_init\n", foo);
|
||||
return foo;
|
||||
}
|
||||
// single_print_state("just after init", 0);
|
||||
|
||||
memset(&globbuf, 0, sizeof(glob_t));
|
||||
foo = glob(globber, 0, NULL, &globbuf);
|
||||
// fprintf(stderr, "globbing '%s' -> %d, %d files found\n",
|
||||
// globber, foo, (int)globbuf.gl_pathc);
|
||||
switch (foo) {
|
||||
case GLOB_NOSPACE:
|
||||
fprintf(stderr, "%s: glob run out of memory\n", __func__);
|
||||
break;
|
||||
case GLOB_ABORTED:
|
||||
fprintf(stderr, "%s: glob read error\n", __func__);
|
||||
break;
|
||||
case GLOB_NOMATCH:
|
||||
fprintf(stderr, "%s: glob found no matches\n", __func__);
|
||||
break;
|
||||
}
|
||||
|
||||
if (0 == globbuf.gl_pathc) {
|
||||
fprintf(stderr, "%s: no file found, aborting\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
||||
|
||||
fname = globbuf.gl_pathv[idx]; /* alias of filename */
|
||||
fprintf(stderr, " %6d %s\r", globbuf.gl_pathc-idx, fname);
|
||||
|
||||
if (0==image.width && 0==image.height) {
|
||||
foo = fimg_create_from_dump(fname, &image);
|
||||
}
|
||||
else {
|
||||
foo = fimg_load_from_dump(fname, &image);
|
||||
}
|
||||
if (foo) {
|
||||
fprintf(stderr, "get image -> %d\n", foo);
|
||||
return -1;
|
||||
}
|
||||
|
||||
foo = filterstack_run(fchain, &image, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: filterstack run --> %d\n",
|
||||
__func__, foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
foo = single_push_picture(&image);
|
||||
if (foo) {
|
||||
fprintf(stderr, "error %d on push_picture\n", foo);
|
||||
return foo;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
single_print_state("end of run :)", 0);
|
||||
|
||||
fimg_destroy(&image);
|
||||
|
||||
return -1;
|
||||
}
|
||||
/* ----------------------------------------------------------- */
|
||||
static void help(void)
|
||||
{
|
||||
@ -39,7 +123,7 @@ int main(int argc, char *argv[])
|
||||
int foo, opt;
|
||||
char *filterchain = "none";
|
||||
char *globbing = "./capture/?????.fimg";
|
||||
char *outdir = "./png/";
|
||||
char *outdir = "./p8";
|
||||
int do_xper = 0;
|
||||
|
||||
fprintf(stderr, "*** %s : compiled %s %s\n", __FILE__,
|
||||
@ -67,6 +151,15 @@ while ((opt = getopt(argc, argv, "hF:g:LO:svx")) != -1) {
|
||||
|
||||
}
|
||||
|
||||
foo = parse_filter_chain(FILTERS, filterchain);
|
||||
if (foo) {
|
||||
fprintf(stderr, "err %d in parse_filter_chain\n", foo);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
foo = run_the_singlepass(globbing, outdir, FILTERS);
|
||||
fprintf(stderr, "\n\tRun the single pass --> %d\n", foo);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
/* ----------------------------------------------------------- */
|
||||
|
||||
int verbosity;
|
||||
int convert_to_gray; /* WTF ? */
|
||||
|
||||
#define PNG "out.png"
|
||||
#define W 800
|
||||
@ -83,9 +82,10 @@ int idx, foo;
|
||||
glob_t globbuf;
|
||||
char *fname;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( '%s' '%s' %d )\n", __func__,
|
||||
globpattern, destdir, chain);
|
||||
|
||||
#endif
|
||||
|
||||
filterstack_list(chain, "essai du single");
|
||||
|
||||
@ -137,11 +137,11 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
single_print_state("end of run", 0);
|
||||
single_print_state("end of run :)", 0);
|
||||
|
||||
fimg_destroy(&image);
|
||||
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
/* ----------------------------------------------------------- */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user