[argyllcms] Re: uuups ... spec2cie swamps my HD

  • From: Klaus Karcher <lists@xxxxxxxxxxxxxxxxx>
  • To: argyllcms@xxxxxxxxxxxxx
  • Date: Mon, 14 Jan 2008 23:46:56 +0100

Gerhard Fuernkranz wrote:
I havent analyzed in detail, but I think that as consequence of not finding a reasonable white patch, the conversion from spectral to XYZ and Lab with FWA compensation yields NaN, and real_format() in cgats.c is not prepared to deal with NaN numbers.

exactly. Here are some fragments of my gdb session:

gdb spec2cie

(gdb) break 699
Breakpoint 1 at 0x512e: file spec2cie.c, line 699.

(gdb) run  -f -I F8 test.ti3 test_F8.ti3

Unknown: Warning - Can't find a media white patch to init FWA

Breakpoint 1, main (argc=6, argv=0xbffff74c) at spec2cie.c:699
699                     if (ocg->write_name(ocg, out_ti3_name)) {

(gdb) print Lab
$1 = {-nan(0x8000000000000), -nan(0x8000000000000), -nan(0x8000000000000)}
(gdb) print XYZ
$2 = {-nan(0x8000000000000), -nan(0x8000000000000), -nan(0x8000000000000)}

(gdb) break real_format

[...]

Breakpoint 2, 0x00038a59 in real_format (value=238.51058959866418, nsd=5, fmt=0xbfff7ebe "%6.2f ") at cgats.c:1809
1809    real_format(double value, int nsd, char *fmt) {
(gdb) print fmt
$3 = 0xbfff7ebe "%6.2f "

[...]

Breakpoint 4, real_format (value=-nan(0x8000000000000), nsd=5, fmt=0xbfff7ebe "%6.-2147483644f") at cgats.c:1839
1839    }
(gdb) print fmt
$9 = 0xbfff7ebe "%6.-2147483644f"


----

I'll attach the cgats.c diff that fixed it for me.

Klaus

*** original/argyllV0.70Beta7_src/cgats/cgats.c 2007-10-20 12:53:56.000000000 
+0200
--- modified/argyllV0.70Beta7_src/cgats/cgats.c 2008-01-14 23:15:35.000000000 
+0100
***************
*** 1432,1441 ****
--- 1432,1446 ----
                                if (t->ftype[field] == r_t) {
                                        char fmt[30];
                                        double val = *((double 
*)t->fdata[set][field]);
+                                       if (isnan(val)) {
+                                               if (fp->printf(fp,"%s ","nan") 
< 0)
+                                                       goto write_error;
+                                       } else {
                                                real_format(val, REAL_SIGDIG, 
fmt);
                                                strcat(fmt," ");
                                                if (fp->printf(fp,fmt,val) < 0)
                                                        goto write_error;
+                                       }
                                } else if (t->ftype[field] == i_t) {
                                        if (fp->printf(fp,"%d ",*((int 
*)t->fdata[set][field])) < 0)
                                                goto write_error;
kmb:argyllV0.70Beta7_src klaus$ 

Other related posts: