Browse Source

Minor cleanup

pull/1567/head
James Jackson-South 1 year ago
parent
commit
f147aadecc
  1. 13
      src/ImageSharp/ColorProfiles/ColorProfileConverterExtensionsIcc.cs
  2. 2
      src/ImageSharp/ColorProfiles/Icc/Calculators/ColorTrcCalculator.cs

13
src/ImageSharp/ColorProfiles/ColorProfileConverterExtensionsIcc.cs

@ -244,6 +244,11 @@ internal static class ColorProfileConverterExtensionsIcc
/// Not required if both spaces need adjustment, since they both have the same understanding of the PCS.
/// Not compatible with PCS adjustment for absolute intent.
/// </summary>
/// <param name="sourcePcs">The source PCS values.</param>
/// <param name="sourceParams">The source profile parameters.</param>
/// <param name="targetParams">The target profile parameters.</param>
/// <param name="pcsConverter">The converter to use for the PCS adjustments.</param>
/// <exception cref="ArgumentOutOfRangeException">Thrown when the source or target PCS is not supported.</exception>
private static Vector4 GetTargetPcsWithPerceptualV2Adjustment(
Vector4 sourcePcs,
ConversionParams sourceParams,
@ -294,16 +299,12 @@ internal static class ColorProfileConverterExtensionsIcc
case IccColorSpaceType.CieLab:
CieLab lab = pcsConverter.Convert<CieXyz, CieLab>(in xyz);
targetPcs = lab.ToScaledVector4();
targetPcs = targetParams.Is16BitLutEntry ? LabToLabV2(targetPcs) : targetPcs;
break;
return targetParams.Is16BitLutEntry ? LabToLabV2(targetPcs) : targetPcs;
case IccColorSpaceType.CieXyz:
targetPcs = xyz.ToScaledVector4();
break;
return xyz.ToScaledVector4();
default:
throw new ArgumentOutOfRangeException($"Target PCS {targetParams.PcsType} is not supported");
}
return targetPcs;
}
// as per DemoIccMAX icPerceptual values in IccCmm.h

2
src/ImageSharp/ColorProfiles/Icc/Calculators/ColorTrcCalculator.cs

@ -23,7 +23,7 @@ internal class ColorTrcCalculator : IVector4Calculator
bool toPcs)
{
this.toPcs = toPcs;
this.curveCalculator = new TrcCalculator(new IccTagDataEntry[] { redTrc, greenTrc, blueTrc }, !toPcs);
this.curveCalculator = new TrcCalculator([redTrc, greenTrc, blueTrc], !toPcs);
Vector3 mr = redMatrixColumn.Data[0];
Vector3 mg = greenMatrixColumn.Data[0];

Loading…
Cancel
Save