Files
craft-libs/crates/develop
Dylan M. TaylorandFredApps 7631ed550e craft-develop: extract sensor and local_tone stages (#587) (#3021)
* craft-develop: extract sensor and local_tone stages (#587)

* craft-develop: fix sensor chart_table/color/binned compilation

* craft-develop: factor OffsetList alias in xtrans demosaic for clippy

* craft-develop: remove unused Bayer test helper

All sensor fixtures already call Cfa::bayer directly. Remove the unused wrapper so strict test lint can pass without suppressing warnings.

AI-assisted: OpenAI Boris.

* craft-develop: keep binned feasibility checks allocation-free

Reject blocks that cannot fit the active area. Check each CFA phase over one period rather than allocating per-block layouts during preflight. Keep the existing path for valid rendered bins and cover both the fitting and non-fitting cases with a small synthetic crop.

AI-assisted: OpenAI Boris.

---------

Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
2026-11-22 05:26:27 -05:00
..

craft-develop

The raw develop pipeline, CPU path: the shared pipeline of #587, moved from LightCraft one module at a time. No unsafe, no panics on hostile input, no file I/O, and it builds for wasm32-unknown-unknown.

craft-develop = { git = "https://github.com/storytold/craft-libs", rev = "<commit>" }

What is here

Module From LightCraft (a75497d6) Contents
auto crates/pipeline Auto tone (AutoTone, auto_tone, scene_log_mean), auto B&W mix (auto_bw_mix), and auto white balance (auto_wb, auto_wb_with).
color::spline crates/color/src/spline.rs Re-exports craft_color_transform::curve (MonotoneCurve, Lut1).
colorops crates/pipeline OkLCh colour tools (ColorOps, WheelK, PointK, band_hues, band_weights, calibration_matrix, calibrate).
crystal crates/pipeline Process V7+ crystal-layer film grain (CrystalGrain, CrystalLook, CrystalTile).
curve crates/pipeline The parametric tone curve and its regions.
finish crates/pipeline Pure-Rust finishing helpers: sharpening masks/limits, vignette parameters, value grain, gamut mapping, and curve saturation refinement.
light_v3 / light_v3_params crates/pipeline Process V4+ calibrated Contrast and Blacks operators (LightOps, PreviewOps, Operator, Fit, Mode).
local crates/pipeline White balance (wb_matrix_for, checked_wb, effective_wb, legacy_white), guided filters, median/detail-free base, noise reduction (denoise, apply_nr), and spatial plane sigmas.
local_tone crates/pipeline DNG ProfileGainTableMap camera local tone mapping (LocalTone, apply).
lut crates/pipeline 3D lookup tables and the .cube reader.
nrc_joint crates/pipeline Process V6+ joint-guided linear colour noise reduction (JointNoise, denoise).
profiles crates/pipeline Base rendering profiles (effective).
raster crates/raster Image<T> (Rgb32f, Rgba8, Plane), separable blur, resampling, point sampling, morphology, and Histogram.
sensor crates/raw Sensor normalization, DNG opcodes (OpcodeList1/2/3), Bayer (AHD/PPG/Bilinear) & X-Trans demosaicing, highlight reconstruction, DNG colour matrices (color), ProfileGainTableMap evaluation (gaintable), and binned preview development.
tone crates/pipeline Global tone mapping (ToneMap and CameraTone) from scene luminance to display-linear luminance, SDR and HDR.
inpaint crates/inpaint Content-aware hole filling for spot removal: complete (multi-scale patch completion with PatchMatch) and membrane_fill (a smooth harmonic fill, its seed and fallback). Interleaved f32 buffers of any channel count, a fixed-seed RNG, the same result on any number of threads.

Parity with LightCraft

Each module comes with a test that its output is LightCraft's at the base commit, compared with craft-render-parity at Tolerance::BASELINE. The expected pictures in tests/fixtures/ were written by LightCraft's own crate at that commit, on the scene the test builds.

Differences from LightCraft (ordinary-range output is covered by the baseline fixtures):

  • inpaint::complete_with returns None for a patch radius wider than the image before computing with it (LightCraft reaches the same None, or overflows on a huge radius), returns an image with no pixels at once, and reports Cancelled when any one poll said so, including a poll made on a worker thread.

  • membrane_fill scales extreme finite boundaries for the harmonic solve and bounds the result by those boundaries, avoiding overflow in means and neighbour sums. Known pixels remain unchanged; ordinary values take the original arithmetic path. This does not promise arbitrary extreme-value safety for PatchMatch completion, which also computes squared costs and downsamples its input.

  • Membrane cell indices retain usize width. PatchMatch rejects grids whose signed search offsets, summed-area counts or padded table cannot be represented; patch-area arithmetic no longer overflows i32. An already-cancelled oversized-patch request returns Cancelled, not an unavailable-patch result.

Not here yet

The rest of the pipeline: the rest of colour, raster, the sensor stage, raw loading and the render stages. No app uses this crate yet.