Open Bug 696594 Opened 13 years ago Updated 2 years ago

huge roundoff error when applying color profiles

Categories

(Core :: Graphics: Color Management, defect)

7 Branch
x86_64
Linux
defect

Tracking

()

UNCONFIRMED

People

(Reporter: jengelh, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1
Build ID: 2011092900

Steps to reproduce:

Load up a PNG file with an sRGB chunk in firefox.


Actual results:

Image is rendered with increased tint so to speak, I suspect it re-applies the system color profile, i.e. that I loaded into Xorg to have color correction on a global scale.


Expected results:

Not tint the image.

This has been reported in the distro bz:
https://bugzilla.novell.com/show_bug.cgi?id=725961
with sample images in
https://bugzilla.novell.com/show_bug.cgi?id=725960
Component: General → GFX: Color Management
Product: Firefox → Core
QA Contact: general → color-management
I'm not familiar with color management on Linux so here's a few question:
1) Is this something default in openSUSE/Xorg? If not which settings have you set in which program?
2) What color space does it expect the programs to render in?
3) Does setting gfx.color_management.mode=0 in about:config resolve the problem?

From the looks of it our logic for getting the output profile is incomplete.
1. In essence, it runs `dispwin -v -d1 -c -L` and loads "/home/jengelh/.local/share/color/icc/devices/display/HSD100IFW1 2011-09-14 max nativ min nativ 2.2 MQ-HQ 3xCurve+MTX.icc" according to strace. dispwin is provided by argyllcms.

2. iccdump says

icc:
Header:
  size         = 18260 bytes
  CMM          = 'argl'
  Version      = 2.2.0
  Device Class = Display
  Color Space  = RGB
  Conn. Space  = XYZ
  Date, Time   = 14 Sep 2011, 12:18:07
  Platform     = *nix
  Flags        = Not Embedded Profile, Use anywhere
  Dev. Mnfctr. = '????'
  Dev. Model   = '????'
  Dev. Attrbts = Reflective, Glossy
  Rndrng Intnt = Relative Colorimetric
  Illuminant   = 0.964203, 1.000000, 0.824905    [Lab 100.000000, 0.000498, -0.000436]
  Creator      = 'argl'
[...]
gfx.color_management.mode=0 turns off color correction within firefox entirely, which is not desired.

The following new observations point out that the system color profile is not involved any longer.

Retrieve http://www.color.org/Lower_Left.jpg as sample image. This image is false-colored on purpose ("BGR"), and has an ICC profile to correct the values stored in the image before display.

Steps to reproduce:
1. Load Lower_Left.jpg for display in both firefox and e.g. gimp (mine uses libgegl somehow, FYI).
2. Do a screenshot (import -window root, or similar).

Actual results:
- the upper left pixel of the JPEG is rendered as (108,178,254) [#6cb2fe] in gimp, and (100,158,251) [#649efb] in firefox.

Expected results:
- because of the simple BGR swap, the ideal rendered color would have been (108,176,254) [#6cb0fe]. The error of the color conversion is therefore (0,2,0) for gimp and (8,20,3) for firefox.

Test 2 follows.

Steps to reproduce:
1. Create a PNG file with gimp that has all pixels set to (255,0,0) [#ff0000], and sRGB-Perceptual assigned (Image > Mode > Assign Color Profile > sRGB).
2. Load the resulting PNG in firefox.
3. Make a screenshot.

Actual results:
- firefox displays it as (255,0,23) [#ff0017], gimp as (255,0,0) [#ff0000]. The error for firefox is therefore (0,0,23), about as larger as with the JPEG file.

Expected results:
- as observed, gimp has a slight roundoff error in the first test. Since this is not present in the red image, it is possible that gimp may skip the color conversion (since the file is already sRGB).
- in anticipation of that it does skip the conversion, I would expect for a rounding error of at most (0,0,3) for any program that does a color conversion in some way.
Summary: system color profile applied twice → huge roundoff error when applying color profiles
I know that disabling the color management isn't the solution. I'm trying to diagnose and understand the problem in order to know what the best fix is. Does disabling.

Your original problem is that color management is applied by both Firefox and 'globally'. Does disabling it prevent it from being applied twice.

What you're describing in Comment #3 appears to be an entirely different bug. I would like to resolve these issues separately if they are separate.
My original problem was just that I noticed hues increasing. The assumption that the color profile was applied twice has been redacted since firefox's behavior is reproducible even when the global color correction is cleared.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.