Browse Source

Update comments

pull/2922/head
James Jackson-South 1 year ago
parent
commit
65bb20bbb4
  1. 9
      src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YCbCrScalar.cs
  2. 7
      src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YccKScalar.cs

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

@ -73,11 +73,10 @@ internal abstract partial class JpegColorConverterBase
// do not implement transforms from it. // do not implement transforms from it.
// Therefore, we first convert JPEG YCbCr to RGB manually, then perform // Therefore, we first convert JPEG YCbCr to RGB manually, then perform
// color-managed conversion to the target profile. // color-managed conversion to the target profile.
//
// TODO: The initial YCbCr => RGB conversion is assumed to be in the sRGB working space. // The YCbCr => RGB conversion is based on BT.601 and is independent of any embedded ICC profile.
// To perform accurate colorimetric conversion via XYZ, we should derive the working space // Since the same RGB working space is used during conversion to and from XYZ,
// from the source ICC profile (e.g., via header/tags). // colorimetric accuracy is preserved.
// This is a placeholder until that logic is implemented.
ColorProfileConverter converter = new(); ColorProfileConverter converter = new();
PackedNormalizeInterleave3(c0, c1, c2, packed, 1F / maxValue); PackedNormalizeInterleave3(c0, c1, c2, packed, 1F / maxValue);

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

@ -104,10 +104,9 @@ internal abstract partial class JpegColorConverterBase
// ICC profiles expect colorimetric CMYK values, so we must first convert YccK to CMYK using a hardcoded inverse transform. // ICC profiles expect colorimetric CMYK values, so we must first convert YccK to CMYK using a hardcoded inverse transform.
// This transform assumes Rec.601 YCbCr coefficients and an inverted K channel. // This transform assumes Rec.601 YCbCr coefficients and an inverted K channel.
// //
// TODO: The intermediate YccK => RGB step assumes a working space with sRGB primaries and D65 white point. // The YccK => Cmyk conversion is independent of any embedded ICC profile.
// To perform accurate colorimetric conversion via XYZ, we should derive the working space // Since the same RGB working space is used during conversion to and from XYZ,
// from the source ICC profile (e.g., via header/tags). // colorimetric accuracy is preserved.
// This is a placeholder until that logic is implemented.
converter.Convert<YccK, Cmyk>(MemoryMarshal.Cast<Cmyk, YccK>(source), source); converter.Convert<YccK, Cmyk>(MemoryMarshal.Cast<Cmyk, YccK>(source), source);
Span<Rgb> destination = MemoryMarshal.Cast<float, Rgb>(packed)[..source.Length]; Span<Rgb> destination = MemoryMarshal.Cast<float, Rgb>(packed)[..source.Length];

Loading…
Cancel
Save