CMSing around

I am still looking at fixing that color management encumbrance. Right now the GNU Classpath CMS seems the most attractive choice (to me). I did some quick comparisons:


I wrote a small test program that converts 1000000 pixels from gray to sRGB. Here are the results:

JDK6: 26301 ms

plain OpenJDK: 13173 ms

OpenJDK with Classpath CMS: 422 ms

Yes that’s right! Only about half a second for 1000000 pixels. Apparently it’s not a good idea to do a million very small JNI calls with hotspot.


I took the above program and adjusted it to do comparisons of accuracy. There’s one program that does 1000000 random pixel conversions and writes the results to stdout, and another program that reads in these reference values and does the same thing on the current build and creates some stats about the divergences. Here are the results:


average difference from reference: 0.0
maximum difference from reference: 0.0

Apparently this is the reference 😉

plain OpenJDK:

average difference from reference: 0.00380017
maximum difference from reference: 0.038417127
Take into accout that the value range is 0.0 -> 1.0. This confirms one of the outstanding bugs with littlecms and OpenJDK.

OpenJDK with Classpath CMS:

average difference from reference: 0.00280433
maximum difference from reference: 0.0042832294

Much better, isn’t it?


From an implementation POV, the next obvious thing to do (AFAICT) is that some classes (namely ColorConvertOp and ColorModel) in java.awt.image use internal implementation classes of the CMS, rather than using java.awt.color. These need to be reworked to work with GNU Classpath’s CMS. This is not a big deal though. I’m on it.

Then this code would need much more testing for conversions other than GRAY->RGB. Unfortunately, OpenJDK has no tests at all for the CMS stuff. I asked the Sun developers to run the package against their testsuites. Let’s see if they do it and how it performs.

The other problem is the legal side of the story. While there’s nothing against mixing GPL’ed code in general, Sun and the FSF have some special requirements with such things. AFAIK, the FSF and Sun are talking about how to solve the problem of integrating each other’s code easily.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: