ISP PQ Tool User Guide
Overview
This document mainly introduces SpacemiT image tuning, including
- The tuning tool
- Calibration plugins
- Image analysis tool (VRF Viewer)
- Platform debugging support
Abbreviations
| Name | Description | 
|---|---|
| ISP | Image Signal Process | 
| VRF / vrf | RAW image with information at the end | 
| BLC | Black Level Correction | 
| LSC | Lens Shading Correction | 
| AWB | Auto White Balance | 
| AEC | Auto Exposure Control | 
| AF | Auto Focus | 
| OTP | One Time Programmable | 
| AEM | Auto Exposure Monitor | 
| AFM | Auto Focus Monitor | 
| CCM | Color Correction Matrix | 
| CT | Color Temperature | 
| BPC | Bad Pixel Correction | 
| CAC | Color Aberration Correction | 
| LTM | Local Tone Mapping | 
| PDC | Phase Detection Compensation | 
| Phase Detection Correction | |
| PDAF | Phase Detection Auto Focus | 
| SE | Special Effect | 
| EIS | Electronic Image Stabilization | 
| CDAF | Contrast Detection Auto Focus | 
| FV | Focus Value | 
| SAD | Sum of absolute difference | 
| ROI | Region of Interest | 
| NR | Noise Reduction | 
| EE | Edge Enhancement | 
| HDR | High Dynamic Range | 
| Qn | Accuracy, 2n is double | 
Tuning Tool Overview
Tuning Tool Architecture

PC-Side Tuning Tool Installation
The tuning software is a portable compressed package — no installation is required. Simply extract the file named AsrIspToolVX.X.X.X.rar to use it.
The tool can be downloaded from the following link: https://archive.spacemit.com/tools/isp-tunning/
After extraction, the following files are included:

Debugging Environment Setup
Hardware and Software Requirements
- 
Hardware Environment - Desktop or laptop computer
- 1GHz or faster processor
- 1GB RAM (32-bit) / 2GB RAM (64-bit)
- At least 10GB of available hard disk space
- Screen resolution of 1920 × 1080 or higher
- USB port
- Terminal device integrated with ASR ISP
 
- 
Software Environment - Windows 7 64-bit or later version of the operating system
 
Device Connection
AsrIspTool connects to the terminal device via USB and communicates with the device through ADB.
Note. Before connecting, the device must first start the tuning server thread, i.e., start the camera.
Basic Operations of the Tuning Tool
Main Interface of the Tuning Tool
Double-click AsrIspTool.exe to launch the tuning tool. The main interface is shown below:

- 
Menu: Functional Menu Area - Open: Open parameter file.
- Save: Save parameter file.
- Save As: Save parameter file under a new name.
- IP Address: Reserved.
- ADB (SN): Connect to the terminal device via ADB; supports manual input of ADB serial number.
- Connect: Connect to the terminal device.
- View: Switch between single-window, horizontal split, and vertical split display modes.
- Format: Toggle between decimal and hexadecimal display.
- Display: Switch between matrix editing, row editing, and column editing modes.
- Plugins: Plugins.
- Frequency: Adjust parameter refresh rate.
- Capture: Capture VRF data (vrf).
- Register: ISP register read/write tool.
- I2C: I2C read/write tool.
- Push: Reserved.
- Transfer: Reserved.
- VRF: Image viewer tool.
- DNG: Reserved.
 
- 
Module list & Filter list: Module and filter list 
- 
Parameter list: List of parameter 
- 
Log: Log area 
Basic Online Operations
Connecting to the Terminal Device
After launching the tool, select ADB (SN) and click Connect. Once the connection is successful, the tool will automatically read the parameters of all current modules and periodically refresh the read-only parameters every 500 ms (this interval can be adjusted via the Frequency option in the menu). If multiple terminal devices are connected to the PC, you can specify the serial number manually.
To enable periodic refreshing of read-write parameters as well, check the AutoUpdate option in the upper-right corner (Note. Parameters cannot be modified while this option is checked).
To perform a one-time read of all parameters, click the Read button in the upper-right corner.

Note. The ADB connection method is only applicable for projects using the Android system. We primarily use TCP network connections to tune the development board.
Parameter Type Description

- 
Adjustable Parameters - Parameters that can be checked, for example, m_bAutoCalculateAEMWindow.
- Editable parameters, for example, m_nPreEndingPercentage.
- Editable array parameters, for example, m_pSubROIPermil. For two-dimensional arrays, you can switch between matrix, row, and column editing modes.
 
- Parameters that can be checked, for example, 
- 
Read-Only (Gray) - Read-only parameters, for example, m_nAdjacentLumaSAD.
 
- Read-only parameters, for example, 
- 
Special Notes - After modifying parameters in plugins or the parameter list, the changed content will be highlighted in red. Hovering the mouse over it will display the original value.
 
Real-Time Parameter Modification
- Expand the module list for the module you want to debug.
- Click the desired module in the module list area.
- Adjust the parameter value using the slider or by directly editing the value in the parameter list area. The changes take effect immediately.
Capturing VRF Images
- Click the Capture button in the menu area.
- Select RAW and set the save path.
- Click Start Capturing to generate raw images with the .vrffile extension.
Register Read/Write

- Click the Register button in the menu area.
- Set the Address (register address).
- Set the Value (8bit) (register value).
- Read: Read the register.
- Write: Write to the register.
 
- Set the Value (32bit) (register value).
- Read: Read the register.
- Write: Write to the register.
 
I2C Read/Write

- Click the I2C button in the menu area.
- Set the Device ID (I2C device number).
- Set the Device Address (slave device address).
- Set the Address Bytes (register address byte width).
- Set the Register Address (register address).
- Set the Value Bytes (register value byte width).
- Set the Value (register value).
- Read: Read the register.
- Batch Read: Batch read registers by importing a file.
- Write: Write to the register.
- Batch Write: Batch write registers by importing a file.
 
Batch Register Read/Write File Format
The file format should be {Address, Value}.
When performing batch register operations, click Batch Read or Batch Write to import the reg_batch.txt file.
The results will be displayed in the red log area, and a file with the same name ending in _read.txt will be generated for later review.

Example of Batch Register Read/Write File Format

Saving Parameters
- Click the Save button in the menu area.
- Choose the path and set a file name.
- Click Save to generate the parameter file.
Opening a Local Parameter File
Click the Open button in the menu area, or simply drag the parameter file into the corresponding module in the tool. This operation will directly write the parameters to the hardware.
Basic Offline Operations
Open a Local Parameter File
- Click the Open button in the menu area, or drag the parameter file into the tool directly.
Modify Parameters
- Expand the module list for the module you want to debug.
- Click the desired module in the module list area.
- Adjust parameter values using the slider or by directly editing the values in the parameter list.
- If it is a one-dimensional vector, click the waveform button in the parameter editing interface to enter curve editing mode.
Calibration Plugins
- Click the Plugins drop-down menu in the menu area to select a plugin.
Save Parameters
- Click the Save button in the menu area, enter a file name, and the parameters will be saved to a local file
ISP Plugins
This section introduces calibration and tuning for BLC, LSC, AWB, CCM, Curve, Noise, PDC, and PDAF, as well as auxiliary debugging tools like General Information and Raw Preprocessor.
Calibration plugins support both online(connecting device) and offline(importing paqrameter files) modes. The plugin can only be opened when the corresponding Filter parameters are enabled.
BLC Calibration and Tuning
VRF Image Requirements for BLC Calibration
Capture VRF data in a completely dark environment or with the lens fully covered.
BLC Calibration Steps
The BLC calibration interface is shown below:

- In the BLC plugin, click Load to import the VRF image.
- Select the Pipe ID (optional if not a single pipeline).
- Select the Channel ID.
- Click Calibrate. The calibration result will be displayed in the Calibrated Result section. If the result is unsatisfactory, you can also manually edit the Result.
- Click Update to apply the parameters to the parameter list. If the result is unsatisfactory, click Cancel to recalibrate.
Notes on BLC Calibration
- The Calibrated Result panel displays the values of 4 channels in both 10-bit and 8-bit formats. When the parameters are saved to a file, they are mapped to 12-bit values.
- Channel ID: Indicates the BLC parameters corresponding to a specific gain level of 2ᵅ. BLC can be adjusted dynamically with gain, ranging from 1x to 2048x gain, for a total of 12 levels (see the Gain–BlackValue diagram below). The final level, manual, takes effect only when manual mode is enabled; in this mode, BLC does not adjust with gain.

Gain – BlackValue Diagram
Notes on BLC Tuning
BLC parameters are located in CDigitalGainFirmwareFilter.
- If BLC should not change with gain, set m_bManualMode to 1. In this case, the BLC value is taken from m_pGlobalBlackValueManual.
- If BLC should change with gain, set m_bManualMode to 0. In this case, the BLC value is taken from m_pGlobalBlackValue.
LSC Calibration and Tuning
VRF Image Requirements for LSC Calibration
Capture several uniformly illuminated images using a diffuse cover over the lens in a lightbox environment (D65, CWF, or A light) or any environment with shading.
LSC Calibration Steps
The LSC calibration interface is shown below:

