This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] Default DCC profile generation tool for TDA4/AM6xA ISP (VPAC)

Hi everyone,

This is a FAQ for using the Default DCC profile generation script tool for TDA4/AM6xA ISP (VPAC).
The script tool generates a default DCC profile (a set of xml files and LUT text files) for your image sensor so that you can get correct color output of your camera in just a few minutes if your sensor driver is ready.

You may find the latest python script in this link below if you use old versions of SDK.
https://git.ti.com/cgit/processor-sdk/imaging/tree/tools/default_DCC_profile_gen?h=main

I have created a short video for using the tool -- Demo video in webex
/cfs-file/__key/communityserver-discussions-components-files/791/Python_5F00_scripts.mp4

Below is an outline of the basic steps.

1. The tool requires a simple configuration file for you to fill in your sensor information such as width, height, WDR mode, and companding knee points.

SENSOR_ID 390
PRJ_DIR ../imx390_output
SENSOR_NAME imx390
SENSOR_DCC_NAME IMX390-UB953_D3

SENSOR_WIDTH 1936
SENSOR_HEIGHT 1096

# 0=RGGB; 1=GRBG; 2=GBRG; 3=BGGR, 4=MONO
COLOR_PATTERN 0

# sensor mode: 0 for linear (no decompanding), 1 for WDR (decompanding)
WDR_MODE 1

# raw sensor image BIT_DEPTH: it may be 8, 10, or 12 for linear sensors; typically 12 for WDR mode because of companding
BIT_DEPTH 12

# WDR BIT_DEPTH: WDR raw sensor image bitdepth after decompanding, typically 20 or 24
WDR_BIT_DEPTH 20

# WDR decompanding knee points (comma separated without spaces in between)
WDR_KNEE_X 0,512,1408,2176,4095,65535
WDR_KNEE_Y 0,2048,16384,65536,1048063,1048063

# Sensor black level to subtract before decompanding (for linear sensors only and some Sony WDR sensors)
BLACK_PRE  0

# Sensor black level to subtract after decompanding (for most WDR sensors and all linear sensors)
BLACK_POST  0

# GAMMA value for compressing 20/24-bit WDR raw to 16-bit ISP internal
# typically around 50 (0.5) for 24-bit WDR sensors and 70 (0.7) for 20-bit sensors
GAMMA_PRE 70

# LSB location for H3A input bit range (from bit-H3A_INPUT_LSB to bit-H3A_INPUT_LSB+9) 
H3A_INPUT_LSB 2

[Update on 08/19/2024]

New configuration file format is available at git.ti.com for RGBIR 4x4 sensor support.
You may take a look at this X5B example for the latest one.
https://git.ti.com/cgit/processor-sdk/imaging/tree/tools/default_DCC_profile_gen/configs/X5B_properties.txt?h=main

SENSOR_ID 5
PRJ_DIR ../X5B_output
SENSOR_NAME X5B
SENSOR_DCC_NAME X5B

SENSOR_WIDTH 2592
SENSOR_HEIGHT 1944

# 0=RGGB;  1=GRBG;  2=GBRG;  3=BGGR,  4=MONO,
#10=RGGI, 11=GRIG, 12=BGGI, 13=GBIG, 14=GIRG, 15=IGGR, 16=GIBG, 17=IGGB
COLOR_PATTERN 12

# sensor mode: 0 for linear (no decompanding), 1 for WDR (decompanding)
WDR_MODE 0

# raw sensor image BIT_DEPTH: it may be 8, 10, or 12 for linear sensors; typically 12 for WDR mode because of companding
BIT_DEPTH 10

# WDR BIT_DEPTH: WDR raw sensor image bitdepth after decompanding, typically 20 or 24
WDR_BIT_DEPTH 24

# WDR decompanding knee points (comma separated without spaces in between)
WDR_KNEE_X 0,512,750,988,1226,1464,1702,1940,2178,2416,2654,2892,3130,3368,3606,4095
WDR_KNEE_Y 0,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,16777215

# Sensor black level to subtract before decompanding (for some Sony WDR sensors)
# When PCID is on for RGBIR sensors, black level might be set to 0
BLACK_PRE  0

# Sensor black level to subtract after decompanding (for most WDR sensors and all linear sensors)
# When PCID is on for RGBIR sensors, black level might be set to 0
BLACK_POST 0

# GAMMA value for compressing 20/24-bit WDR raw to 16-bit ISP internal
# typically around 50 (0.5) for 24-bit WDR sensors and 70 (0.7) for 20-bit sensors
GAMMA_PRE 50

# LSB location for H3A input bit range (from bit-H3A_INPUT_LSB to bit-H3A_INPUT_LSB+9) 
H3A_INPUT_LSB 0

2. Then, you may execute the tool as below (under "imaging/tool/default_DCC_profile_gen/scripts/") to generate the default DCC profile.

python ctt_def_xml_gen.py ../configs/imx390_properties.txt

3. Copy the default profile to your sensor driver folder (e.g., imaging/sensor_drv/imx390/_dcc_xmls/wdr/" and run the "generate_dcc.sh" script from there.

4. Recompile your SDK and build to your SD card.

5. Start the single-cam app on your EVM with your camera/sensor to preview the video output.
You should get proper looking color and good WDR effect.
This picture below is what I get while using the tool for the D3-IMX390 camera on TDA4 EVM.

6. Next steps are to fine tune the color and image quality (AE/AWB color etc.) with the DCC tuning tool.