--- ray/src/common/tmapluv.c 2005/01/07 20:33:02 3.10 +++ ray/src/common/tmapluv.c 2005/11/15 06:53:00 3.12 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: tmapluv.c,v 3.10 2005/01/07 20:33:02 greg Exp $"; +static const char RCSid[] = "$Id: tmapluv.c,v 3.12 2005/11/15 06:53:00 greg Exp $"; #endif /* * Routines for tone-mapping LogLuv encoded pixels. @@ -131,7 +131,7 @@ uint32 *luvs, int len ) { - static char funcName[] = "tmCvLuv32"; + static const char funcName[] = "tmCvLuv32"; double uvp[2]; register LUV32DATA *ld; register int i, j; @@ -255,7 +255,7 @@ uint16 *l16s, int len ) { - static char funcName[] = "tmCvL16"; + static const char funcName[] = "tmCvL16"; static double lastsf; static int offset; register int i; @@ -266,11 +266,7 @@ int len returnErr(TM_E_ILLEGAL); /* check scaling offset */ if (!FEQ(tms->inpsf, lastsf)) { - offset = BRT2SCALE(64); - if (tms->inpsf > 1.0001) - offset -= (int)(TM_BRTSCALE*log(tms->inpsf)+.5); - else if (tms->inpsf < 0.9999) - offset -= (int)(TM_BRTSCALE*log(tms->inpsf)-.5); + offset = BRT2SCALE(64) - tmCvLuminance(tms->inpsf); lastsf = tms->inpsf; } /* convert each pixel */ @@ -295,11 +291,7 @@ TMstruct *tms; exit(1); } ld = (LUV32DATA *)tms->pd[luv32Reg]; - ld->offset = BRT2SCALE(64); - if (tms->inpsf > 1.0001) - ld->offset -= (int)(TM_BRTSCALE*log(tms->inpsf)+.5); - else if (tms->inpsf < 0.9999) - ld->offset -= (int)(TM_BRTSCALE*log(tms->inpsf)-.5); + ld->offset = BRT2SCALE(64) - tmCvLuminance(tms->inpsf); clruvall(ld); } @@ -330,11 +322,7 @@ TMstruct *tms; exit(1); } ld = (LUV24DATA *)tms->pd[luv24Reg]; - ld->offset = BRT2SCALE(12); - if (tms->inpsf > 1.0001) - ld->offset -= (int)(TM_BRTSCALE*log(tms->inpsf)+.5); - else if (tms->inpsf < 0.9999) - ld->offset -= (int)(TM_BRTSCALE*log(tms->inpsf)-.5); + ld->offset = BRT2SCALE(12) - tmCvLuminance(tms->inpsf); clruvall(ld); }