- In the LSC plugin, click Load to import the VRF image.
- Select the Pipe ID (optional if not a single pipeline).
- Select the Channel ID.
- Adjust the compensation ratio using Current Percentage. It is recommended to start with 100%; you can later fine-tune the compensation intensity using strength.
- Click Calibrate. The simulated correction result will be displayed in Calibrated Image.
- Click Update to apply the parameters to the parameter list. If the result is not satisfactory, click Cancel to recalibrate.
Notes on LSC Calibration
- Channel ID:
- 0: Low color temperature compensation table
- 1: Medium color temperature compensation table
- 2: High color temperature compensation table
- manual: Effective when manual mode is enabled; in this mode, LSC does not adjust with color temperature changes.
 
Notes on LSC Tuning
LSC can be adjusted according to CT or CorrelatedCT (see the CT-LSCProfile diagram below).
- CT Definition: 256 × AWB_RGain / AWB_BGain (can be obtained via CT info / 4 in the AWB plugin).
- CorrelatedCT Definition: Correlated color temperature, representing how closely the light emitted by a source matches the blackbody radiation at a certain color temperature.

LSC parameters are located in CLSCFirmwareFilter.
- If LSC needs to change with color temperature, set an appropriate m_pCTIndex to select the shading table for different color temperatures.
- Recommended to use: m_nCorrelationCT (read from CCTCalculatorFilter).
Note. LSC interpolation can be based on either the CT result calculated by AWBFilter (read CT in AWB plugin) or the CCT result calculated by CCTCalculatorFilter (read m_nCorrelationCT in WbFirmwareFilter)

CCM and CCT Calibration and Tuning
VRF Image Requirements for CCM Calibration
Capture an image of a 24-color chart in a lightbox environment. The color chart should be as centered and aligned as possible, occupying about 1/9 of the frame. D65, CWF, and A light sources are required.
CCM Calibration Steps
The CCM calibration interface is shown below:

- In the CCM plugin, click Load to import the VRF image. The VRF image should be compensated for LSC and PDF (if PD pixels exist) using the Raw Preprocessor plugin.
- Select the entire color chart in the image by drawing a box, ensuring all 24 ROIs fall within the color patches. If the image is misaligned or heavily distorted, click Start, check the ROIs you want to adjust individually, and then manually drag the ROIs.
- Set the desired saturation for calibration.
- Click Calibrate. The calibration simulation result will be displayed in Calibrated Result.
- Select the Pipe ID (optional if not a single pipeline).
- Select the Channel ID.
- Click Update to apply the parameters to the parameter list. If the result is not satisfactory, you can adjust the saturation of individual blocks in the Saturation Table and then recalibrate.
CCT Calibration Steps
The CCM calibration interface is shown below:

- The CCT calibration can be performed simultaneously with CCM calibration. CCT requires only A and D65 light sources.
- After calibrating CCM with A light, select profile 2850K and click UpdateCTMatrix.
- After calibrating CCM with D65 light, select profile 6500K and click UpdateCTMatrix.
- The results will automatically update in CCTCalculatorFilter under m_pCTMatrix_low / m_pCTMatrix_high.
Notes on CCM Calibration
- Use Internal Curve – Calibration: No need to check.
- Use Internal Curve – Render: No need to check.
- Use AGTM: Check this option.
- Target: Keep as D50。
- View Environment: Keep as D50。
- Calibrated Result: Displays the simulated result after calibration.
- CCM Result: Lists the calibrated color matrix. This can also be manually edited here. Click Set to apply it to the hardware。
- Channel ID:
- 0: Low color temperature CCM parameters
- 1: Medium color temperature CCM parameters
- 2: High color temperature CCM parameters
- manual: Effective when manual mode is enabled; CCM does not adjust with color temperature changes.
 
- Make DNG Profile: reserved
- UpdateCTMatrix: Update the CCT matrix
- SaveImage: Save the rendered image
Notes on CCM Tuning
CCM can be adjusted based on color temperature (see the CCM–Color Temperature Control Curve below).

