working on glitching methods
This commit is contained in:
@@ -39,7 +39,7 @@ static int cmp_idxvalues(const void *pa, const void *pb)
|
||||
return ( ((IdxValue *)pa)->value > ((IdxValue *)pb)->value);
|
||||
}
|
||||
|
||||
int tentative_triage(glob_t *ptr_glob, IdxValue **ptr_idxval)
|
||||
int tentative_triage(glob_t *ptr_glob, IdxValue **ptr_idxval, int method)
|
||||
{
|
||||
int idx, foo, nombre;
|
||||
float metrique;
|
||||
@@ -47,7 +47,8 @@ char *filename;
|
||||
IdxValue *idxvalues;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %p )\n", __func__, ptr_glob, ptr_idxval);
|
||||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, ptr_glob,
|
||||
ptr_idxval, method);
|
||||
#endif
|
||||
|
||||
nombre = ptr_glob->gl_pathc;
|
||||
@@ -71,13 +72,16 @@ for (idx=0; idx<nombre; idx++) {
|
||||
foo, filename);
|
||||
return -1;
|
||||
}
|
||||
fprintf(stderr, "%5d %s %f\n", idx, filename, metrique);
|
||||
if (verbosity)
|
||||
fprintf(stderr, "%5d %s %f\n", idx, filename, metrique);
|
||||
idxvalues[idx].idx = idx;
|
||||
idxvalues[idx].value = metrique;
|
||||
}
|
||||
|
||||
/* and now, we can massage all our datas */
|
||||
qsort(idxvalues, nombre, sizeof(IdxValue), cmp_idxvalues);
|
||||
if (method) {
|
||||
/* and now, we can massage all our datas */
|
||||
qsort(idxvalues, nombre, sizeof(IdxValue), cmp_idxvalues);
|
||||
}
|
||||
|
||||
for (idx=0; idx<nombre; idx++) {
|
||||
printf("%5d %9.6f %5d\n", idx,
|
||||
@@ -92,7 +96,8 @@ return 0;
|
||||
/*
|
||||
* This is the mega working loop
|
||||
*/
|
||||
int interpolator(char *pattern, char *outdir, int Nsteps, int infx)
|
||||
int interpolator(char *pattern, char *outdir, int Nsteps,
|
||||
int infx, int outfx, int sort)
|
||||
{
|
||||
FloatImg A, B, Out, *pFirst, *pSecond;
|
||||
glob_t globbuf;
|
||||
@@ -117,7 +122,7 @@ if (0 == globbuf.gl_pathc) {
|
||||
}
|
||||
|
||||
idx_values = NULL;
|
||||
foo = tentative_triage(&globbuf, &idx_values);
|
||||
foo = tentative_triage(&globbuf, &idx_values, sort);
|
||||
fprintf(stderr, "\tTRI of %p -> %d\n\n", idx_values, foo);
|
||||
|
||||
foo = fimg_fileinfos(globbuf.gl_pathv[0], iarray);
|
||||
@@ -151,10 +156,10 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
||||
value = idx_values[idx].value;
|
||||
|
||||
/* here, we can insert the input filter */
|
||||
/* OK try it ... */
|
||||
/* OK try it ... */
|
||||
foo = crapulator(&B, infx, value/2.0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "crapulator failure %d\n", foo);
|
||||
fprintf(stderr, "in fx crapulator failure %d\n", foo);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -163,9 +168,11 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
||||
fimg_interpolate(pSecond, pFirst, &Out, coef);
|
||||
|
||||
/* here we can insert the output filter */
|
||||
if (rand() & 0x55) {
|
||||
kill_a_few_lines(&Out, value/2.0, 5+(rand()%20));
|
||||
kill_a_few_lines(&Out, 0.0, 5+(rand()%20));
|
||||
foo = crapulator(&Out, outfx, value);
|
||||
if (foo) {
|
||||
fprintf(stderr, "\nout fx %d crapulator failure %d\n",
|
||||
outfx, foo);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sprintf(line, "%s/%05d.png", outdir, ipng);
|
||||
@@ -210,29 +217,36 @@ int main (int argc, char *argv[])
|
||||
int foo;
|
||||
int nbrsteps = 9;
|
||||
int opt;
|
||||
int inFx = 0;
|
||||
int outFx = 0;
|
||||
int sort = 0;
|
||||
|
||||
fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", __FILE__,
|
||||
__DATE__, __TIME__);
|
||||
fimg_print_version(2);
|
||||
|
||||
while ((opt = getopt(argc, argv, "hv")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "hS:vw:x:")) != -1) {
|
||||
switch(opt) {
|
||||
case 'h': help(); break;
|
||||
case 'S': sort = atoi(optarg); break;
|
||||
case 'v': verbosity++; break;
|
||||
case 'w': inFx = atoi(optarg); break;
|
||||
case 'x': outFx = atoi(optarg); break;
|
||||
}
|
||||
}
|
||||
|
||||
/* TO BE CONTINUED *****/
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s : argc = %d, optind = %d\n", argv[0], argc, optind);
|
||||
#endif
|
||||
|
||||
if (4 != argc) {
|
||||
fprintf(stderr, "args: <in globpattern> <out dir> <nbrsteep>\n");
|
||||
if (3 != (argc-optind)) {
|
||||
fprintf(stderr, "args: [options] <inglob> <outdir> <nbsteep>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
nbrsteps = atoi(argv[3]);
|
||||
|
||||
#define EFFECT 7
|
||||
foo = interpolator(argv[1], argv[2], nbrsteps, EFFECT);
|
||||
nbrsteps = atoi(argv[optind+2]);
|
||||
foo = interpolator(argv[optind], argv[optind+1], nbrsteps,
|
||||
inFx, outFx, sort);
|
||||
|
||||
fprintf(stderr, "interpolator give a %d score\n", foo);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user