Skip to content

[css-color-4] Discrepancy between § 19.1. ΔE2000 implementation and ISO 11664-6:2014/Sharma et al., 2005 #13322

Closed

Description

@initramfs

The sample implementation in section of 19.1. ΔE2000 of CIEDE2000 has a discrepancy in the computation of the mean hue angle $\overline{h'}$ versus the equation in ISO/CIE 11664-6:2014 (I do not have the 2022 version available) which reference the paper by Sharma et al., 2005.

The offending line exists on line 103 of the code snippet:

if (Cdash1 == 0 && Cdash2 == 0) {

where $\overline{h'}$ (hdash in code) is set to hsum if Cdash1 and Cdash2 is zero, which differs from the specification condition that $C'_1 \cdot{} C'_2 = 0$, which would be implemented in code as:

if (Cdash1 * Cdash2 === 0) {

The above condition is correctly implemented for the computation of $Δh'$ (Δh in code) as seen on line 75 of the implementation.

Mathematically, the discrepancy does not matter in the final computation of the ΔE2000 value since having either $C'_1$ or $C'_2$ be 0 means that the $ΔH$ value is 0, and the mean hue angle $\overline{h'}$ is always eventually multiplied with $ΔH$, making the discrepancy disappear in the final result.

However, the intermediate values $Δθ$, $T$, and $R_T$ do show the discrepancy and may not match testing data that expect all the intermediate values to match as well.

A specific test pair of:
Reference L = 50.00, a = 0.000, b = 0.000
and
Sample L = 50.00, a = 10.00, b = -114.3

can be used to show large deviations between the two specifications for the $Δθ$, $T$, and $R_T$ values (as well as $\overline{h'}$), with $Δθ = 30.000$ for ISO/CIE 11664-6:2014 and $Δθ = 1.6669$ for the sample implementation in section 19.1. ΔE2000.


I was wondering what the rationale behind the change in implementation is, as the code comments don't seem to note anything about this discrepancy.

Activity

  1. facelessuser commented on Jan 11, 2026

    @facelessuser
    Contributor

    Yes, this is a mistake. The reference implementation was corrected, but it wasn't in the spec, or at least not the second case.

  2. svgeesus commented on Jan 11, 2026

    @svgeesus
    Collaborator

    I'm seeing the same code in the spec

    if (Cdash1 * Cdash2 === 0) {

  3. initramfs commented on Jan 11, 2026

    @initramfs
    ContributorAuthor

    @svgeesus Might you be looking at line 75 (snippet below):

    if (Cdash1 * Cdash2 === 0) {
    	Δh = 0;
    }

    instead of line 103 (snippet below):

    if (Cdash1 == 0 && Cdash2 == 0) {
    	hdash = hsum;   // which should be zero
    }

    I still see the discrepancy in the spec document you sent, and it still appears to be present in the current main commit:

    if (Cdash1 == 0 && Cdash2 == 0) {

  4. svgeesus commented on Jan 16, 2026

    @svgeesus
    Collaborator

    instead of line 103 (snippet below):

    Ah, yes indeed.

  5. svgeesus commented on Jan 16, 2026

    @svgeesus
    Collaborator

    Closed by #13338

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions