Compare commits

..

15 Commits

Author SHA1 Message Date
tTh
8202df9a63 check for the export directory (singlepass) 2024-11-13 13:37:54 +01:00
tTh
67ba638690 check for the export directory (interpolator) 2024-11-13 13:35:22 +01:00
tTh
e8a7bf28e3 check for the export directory (fonderie) 2024-11-12 22:58:55 +01:00
tTh
b19107d71b add two molly-guard 2024-11-12 12:50:31 +01:00
tTh
fabe94792b add two molly-guard 2024-11-12 12:49:43 +01:00
tTh
d1e67f7397 add a missing exit() 2024-11-12 11:36:57 +01:00
tTh
28453e862a msg when export dir not writable 2024-11-11 17:24:03 +01:00
tTh
2147d4b164 tweaking help text 2024-11-11 17:15:53 +01:00
tTh
b0983ab18b msg bug + better exit 2024-11-11 17:13:20 +01:00
tTh
08fcf513cc checking export directory, first try 2024-11-10 13:55:25 +01:00
tTh
e6b72e5faa minor changes 2024-10-27 16:37:10 +01:00
tTh
756766ca42 + libncurses-dev 2024-10-12 00:34:27 +02:00
tTh
9ede78fa5d signaler création répertoire pour export 2024-10-11 23:54:23 +02:00
tTh
506bf39393 cosmetic 2024-10-11 23:30:41 +02:00
tTh
26e82619fb little tweak 2024-09-29 20:14:13 +02:00
15 changed files with 173 additions and 22 deletions

View File

@@ -7,12 +7,12 @@ COPT = -g -fpic -no-pie -Wall -DDEBUG_LEVEL=0 -Werror=parentheses
LIBS = ../libfloatimg.a -ltiff -lpnglite -lm -lz -lcfitsio LIBS = ../libfloatimg.a -ltiff -lpnglite -lm -lz -lcfitsio
OBJS = fifo.o sfx.o crapulator.o glitches.o metriques.o \ OBJS = fifo.o sfx.o crapulator.o glitches.o metriques.o \
filterstack.o single.o filterstack.o single.o utilfuncs.o
DEPS = ../floatimg.h \ DEPS = ../floatimg.h \
../libfloatimg.a \ ../libfloatimg.a \
fifo.h crapulator.h metriques.h glitches.h sfx.h \ fifo.h crapulator.h metriques.h glitches.h sfx.h \
filterstack.h crapdef.h crapstr.h single.h filterstack.h crapdef.h crapstr.h single.h utilfuncs.h
all: fonderie interpolator singlepass t all: fonderie interpolator singlepass t
@@ -71,4 +71,7 @@ metriques.o: metriques.c metriques.h Makefile
glitches.o: glitches.c glitches.h Makefile glitches.o: glitches.c glitches.h Makefile
gcc ${COPT} -c $< gcc ${COPT} -c $<
utilfuncs.o: utilfuncs.c utilfuncs.h Makefile
gcc ${COPT} -c $<
# --------------------------------------------------------- # ---------------------------------------------------------

View File

