Both sides previous revisionPrevious revisionNext revision | Previous revision |
code:fpga_map_gen5 [2024/06/08 02:48] – [Color gains] Igor Yefmov | code:fpga_map_gen5 [2025/02/25 03:11] (current) – [FPGA operation mode] Igor Yefmov |
---|
^ FPGA basic status and controls ^^^^^^ | ^ FPGA basic status and controls ^^^^^^ |
^Address ^Name ^Bytes ^Access ^Bit mapping ^Notes ^ | ^Address ^Name ^Bytes ^Access ^Bit mapping ^Notes ^ |
|''0x5000'0000''|:!: FPGA Version| 4 |R/O| see [[code#firmware_version_info|Firmware Version Info]] | | | |''0x5000'0000''|FPGA Version| 4 |R/O| see [[code#firmware_version_info|Firmware Version Info]] | | |
|''0x5000'0004''|:!: FPGA status| 4 |R/O|see Notes for more details\\ \\ ''31:16'' [[code:code#FPGA config status - SPI codes|SPI codes]]\\ ''15:8'' FPGA core temperature\\ ''7:2'' reserved\\ ''1'' DPC done\\ ''0'' SFP active| The bytes of the FPGA status register are allocated according to the little-ending memory layout of the following C-style declaration((For details on ''spi_config_status'' see [[code:code#FPGA config status - SPI codes|SPI codes]])):\\ <code c++> | |''0x5000'0004''|:!: FPGA status| 4 |R/O|see Notes for more details\\ \\ ''31:16'' [[code:code#FPGA config status - SPI codes|SPI codes]]\\ ''15:8'' FPGA core temperature\\ ''7:2'' reserved\\ ''1'' DPC done\\ ''0'' SFP active| The bytes of the FPGA status register are allocated according to the little-ending memory layout of the following C-style declaration((For details on ''spi_config_status'' see [[code:code#FPGA config status - SPI codes|SPI codes]])):\\ <code c++> |
struct FpgaStatus{ | struct FpgaStatus{ |
^ FPGA operation mode((Set the operation mode of the FPGA (e.g. switch into firmware programming) and enable/disable individual media output channels and specific transformation blocks)) ^^^^^^ | ^ FPGA operation mode((Set the operation mode of the FPGA (e.g. switch into firmware programming) and enable/disable individual media output channels and specific transformation blocks)) ^^^^^^ |
^Address ^Name ^Bytes ^Access ^Bit mapping ^Notes ^ | ^Address ^Name ^Bytes ^Access ^Bit mapping ^Notes ^ |
|''0x5000'0008''|:!: FPGA operation mode| 4 |R/W|''31:20'' reserved| | | |''0x5000'0008''|:!: FPGA operation mode| 4 |R/W|''31:26'' reserved| | |
|:::|:::|:::|:::|:!: ''19'' CCM| enable Color Correction Matrix transformation block | | |:::|:::|:::|:::|:!: ''25'' CCM| enable Color Correction Matrix transformation block | |
|:::|:::|:::|:::|:!: ''18'' Gamma| enable UVC Gamma transformation block | | |:::|:::|:::|:::|:!: ''24'' Gamma| enable UVC Gamma transformation block | |
|:::|:::|:::|:::|:!: ''17:16'' debayer strategy|**De-mosaicing strategy** directs the use of a specific implementation of color reconstruction:\\ ''0'' - use "branchless 5x5", like the one [[https://www.ipol.im/pub/art/2011/g_mhcd/article.pdf|described in here]]\\ ''1'' - use "branching 5x5", for example the one [[http://www.siliconimaging.com/RGB%20Bayer.htm|described here]]\\ ''2'', ''3'' - reserved| | |:::|:::|:::|:::| ''23'' reserved| | |
|:::|:::|:::|:::| ''15'' reserved| | | |:::|:::|:::|:::|:!: ''22:21'' debayer strategy|**De-mosaicing strategy** directs the use of a specific implementation of color reconstruction:\\ ''0'' - use "branchless 5x5", like the one [[https://www.ipol.im/pub/art/2011/g_mhcd/article.pdf|described in here]]\\ ''1'' - use "branching 5x5", for example the one [[http://www.siliconimaging.com/RGB%20Bayer.htm|described here]]\\ ''2'', ''3'' - reserved| |
|:::|:::|:::|:::|:!: ''14'' reserved (headphones)| | | |:::|:::|:::|:::| ''20:17'' reserved| | |
|:::|:::|:::|:::|:!: ''13'' reserved (UAC)| | | |:::|:::|:::|:::|:!: ''16'' headphones audio| enable audio output via headphone jack | |
|:::|:::|:::|:::| ''12'' reserved| | | |:::|:::|:::|:::|:!: ''15'' HDMI audio| enable HDMI audio output | |
|:::|:::|:::|:::|:!: ''11'' HDMI output| enable HDMI video output | | |:::|:::|:::|:::|:!: ''14'' SDI audio| enable SDI audio output | |
|:::|:::|:::|:::|:!: ''10'' SDI output| enable SDI video output | | |:::|:::|:::|:::|:!: ''13'' SFP+ audio| enable SFP+ audio output | |
| |:::|:::|:::|:::|:!: ''12'' UAC output| enable UAC output | |
| |:::|:::|:::|:::|:!: ''11'' HDMI video| enable HDMI video output | |
| |:::|:::|:::|:::|:!: ''10'' SDI video| enable SDI video output | |
|:::|:::|:::|:::|:!: ''9'' SFP+ video| enable SFP+ video output | | |:::|:::|:::|:::|:!: ''9'' SFP+ video| enable SFP+ video output | |
|:::|:::|:::|:::|:!: ''8'' UVC output| enable UVC output | | |:::|:::|:::|:::|:!: ''8'' UVC output| enable UVC output | |
| |
===== Color gains ===== | ===== Color gains ===== |
Multiplicative adjustments will be added later. | |
Each color channel gets adjusted before being processed by de-bayer. The adjustment is of the form | Each color channel gets adjusted before being processed by de-bayer. The adjustment is of the form |
\[ | \[ |
C_{out} = (C_{in} - {black \space level}) \times Mult + Add | C_{out} = [(C_{in} - {black \space level})] \times Mult + Add \\ |
| \text{where the result of} \space |
| [(C_{in} - {black \space level})] \space |
| \text{is 0 if negative} |
\] | \] |
Additive and black level adjustments are 12 bit unsigned integers in range \([0..4095]\). Multiplicative adjustments are fixed-point format numbers with first 3 bits for integer part and the rest 13 bits for fractional, i.e. ''Q3.13'' format. | Additive and black level adjustments are 12 bit unsigned integers in range \([0..4095]\). Multiplicative adjustments are fixed-point format numbers with first 3 bits for integer part and the rest 13 bits for fractional, i.e. ''Q3.13'' format. |
^ Color gain adjustments, pre-debayer ^^^^^ | ^ Color gain adjustments, pre-debayer ^^^^^ |
^Address ^Name ^Type ^Access ^Notes ^ | ^Address ^Name ^Type ^Access ^Notes ^ |
|''0x5000'0100''|:!: Additive gain Red| <code>uint16_t</code> |R/W|value to add to Red component. Default is \(1200\)| | |''0x5000'0100''|Additive gain Red| <code>uint16_t</code> |R/W|value to add to Red component. Default is \(1200\)| |
|''0x5000'0104''|:!: Additive gain Green (red)| <code>uint16_t</code> |R/W|value to add to Green component in red row. Default is \(1200\)| | |''0x5000'0104''|Additive gain Green (red)| <code>uint16_t</code> |R/W|value to add to Green component in red row. Default is \(1200\)| |
|''0x5000'0108''|:!: Additive gain Green (blue)| <code>uint16_t</code> |R/W|value to add to Green component in blue row. Default is \(1200\)| | |''0x5000'0108''|Additive gain Green (blue)| <code>uint16_t</code> |R/W|value to add to Green component in blue row. Default is \(1200\)| |
|''0x5000'010C''|:!: Additive gain Blue| <code>uint16_t</code> |R/W|value to add to Blue component. Default is \(1200\)| | |''0x5000'010C''|Additive gain Blue| <code>uint16_t</code> |R/W|value to add to Blue component. Default is \(1200\)| |
|''0x5000'0110''|:!: Multiplicative gain Red| <code>Q3.13</code> |R/W|Multiplicative adjustment to apply to Red channel| | |''0x5000'0110''|:!: Multiplicative gain Red| <code>Q3.13</code> |R/W|Multiplicative adjustment to apply to Red channel| |
|''0x5000'0114''|:!: Multiplicative gain Green (red)| <code>Q3.13</code> |R/W|Multiplicative adjustment to apply to Green channel in red row| | |''0x5000'0114''|:!: Multiplicative gain Green (red)| <code>Q3.13</code> |R/W|Multiplicative adjustment to apply to Green channel in red row| |
|''0x5000'012C''|:!: Black level Blue| <code>uint16_t</code> |R/W|Value to subtract from initial Blue component before applying multiplicative adjustment| | |''0x5000'012C''|:!: Black level Blue| <code>uint16_t</code> |R/W|Value to subtract from initial Blue component before applying multiplicative adjustment| |
| |
| |
| ===== RGGB gamma LUTs ===== |
| ^ RGGB gamma LUTs ^^^^^ |
| FX3 (or Nios) is responsible for populating the 4x4K LUTs for FPGA to use for RGGB gamma correction. |
| ^Address ^Name ^Type ^Access ^Notes ^ |
| |''0x5000'0138''|:!: RGGB gamma LUT control| <code>uint32_t</code> |R/W|| |
| |''0x5000'013C''|:!: RGGB gamma LUT data| <code>uint32_t</code> |R/W|| |
| |
===== AWB ===== | ===== AWB ===== |
|''0x5000'0204''|:!: AWB Green adjustment| <code>uint16_t</code> |R/W|value to add to Green component. Default is \(0\)| | |''0x5000'0204''|:!: AWB Green adjustment| <code>uint16_t</code> |R/W|value to add to Green component. Default is \(0\)| |
|''0x5000'0208''|:!: AWB Blue adjustment| <code>uint16_t</code> |R/W|value to add to Blue component. Default is \(0\)| | |''0x5000'0208''|:!: AWB Blue adjustment| <code>uint16_t</code> |R/W|value to add to Blue component. Default is \(0\)| |
|''0x5000'020C''|:!: AWB Red total| <code>uint32_t</code> | R/O | | | |
|''0x5000'0210''|:!: AWB Green total| <code>uint32_t</code> | R/O | | | |
|''0x5000'0214''|:!: AWB Blue total| <code>uint32_t</code> | R/O | | | |
|''0x5000'0218''|:!: AWB count total| <code>uint32_t</code> | R/O | A count of pixels that were used to calculate the \(R/G/B\) totals | | |
|''0x5000'021C''|:!: AWB status| byte-size bitfield |R/O| Status and flags pertaining to AWB.\\ ''7:2'' reserved\\ :!: ''1'' - indicates whether a red overexposure is detected\\ :!: ''0'' - set if there is a general overexposure detected | | |
| |
| |
|''0x5000'0308''|:!: Saturation| 2 |R/W|\([0..900]\) |\([0\%..900\%]\) or grayscale to 9x |\(100\) | | |''0x5000'0308''|:!: Saturation| 2 |R/W|\([0..900]\) |\([0\%..900\%]\) or grayscale to 9x |\(100\) | |
|''0x5000'030C''|:!: Sharpness| 1 |R/W|\([0..255]\) | |\(0\) | | |''0x5000'030C''|:!: Sharpness| 1 |R/W|\([0..255]\) | |\(0\) | |
|''0x5000'0310''|:!: Gamma| 1 |R/W|\([0..15]\) | |\(1\) | | |''0x5000'0310''|:!: Gamma| 1 |R/W|\([0..15]\) | the values \([0..15]\) map into range from \(1.0\) to \(2.5\) with a \(0.1\) increment step |\(0\) | |
|''0x5000'0314''|:!: Hue| 2 |R/W|\([-8192..8191]\) |\([-180°..180°)\) |\(0\) | | |''0x5000'0314''|:!: Hue| 2 |R/W|\([-8192..8191]\) |\([-180°..180°)\) |\(0\) | |
| |
| |
===== Color Correction Matrix (a.k.a. CCM or CMX) ===== | ===== Color Correction Matrix (a.k.a. CCM or CMX) ===== |
See [[isp:ccm|Color correction matrix]] article in this Wiki's ISP section for more details. The 16-bit (MSB-LSB) value is defined as \(7+9\) bits, where MSB''[7:1]'' are the integer part and MSB''[0]''LSB''[7:0]'' is the fractional part (effectively that value is 512 times larger than the original fractional part) | See [[isp:ccm|Color correction matrix]] article in this Wiki's ISP section for more details. The 16-bit (MSB-LSB) value is defined as \(7+9\) bits (a.k.a. ''Q7.9''), where MSB''[7:1]'' are the integer part and MSB''[0]''LSB''[7:0]'' is the fractional part (effectively that value is 512 times larger than the original fractional part) |
^ CMX ^^^^^ | ^ CMX ^^^^^ |
^Address ^Name ^Bytes ^Access ^Notes ^ | ^Address ^Name ^Bytes ^Access ^Notes ^ |
|''0x5000'051C''|:!: CCM_21| 2 |R/W|\(CCM_{21}\)| | |''0x5000'051C''|:!: CCM_21| 2 |R/W|\(CCM_{21}\)| |
|''0x5000'0520''|:!: CCM_22| 2 |R/W|\(CCM_{22}\)| | |''0x5000'0520''|:!: CCM_22| 2 |R/W|\(CCM_{22}\)| |
| |
| ===== Exposure stats ===== |
| Exposure stats are being accumulated each frame by summing up \(R+G+B\) values of every pixel in the specified window |
| ^ Image's exposure stats ^^^^^ |
| ^Address ^Name ^Bytes ^Access ^Notes ^ |
| |''0x5000'0530''|exposure_xy_win1| 4 |R/W|''31:16'' - X coordinate\\ ''15:0'' - Y coordinate| |
| |''0x5000'0534''|exposure_xy_win2| 4 |R/W|''31:16'' - X coordinate\\ ''15:0'' - Y coordinate| |
| |''0x5000'0538''|exposure_sum| 4 |R/O|Sum of all pixel’s magnitude within window| |
| |''0x5000'053C''|over_exposed_sum| 4 |R/O|Number of over exposed pixels (those with \(R+G+B > 12000\))| |
| |
| ===== White balance stats ===== |
| WB stats are being accumulated each frame by summing up \(R, G, B\) channel values of every pixel in the specified window |
| ^ Image's exposure stats ^^^^^ |
| ^Address ^Name ^Bytes ^Access ^Notes ^ |
| |''0x5000'0540''|wb_xy_win1| 4 |R/W|''31:16'' - X coordinate\\ ''15:0'' - Y coordinate| |
| |''0x5000'0544''|wb_xy_win2| 4 |R/W|''31:16'' - X coordinate\\ ''15:0'' - Y coordinate| |
| |''0x5000'0548''|R_sum| 4 |R/O|Sum of all pixel’s \(R\) values within window| |
| |''0x5000'054C''|G_sum| 4 |R/O|Sum of all pixel’s \(G\) values within window| |
| |''0x5000'0550''|B_sum| 4 |R/O|Sum of all pixel’s \(B\) values within window| |
| |''0x5000'0554''|R_sat_count| 4 |R/O|Number of pixel within window where \(R\) values are saturated (those with \(R > 4000\))| |
| |''0x5000'0558''|G_sat_count| 4 |R/O|Number of pixel within window where \(G\) values are saturated (those with \(G > 4000\))| |
| |''0x5000'055C''|B_sat_count| 4 |R/O|Number of pixel within window where \(B\) values are saturated (those with \(B > 4000\))| |
| |
===== Color grading ===== | ===== Color grading ===== |
| |
| |
==== mFT lense access ==== | ==== mFTS lens access ==== |
^ mFT lense access ^^^^^ | ^ mFT lense access ^^^^^ |
^Address ^Name ^Bytes ^Access ^Notes ^ | ^Address ^Name ^Bytes ^Access ^Notes ^ |