CCM parameters are located in CColorMatrixFirmwareFilter.
- If CCM needs to change with color temperature, set an appropriate m_pCTIndex to select the color matrix for different color temperatures.
- Recommended to use: CorrelatedCT.
Note. CCM interpolation can be based on either the CT result calculated by AWBFilter (read CT in the AWB plugin) or the CCT result calculated by CCTCalculatorFilter (read m_nCorrelationCT in WbFirmwareFilter).

AWB Calibration and Tuning
VRF Image Requirements for AWB White Point Calibration
No additional images are needed for AWB calibration; it can be performed after completing CCT calibration.
AWB White Point Calibration Steps
The AWB calibration interface is shown below:

- Open the AWB plugin.
- Click Optimize. The calibration parameters will be automatically updated in the parameter interface.
AWB Brightness Calibration
After AE tuning is completed, brightness calibration of the module is required to obtain the Lux value needed by AWB. The calibration steps are as follows:
- Place the camera in the lightbox and capture the lightbox wall with the light source set to D65.
- Measure the lightbox illuminance using a color temperature illuminance meter and enter the value into m_nCalibSceneLux in the AECFilter.
- Read m_nExpIndexLong from AECFilter and enter it into m_nCalibExposureIndex in AECFilter.
- Read m_nLumQ16 from AECFilter and enter it into m_nCalibSceneLum in AECFilter.
| Parameter Name | Description | Recommended to Tune | Special Notes | 
|---|---|---|---|
| m_nCalibExposureIndex | Exposure index for brightness calibration | Yes | |
| m_nCalibSceneLum | Scene brightness for brightness calibration | Yes | |
| m_nCalibSceneLux | Actual illuminance corresponding to calibration scene | Yes | |
| m_nSceneLux | AWB debug parameter, current scene illuminance calculated by AE | - | Read-Only | 
AWB Debug
Block Debug Information
When connected to the device, open the AWB plugin. The position of each block will be displayed as a blue dot on the coordinate axis, and the AWB statistics image will be shown as a thumbnail.
You can select a region on the statistics chart (by default, points from all regions are displayed). After selection, only the points within the selected blocks will be shown.

White Points within ROI
Click Show ROI to view the blocks contained within different ROIs. The white blocks are those participating in the white balance calculation, meaning the blocks that fall inside the ROI area. The image below shows the specific affiliation of 32 x 24 blocks to their respective ROIs

Block Weight
Checking auto update will periodically refresh the lux value and statistics chart, and calculate the block weights in real-time.
By adjusting the Weight Percentage slider, you can control the ratio between the actual scene and the blocks participating in the white balance calculation on the debug image.
- At 0%, the image shows the actual scene.
- At 100%, it shows the weights of blocks participating in the white balance calculation (weights are referenced in the heatmap).
If set to 100%, the screen may appear completely black, indicating that all blocks have zero weight under the current lux.

Setting Weight Percentage to 100% displays the block weights as a heatmap. You can hover the mouse over any block to see its weight displayed on the right side of the heatmap (debug info is also available in AWB Frameinfo).In the image below, the mouse is selecting block[12][2], which has a weight of 16.

White Balance Gain Position
In the RGB gain panel module, check enabled, and enter RGB gain values in Q12 precision (from debug info CurrentResult). The corresponding white balance gain will be displayed as a blue square in the chromaticity (color temperature) coordinate system. You can zoom in by dragging the mouse from the top-left to the bottom-right, and zoom out by dragging from the bottom-right to the top-left.
The current white balance gain is shown as a red square in the chromaticity coordinate system.

AWB Debug Description
- 
Calibration Panel - Calibrate Panel
- Visible: When checked, this ROI will be shown in the chromaticity coordinate system.
- Enable: When checked, this ROI is enabled for calibration.
 
- Calibrate Files Panel
- Percentage: Proportion of the VRF image to be used for calibration. For example, 20% means the central 20% area of the image will be used, as the center is less affected by shading.
- Optimize: Performs automatic calibration.
- Load config: Reserved.
- Save config: Reserved.
- Load: Import VRF file.
- Calibrate: Reserved.
- Update: Update parameters to the parameter list.
- Cancel: Cancel parameter updates.
- ShowROI: Show the white points within each ROI.
 
 
- Calibrate Panel
- 
Debugging Panel - 
Control Panel - Pipe ID: Current pipeline ID (selectable when not using a single pipe).
- Auto Update: Automatically updates the current brightness and statistics window when online (when checked, parameters in the plugin cannot be modified).
- Manual Lux: Fixes the current brightness.
- Weight Percentage: Debug parameter to adjust the display of white balance statistic blocks and their weights.
- 0% shows the statistic blocks;
- 100% shows a heatmap of block weights.
 
