Skip to content

Commit 7d5716a

Browse files
docs: name+describe every iccviz function; add round-trip in-gamut rationale
Documentation-only pass over the iccviz module (no code change): - Every function/method in IccVizModel.cpp, IccVizMath.hpp and the public IccVizModel.hpp declarations now has a comment block that leads with the function name, then says what it does and why it does it that way. Filled the ~15 that had no comment (helpers, producers, the public API definitions and setters) and prefixed the existing descriptive comments with their name. - RoundTripDE: documented WHY the seeds come from the device cube (via A2B) rather than a raw L*a*b* grid — it guarantees the test points are wholly in-gamut (so the metric measures real B2A/A2B agreement, not out-of-gamut clamping) and spreads them reasonably evenly through the interior of the in-gamut region of L*a*b* space. - Comment/code consistency fixes: Enumerate's order list now mentions the neutral-axis stage; the gamut-volume provenance is consistent (gamut-wasm); the round-trip citation reads "method suggested by Harold Boll". Compiles clean under g++ -Wall -Wextra -Wunused-function. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7c75963 commit 7d5716a

3 files changed

Lines changed: 176 additions & 37 deletions

File tree

iccviz/IccVizMath.hpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ struct XY {
8585
float y = 0.0f;
8686
};
8787

88-
// 16-bit ICC XYZ (s15Fixed16 stored as integer/65535) → CIE xy chromaticity.
88+
// xyFromICCXYZ — project a 16-bit ICC XYZ (s15Fixed16 stored as integer/65535) to
89+
// CIE xy chromaticity. Separate from the float version because the integer source
90+
// can't be NaN/Inf, so it skips those checks; a near-zero sum returns (0,0).
8991
inline XY xyFromICCXYZ(const icXYZNumber* xyz) {
9092
// integers, so don't have to test for NaN or Inf
9193
float X = xyz->X / 65535.0f;
@@ -96,7 +98,9 @@ inline XY xyFromICCXYZ(const icXYZNumber* xyz) {
9698
return XY{X / sum, Y / sum};
9799
}
98100

99-
// Float XYZ → CIE xy chromaticity.
101+
// xyFromXYZFloat — project a floating-point XYZ triple to CIE xy chromaticity; the
102+
// float twin of xyFromICCXYZ for values that come from a transform rather than a
103+
// stored tag. A near-zero (or non-positive) sum returns (0,0) to avoid dividing by ~0.
100104
inline XY xyFromXYZFloat(const icFloatNumber* xyz) {
101105
float X = xyz[0];
102106
float Y = xyz[1];
@@ -106,7 +110,10 @@ inline XY xyFromXYZFloat(const icFloatNumber* xyz) {
106110
return XY{X / sum, Y / sum};
107111
}
108112

109-
// Planckian (blackbody) locus approximation in CIE xy.
113+
// approxPlanck — approximate the planckian (blackbody) locus in CIE xy for a colour
114+
// temperature `t` (Kelvin), used to draw the reference curve on the chromaticity
115+
// chart. Uses the Kang et al. piecewise polynomial fit rather than integrating the
116+
// Planck radiator, which is fast, table-free and accurate enough for a plotted guide.
110117
// https://en.wikipedia.org/wiki/Planckian_locus
111118
// Bongsoon Kang; Ohak Moon; Changhee Hong; Honam Lee; Bonghwan Cho;
112119
// Youngsun Kim (December 2002). "Design of Advanced Color Temperature Control

0 commit comments

Comments
 (0)