@@ -7,8 +7,10 @@ de **films flous** dans le domaine spatio-temporel.
À l'heure actuelle, il y a plusieurs programmes distincts. Le premier À l'heure actuelle, il y a plusieurs programmes distincts. Le premier
(fonderie) fait une moyenne mobile sur N images consécutives, (fonderie) fait une moyenne mobile sur N images consécutives,
et le second (interpolator) fait un fondu-enchainé de N pas le second (interpolator) fait un fondu-enchainé de N pas
entre deux images consécutives. entre deux images consécutives,
et le troisième (singlepass) fait d'autres trucs, comme
répéter N fois un image pour avoir une vidéo sacadée.
Mais avant et après un de ces deux traitements, il y a des chaines Mais avant et après un de ces deux traitements, il y a des chaines
de filtres... de filtres...
@@ -72,6 +74,8 @@ GLOB=${GRABDIR}'/?????.fimg'
${FONDEUR} -I "$GLOB" -E cos01:trinitron -F classtrial -T 30 ${FONDEUR} -I "$GLOB" -E cos01:trinitron -F classtrial -T 30
``` ```
Par défaut le répertoire où sont exportées les images est nommé
`p8/` et il doit être là, c'est donc à vous de le créer.
Votre machine va maintenant mouliner avec entrain et persévérance, Votre machine va maintenant mouliner avec entrain et persévérance,
puis puis
ensuite il vous suffira d'encoder toutes les images générées dans ensuite il vous suffira d'encoder toutes les images générées dans
@@ -94,7 +98,7 @@ assez rudimentaire, avec un paramétrage simpliste, et un manque
criant de documentation... criant de documentation...
Dans la même équipe, vous pouvez aussi aller contempler `glitches.c` Dans la même équipe, vous pouvez aussi aller contempler `glitches.c`
pour voir le genre de traitement que l'on fait subir à nox pixels pour voir le genre de traitement que l'on fait subir à nos pixels
flottants. flottants.
## Interpolator ## Interpolator
@@ -111,8 +115,8 @@ usage:
interpolator [options] <inglob> <outdir> <nbsteep> interpolator [options] <inglob> <outdir> <nbsteep>
options: options:
-S nn mysterious sort -S nn mysterious sort
-E i:bla:k input filter chain -E foo:bla:kr input filter chain
-F name:j output filter chain -F name:just output filter chain
-L list available filters -L list available filters
-v increase verbosity -v increase verbosity
``` ```
@@ -129,6 +133,7 @@ usage:
-F define:the:filter:chain -F define:the:filter:chain
-g input glob pattern -g input glob pattern
-L list available filters -L list available filters
-r N repetiiing factor
-O /output/directory -O /output/directory
-v spit more messages -v spit more messages
``` ```

View File

