This is an old revision of the document!
YUV 4:4:4 UVC Gamma Correction
At this stage of the imaging pipeline the pixel data is already represented in full-range YCbCr 4:4:4 color space with 12-bit precision per component, as produced by the RGB-to-YCbCr conversion stage (gen5-rgb-to-yuv).
The purpose of this block is to apply UVC gamma correction to the luma component while leaving chroma components unmodified.
This block is intended to be implemented in FPGA logic and therefore avoids runtime floating-point arithmetic.
Input format
The input consists of YCbCr pixels with the following properties:
\[ Y12 \in [0..4095]\\ C_b12 \in [0..4095]\text{, neutral at }2048\\ C_r12 \in [0..4095]\text{, neutral at }2048 \]
All values are unsigned 12-bit integers.
Output format
The output format is identical to the input format:
\[ Y12^{\gamma} \in [0..4095]\\ C_b12^{\gamma} = C_b12\\ C_r12^{\gamma} = C_r12 \]
Only the luma component is modified by the gamma correction stage.
Step 1: UVC gamma transfer function
Gamma correction is applied only to the luma component \(Y12\). The chroma components \(C_b12\) and \(C_r12\) are passed through unchanged.
The UVC gamma transfer function is defined in the following document: UVC Gamma Correction Specification
No additional interpretation or modification of the transfer function is performed at this stage.
Step 2: LUT-based FPGA implementation
For FPGA implementation, the UVC gamma correction shall be realized using a LUT with 4096 entries, indexed by the 12-bit luma value.
Each LUT entry maps a 12-bit input luma value to a 12-bit output luma value:
Y_in = i // i in range [0..4095] Y_out = LUT[i] // gamma-corrected luma
Step 3: LUT generation tool
To simplify and standardize LUT generation, the following online tool may be used: Sub2r Gamma LUT Generator
The tool generates FPGA-ready gamma tables compatible with a 12-bit input and 12-bit output pipeline.
Step 4: pixel reconstruction
For each pixel, the output components are constructed as:
\[ Y12^{\gamma} = LUT[Y12]\\ C_b12^{\gamma} = C_b12\\ C_r12^{\gamma} = C_r12 \]
No additional scaling, offsetting, or clamping is required beyond the LUT bounds.