more debug or more bug ?
This commit is contained in:
@@ -39,10 +39,12 @@ 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 method)
|
||||
int tentative_triage(glob_t *ptr_glob, IdxValue **ptr_idxval,
|
||||
int method, double *p_average)
|
||||
{
|
||||
int idx, foo, nombre;
|
||||
float metrique;
|
||||
double average;
|
||||
char *filename;
|
||||
IdxValue *idxvalues;
|
||||
|
||||
@@ -62,6 +64,7 @@ if (NULL==idxvalues) {
|
||||
fprintf(stderr, "IdxValues array at %p\n", idxvalues);
|
||||
|
||||
*ptr_idxval = idxvalues;
|
||||
average = 0.0;
|
||||
|
||||
/* compute all the needed values */
|
||||
for (idx=0; idx<nombre; idx++) {
|
||||
@@ -76,6 +79,7 @@ for (idx=0; idx<nombre; idx++) {
|
||||
fprintf(stderr, "%5d %s %f\r", idx, filename, metrique);
|
||||
idxvalues[idx].idx = idx;
|
||||
idxvalues[idx].value = metrique;
|
||||
average += (double)metrique;
|
||||
}
|
||||
|
||||
if (method) {
|
||||
@@ -91,7 +95,11 @@ if (verbosity > 1) {
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "\n.\n");
|
||||
average /= (double)nombre;
|
||||
*p_average = average;
|
||||
|
||||
fprintf(stderr, "\naverage %f\n", average);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -109,6 +117,7 @@ int curpix;
|
||||
int iarray[3];
|
||||
char *cptr, line[200];
|
||||
float coef, value;
|
||||
double meanmetric;
|
||||
IdxValue *idx_values;
|
||||
|
||||
fprintf(stderr, " interpolate from '%s' to '%s' with %d steps.\n",
|
||||
@@ -124,7 +133,7 @@ if (0 == globbuf.gl_pathc) {
|
||||
}
|
||||
|
||||
idx_values = NULL;
|
||||
foo = tentative_triage(&globbuf, &idx_values, sort);
|
||||
foo = tentative_triage(&globbuf, &idx_values, sort, &meanmetric);
|
||||
if (foo) {
|
||||
fprintf(stderr, "sort of %p -> %d\n\n", idx_values, foo);
|
||||
return foo;
|
||||
@@ -134,8 +143,14 @@ foo = fimg_fileinfos(globbuf.gl_pathv[0], iarray);
|
||||
if (FIMG_TYPE_RGB != iarray[2]) {
|
||||
fprintf(stderr, "can work only on RGB fimg picture, was %d\n",
|
||||
iarray[2]);
|
||||
exit(1);
|
||||
exit(1); /* BLAM! */
|
||||
}
|
||||
|
||||
if (infx) fprintf(stderr, "\tin fx #%d\n", infx);
|
||||
else fprintf(stderr, "\tno in fx\n");
|
||||
if (outfx) fprintf(stderr, "\tout fx #%d\n", outfx);
|
||||
else fprintf(stderr, "\tno out fx\n");
|
||||
|
||||
w = iarray[0], h = iarray[1];
|
||||
fprintf(stderr, "first image size : %dx%d\n", w, h);
|
||||
|
||||
@@ -256,6 +271,12 @@ fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", __FILE__,
|
||||
__DATE__, __TIME__);
|
||||
fimg_print_version(2);
|
||||
|
||||
//#if DEBUG_LEVEL
|
||||
/* this is for the debug off calling shellscript */
|
||||
for (foo=0; foo<argc; foo++)
|
||||
fprintf(stderr, "%5d %s\n", foo, argv[foo]);
|
||||
//#endif
|
||||
|
||||
while ((opt = getopt(argc, argv, "E:F:hS:vw:x:")) != -1) {
|
||||
switch(opt) {
|
||||
case 'E': InFchain = optarg; break;
|
||||
@@ -268,9 +289,9 @@ while ((opt = getopt(argc, argv, "E:F:hS:vw:x:")) != -1) {
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s : argc = %d, optind = %d\n", argv[0], argc, optind);
|
||||
#endif
|
||||
//#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s: argc = %d, optind = %d\n", argv[0], argc, optind);
|
||||
//#endif
|
||||
|
||||
if (3 != (argc-optind)) {
|
||||
fprintf(stderr, "args: [options] <inglob> <outdir> <nbsteep>\n");
|
||||
@@ -288,7 +309,7 @@ if (foo) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (verbosity) {
|
||||
if (verbosity > 1) {
|
||||
puts("==============");
|
||||
filterstack_list(0, __FILE__);
|
||||
filterstack_list(1, __FILE__);
|
||||
|
||||
Reference in New Issue
Block a user