Compare commits

..

No commits in common. "a9e03371b813fe2bb4061852ff258dff6467314e" and "74133a2cabb60233a156df98e5babc6c98ab758f" have entirely different histories.

7 changed files with 19 additions and 59 deletions

1
.gitignore vendored
View File

@ -67,7 +67,6 @@ Fonderie/*.o
Fonderie/*.png Fonderie/*.png
Fonderie/*.pnm Fonderie/*.pnm
Fonderie/*.gif Fonderie/*.gif
Fonderie/*.fimg
Fonderie/fonderie Fonderie/fonderie
Fonderie/interpolator Fonderie/interpolator
Fonderie/t Fonderie/t

View File

@ -14,8 +14,6 @@
#include "glitches.h" #include "glitches.h"
#include "sfx.h" #include "sfx.h"
extern int verbosity;
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
static int trier_les_pixels(FloatImg *pimg) static int trier_les_pixels(FloatImg *pimg)
{ {
@ -78,7 +76,7 @@ return 0;
static int insitu_filtre3x3(FloatImg *pimg, int typef) static int insitu_filtre3x3(FloatImg *pimg, int typef)
{ {
FloatImg img; FloatImg img;
int foo, retval; int retval;
FimgFilter3x3 *pfiltre; FimgFilter3x3 *pfiltre;
FimgFilter3x3 lowpass = { FimgFilter3x3 lowpass = {
@ -99,19 +97,9 @@ FimgFilter3x3 hipass = {
1.0, 0.0 1.0, 0.0
}; };
FimgFilter3x3 diagonal = {
{
2.0, 1.0, 0.0,
1.0, 0.0, -1.0,
0.0, -1.0, -2.0,
},
1.0, 4.0
};
switch (typef) { switch (typef) {
case 0: pfiltre = &lowpass; break; case 0: pfiltre = &lowpass; break;
case 1: pfiltre = &hipass; break; case 1: pfiltre = &hipass; break;
case 2: pfiltre = &diagonal; break;
default: default:
fprintf(stderr, "%s: bad filter number %d\n", fprintf(stderr, "%s: bad filter number %d\n",
__func__, typef); __func__, typef);
@ -126,13 +114,7 @@ if (retval) {
fprintf(stderr, "%s error %d on filter\n", __func__, retval); fprintf(stderr, "%s error %d on filter\n", __func__, retval);
exit(1); exit(1);
} }
/** may be, we can check for negative values ? */ fimg_killborders(&img); /* XXX WTF OMG */
if (verbosity) {
foo = fimg_count_negativ(&img);
fprintf(stderr, "%s -> %d negs\n", __func__, foo);
}
fimg_killborders(&img);
fimg_copy_data(&img, pimg); fimg_copy_data(&img, pimg);
fimg_destroy(&img); fimg_destroy(&img);
@ -212,7 +194,7 @@ switch (idFx) {
break; break;
case CR_liss2x2: case CR_liss2x2:
retval = fimg_lissage_2x2(image); retval = fimg_lissage_2x2(image);
// (void)fimg_killborders(image); (void)fimg_killborders(image);
break; break;
case CR_liss3x3: case CR_liss3x3:
/* smooth filter */ /* smooth filter */
@ -238,9 +220,6 @@ switch (idFx) {
/* hipass filter */ /* hipass filter */
retval = insitu_filtre3x3(image, 1); retval = insitu_filtre3x3(image, 1);
break; break;
case CR_diagonal:
retval = insitu_filtre3x3(image, 2);
break;
case CR_octotree: case CR_octotree:
retval = octotree_classif(image, 0.500, 0); retval = octotree_classif(image, 0.500, 0);
break; break;

View File

@ -26,7 +26,6 @@
27 shiftln0 1 1.0 27 shiftln0 1 1.0
28 qsortrgb 2 1.0 28 qsortrgb 2 1.0
30 multidots 100 1.333 30 multidots 100 1.333
31 diagonal 1 1.0
42 nothing 42 3.1415926 42 nothing 42 3.1415926
99 message 1 1.0 99 message 1 1.0
-1 end 1 1.0 -1 end 1 1.0

View File

@ -9,8 +9,7 @@ FILTRES=$(./t -L | awk 'NR>1 { print $1 }' | sort)
rm /tmp/fstack*.png rm /tmp/fstack*.png
# SRC=$(ls -rt1 $HOME/Essais/FondageDePlomb/capture/* | tail -1) SRC=$(ls -rt1 $HOME/Essais/FondageDePlomb/capture/* | tail -1)
SRC=mire.fimg
for F in $FILTRES for F in $FILTRES
do do
@ -54,6 +53,6 @@ ffmpeg -nostdin \
# ------------------------------------------------------------ # ------------------------------------------------------------
# MAIN # MAIN
essai_filtres essai_singlepass
# ------------------------------------------------------------ # ------------------------------------------------------------

View File

@ -3,7 +3,7 @@
* ugly code from tTh * ugly code from tTh
*/ */
#define FIMG_VERSION 119 #define FIMG_VERSION 118
/* /*
* in memory descriptor * in memory descriptor

View File

@ -15,7 +15,7 @@ float *M; /* alias of filter matrix */
double dval; double dval;
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, src, dst, filtr); fprintf(stderr, ">>> %s ( %p %p %p)\n", __func__, src, dst, filtr);
#endif #endif
if (src->type != FIMG_TYPE_RGB) { if (src->type != FIMG_TYPE_RGB) {
@ -48,7 +48,7 @@ for (y=1; y < h-1; y++) {
M[7] * pr[of+w] + M[7] * pr[of+w] +
M[8] * pr[of+(w-1)] ; M[8] * pr[of+(w-1)] ;
dst->R[of] = dval + filtr->offset; dst->R[of] = dval;
dval = M[0] * pg[of-(w+1)] + dval = M[0] * pg[of-(w+1)] +
M[1] * pg[of-w] + M[1] * pg[of-w] +
@ -60,7 +60,7 @@ for (y=1; y < h-1; y++) {
M[7] * pg[of+w] + M[7] * pg[of+w] +
M[8] * pg[of+(w-1)] ; M[8] * pg[of+(w-1)] ;
dst->G[of] = dval + filtr->offset; dst->G[of] = dval;
dval = M[0] * pb[of-(w+1)] + dval = M[0] * pb[of-(w+1)] +
M[1] * pb[of-w] + M[1] * pb[of-w] +
@ -72,7 +72,7 @@ for (y=1; y < h-1; y++) {
M[7] * pb[of+w] + M[7] * pb[of+w] +
M[8] * pb[of+(w-1)] ; M[8] * pb[of+(w-1)] ;
dst->B[of] = dval + filtr->offset; dst->B[of] = dval;
} }
} }
@ -189,6 +189,7 @@ if (foo) {
return foo; return foo;
} }
/* XXX */
fimg_killborders(img); fimg_killborders(img);
return foo; return foo;

View File

@ -323,7 +323,7 @@ FimgFilter3x3 filter_a = {
{ 1.0, 1.0, 1.0, { 1.0, 1.0, 1.0,
1.0, -3.0, 1.0, 1.0, -3.0, 1.0,
1.0, 1.0, 1.0 }, 1.0, 1.0, 1.0 },
9.0, 0.0 8.0, 0.0
}; };
@ -336,15 +336,6 @@ FimgFilter3x3 filter_b = {
}; };
FimgFilter3x3 filter_c = {
{
2.0, 1.0, 0.0,
1.0, 0.0, -1.0,
0.0, -1.0, -2.0,
},
1.0, 8.0
};
if (NULL != infile) { if (NULL != infile) {
fprintf(stderr, "%s: loading %s\n", __func__, infile); fprintf(stderr, "%s: loading %s\n", __func__, infile);
foo = fimg_create_from_dump(infile, &src); foo = fimg_create_from_dump(infile, &src);
@ -360,8 +351,6 @@ else {
} }
// fimg_save_as_png(&src, "test.png", 0); // fimg_save_as_png(&src, "test.png", 0);
foo = fimg_count_negativ(&src);
fprintf(stderr, "%s: source have %d negs\n", __func__, foo);
foo = fimg_clone(&src, &dst, 0); foo = fimg_clone(&src, &dst, 0);
if (foo) { if (foo) {
@ -370,27 +359,21 @@ if (foo) {
} }
fimg_filter_3x3(&src, &dst, &filter_a); fimg_filter_3x3(&src, &dst, &filter_a);
foo = fimg_clamp_negativ(&dst); foo = fimg_clamp_negativ(&dst);
if (foo) { if (foo) {
fprintf(stderr, "A clamped %d negative pixels\n", foo); fprintf(stderr, "clamped %d negative pixels\n", foo);
} }
foo = fimg_save_as_png(&dst, "f3x3a.png", 0); // foo = fimg_save_as_png(&dst, "f3x3a.png", 0);
// foo = fimg_save_as_pnm(&dst, "f3x3a.pnm", 0); // foo = fimg_save_as_pnm(&dst, "f3x3a.pnm", 0);
fimg_filter_3x3(&src, &dst, &filter_b); fimg_filter_3x3(&src, &dst, &filter_b);
foo = fimg_clamp_negativ(&dst); foo = fimg_clamp_negativ(&dst);
if (foo) { if (foo) {
fprintf(stderr, "B clamped %d negative pixels\n", foo); fprintf(stderr, "clamped %d negative pixels\n", foo);
} }
foo = fimg_save_as_png(&dst, "f3x3b.png", 0); // foo = fimg_save_as_png(&dst, "f3x3b.png", 0);
// foo = fimg_save_as_pnm(&dst, "f3x3a.pnm", 0);
fimg_filter_3x3(&src, &dst, &filter_c);
foo = fimg_clamp_negativ(&dst);
if (foo) {
fprintf(stderr, "C clamped %d negative pixels\n", foo);
}
foo = fimg_save_as_png(&dst, "f3x3b.png", 0);
// foo = fimg_save_as_pnm(&dst, "f3x3a.pnm", 0); // foo = fimg_save_as_pnm(&dst, "f3x3a.pnm", 0);
fimg_destroy(&src); fimg_destroy(&dst); fimg_destroy(&src); fimg_destroy(&dst);