On Sep 28, 2010, at 6:32 PM, Florian Höch wrote: > Hi, > > did you notice that the first column does not end at the actual maximum > (65535)? The cmsBuildGamma values are correct. > > for (int i = 0; i < numberOfEntries; i++) { > ... > value = (value * max) / (numberOfEntries - 1); > ... > }
oh! I should have seen that. Especially if I analyzed the numbers. Take the last case, for example. value = 99.0 value = (99.0 * 65535) / 100; yup, that's not right! Thanks for the quick response. Paul > > Am 28.09.2010 23:33, schrieb Paul Cezanne: >> I'm looking at a 1% error in what I expect my gamma to be and now I'm >> wondering if it is an LCMS bug! Run this program. >> >> #include "lcms.h" >> >> int main (int argc, const char * argv[]) { >> >> >> const int numberOfEntries = 100; >> >> LPGAMMATABLE transferFunctionsDebug; >> transferFunctionsDebug = cmsBuildGamma(numberOfEntries, 1.0); >> >> int max = transferFunctionsDebug[0].GammaTable[numberOfEntries-1]; >> >> float value; >> int vInt; >> >> >> for(int i =0; i < 100; i++) { >> value = i; // convert to float >> value = (value * max)/numberOfEntries; // normalize to gamma range >> vInt = (int) (value + 0.5); >> >> >> fprintf(stdout, "%d\t%d\n", vInt, transferFunctionsDebug->GammaTable[i]); >> } >> >> } >> >> >> * >> I get this output: >> >> 0 0 >> 655 662 >> 1311 1324 >> ... >> 62914 63549 >> 63569 64211 >> 64224 64873 >> 64880 65535 >> >> I would have expected the columns to be the same. Does cmsBuildGamma not >> build a perfectly linear LUT? > > -- > Florian Höch > ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Lcms-user mailing list Lcms-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lcms-user