Compare commits
No commits in common. "3f44abc18d65c4e370438ab6383ddde8ce0ca845" and "170d0e7193d29fb94fd2bd92c5a2fe2087e4c609" have entirely different histories.
3f44abc18d
...
170d0e7193
@ -14,28 +14,6 @@
|
||||
#include "glitches.h"
|
||||
#include "sfx.h"
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
static int trier_les_pixels(FloatImg *pimg)
|
||||
{
|
||||
FloatImg copy;
|
||||
int foo;
|
||||
|
||||
fimg_clone(pimg, ©, 1);
|
||||
|
||||
foo = fimg_qsort_rgb_b(pimg, ©, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: err qsort rgb = %d\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
incrustation_0(pimg, ©, 0);
|
||||
|
||||
fimg_copy_data(©, pimg);
|
||||
|
||||
fimg_destroy(©);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
static int effect_3(FloatImg *image)
|
||||
{
|
||||
@ -249,8 +227,7 @@ switch (idFx) {
|
||||
|
||||
case CR_qsortrgb:
|
||||
// fprintf(stderr, "!!! %d !!!\n", idFx);
|
||||
// retval = fimg_qsort_rgb_b(image, image, 0);
|
||||
retval = trier_les_pixels(image);
|
||||
retval = fimg_qsort_rgb_b(image, image, 0);
|
||||
break;
|
||||
|
||||
case CR_message:
|
||||
|
@ -31,17 +31,12 @@ convert -delay 200 /tmp/fstack*.png foo.gif
|
||||
essai_single ()
|
||||
{
|
||||
MP4="/home/tth/Essais/FondageDePlomb/foo.mp4"
|
||||
INPUT="/home/tth/Essais/FondageDePlomb/capture/?[23]???.fimg"
|
||||
FILTRE="classtrial:liss3x3"
|
||||
|
||||
echo '********* essai single *********'
|
||||
|
||||
echo '*** essai single ***'
|
||||
|
||||
rm /tmp/x8/*.png
|
||||
|
||||
time ./t -v -g "$INPUT" -F $FILTRE -s
|
||||
|
||||
echo ; echo "encoding to " $MP4
|
||||
time ./t -v -F rnd48b:water:liss2x2 -x
|
||||
|
||||
ffmpeg -nostdin \
|
||||
-loglevel error \
|
||||
@ -53,6 +48,6 @@ ffmpeg -nostdin \
|
||||
# ------------------------------------------------------------
|
||||
# MAIN
|
||||
|
||||
essai_single
|
||||
essai_filtres
|
||||
|
||||
# ------------------------------------------------------------
|
||||
|
@ -36,7 +36,7 @@ x4 = dst->width / 4, y4 = dst->height / 4;
|
||||
for (y=0; y<y4; y++) {
|
||||
for (x=0; x<x4; x++) {
|
||||
fimg_get_rgb(src, x*4, y*4, rgb);
|
||||
fimg_put_rgb(dst, x+19, y+19, rgb);
|
||||
fimg_put_rgb(dst, x+9, y+9, rgb);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,10 +23,9 @@
|
||||
|
||||
static int nextpng, counter;
|
||||
static char *destination;
|
||||
static int chainfilter;
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
int single_init(int next, char *dest, int fxchain)
|
||||
int single_init(int next, char *dest, char *sfxchain)
|
||||
{
|
||||
int foo;
|
||||
struct stat stbuf;
|
||||
@ -34,19 +33,19 @@ struct stat stbuf;
|
||||
fprintf(stderr, ">>> %s ( %d '%s' )\n", __func__, next, dest);
|
||||
|
||||
nextpng = next;
|
||||
chainfilter = fxchain;
|
||||
|
||||
foo = stat(dest, &stbuf);
|
||||
if (foo) {
|
||||
perror("stat dest dir");
|
||||
return -2;
|
||||
}
|
||||
// fprintf(stderr, "\t%s type = %04x\n", dest, stbuf.st_mode & S_IFMT);
|
||||
if (S_IFDIR != (stbuf.st_mode & S_IFMT)) {
|
||||
fprintf(stderr, "! %s must be a directory\n", dest);
|
||||
return -3;
|
||||
}
|
||||
|
||||
destination = strdup(dest); /* have a static copy */
|
||||
destination = dest;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -77,7 +76,7 @@ if (foo) {
|
||||
return foo;
|
||||
}
|
||||
|
||||
nextpng++; counter++;
|
||||
nextpng++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -88,12 +87,8 @@ int single_print_state(char *title, int k)
|
||||
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, title, k);
|
||||
#endif
|
||||
|
||||
fprintf(stderr, "%s : %s\n", __FILE__, title);
|
||||
fprintf(stderr, "nextpng %d\n", nextpng);
|
||||
fprintf(stderr, "counter %d\n", counter);
|
||||
fprintf(stderr, " chainfilter %d\n", chainfilter);
|
||||
|
||||
fprintf(stderr, " destination %s\n", destination);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
|
||||
int single_init(int next, char *dest, int fxchain);
|
||||
int single_init(int next, char *dest, char *sfxchain);
|
||||
int single_push_picture(FloatImg *pimg);
|
||||
|
||||
int single_print_state(char *title, int k);
|
||||
|
72
Fonderie/t.c
72
Fonderie/t.c
@ -6,7 +6,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <glob.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
#include "glitches.h"
|
||||
@ -78,48 +77,28 @@ fprintf(stderr, "essayer single -> %d\n", foo);
|
||||
*/
|
||||
int essayer_single(char *globpattern, char *destdir, int chain)
|
||||
{
|
||||
FloatImg image = { 0 };
|
||||
FloatImg image;
|
||||
int idx, foo;
|
||||
glob_t globbuf;
|
||||
char *fname;
|
||||
|
||||
fprintf(stderr, ">>> %s ( '%s' '%s' %d )\n", __func__,
|
||||
globpattern, destdir, chain);
|
||||
|
||||
foo = fimg_create(&image, 640, 480, 3);
|
||||
if (foo) {
|
||||
fprintf(stderr, "erreur %d creation image\n", foo);
|
||||
return foo;
|
||||
}
|
||||
fimg_vdeg_a(&image, (double)3.141592654);
|
||||
|
||||
filterstack_list(chain, "essai du single");
|
||||
|
||||
foo = single_init(0, destdir, chain);
|
||||
foo = single_init(0, destdir, "none");
|
||||
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(globpattern, 0, NULL, &globbuf);
|
||||
fprintf(stderr, "globbing '%s' -> %d, %d files found\n",
|
||||
globpattern, foo, (int)globbuf.gl_pathc);
|
||||
if (0 == globbuf.gl_pathc) {
|
||||
fprintf(stderr, "%s : no file found, aborting\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
filterstack_list(chain, "essai du single");
|
||||
|
||||
for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
||||
|
||||
fname = globbuf.gl_pathv[idx]; /* alias of filename */
|
||||
fprintf(stderr, "%s %6d %s\r", __func__, 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;
|
||||
}
|
||||
for (idx=0; idx<666; idx++) {
|
||||
|
||||
foo = filterstack_run(chain, &image, 0);
|
||||
if (foo) {
|
||||
@ -133,29 +112,22 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
||||
fprintf(stderr, "erreur %d push picture\n", foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
single_print_state("end of run", 0);
|
||||
|
||||
fimg_destroy(&image);
|
||||
|
||||
return -1;
|
||||
}
|
||||
/* ----------------------------------------------------------- */
|
||||
|
||||
int help(void)
|
||||
{
|
||||
puts("Yolo!");
|
||||
puts("yolo!");
|
||||
|
||||
puts("\t-F\tdefine:the:filter:chain");
|
||||
puts("\t-g\tinput glob pattern");
|
||||
puts("\t-i\tinfile.fimg");
|
||||
puts("\t-L\tlist available filters");
|
||||
puts("\t-i\tinfile.fimg");
|
||||
puts("\t-o\tinfile.xxx");
|
||||
puts("\t-O\t/output/directory");
|
||||
puts("\t-s\tdo single test");
|
||||
|
||||
|
||||
exit(0);
|
||||
}
|
||||
@ -186,31 +158,26 @@ exit(0); /* back to real world */
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int foo, opt;
|
||||
int do_xper = 0;
|
||||
int do_single = 0;
|
||||
int foo;
|
||||
int opt, do_xper = 0;
|
||||
char *filterchain = "0";
|
||||
char *infile = "mire.fimg";
|
||||
char *outfile = PNG;
|
||||
char *outdir = "/tmp/x8/";
|
||||
char *globstr = "capture/????7.fimg";
|
||||
|
||||
fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", __FILE__,
|
||||
__DATE__, __TIME__);
|
||||
fimg_print_version(2);
|
||||
|
||||
while ((opt = getopt(argc, argv, "hF:g:i:Lo:O:svx")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "hF:i:Lo:vx")) != -1) {
|
||||
switch(opt) {
|
||||
case 'h': help(); break;
|
||||
case 'F': filterchain = optarg; break;
|
||||
case 'g': globstr = optarg; break;
|
||||
case 'i': infile = optarg; break;
|
||||
case 'L':
|
||||
list_crapulors("available filters");
|
||||
exit(0);
|
||||
case 'o': outfile = optarg; break;
|
||||
case 'O': outdir = optarg; break;
|
||||
case 's': do_single = 1; break;
|
||||
case 'v': verbosity++; break;
|
||||
case 'x': do_xper = 1; break;
|
||||
default: exit(1);
|
||||
@ -231,11 +198,6 @@ if (do_xper) {
|
||||
experiment();
|
||||
return 0;
|
||||
}
|
||||
if (do_single) {
|
||||
fprintf(stderr, "Globbing '%s'\n", globstr);
|
||||
essayer_single(globstr, outdir, STK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
foo = essai_filterstack(infile, outfile);
|
||||
if (foo) {
|
||||
|
@ -41,7 +41,7 @@ if (psrc != pdst) { /* optimize or futurbug ? */
|
||||
}
|
||||
|
||||
szimg = pdst->width * pdst->height;
|
||||
// fprintf(stderr, "%s : %d pixels\n", __func__, szimg);
|
||||
fprintf(stderr, "%s : %d pixels\n", __func__, szimg);
|
||||
|
||||
qsort(pdst->R, szimg, sizeof(float), compare_a);
|
||||
qsort(pdst->G, szimg, sizeof(float), compare_a);
|
||||
@ -83,7 +83,7 @@ if (fimg_images_not_compatible(psrc, pdst)) {
|
||||
}
|
||||
|
||||
szimg = pdst->width * pdst->height;
|
||||
// fprintf(stderr, "%s : %d pixels\n", __func__, szimg);
|
||||
fprintf(stderr, "%s : %d pixels\n", __func__, szimg);
|
||||
|
||||
ppix = calloc(szimg, sizeof(pix));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user