Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| isp:gen5-gamma [2026/01/13 23:36] – created Igor Yefmov | isp:gen5-gamma [2026/01/27 05:40] (current) – [RGB UVC Gamma Adjustment] Igor Yefmov | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| - | At this stage of the imaging pipeline the pixel data is already | + | At this stage of the imaging pipeline the pixel data is represented in |
| - | full-range | + | full-range |
| - | produced by the RGB-to-YCbCr conversion | + | the CMX stage ([[isp: |
| - | ([[isp: | + | |
| - | The purpose of this block is to apply **UVC gamma correction** to the luma | + | The purpose of this block is to apply **UVC gamma adjustment** in **RGB space** |
| - | component while leaving chroma components unmodified. | + | by applying the **same LUT** to all three channels (baseline implementation). |
| + | This avoids | ||
| + | transfer function to luma-only in YCbCr. | ||
| This block is intended to be implemented in FPGA logic and therefore avoids | This block is intended to be implemented in FPGA logic and therefore avoids | ||
| runtime floating-point arithmetic. | runtime floating-point arithmetic. | ||
| + | |||
| + | After this stage completes, the next pipeline stage is the RGB-to-YCbCr | ||
| + | conversion stage ([[isp: | ||
| ===== Input format ===== | ===== Input format ===== | ||
| - | The input consists of YCbCr pixels with the following properties: | + | The input consists of RGB pixels with the following properties: |
| \[ | \[ | ||
| - | Y12 \in [0..4095]\\ | + | R12 \in [0..4095]\\ |
| - | C_b12 \in [0..4095]\text{, neutral at }2048\\ | + | G12 \in [0..4095]\\ |
| - | C_r12 \in [0..4095]\text{, neutral at }2048 | + | B12 \in [0..4095] |
| \] | \] | ||
| Line 27: | Line 31: | ||
| \[ | \[ | ||
| - | Y12^{\gamma} \in [0..4095]\\ | + | R12^{\gamma} \in [0..4095]\\ |
| - | C_b12^{\gamma} | + | G12^{\gamma} |
| - | C_r12^{\gamma} | + | B12^{\gamma} |
| \] | \] | ||
| - | Only the luma component is modified by the gamma correction | + | All three channels are modified by the gamma adjustment |
| ===== Step 1: UVC gamma transfer function ===== | ===== Step 1: UVC gamma transfer function ===== | ||
| - | Gamma correction | + | Gamma adjustment |
| - | The chroma components | + | \(G12\), and \(B12\) using the **same** transfer function / LUT. |
| - | The UVC gamma transfer function is defined in the following document: [[https:// | + | The UVC gamma transfer function is defined in the following document: |
| + | [[https:// | ||
| No additional interpretation or modification of the transfer function is | No additional interpretation or modification of the transfer function is | ||
| Line 44: | Line 49: | ||
| ===== Step 2: LUT-based FPGA implementation ===== | ===== Step 2: LUT-based FPGA implementation ===== | ||
| - | For FPGA implementation, | + | For FPGA implementation, |
| - | LUT with **4096 entries**, indexed by the 12-bit | + | LUT with **4096 entries**, indexed by the 12-bit |
| - | Each LUT entry maps a 12-bit input luma value to a 12-bit output | + | Each LUT entry maps a 12-bit input channel |
| + | value: | ||
| < | < | ||
| - | Y_in = i // i in range [0..4095] | + | X_in = i // i in range [0..4095] |
| - | Y_out = LUT[i] | + | X_out = LUT[i] |
| </ | </ | ||
| + | |||
| + | The same LUT instance (same contents) is used for all channels. | ||
| ===== Step 3: LUT generation tool ===== | ===== Step 3: LUT generation tool ===== | ||
| To simplify and standardize LUT generation, the following online tool may be | To simplify and standardize LUT generation, the following online tool may be | ||
| - | used: [[https:// | + | used: |
| + | [[https:// | ||
| The tool generates FPGA-ready gamma tables compatible with a 12-bit input and | The tool generates FPGA-ready gamma tables compatible with a 12-bit input and | ||
| Line 65: | Line 74: | ||
| \[ | \[ | ||
| - | Y12^{\gamma} | + | R12^{\gamma} = LUT[R12]\\ |
| - | C_b12^{\gamma} = C_b12\\ | + | G12^{\gamma} = LUT[G12]\\ |
| - | C_r12^{\gamma} = C_r12 | + | B12^{\gamma} = LUT[B12] |
| \] | \] | ||
| Line 73: | Line 82: | ||
| bounds. | bounds. | ||
| - | ===== Notes ===== | + | ===== Integration notes ===== |
| - | * This block operates entirely in **YCbCr space**. | + | This block is placed as follows: |
| - | * Gamma correction | + | |
| - | * Chroma components are passed through unchanged. | + | |
| - | * The LUT-based design ensures deterministic, | + | |
| - | * This stage assumes **full-range (computer-range) YCbCr** coding. | + | |
| + | < | ||
| + | ... -> CMX -> RGB UVC Gamma -> RGB-to-YCbCr -> ... | ||
| + | </ | ||
| + | |||
| + | The downstream RGB-to-YCbCr block consumes \(R12^{\gamma}\), | ||
| + | and \(B12^{\gamma}\) as its inputs. | ||
| + | |||
| + | {{: | ||
| + | |||
| + | ===== Expected results ===== | ||
| + | * Gamma \(1.0\) is an identity gamma, that produces a LUT of a linear set of incremental values with one-to-one correspondence between input and output | ||
| + | * Image doesn' | ||
| + | * Slight hue drift is expected, but not to be an excessive one at extreme Gamma values | ||
| + | * LUT table for a given Gamma should match the one produced by the [[https:// | ||
| + | |||
| + | ===== Notes ===== | ||
| + | * This block operates entirely in **RGB space**. | ||
| + | * Gamma adjustment is applied independently to **all three channels** using the **same** LUT (baseline implementation). | ||
| + | * This stage assumes **full-range (computer-range) 12-bit RGB** coding. | ||