Skip to content

Commit 65bb20b

Browse files
Update comments
1 parent 04053c5 commit 65bb20b

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YCbCrScalar.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,10 @@ public static void ConvertToRgbInPlaceWithIcc(Configuration configuration, IccPr
7373
// do not implement transforms from it.
7474
// Therefore, we first convert JPEG YCbCr to RGB manually, then perform
7575
// color-managed conversion to the target profile.
76-
77-
// TODO: The initial YCbCr => RGB conversion is assumed to be in the sRGB working space.
78-
// To perform accurate colorimetric conversion via XYZ, we should derive the working space
79-
// from the source ICC profile (e.g., via header/tags).
80-
// This is a placeholder until that logic is implemented.
76+
//
77+
// The YCbCr => RGB conversion is based on BT.601 and is independent of any embedded ICC profile.
78+
// Since the same RGB working space is used during conversion to and from XYZ,
79+
// colorimetric accuracy is preserved.
8180
ColorProfileConverter converter = new();
8281

8382
PackedNormalizeInterleave3(c0, c1, c2, packed, 1F / maxValue);

src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YccKScalar.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,9 @@ public static void ConvertToRgbInPlaceWithIcc(Configuration configuration, IccPr
104104
// ICC profiles expect colorimetric CMYK values, so we must first convert YccK to CMYK using a hardcoded inverse transform.
105105
// This transform assumes Rec.601 YCbCr coefficients and an inverted K channel.
106106
//
107-
// TODO: The intermediate YccK => RGB step assumes a working space with sRGB primaries and D65 white point.
108-
// To perform accurate colorimetric conversion via XYZ, we should derive the working space
109-
// from the source ICC profile (e.g., via header/tags).
110-
// This is a placeholder until that logic is implemented.
107+
// The YccK => Cmyk conversion is independent of any embedded ICC profile.
108+
// Since the same RGB working space is used during conversion to and from XYZ,
109+
// colorimetric accuracy is preserved.
111110
converter.Convert<YccK, Cmyk>(MemoryMarshal.Cast<Cmyk, YccK>(source), source);
112111

113112
Span<Rgb> destination = MemoryMarshal.Cast<float, Rgb>(packed)[..source.Length];

0 commit comments

Comments
 (0)