Clamping a Computed Image Value
Image formats often restrict allowable values. A processing pipeline can compute in a larger range and clamp only when required by the output contract.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Trace one addition
A brightening rule adding 20 to value 245 produces 265 before restriction. Clamping to an eight-bit maximum gives 255. See saturating integer arithmetic.
Choose when to clamp
Several processing steps applied in sequence may lose intended detail if each clamps unnecessarily. Test a high value followed by a later correction. Rounding intermediate and final results gives the related timing issue.[1][2]