@@ -10,6 +10,7 @@
#include <glob.h> #include <glob.h>
#include "../floatimg.h" #include "../floatimg.h"
#include "utilfuncs.h"
#include "fifo.h" #include "fifo.h"
#include "glitches.h" #include "glitches.h"
#include "crapulator.h" #include "crapulator.h"
@@ -186,10 +187,12 @@ 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-I\tinput glob pattern");
puts("\t-L\tlist available filters"); puts("\t-L\tlist available filters");
puts("\t-O\toutput directory"); puts("\t-O\toutput directory (default p8/)");
puts("\t-T\tfifo size"); puts("\t-T\tfifo size");
puts("\t-v\tincrease verbosity"); puts("\t-v\tincrease verbosity");
if (verbosity) { puts(""); fimg_print_version(2); puts(""); }
exit(0); exit(0);
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
@@ -206,7 +209,6 @@ char *OutFchain = "none";
fprintf(stderr, "*** %s\n\tcompiled %s, %s, pid %d\n", fprintf(stderr, "*** %s\n\tcompiled %s, %s, pid %d\n",
argv[0], __DATE__, __TIME__, getpid()); argv[0], __DATE__, __TIME__, getpid());
if (verbosity) fimg_print_version(2);
while ((opt = getopt(argc, argv, "B:E:F:ghI:LO:T:vw:x:")) != -1) { while ((opt = getopt(argc, argv, "B:E:F:ghI:LO:T:vw:x:")) != -1) {
switch(opt) { switch(opt) {
@@ -240,6 +242,15 @@ if (verbosity) {
fprintf(stderr, "\tout filter '%s'\n", OutFchain); fprintf(stderr, "\tout filter '%s'\n", OutFchain);
fprintf(stderr, "\tfifo size %d\n", fifosize); fprintf(stderr, "\tfifo size %d\n", fifosize);
} }
/*
* check for the export directory
*/
foo = check_if_export_dir_is_valid(out_dir, 0);
if ( !foo ) {
fprintf(stderr, "** export dir (%s) not valid\n", out_dir);
fprintf(stderr, "** may be you have to create it ?\n");
exit(1);
}
foo = parse_filter_chain(0, InFchain); foo = parse_filter_chain(0, InFchain);
if (foo) { if (foo) {

View File

@@ -17,6 +17,7 @@
#include "../floatimg.h" #include "../floatimg.h"
#include "utilfuncs.h"
#include "fifo.h" #include "fifo.h"
#include "glitches.h" #include "glitches.h"
#include "crapulator.h" #include "crapulator.h"
@@ -55,7 +56,7 @@ IdxValue *idxvalues;
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %d %p)\n", __func__, ptr_glob, fprintf(stderr, ">>> %s ( %p %p %d %p)\n", __func__, ptr_glob,
ptr_idxval, method, average); ptr_idxval, method, p_average);
#endif #endif
if (0==method && verbosity) { if (0==method && verbosity) {
@@ -140,8 +141,8 @@ foo = glob(pattern, 0, NULL, &globbuf);
fprintf(stderr, " globbing '%s' -> %d, %d files found\n", fprintf(stderr, " globbing '%s' -> %d, %d files found\n",
pattern, foo, (int)globbuf.gl_pathc); pattern, foo, (int)globbuf.gl_pathc);
if (0 == globbuf.gl_pathc) { if (0 == globbuf.gl_pathc) {
fprintf(stderr, "%s : no file found, aborting\n", __func__); fprintf(stderr, "%s : no file found, ABEND\n", __func__);
return -1; exit(1);
} }
idx_values = NULL; idx_values = NULL;
@@ -240,9 +241,7 @@ puts("\t-S nn\t\tmysterious sort");
puts("\t-L\t\tlist available filters"); puts("\t-L\t\tlist available filters");
puts("\t-v\t\tincrease verbosity"); puts("\t-v\t\tincrease verbosity");
if (verbosity) { if (verbosity) { puts(""); fimg_print_version(2); puts(""); }
list_crapulors("available filters");
}
exit(0); exit(0);
} }
@@ -257,6 +256,7 @@ int opt;
int sort = 0; int sort = 0;
char *InFchain = "0"; char *InFchain = "0";
char *OutFchain = "0"; char *OutFchain = "0";
char *out_dir = "p8/";
fprintf(stderr, "*** %s\n\tcompiled on %s %s\n", argv[0], fprintf(stderr, "*** %s\n\tcompiled on %s %s\n", argv[0],
__DATE__, __TIME__); __DATE__, __TIME__);
@@ -292,6 +292,18 @@ if (3 != (argc-optind)) {
exit(1); exit(1);
} }
out_dir = argv[optind+1];
/*
* check for the export directory
*/
foo = check_if_export_dir_is_valid(out_dir, 0);
if ( !foo ) {
fprintf(stderr, "** export dir (%s) not valid\n", out_dir);
fprintf(stderr, "** may be you have to create it ?\n");
exit(1);
}
foo = parse_filter_chain(0, InFchain); foo = parse_filter_chain(0, InFchain);
if (foo) { if (foo) {
fprintf(stderr, "err %d parsing '%s'\n", foo, InFchain); fprintf(stderr, "err %d parsing '%s'\n", foo, InFchain);

View File

@@ -13,6 +13,7 @@
#include "../floatimg.h" #include "../floatimg.h"
#include "utilfuncs.h"
#include "crapulator.h" #include "crapulator.h"
#include "filterstack.h" #include "filterstack.h"
#include "single.h" #include "single.h"
@@ -198,6 +199,13 @@ if (repeat < 1) {
exit(2); exit(2);
} }
foo = check_if_export_dir_is_valid(outdir, 0);
if ( !foo ) {
fprintf(stderr, "** export dir (%s) not valid\n", outdir);
fprintf(stderr, "** may be you have to create it ?\n");
exit(1);
}
foo = parse_filter_chain(FILTERS, filterchain); foo = parse_filter_chain(FILTERS, filterchain);
if (foo) { if (foo) {
fprintf(stderr, "err %d in parse_filter_chain\n", foo); fprintf(stderr, "err %d in parse_filter_chain\n", foo);

View File

@@ -16,6 +16,8 @@
#include "crapulator.h" #include "crapulator.h"
#include "single.h" #include "single.h"
#include "utilfuncs.h"
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
int verbosity; int verbosity;
@@ -28,6 +30,30 @@ int verbosity;
#define STK 6 #define STK 6
/* ----------------------------------------------------------- */
/* new Sat Nov 9 22:17:46 UTC 2024 */
int essai_test_export_dir(char *footxt)
{
int foo;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( '%s' )\n", __func__, footxt);
#endif
foo = check_if_export_dir_is_valid("/tmp/quux", 0);
fprintf(stderr, " got %d\n\n", foo);
foo = check_if_export_dir_is_valid("/home", 0);
fprintf(stderr, " got %d\n\n", foo);
foo = check_if_export_dir_is_valid("./", 0);
fprintf(stderr, " got %d\n\n", foo);
foo = check_if_export_dir_is_valid("Makefile", 0);
fprintf(stderr, " got %d\n\n", foo);
return -1;
}
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
int essai_filterstack(char *fIname, char *fOname) int essai_filterstack(char *fIname, char *fOname)
@@ -36,6 +62,11 @@ int foo;
FloatImg image; FloatImg image;
double debut, fin; double debut, fin;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( '%s' '%s' )\n", __func__, fIname, fOname);
#endif
// filterstack_list(STK, __func__); // filterstack_list(STK, __func__);
foo = fimg_create_from_dump(fIname, &image); foo = fimg_create_from_dump(fIname, &image);
@@ -218,15 +249,23 @@ while ((opt = getopt(argc, argv, "hF:g:i:Lo:O:svx")) != -1) {
} }
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, "%s : argc = %d, optind = %d\n", argv[0], argc, optind); fprintf(stderr, ">>> %s : argc=%d, optind=%d\n", argv[0], argc, optind);
#endif #endif
foo = essai_test_export_dir("bla bla");
if (foo) {
fprintf(stderr, "err %d in essai_test_export_dir\n", foo);
exit(1);
}
exit(0);
foo = parse_filter_chain(STK, filterchain); foo = parse_filter_chain(STK, filterchain);
if (foo) { if (foo) {
fprintf(stderr, "err %d in parse_filter_chain\n", foo); fprintf(stderr, "err %d in parse_filter_chain\n", foo);
exit(1); exit(1);
} }
if (do_xper) { if (do_xper) {
experiment(infile); experiment(infile);
return 0; return 0;

53
Fonderie/utilfuncs.c Normal file
View File

@@ -0,0 +1,53 @@
/*
* utilfuncs.c
*
* new Sat Nov 9 22:15:15 UTC 2024
*/
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "utilfuncs.h"
extern int verbosity;
/* -------------------------------------------------------------- */
int check_if_export_dir_is_valid(char *path, int action)
{
int foo;
struct stat statbuf;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( '%s', %d )\n", __func__, path, action);
#endif
foo = stat(path, &statbuf);
if (foo) {
if (verbosity) perror(path);
return 0;
}
#if DEBUG_LEVEL
fprintf(stderr, " mode 0x%x\n", statbuf.st_mode);
#endif
if ((statbuf.st_mode & S_IFMT) != S_IFDIR) {
if (verbosity) fprintf(stderr, "%s: Not a directory\n", path);
return 0;
}
/* OK, c'est un repertoire, mais peut-on écrire dedans ? */
foo = access(path, W_OK);
#if DEBUG_LEVEL
fprintf(stderr, " access '%s' = %d\n", path, foo);
#endif
if (0 != foo) {
if (verbosity) fprintf(stderr, "%s: can't write\n", path);
return 0;
}
return 1; /* export dir is OK */
}
/* -------------------------------------------------------------- */

11
Fonderie/utilfuncs.h Normal file
View File

@@ -0,0 +1,11 @@
/*
* utilfuncs.c
*
* new Sat Nov 9 22:15:49 UTC 2024
*/
/* -------------------------------------------------------------- */
int check_if_export_dir_is_valid(char *path, int action);
/* -------------------------------------------------------------- */

View File

@@ -49,13 +49,14 @@ apt install liblo-dev
apt install libv4l2-dev apt install libv4l2-dev
apt install libcfitsio-dev apt install libcfitsio-dev
apt install libnetpbm-dev apt install libnetpbm-dev
apt install libncurses-dev
``` ```
Bon, OK, je suis en train de changer de machine, et ça serait vraiment Bon, OK, je suis en train de changer de machine, et ça serait vraiment
cool d'avoir juste une ligne à c'n'p, donc voila : cool d'avoir juste une ligne à c'n'p, donc voila :
``` ```
apt install libtiff-dev libpnglite-dev liblo-dev libv4l2-dev \ apt install libtiff-dev libpnglite-dev liblo-dev libv4l2-dev \
libcfitsio-dev libnetpbm-dev libcfitsio-dev libnetpbm-dev libncurses-dev
``` ```
Il est probable que j'en oublie. Il est probable que j'en oublie.
Et ya Debian qui change des trucs, alors, ça marche plus, du Et ya Debian qui change des trucs, alors, ça marche plus, du

View File

@@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
set -e ; set -u
# ------------------------------------------------------------------ # ------------------------------------------------------------------
function build function build

View File

@@ -65,7 +65,7 @@ for (yd=0; yd<pdst->height; yd++) {
fimg_get_rgb(pshift, xd, yd, disp); fimg_get_rgb(pshift, xd, yd, disp);
xs = xd + ((disp[0]/dltr*MULT) - OFFS); xs = xd + ((disp[0]/dltr*MULT) - OFFS);
ys = yd + ((disp[2]/dltb*MULT) - OFFS); ys = yd + ((disp[1]/dltb*MULT) - OFFS);
if ( xs<0 || xs>psrc->width || if ( xs<0 || xs>psrc->width ||
ys<0 || ys>psrc->height ) { ys<0 || ys>psrc->height ) {

View File

@@ -14,9 +14,8 @@ int verbosity;
/* --------------------------------------------------------------- */ /* --------------------------------------------------------------- */
int triplane_muxer(FloatImg *sr, FloatImg *sg, FloatImg *sb, int triplane_muxer(FloatImg *sr, FloatImg *sg, FloatImg *sb,
FloatImg *dst, int flags) FloatImg *dst)
{ {
int foo;
int sz; int sz;
if (FIMG_TYPE_RGB != dst->type) { if (FIMG_TYPE_RGB != dst->type) {
@@ -48,6 +47,10 @@ FloatImg imr, img, imb, dest;
fprintf(stderr, "muxing: %s %s %s -> %s\n", fr, fg, fb, dst); fprintf(stderr, "muxing: %s %s %s -> %s\n", fr, fg, fb, dst);
if (flags) {
fprintf(stderr, "%s: flag non 0 ?\n", __FILE__);
}
foo = fimg_create_from_dump(fr, &imr); foo = fimg_create_from_dump(fr, &imr);
if (foo) { if (foo) {
fprintf(stderr, "%s: err %d loading %s\n", __func__, foo, fr); fprintf(stderr, "%s: err %d loading %s\n", __func__, foo, fr);
@@ -66,7 +69,7 @@ if (foo) {
fimg_clone(&imr, &dest, 0); fimg_clone(&imr, &dest, 0);
foo = triplane_muxer(&imr, &img, &imb, &dest, 0); foo = triplane_muxer(&imr, &img, &imb, &dest);
if (foo) { if (foo) {
fprintf(stderr, "%s: err %d\n", __func__, foo); fprintf(stderr, "%s: err %d\n", __func__, foo);
return foo; return foo;

View File

@@ -20,7 +20,7 @@
* https://git.tetalab.org/tTh/FloatImg * https://git.tetalab.org/tTh/FloatImg
*/ */
#define FIMG_VERSION (242) #define FIMG_VERSION (245)
#define RELEASE_NAME ("noname") #define RELEASE_NAME ("noname")
#define PATCH_LEVEL ("aaaa") #define PATCH_LEVEL ("aaaa")

View File

@@ -1,5 +1,7 @@
#!/bin/bash -v #!/bin/bash -v
set -e ; set -u
cp libfloatimg.a /usr/local/lib cp libfloatimg.a /usr/local/lib
cp floatimg.h /usr/local/include cp floatimg.h /usr/local/include

View File

@@ -92,6 +92,7 @@ if (2 != argc-optind) {
foo = convertir_fimg_en_PNG(argv[optind], argv[optind+1], to_gray); foo = convertir_fimg_en_PNG(argv[optind], argv[optind+1], to_gray);
if (foo) { if (foo) {
fprintf(stderr, "%s : got a %d from convertor\n", argv[0], foo); fprintf(stderr, "%s : got a %d from convertor\n", argv[0], foo);
exit(1);
} }
return 0; return 0;