Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6523402
Votes 0
Synopsis OSS CMM: Some quality problems with GRAY, PYCC and CIEXYZ color spaces with lcms library
Category java:classes_2d
Reported Against
Release Fixed
State 3-Accepted, bug
Priority: 4-Low
Related Bugs
Submit Date 09-FEB-2007
Description
There are some quality problems with following color spaces:  GRAY(not so noticeable), PYCC  and  CIEXYZ. Because of that following regression test is using large tolerance values for checking the result of transformations:

test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java
Posted Date : 2007-02-14 15:00:25.0

Here is tolerance values that used for comparing results of the color transformations with ones obtained from original Kodak color management system:

Color Space   Tolerance 

sRGB               3     
LINEAR_RGB         7         
GRAY              11
PYCC              46
CIEXYZ            48
Posted Date : 2007-02-14 15:00:25.0
Work Around
N/A
Evaluation
This problem happens because inaccuracy inside the littleCMS library. The same inaccuracy happens with both jdk and openJDK color profiles. Here is minimized java and native testcases showing the problem with GRAY -> sRGB transform.

--------------GrayTest.java------------------
import java.awt.color.ColorSpace;

public class GrayTest {
    final static int [] cols = {1, 2, 3, 4, 5, 6, 7};
    
    public static void main(String [] args) {
        ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
        float [] p = new float[1];
        for (int i = 0; i < cols.length; i++) {
            p[0] = cols[i]/255.0f;
            float [] r = cs.toRGB(p);
            for (int j = 0; j < r.length; j++) {
                System.out.print((int)(r[j]*255) + ",");
            }
            System.out.println();
        }
    }
}

-------------------gray.cpp---------------------
#include <stdio.h>
#include "lcms.h"

char pixels[] = {1, 2, 3, 4, 5, 6, 7};

int main(int argc, char* argv[]) {
    char* in = pixels;
    char out[3];

    cmsHPROFILE profiles[2];
    profiles[0] = cmsOpenProfileFromFile("KCMS\\GRAY.pf", "r");

    profiles[1] = cmsOpenProfileFromFile("KCMS\\sRGB.pf", "r");

    cmsHTRANSFORM trans = cmsCreateMultiprofileTransform(
        profiles,2,BYTES_SH(1) | CHANNELS_SH(1), BYTES_SH(1) | CHANNELS_SH(3),
        0/* perceptual*/,0);

    for (int i = 0; i < sizeof(pixels)/sizeof(char); i++) {

        cmsDoTransform(trans, in++, out, 1);

        printf("%d,%d,%d\n", out[0], out[1], out[2]);
    }

}

output from JDK6,7 with GrayTest:

12,12,12,
21,21,21,
28,28,28,
33,33,33,
38,38,38,
42,42,42,
46,46,46,

output from openJDK with GrayTest and native testcase:

6,6,6,
12,12,12,
18,18,18,
24,24,24,
31,31,31,
37,37,37,
43,43,43,
Posted Date : 2007-03-06 22:02:53.0
Comments
  
  Include a link with my name & email   

Submitted On 02-MAR-2007
Without access to a testcase and/or a more detailed description it is hard to think what exactly the problem is.

/Roman


Submitted On 28-MAR-2008
aph
I'm rather suspicious of this test case.

Firstly, it uses a perceptual transform: perceptual rendering is not fully-defined by ICC, and is as much as anything subject to matters of aesthetic judgement.  If there is to be a conformance test of colour profiles, let it use colorimetric rendering.

Also, the Kodak profiles used in the proprietary JDK have some apparently arbitrary features.  For example, the white point of their sRGB profile is L*=96.  The whitepoint of the lcms sRGB profile is l*=100, which is apparently far more logical.

So, do we declare the transforms using Kodak colour profiles as "correct", simply because they reflect Kodak's opinion, and Kodak must be correct?



PLEASE NOTE: JDK6 is formerly known as Project Mustang