- RGB Gain Debug-applied gain, corresponding to the red point in the chromaticity coordinate system.
- Luminance Boundary: Brightness range (8-bit) of pixels participating in AWB statistics.
- Valid Number: Minimum number of valid blocks required for white balance calculation, range [0,768]。
- Correct Limit Panel: Block range limits. Blocks that exceed the limits and fall within the ROI will be remapped in the XY direction.
 
- 
Green Shift Panel - Shift Max Weight: Shift weight; multiplied by exposure shift to get the final shift weight. Maximum is 32, which fully biases toward the outdoor gain.
- Green Number Threshold: Threshold: The number of blocks falling into the "G region"; if within this range, green shift is activated.
- Outdoor RGB Gain: Target gain for green shift.。
- Shift Weight: Weight adjusted based on exposure.
 
- 
Luminance Panel - Lux: Brightness index.
- Weight: The weight of the corresponding ROI at the current brightness level.
- Min / Max: Luminance range (8-bit).
 
 
- 
- 
Debug Panel - 
RGB Gain Panel - enabled: Used to display the white balance gain position in the color temperature coordinate system.
- RGB: White balance gain.
 
- 
Gain Panel: Debug information. Hovering the mouse over the color temperature coordinate system will display the corresponding debug info. - X Y: The XY coordinates of the point on the color temperature coordinate system.。
- CT: The correlated color temperature (CT) value at the point, which can be used as a reference for LSC and CCM interpolation.
- RGB: The white balance gain at the point on the color temperature coordinate system.
- CCT、Tint: The correlated color temperature and tint at the point, also usable for LSC and CCM interpolation.
- CCT curve: Displays the CCT curve on the color temperature coordinate system.
- Vaild only: Displays only the valid statistic blocks on the color temperature coordinate system.
- Applied Gain: The white balance gain point of the current scene, shown as a red dot on the color temperature coordinate system.。
- Block、Weight: When hovering the mouse over the statistics image, the corresponding block position and weight are displayed.
 
 
- 
Curve Debugging
Curve Debugging Steps
The Curve debugging interface is shown below:

- Open the Curve plugin.
- Select Pipe ID (applicable if not using a single pipeline).
- Select Channel ID.
- Move the mouse to the point on the curve you want to adjust, then left-click and drag it to the desired position.
- Click Update to apply the parameters to the parameter list. If the result is unsatisfactory, click Cancel to redo the calibration.
Curve Debugging Description
- Channel ID:
- BacklightCurveManual: Controls the background brightness. It is recommended to keep the curve unchanged and only adjust the strength.
- ContrastCurveManual: Controls the contrast. It is recommended to keep the curve unchanged and only adjust the strength.
- GTMCurve0: Curve used when the gain equals m_pGainIndex[0] (Q4 precision).
- GTMCurve1: Curve used when the gain equals m_pGainIndex[1] (Q4 precision).
- GTMCurve2: Curve used when the gain equals m_pGainIndex[2] (Q4 precision).
 
Note. When m_nCurveSelectOption is set to 0, the curve is interpolated based on the current gain (see diagram below: Curve-Gain Control Curve Diagram).

Curve parameters are located in CCurveFirmwareFilter.
- The curve can vary with gain. Set appropriate m_pGainIndex values to specify different curves for different gains.

Noise Calibration and Debugging
RAW Image Requirements for Noise Calibration
In a laboratory environment, use a 24-color chart for shooting. Ensure that the color chart is as straight/aligned as possible, centered in the frame, and occupies approximately 1/9 of the image.
Adjust the lighting brightness accordingly, and sequentially capture images of the color chart under the following gain settings: 1×, 2×, 4×, 8×, 16×, 32×, 64×, 128×, 256×, 512×, 1024×, and 2048× gain.
Noise Calibration Steps
The calibration interface is shown in the figure below:

- In the Noise plugin, click Load to import the RAW image. Use the Raw Preprocessor plugin to compensate for LSC and PDF (if there are PD pixels).
- In the image, select the bottom 6 color patches on the color chart. Ensure that all 6 ROIs fall entirely within the color blocks. If the image is tilted or has noticeable distortion, click Start, check the ROIs you want to manually adjust, and drag them into the correct position.
- Set the desired Denoise Strength.
- Click Calibrate. The calibrated noise levels will appear under Noise Result.
- Select the Pipe ID.
- Select the Channel ID.
- Click Update to apply the parameters to the parameter list. If the result is not satisfactory, click Cancel to re-calibrate