Contribution lab / Pixel display
When bright
values wrap.
A large input can accidentally choose the darkest entry in a display table. Play the example, then move the values yourself to see the proposed correction.
Loading the 3D table. The arithmetic and controls work without it.
Input 2 · Before 30 → After 30
Select a bar or an index button to inspect its mapping.
01 / Read the table
One input. One table entry.
The first mapped input is 0. Input 2 selects index 2, whose output is 30. Both paths agree.
Baseline · 8-bit index
30Index 2Proposed · safe index
30Index 2Both select the same table entry.
Follow the arithmetic
Baseline2 − 0 = 2 → uint8: 2 → clip: 2 → LUT[2] = 30
Proposed0 ≤ 2 < 4 → 2 − 0 = 2 → LUT[2] = 30
Explore the boundary
Changing a control pauses the guided example.
Why the change matters
The index needs its own width.
An 8-bit output does not require an 8-bit lookup index. In the reported example, converting offset 256 to an 8-bit index makes it 0 before clipping can help. The result is 10 instead of 40.
The proposed integer path stores indices as uint16, selects the endpoints for out-of-range inputs, and subtracts in int32 only for in-range inputs. The PR also covers larger tables and integer extremes; floating-input behavior is unchanged.