lib-color · crate
kinogaki-color
Color science and color management for Kinogaki.
- Repository
- lib-color (kinogaki/lib-color)
- Folder
libs/lib-color/crates/color- Source
- 31 files, 10,328 lines
- Tests
- 4 files, 522 lines
Also 2 shader or C files, 219 lines.
What it is
Color science and color management for Kinogaki.
matrix,xyz: 3×3 matrices, CIE XYZ, chromaticities, primaries (sRGB, Display P3, Adobe RGB, Rec. 2020, ACES AP0/AP1, ProPhoto) and their derived matrices, Bradford adaptation.transfer: sRGB, gamma, PQ and HLG curves.lab,oklab,hsl: CIELAB with CIEDE2000, Oklab with its sRGB gamut, HSV and HSL for pickers.temperature: correlated color temperature and tint.spectral: the CIE 1931 observer, blackbodies, CIE daylight and the spectral upsampling of colors.aces: the ACES 2.0 Output Transform and its inverse.ocio: OpenColorIO v2 configs, our own reader and processors (CPU and WGSL), with the ACES 2.0 CG config built in.
No dependencies, no unsafe code.
Depends on
None.
Third-party
None.
Used by
| Crate | Repository | As | What it is |
|---|---|---|---|
kinogaki-color-service | Core and the app | normal | Studio's color service: the OpenColorIO config (lib-color's built-in ACES 2.0 CG config, or a file), the working space, and the viewer's display, view, look, exposure and gamma. |
kinogaki-color-wgpu | lib-color | normal | kinogaki-color's processors on a wgpu device. |
kinogaki-composit | lib-composit | normal | Comp's device-free half: each operator's parameters and maths, tone curves, and the plan a host compiles a network to. |
kinogaki-editor | Core and the app | normal | Kinogaki Studio's editor: the document and everything the window shows of it, as parts one frame borrows one by one. |
kinogaki-image-pipeline | Core and the app | normal | ImagePipeline: what renders become on screen and in files. |
kinogaki-scene | Core and the app | tests | Studio's scene: the document cooked object by object. |
kinogaki-spectra | lib-render | normal | Spectral data and the color science hosts and engines share. |
kinogaki-spectre | Spectre | normal | Spectre, the spectral path tracer, as a Kinogaki Studio render plugin. |
kinogaki-workflows | Workflows | tests | Tests alone: tests/workflows drives what a person does across the plugins the app ships, through the real editor offscreen. |
Modules
acesThe ACES 2.0 Output Transform: scene-referred ACES (AP0, or AP1 throughOutputTransform::apply_ap1) to display light for a display of a given peak luminance and limiting primaries, as the Academy's aces-output and OpenColorIO's builtin ACES2 transforms ...255 linesaces::camHellwig 2022 JMh with the ACES 2.0 modifications: CAM16's cone space (with its "stretched" primaries), full adaptation to the RGB space's own white, a dim surround at 100 cd/m² adapting luminance, the post-adaptation compression without CAM16's noise term ...191 linesaces::gamutThe gamut compression.336 linesaces::tablesThe hue tables the gamut compression reads, built once per transform.279 linesaces::tonescaleThe Daniele tonescale and the chroma compression.222 lineshslHSV (Photoshop's HSB) and HSL over encoded RGB, for pickers.143 linesiccICC display profiles: an RGB matrix and a tone curve, the shape files carry to say which display their code values are for.357 lineslabCIELAB and its polar form, ΔE76 and CIEDE2000.224 linesmatrix3×3 matrices (row-major) and RGB triples in f64.135 linesocioOpenColorIO v2 configs, read and run by our own code (OpenColorIO itself is only the tests' oracle): the YAML (yaml), the config model (config), the transforms it writes (transform), the builtins (builtins), LUT files (files), and ...157 linesocio::builtinsOpenColorIO's builtin transforms (!<BuiltinTransform> {style: …}): ACES color spaces and looks, the ACES 2.0 output transforms, camera log encodings and display encodings, built from their published definitions (primaries, curves) as ops.530 linesocio::compile(private)Config transforms to ops: color space conversions through the references (bridged by the default view transform), displays and views, looks, named transforms, builtins and files.580 linesocio::configAn OpenColorIO config: color spaces (scene- and display-referred), roles, displays and views, view transforms, looks, named transforms, file rules and viewing rules, read from its YAML (profile versions 1 and 2).546 linesocio::config::read(private)Reading a config from its YAML: the top-level keys, each color space, view and file rule, and the checks that the names it refers to exist.429 linesocio::curvesPer-channel curves OpenColorIO's builtins carry as lookup tables, here in closed form from their published definitions: ST 2084, HLG, ACEScc, Apple Log, Canon Log 2 and 3, and ADX's density to log exposure.289 linesocio::filesThe lookup-table files FileTransforms name: Resolve and Iridas.cube(1D and 3D), Sony Pictures Imageworks.spi1d,.spi3dand.spimtx, and Academy/ASC CLF and OpenColorIO CTF (.clf,.ctf) process lists.661 linesocio::lutLookup tables: 1D (per channel, linear interpolation, inverted by search on a monotonic table) and 3D (trilinear or tetrahedral).267 linesocio::opsThe primitive operations a processor runs, each with its direction resolved: what config transforms compile to (super::compile), what the CPU evaluates (Op::apply) and what the WGSL generator writes (super::wgsl).751 linesocio::processor(private)A processor: a config conversion compiled to ops and simplified (matrices and offsets merged, identities dropped), run on single colors or on interleaved f32 pixels, and turned into WGSL (super::wgsl).184 linesocio::regexThe regular expressions file rules use (ECMAScript-like): literals,., classes ([a-z],[^…],\d \w \s), groups, alternation,* + ? {m,n}(greedy) and the anchors^ $.319 linesocio::transformTransforms as a config writes them (!<MatrixTransform> {…}and the rest), read from its YAML.491 linesocio::wgslWGSL for a processor: the same ops as the CPU path, written as one WGSL functionfn <name>(rgb: vec3<f32>) -> vec3<f32>, its tables (LUTs, the ACES 2.0 hue tables) and dynamic values (the viewer's exposure and gamma) in one read-only storage buffer of f32 ...622 linesocio::xmlThe XML CLF and CTF files are written in: elements, attributes, text, comments, the declaration, CDATA and the five entities plus numeric references.265 linesocio::yamlThe YAML that OpenColorIO configs are written in: block mappings and sequences by indentation, flow mappings and sequences ({a: b},[a, b], across lines), local tags (!<ColorSpace>), literal and folded block scalars (|,>, with chomping), single- ...663 linesocio::yaml::flow(private)Flow-style values on one line: plain, single- and double-quoted scalars and flow mappings and sequences ({a: b},[a, b]).262 linesoklabOklab (Ottosson 2020): from linear sRGB and from XYZ (D65), ΔEok, its polar form, and the sRGB gamut seen from OkLCh (the most chroma a lightness and hue can carry, and CSS Color 4's chroma-reducing map).237 linesspectralSpectra: the CIE 1931 2° observer (as the CIE's 5 nm table and as Wyman, Sloan and Shirley's multi-lobe fit), XYZ relative to the equal-energy white E, black-body and CIE daylight light, and spectral upsampling of a linear RGB color by Jakob and Hanika's ...387 linestemperatureCorrelated color temperature and tint: Robertson's method on his table of isotemperature lines in CIE 1960 uv, with the DNG SDK's tint scale (−3000 per uv unit; green negative, magenta positive), so a temperature and tint name the same white as raw converters ...123 linestransferTransfer functions: how a display-encoded component relates to linear light.171 linesxyzCIE XYZ, the hub every RGB space meets at, and the RGB spaces defined on it by their primaries and white.252 lines
Public types and traits
At the crate root
Structs Matrix3
Type aliases Rgb
By module: 52 public types and traits in 24 modules
aces InvalidPeakOutputTransform
aces::cam Cam
aces::gamut GamutHueGamut
aces::tables Corners
aces::tonescale ChromaTones
hsl HslHsv
icc CurveProfile
lab LabLCh
matrix Matrix3Rgb
ocio Error
ocio::config ColorSpaceConfigDisplayFileRuleLookNamedTransformReferenceRuleKindViewViewEntryViewingRuleViewTransform
ocio::curves Curve
ocio::lut InterpolationLut1DLut3D
ocio::ops CdlDynamicLogParamsNegativesOp
ocio::processor Processor
ocio::regex Regex
ocio::transform DirectionTransform
ocio::wgsl Shader
ocio::xml Element
ocio::yaml NodeValueYamlError
oklab Oklab
spectral SigmoidFit
transfer Transfer
xyz ChromaticityPrimaries
Besides these, 79 public functions at module level.
