ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/ra_tiff.c
(Generate patch)

Comparing ray/src/px/ra_tiff.c (file contents):
Revision 2.28 by schorsch, Sun Mar 28 20:33:14 2004 UTC vs.
Revision 2.32 by greg, Fri Aug 19 02:31:32 2005 UTC

# Line 275 | Line 275 | initfromtif(void)              /* initialize conversion from TIFF
275                          cpcolormat(cvts.cmat, xyz2rgbmat);
276                          SET(C_CXFM|C_GAMUT);
277                  } else if (cvts.comp == COMPRESSION_SGILOG)
278 <                        SET(C_GAMUT);
278 >                        SET(C_GAMUT);           /* may be outside XYZ gamut */
279                  if (cvts.pconf != PLANARCONFIG_CONTIG)
280                          quiterr("cannot handle separate Luv planes");
281                  TIFFSetField(cvts.tif, TIFFTAG_SGILOGDATAFMT,
# Line 362 | Line 362 | initfromtif(void)              /* initialize conversion from TIFF
362                  quiterr("unknown input image resolution");
363  
364          if (!TIFFGetField(cvts.tif, TIFFTAG_STONITS, &cvts.stonits))
365 <                cvts.stonits = 1.;
365 >                cvts.stonits = -1.;
366  
367          if (!TIFFGetField(cvts.tif, TIFFTAG_DATETIME, &cp))
368                  cvts.capdate[0] = '\0';
# Line 380 | Line 380 | initfromtif(void)              /* initialize conversion from TIFF
380          if (cvts.pixrat < .99 || cvts.pixrat > 1.01)
381                  fputaspect(cvts.pixrat, cvts.rfp);
382          if (CHK(C_XYZE)) {
383 <                fputexpos(pow(2.,(double)cvts.bradj)/cvts.stonits, cvts.rfp);
383 >                if (cvts.stonits > .0)
384 >                        fputexpos(pow(2.,(double)cvts.bradj)/cvts.stonits, cvts.rfp);
385                  fputformat(CIEFMT, cvts.rfp);
386          } else {
387                  if (CHK(C_PRIM))
388                          fputprims(cvts.prims, cvts.rfp);
389 <                fputexpos(WHTEFFICACY*pow(2.,(double)cvts.bradj)/cvts.stonits,
390 <                                cvts.rfp);
389 >                if (cvts.stonits > .0)
390 >                        fputexpos(WHTEFFICACY*pow(2.,(double)cvts.bradj)/cvts.stonits,
391 >                                        cvts.rfp);
392                  fputformat(COLRFMT, cvts.rfp);
393          }
394          if (cvts.capdate[0])
# Line 569 | Line 571 | initfromrad(void)                      /* initialize input from a Radianc
571                                          SAMPLEFORMAT_IEEEFP);
572                          cvts.tf = Color2RfGfBf;
573                          SET(C_RFLT);
574 +                        CLR(C_GAMUT);
575                  } else
576                          cvts.tf = Colr2RGB;
577                  break;
# Line 655 | Line 658 | Luv2Color(                     /* read/convert/write Luv->COLOR scanline
658          if (CHK(C_RFLT|C_TWRD|C_TFLT|C_GRY) != (C_RFLT|C_TFLT))
659                  quiterr("internal error 1 in Luv2Color");
660  
661 +        if (cvts.pconf != PLANARCONFIG_CONTIG)
662 +                quiterr("cannot handle separate 32-bit color planes");
663 +
664          if (TIFFReadScanline(cvts.tif, cvts.t.p, y, 0) < 0)
665                  quiterr("error reading TIFF input");
666                                          /* also works for float RGB */
# Line 693 | Line 699 | RRGGBB2Color(                  /* read/convert/write RGB16->COLOR sca
699          if (CHK(C_RFLT|C_TWRD|C_TFLT|C_GRY) != (C_TWRD|C_RFLT))
700                  quiterr("internal error 1 in RRGGBB2Color");
701  
702 +        if (cvts.pconf != PLANARCONFIG_CONTIG)
703 +                quiterr("cannot handle separate 16-bit color planes");
704 +
705          if (TIFFReadScanline(cvts.tif, cvts.t.p, y, 0) < 0)
706                  quiterr("error reading TIFF input");
707          
# Line 709 | Line 718 | RRGGBB2Color(                  /* read/convert/write RGB16->COLOR sca
718                  if (CHK(C_CXFM))
719                          colortrans(cvts.r.colors[x], cvts.cmat,
720                                          cvts.r.colors[x]);
712                if (CHK(C_GAMUT))
713                        clipgamut(cvts.r.colors[x], cvts.t.fp[3*x + 1],
714                                        CGAMUT_LOWER, cblack, cwhite);
721          }
722          if (cvts.bradj) {
723                  d = pow(2.,(double)cvts.bradj);
# Line 970 | Line 976 | Color2RRGGBB(                  /* read/convert/write COLOR->RGB16 sca
976          if (freadscan(cvts.r.colors, cvts.xmax, cvts.rfp) < 0)
977                  quiterr("error reading Radiance picture");
978  
979 <        for (x = cvts.xmax; x--; )
979 >        for (x = cvts.xmax; x--; ) {
980 >            if (CHK(C_CXFM)) {
981 >                        colortrans(cvts.r.colors[x], cvts.cmat,
982 >                                        cvts.r.colors[x]);
983 >                if (CHK(C_GAMUT))
984 >                        clipgamut(cvts.r.colors[x], bright(cvts.r.colors[x]),
985 >                                        CGAMUT_LOWER, cblack, cwhite);
986 >            }
987              for (i = 3; i--; ) {
988                  register float  f = m*colval(cvts.r.colors[x],i);
989                  if (f <= 0)
# Line 983 | Line 996 | Color2RRGGBB(                  /* read/convert/write COLOR->RGB16 sca
996                  else
997                          cvts.t.wp[3*x + i] = (int)((float)(1L<<16)*f);
998              }
999 +        }
1000  
1001          if (TIFFWriteScanline(cvts.tif, cvts.t.p, y, 0) < 0)
1002                  quiterr("error writing TIFF output");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines