Skip to content

feat(color): apply per-emitter response LUTs after flux scaling #4497

Closed

Description

@zackees

Context

#4156 R2 requires physical response inversion after the shared linear-flux brightness and power scalar. EmitterProfile accepts response_lut_r/g/b; ChannelOptions::setColorProfile() validates them and ColorProfileStorage owns a copy. On current master, processPixelQ16() in src/fl/gfx/pipeline.cpp.hpp ends at applyFluxScalar() and does not read those tables. A profile with a nonlinear response therefore renders as if its response were linear. The arithmetic ordering is pinned in tests/fl/gfx/flux_scalar.cpp; tests/fl/channels/color_profile.cpp confirms the current inert behavior.

This also addresses the longstanding user request #909 for channel-specific correction after brightness, through the managed color pipeline.

Proposal

Apply an inverse code-to-light response per emitter after the single flux scalar and before native encoding. Keep source transfer decoding and legacy correction separate. Define fixed-point interpolation, endpoints, plateaus, and admission for the LUTs; the electrical power estimator must score the resulting drive codes. Preserve the disabled pipeline's byte-identical legacy path and the TINY tier's link budget.

Acceptance criteria

  • Capture focused RED evidence with unequal synthetic responses (for example red light d, green light d²) showing that binding the response changes emitted codes and maintains neutral emitted light at full, half, 1/32, and zero brightness. Implement, then make that evidence GREEN.
  • Verify brightness and power scale linear emitted flux before inversion, including the quarter-light counterexample from Meta: color-pipeline review findings burndown (R1–R10, D1) #4156 R2.
  • Cover monotone LUT interpolation, endpoint values, plateaus, invalid/non-monotone tables, and native 8- and 16-bit encoders. Compare reconstructed emitted light against the reference, not merely intermediate drives.
  • Include response-aware power estimation and a representative bloat check; no response machinery links in an unbound sketch.

Decisions

  • Own this in the managed pipeline/encoder boundary: the profile API already stores the LUTs, while the missing stage is between applyFluxScalar() and quantization.
  • Treat this as calibration, not artistic gamma: adding another legacy correction would repeat the shaping that managed mode excludes.
  • Keep Apply a curve for color correction? #909 as related historical user demand; this issue is the implementation contract with objective tests.

Related issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions