Rockchip Development Guide ISP20 en v1.6.4
Rockchip Development Guide ISP20 en v1.6.4
ID: RK-SM-YF-601
DISCLAIMER
THIS DOCUMENT IS PROVIDED “AS IS”. ROCKCHIP ELECTRONICS CO., LTD.(“ROCKCHIP”)DOES NOT
PROVIDE ANY WARRANTY OF ANY KIND, EXPRESSED, IMPLIED OR OTHERWISE, WITH RESPECT TO
THE ACCURACY, RELIABILITY, COMPLETENESS,MERCHANTABILITY, FITNESS FOR ANY PARTICULAR
PURPOSE OR NON-INFRINGEMENT OF ANY REPRESENTATION, INFORMATION AND CONTENT IN
THIS DOCUMENT. THIS DOCUMENT IS FOR REFERENCE ONLY. THIS DOCUMENT MAY BE
UPDATED OR CHANGED WITHOUT ANY NOTICE AT ANY TIME DUE TO THE UPGRADES OF THE
PRODUCT OR ANY OTHER REASONS.
Trademark Statement
"Rockchip", "瑞芯微", "瑞芯" shall be Rockchip’s registered trademarks and owned by Rockchip. All
the other trademarks or registered trademarks mentioned in this document shall be owned by
their respective owners.
Beyond the scope of fair use, neither any entity nor individual shall extract, copy, or distribute
this document in any form in whole or in part without the written approval of Rockchip.
Website: www.rock-chips.com
Overview
This article aims to describe the role of the RkAiq (Rk Auto Image Quality) module, the overall
workflow, and related API interfaces. Mainly to
Engineers who use RkAiq module for ISP function development provide help.
Product Version''
Target Audience
RV1126 Y N N N
RV1109 Y N N N
Revision History
Version Revision
Author Revision Description
Number Date
2020-9-
v1.2.0 William Hu Added AF statistical value description
25
2020-10-
v1.3.0 William Hu Add AF module API description
14
Version Revision
Author Revision Description
Number Date
2020-11-
v1.6.0 Liquid Li 1. Add DPCC description
11
Content
Content
Overview
ISP20 contains a series of image processing algorithm modules, mainly including: dark current
correction, dead pixel correction, 3A, HDR, lens shading correction, lens distortion correction,
3DLUT, denoising (including RAW domain denoising, multi-frame denoising, Color denoising,
etc.), sharpening, etc.
ISP20 includes hardware algorithm realization and software logic control part, RkAiq is the
realization of software logic control part.
The main functions of the RkAiq software module are: obtaining image statistics from the ISP
driver, combining with IQ Tuning parameters, using a series of algorithms to calculate new ISP,
Sensor and other hardware parameters, and continuously iterating the process to finally achieve
the optimal image effect.
Function description
Figure 1-1 ISP20 system block diagram
The overall software and hardware block diagram of ISP20 is shown in Figure 1-1. The Sensor
outputs the data stream to the ISP HW, and the ISP HW outputs the image after a series of image
processing algorithms. RkAiq continuously obtains statistical data from ISP HW, and generates
new parameters through 3A and other algorithms to feed back to each hardware module. Tuning
tool can debug the parameters online in real time, and save and generate a new iq parameter file
after debugging.
RkAiq Architecture
The design idea of ISP20 RkAiq software is shown in Figure 1-2. Mainly divided into the following
four parts:
1. RkAiq lib dynamic library. The library contains the main logic part, which is responsible for
obtaining statistics from the driver and transmitting them to each algorithm library.
2. Integrated algo libs. The static algorithm library provided by Rk has been registered to the
RkAiq lib dynamic library by default.
3. customer 3A libs. Customers can implement their own 3A algorithm library or other
algorithm libraries according to the algorithm library interface definition. After registering
the custom algorithm library to the RkAiq lib dynamic library, you can choose to run the
custom library or the Rk library according to the provided interface.
4. IQ file. The iq tuning result file saves algorithm related parameters and some system static
parameters such as CIS.
Software Architecture
The ISP20 software block diagram is shown in Figure 1-3. Mainly divided into the following three
layers:
1. Kernel layer. This layer contains all the hardware drivers of the Camera system, mainly
including ISP driver, sensor driver, vcm driver, flashlight driver, IrCutter driver and so on. The
drivers are implemented based on the V4L2 and Media framework.
2. framework layer. This layer is the integration layer of RkAiq lib. Rkaiq lib has two integration
methods:
IspServer method.
In this way, Rkaiq lib runs in an independent process of IspServer, and the client
communicates with it through dbus. In addition, this method can provide images with
ISP debugging effects for existing third-party applications such as v4l-ctl without
modifying the source code
Software Process
Figure 1-4 Flow chart
The calling process of the RkAiq interface is shown in Figure 1-4. The dotted frame in the figure is
optional, and the blue font is the configuration that the application needs to cooperate with the
RkAiq process.
configure media pipeline. Optionally, configure ISP20 pipeline, such as sensor output
resolution, etc. The driver has default configuration.
rk_aiq_uapi_sysctl_init. Initialize RkAiq, including IQ tuning parameters and initialization of
each algorithm library.
other Aiq or algo params uapis. Optional, you can configure the required parameters
through the API interface provided by each algorithm, and register a third-party algorithm
library, etc.
rk_aiq_uapi_sysctl_prepare. Prepare the initialization parameters of each algorithm library
and each hardware module, and set them to the drive.
video capture start. This process is the start of the ISP data stream on the application side,
and this process needs to be called after rk_aiq_uapi_sysctl_prepare.
rk_aiq_uapi_sysctl_start. Start the internal process of RkAiq. After the interface is
successfully called, the sensor starts to output data, the ISP starts to process the data, and
output the processed image.
Rkaiq running. RkAiq continuously obtains statistical data from the ISP driver, calls 3A and
other algorithms to calculate new parameters, and applies the new parameters to the
driver.
PC Online Tuning Tool. On the PC side, the parameters can be adjusted online through the
Tuning Tool.
video capture stop. You need to stop the data flow part before stopping the RkAiq process.
rk_aiq_uapi_sysctl_stop. Stop the RkAiq running process. The parameters can be adjusted
and then restarted or restarted directly.
rk_aiq_uapi_sysctl_deinit. Uninitialize RkAiq.
API description
The API provided by RKAiq is divided into two levels: function level API and module level API.
Among them, the function-level API is packaged based on the module-level API, mainly for some
simple functional designs based on the module for product applications. The module-level API
provides detailed parameter settings and queries for the module, and does not differentiate
between functions.
System Control
Functional Overview
The system control part includes AIQ public attribute configuration, initialize AIQ, run AIQ, exit
AIQ, set AIQ modules and other functions.
API Reference
rk_aiq_uapi_sysctl_init
【Description】
Initialize the AIQ context.
【Syntax】
rk_aiq_sys_ctx_t*
rk_aiq_uapi_sysctl_init (const char* sns_ent_name,
const char* iq_file_dir,
rk_aiq_error_cb err_cb,
rk_aiq_metas_cb metas_cb);
【Parameter】
【Return value】
【Requirement】
【Note】
rk_aiq_uapi_sysctl_deinit
【Description】
Deinitialize the AIQ context environment.
【Syntax】
void
rk_aiq_uapi_sysctl_deinit( rk_aiq_sys_ctx_t* ctx);
【Parameter】
【Return value】
None None
【Requirement】
-Header file: rk_aiq_user_api_sysctl.h
-Library file: librkaiq.so
【Note】
-It should not be called when the AIQ is in the start state.
rk_aiq_uapi_sysctl_prepare
【Description】
Prepare the AIQ operating environment.
【Syntax】
XCamReturn
rk_aiq_uapi_sysctl_prepare(const rk_aiq_sys_ctx_t* ctx,
uint32_t width,
uint32_t height,
rk_aiq_working_mode_t mode);
【Parameter】
Parameter
Description Input/Output
Name
【Return value】
0 Success
【Requirement】
【Note】
rk_aiq_uapi_sysctl_start
【Description】
Start the AIQ control system. After the AIQ is started, it will continuously obtain 3A statistics from
the ISP driver, run the 3A algorithm, and apply the calculated new parameters.
【Syntax】
XCamReturn
rk_aiq_uapi_sysctl_start(const rk_aiq_sys_ctx_t* ctx);
【Parameter】
【Return value】
0 Success
【Requirement】
【Note】
rk_aiq_uapi_sysctl_stop
【Description】
Stop the AIQ control system.
【Syntax】
XCamReturn
rk_aiq_uapi_sysctl_stop(const rk_aiq_sys_ctx_t* ctx);
【Parameter】
【Return value】
0 Success
rk_aiq_uapi_sysctl_getStaticMetas
【Description】
Query sensor corresponding static information, such as resolution, data format, etc.
【Syntax】
XCamReturn
rk_aiq_uapi_sysctl_getStaticMetas(const char* sns_ent_name,
rk_aiq_static_info_t* static_info);
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_sysctl_enumStaticMetas
【Description】
Enumerate the static information obtained by AIQ.
【Syntax】
XCamReturn
rk_aiq_uapi_sysctl_enumStaticMetas(int index, rk_aiq_static_info_t*
static_info);
【Parameter】
0 Success
【Requirement】
rk_aiq_uapi_sysctl_setModuleCtl
【Description】
AIQ module switch settings.
【Syntax】
XCamReturn
rk_aiq_uapi_sysctl_setModuleCtl(const rk_aiq_sys_ctx_t* ctx, rk_aiq_module_id_t
mId, bool mod_en);
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_sysctl_getModuleCtl
【Description】
AIQ module status query.
【Syntax】
XCamReturn
rk_aiq_uapi_sysctl_getModuleCtl(const rk_aiq_sys_ctx_t* ctx, rk_aiq_module_id_t
mId, bool *mod_en);
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_sysctl_regLib
【Description】
Register a custom algorithm library.
【Syntax】
XCamReturn
rk_aiq_uapi_sysctl_regLib(const rk_aiq_sys_ctx_t* ctx,
RkAiqAlgoDesComm* algo_lib_des);
【Parameter】
Parameter
Description Input/Output
Name
【Return value】
0 Success
rk_aiq_uapi_sysctl_unRegLib
【Description】
Log out of the custom algorithm library.
【Syntax】
XCamReturn
rk_aiq_uapi_sysctl_unRegLib(const rk_aiq_sys_ctx_t* ctx,
const int algo_type,
const int lib_id);
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_sysctl_enableAxlib
【Description】
Set the running status of the custom algorithm library.
【Syntax】
XCamReturn
rk_aiq_uapi_sysctl_enableAxlib(const rk_aiq_sys_ctx_t* ctx,
const int algo_type,
const int lib_id,
bool enable);
【Parameter】
Parameter Name Description Input/Output
【Return value】
0 Success
【Requirement】
【Note】
-If lib_id is equal to the currently running algorithm library, this function can be called in any state
except uninitialized.
-In other cases, it is only called in the prepared state, and the algorithm library identified by
algo_type will be replaced by the new algorithm library identified by lib_id.
rk_aiq_uapi_sysctl_getAxlibStatus
【Description】
Get the state of the algorithm library.
【Syntax】
bool
rk_aiq_uapi_sysctl_getAxlibStatus(const rk_aiq_sys_ctx_t* ctx,
const int algo_type,
const int lib_id);
【Parameter】
【Return value】
Return Value Description
【Requirement】
rk_aiq_uapi_sysctl_getEnabledAxlibCtx
【Description】
Get the context structure of the enabled algorithm library.
【Syntax】
const RkAiqAlgoContext*
rk_aiq_uapi_sysctl_getEnabledAxlibCtx(const rk_aiq_sys_ctx_t* ctx, const int
algo_type);
【Parameter】
【Return value】
【Requirement】
【Note】
-The returned algorithm context structure will be used by internal private functions. For user-
defined algorithm libraries, this function should be called after rk_aiq_uapi_sysctl_enableAxlib,
otherwise it will return NULL.
rk_aiq_uapi_sysctl_setCpsLtCfg
【Description】
Set the fill light control information.
【Syntax】
XCamReturn
rk_aiq_uapi_sysctl_setCpsLtCfg(const rk_aiq_sys_ctx_t* ctx,
rk_aiq_cpsl_cfg_t* cfg);
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_sysctl_getCpsLtInfo
【Description】
Obtain the fill light control information.
【Syntax】
XCamReturn
rk_aiq_uapi_sysctl_getCpsLtInfo(const rk_aiq_sys_ctx_t* ctx,
rk_aiq_cpsl_info_t* info);
【Parameter】
【Return value】
0 Success
【Requirement】
-Header file: rk_aiq_user_api_sysctl.h
-Library file: librkaiq.so
rk_aiq_uapi_sysctl_queryCpsLtCap
【Description】
Query the support capability of the fill light.
【Syntax】
XCamReturn
rk_aiq_uapi_sysctl_queryCpsLtCap(const rk_aiq_sys_ctx_t* ctx,
rk_aiq_cpsl_cap_t* cap);
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_sysctl_getBindedSnsEntNmByVd
【Description】
Query the sensor entity name corresponding to the video node.
【Syntax】
【Parameter】
【Return value】
【Requirement】
rk_aiq_uapi_sysctl_updateIq
【Description】
Dynamically update the currently used iq parameter file without stopping the data flow.
【Syntax】
【Parameter】
【Return value】
0 Success
【Note】
【Requirement】
rk_aiq_uapi_sysctl_setCrop
【Description】
Set crop parameters.
【Syntax】
XCamReturn
rk_aiq_uapi_sysctl_setCrop(const rk_aiq_sys_ctx_t* sys_ctx, rk_aiq_rect_t rect);
【Parameter】
【Return value】
0 Success
【Note】
rk_aiq_uapi_sysctl_getCrop
【Description】
Get crop parameters.
【Syntax】
XCamReturn
rk_aiq_uapi_sysctl_getCrop(const rk_aiq_sys_ctx_t* sys_ctx, rk_aiq_rect_t
*rect);
【Parameter】
【Return value】
Return Value Description
0 Success
Type of Data
rk_aiq_working_mode_t
【Description】
AIQ pipeline working mode
【Definition】
typedef enum {
RK_AIQ_WORKING_MODE_NORMAL,
RK_AIQ_WORKING_MODE_ISP_HDR2 = 0x10,
RK_AIQ_WORKING_MODE_ISP_HDR3 = 0x20,
} rk_aiq_working_mode_t;
【Member】
【Precautions】
-You need to query the modes supported by the sensor and AIQ first. If the set mode does not
support the setting, the setting will be invalid.
rk_aiq_static_info_t
【Description】
AIQ static information
【Definition】
typedef struct {
rk_aiq_sensor_info_t sensor_info;
rk_aiq_lens_info_t lens_info;
bool has_lens_vcm;
bool has_fl;
bool fl_strth_adj_sup;
bool has_irc;
bool fl_ir_strth_adj_sup;
} rk_aiq_static_info_t;
【Member】
Member Name Description
bool fl_ir_strth_adj_sup
rk_aiq_sensor_info_t
【Description】
sensor information
【Definition】
typedef struct {
char sensor_name[32];
rk_frame_fmt_t support_fmt[SUPPORT_FMT_MAX];
int32_t num;
/* binded pp stream media index */
int8_t binded_strm_media_idx;
} rk_aiq_sensor_info_t;
【Member】
rk_aiq_module_id_t
【Description】
AIQ module ID
【Definition】
typedef enum {
RK_MODULE_INVAL = 0,
RK_MODULE_DPCC,
RK_MODULE_BLS,
RK_MODULE_LSC,
RK_MODULE_AWB_GAIN,
RK_MODULE_CTK,
RK_MODULE_GOC,
RK_MODULE_SHARP,
RK_MODULE_AE,
RK_MODULE_AWB,
RK_MODULE_NR,
RK_MODULE_GIC,
RK_MODULE_3DLUT,
RK_MODULE_LDCH,
RK_MODULE_TNR,
RK_MODULE_FEC,
RK_MODULE_MAX
}rk_aiq_module_id_t;
【Member】
RK_MODULE_GOC Gamma
RK_MODULE_SHARP Sharpen
RK_MODULE_AE Exposure
RK_MODULE_NR Denoising
RK_MODULE_3DLUT 3DLUT
RK_MODULE_LDCH LDCH
RK_MODULE_TNR 3D denoising
rk_aiq_cpsl_cfg_t
【Description】
Fill light setting information structure
【Definition】
【Member】
Member
Description
Name
Whether to cut the screen to black and white after switching to night
gray_on
mode
rk_aiq_cpsl_info_t
【Description】
Fill light query information structure
【Definition】
【Member】
Member
Description
Name
Whether to cut the screen to black and white after switching to night
gray
mode
rk_aiq_cpsl_cap_t
【Description】
Supplement light support capability structure
【Definition】
【Member】
Whether to cut the screen to black and white after switching to night
gray
mode
【Description】
Define crop parameter structure
【Definition】
【Member】
Overview
RKAIQ provides offline RAW frame processing function, that is, RK customized RAW format files
are parsed by RKAIQ and then sent into ISP for processing, and output as an image that can be
normally displayed.
Function description
Support RK-RAW format file input. Calling the file input interface, the calling process will be
blocked until the file is successfully processed and output .
Support RK-RAW format buffer input and asynchronous working mode. Calling the buffer
input interface, the calling process will not be blocked, and the callback function will be
called after the buffer processing is completed (if there is a registered callback function).
Support RK-RAW format buffer input, synchronous working mode. Calling the buffer input
interface, the calling process will be blocked until the buffer processing is successfully
processed and output .
【Description】
Prepare the environment for RK Raw format data processing.
【Prototype】
XCamReturn
rk_aiq_uapi_sysctl_prepareRkRaw(const rk_aiq_sys_ctx_t* ctx, rk_aiq_raw_prop_t
prop);
【Parameter】
【Return value】
0 Success
【Note】
rk_aiq_uapi_sysctl_enqueueRkRawBuf
【Description】
input RK Raw format buffer
【Prototype】
XCamReturn
rk_aiq_uapi_sysctl_enqueueRkRawBuf(const rk_aiq_sys_ctx_t* ctx, void *rawdata,
bool sync);
【Parameter】
【Return value】
Return Value Description
0 Success
【Note】
If you need extra operation on the rawdata that has been processed in asynchronous mode,
you can use the rk_aiq_uapi_sysctl_registRkRawCb interface to register the callback function, and
the rawdata buffer will be passed into the callback function.
rk_aiq_uapi_sysctl_enqueueRkRawFile
【Description】
input RK Raw format file
【Prototype】
XCamReturn
rk_aiq_uapi_sysctl_enqueueRkRawFile(const rk_aiq_sys_ctx_t* ctx, const char
*path);
【Parameter】
【Return value】
0 Success
【Note】
rk_aiq_uapi_sysctl_registRkRawCb
【Description】
Register callback function
【Prototype】
XCamReturn
rk_aiq_uapi_sysctl_registRkRawCb(const rk_aiq_sys_ctx_t* ctx, void (*callback)
(void*));
【Parameter】
Parameter Name Description Input/Output
【Return value】
0 Success
【Note】
Data structure
rk_aiq_raw_prop_t
【Description】
RK Raw parameter structure
【Definition】
【Member】
rk_aiq_rawbuf_type_t
【Description】
RK Raw type structure
【Definition】
typedef enum rk_aiq_rawbuf_type_s {
RK_AIQ_RAW_ADDR,
RK_AIQ_RAW_FD,
RK_AIQ_RAW_DATA,
RK_AIQ_RAW_FILE
}rk_aiq_rawbuf_type_t;
【Member】
Indicates that the raw image data is stored in the'Raw data' section
RK_AIQ_RAW_DATA
of the input RK Raw format buffer.
Note
Using RK Raw data processing function, when creating AIQ Context, the parameter
sns_ent_name of the rk_aiq_uapi_sysctl_init interface must be "FakeCamera".
The processing of raw data depends on IQ XML file, and make sure that the XML file is
generated with the same resolution of the offline raw file. The IQ XML file must be named as
FakeCamera.xml and placed under the loading path of the Aiq configuration files.
If you do not connect to the real camera and want to use the RK Raw data processing
function, then do not configure the input port in the ISP node in the kernel DTS file.
If a real camera sensor is currently configured, suppose that the real camera sensor is
connected to ISP0&ISPP0; if you want to use the RK Raw data processing function, you need
to enable ISP1&ISPP1 in DTS , so that the created fake camera sensor can be used normally.
If the real camera sensor and fake camera sensor need to be used concurrently and their
resolutions are different, then the ISPP node in the DTS file SHOULD configure the
maximum resolution information. For the specific configuration method, please refer to the
document "Rockchip_Driver_Guide_ISP2x_CN".
Reference example
For how to use the offline frame processing API, please refer to rkisp_demo, the path is
YOUR_SDK_DIR/external/camera_engine_rkaiq/rkisp_demo.
AE
Overview
The function of the AE module is to obtain the current image exposure according to the
automatic metering system, and then automatically configure the lens aperture, sensor shutter
and gain to obtain the best image quality.
Important concepts
-Exposure time: The time for the sensor to accumulate charge, which is the period from when the
sensor pixel is exposed to when the charge is read out.
-Exposure gain: The total amplification factor of the output charge of the sensor. Generally, there
are digital gain and analog gain. The noise introduced by analog gain will be slightly smaller, so
analog gain is generally preferred.
-Aperture: Aperture is a mechanical device in the lens that can change the size of the clear
aperture.
-Anti-flicker: The screen flicker caused by the mismatch between the power frequency of the
lamp and the frame rate of the sensor, generally by limiting the exposure time and modifying the
frame rate of the sensor to achieve the anti-flicker effect.
Function description
The AE module is composed of AE statistical information and the algorithm of AE control
strategy.
【Description】
Set the exposure mode.
【Syntax】
【Parameter】
【Return value】
0 Success
rk_aiq_uapi_getExpMode
【Description】
Get the exposure mode.
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_setAeMode
【Description】
Set AE working mode.
【Syntax】
【Parameter】
【Return value】
Return Value Description
0 Success
【Note】
When the exposure mode is switched to manual mode, the gain and exposure time adopt the
initial values defined in the image effect file. If you need to set the exposure value while switching
to manual mode, you can use the rk_aiq_uapi_setManualExp interface.
【Requirement】
rk_aiq_uapi_getAeMode
【Description】
Get the AE working mode.
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_setManualExp
【Description】
Use manual exposure mode, and set the gain and exposure time.
【Syntax】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_setExpGainRange
【Description】
Set the gain range.
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_getExpGainRange
【Description】
Get the gain range.
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_setExpTimeRange
【Description】
Set the exposure time range.
【Syntax】
【Parameter】
【Return value】
0 Success
rk_aiq_uapi_getExpTimeRange
【Description】
Get the exposure time range.
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_setBLCMode
【Description】
Backlight compensation switch, area setting.
【Syntax】
【Parameter】
on switch input
0 Success
【Note】
【Requirement】
rk_aiq_uapi_setBLCStrength
【Description】
Set the dark area to enhance the intensity.
【Syntax】
【Parameter】
【Return value】
0 Success
【Note】
【Requirement】
rk_aiq_uapi_setHLCMode
【Description】
Strong light suppression switch.
【Syntax】
XCamReturn rk_aiq_uapi_setHLCMode(const rk_aiq_sys_ctx_t* ctx, bool on);
【Parameter】
on switch input
【Return value】
0 Success
【Note】
【Requirement】
rk_aiq_uapi_setHLCStrength
【Description】
Set the intensity of strong light suppression.
【Syntax】
【Parameter】
【Return value】
0 Success
【Note】
rk_aiq_uapi_setDarkAreaBoostStrth
【Description】
Set the dark area to enhance the intensity.
【Syntax】
【Parameter】
【Return value】
0 Success
【Note】
【Requirement】
rk_aiq_uapi_getDarkAreaBoostStrth
【Description】
Get the current dark area boost intensity.
【Syntax】
【Parameter】
0 Success
【Note】
【Requirement】
rk_aiq_uapi_setAntiFlickerMode
【Description】
Set the anti-flash mode.
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_getAntiFlickerMode
【Description】
Get anti-flash mode.
【Syntax】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_setExpPwrLineFreqMode
【Description】
Set the anti-flash frequency.
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_getExpPwrLineFreqMode
【Description】
Obtain the anti-flash frequency.
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
【Description】
Define automatic manual mode
【Definition】
【Member】
aeMode_t
【Description】
Define AE working mode
【Definition】
【Member】
paRange_t
【Description】
Define the parameter range
【Definition】
【Member】
aeMeasAreaType_t
【Description】
Define AE measurement area type
【Definition】
AE_MEAS_AREA_AUTO Automatic
expPwrLineFreq_t
【Description】
Define anti-flash frequency
【Definition】
【Member】
EXP_PWR_LINE_FREQ_DIS
EXP_PWR_LINE_FREQ_50HZ 50 Hz
EXP_PWR_LINE_FREQ_60HZ 60 Hz
antiFlickerMode_t
【Description】
Define anti-flash mode
【Definition】
【Member】
Member Name Description
【Description】
Set AE exposure software properties.
【Syntax】
XCamReturn
rk_aiq_user_api_ae_setExpSwAttr(const rk_aiq_sys_ctx_t* ctx,
const Uapi_ExpSwAttr_t expSwAttr);
【Parameter】
【Return value】
0 Success
【Requirement】
【Example】
Exposure components include sensor exposure time, sensor exposure gain, isp digital gain,
and aperture. After setting the manual mode, you also need to set the manual state of each
exposure component (ManualGainEn, ManualTimeEn, ManualIspDgainEn, ManualIrisEn) and the
corresponding manual value. In manual mode, at least one exposure component is required to
be in manual state, otherwise it will report an error and exit. The value of each exposure
component set in manual mode will be limited by the sensor and lens. If the set exposure
component value exceeds the limit of the sensor and lens, the algorithm will automatically
correct it.
Uapi_ExpSwAttr_t expSwAttr;
ret = rk_aiq_user_api_ae_getExpSwAttr(ctx, &expSwAttr);
expSwAttr.AecOpType = RK_AIQ_OP_MODE_MANUAL;
//LinearAE
expSwAttr.stManual.stLinMe.ManualGainEn = true;
expSwAttr.stManual.stLinMe.ManualTimeEn = true;
expSwAttr.stManual.stLinMe.ManualIspDgainEn = true;
expSwAttr.stManual.stLinMe.ManualIrisEn = true;
expSwAttr.stManual.stLinMe.GainValue = 1.0f; /*gain = 1x*/
expSwAttr.stManual.stLinMe.TimeValue = 0.02f; /*time = 1/50s*/
expSwAttr.stManual.stLinMe.IspDGainValue = 1.0f;/*IspDgain = 1x*/
expSwAttr.stManual.stLinMe.PIrisGainValue = 512; /*p-iris F#=1.4*/
expSwAttr.stManual.stLinMe.DCIrisValue = 20; /*dc-iris PwmDuty=20*/
//HdrAE
expSwAttr.stManual.stHdrMe.ManualGainEn = true;
expSwAttr.stManual.stHdrMe.ManualTimeEn = true;
expSwAttr.stManual.stHdrMe.ManualIspDgainEn = true;
expSwAttr.stManual.stHdrMe.ManualIrisEn = true;
expSwAttr.stManual.stHdrMe.GainValue[0] = 1.0f; /*sframe gain = 1x*/
expSwAttr.stManual.stHdrMe.TimeValue[0] = 0.02f; /*sframe time = 1/50s*/
expSwAttr.stManual.stHdrMe.IspDGainValue[0] = 1.0f;/*sframe IspDgain = 1x*/
expSwAttr.stManual.stHdrMe.PIrisGainValue = 512; /*p-iris F#=1.4*/
expSwAttr.stManual.stHdrMe.DCIrisValue = 20; /*dc-iris PwmDuty=20*/
Uapi_ExpSwAttr_t expSwAttr;
ret = rk_aiq_user_api_ae_getExpSwAttr(ctx, &expSwAttr);
expSwAttr.AecOpType = RK_AIQ_OP_MODE_AUTO;
//set ae speed
expSwAttr.stAuto.stAeSpeed.DampOver = 0.2f;
expSwAttr.stAuto.stAeSpeed.DampUnder = 0.5f;
ret = rk_aiq_user_api_ae_setExpSwAttr(ctx, expSwAttr);
//set ae delay
expSwAttr.stAuto.BlackDelayFrame = 2;
expSwAttr.stAuto.WhiteDelayFrame = 4;
ret = rk_aiq_user_api_ae_setExpSwAttr(ctx, expSwAttr);
Uapi_ExpSwAttr_t expSwAttr;
ret = rk_aiq_user_api_ae_getExpSwAttr(ctx, &expSwAttr);
expSwAttr.stIris.enable = true; /*run AIris*/
Set AE weight
Set the 5X5 weight, and expand the weight according to the actual hardware block
specifications within the algorithm
Uapi_ExpSwAttr_t expSwAttr;
ret = rk_aiq_user_api_ae_getExpSwAttr(ctx, &expSwAttr);
Set the 15X15 weight, and the algorithm will compress the weight according to the actual block
specifications of the hardware.
Uapi_ExpSwAttr_t expSwAttr;
ret = rk_aiq_user_api_ae_getExpSwAttr(ctx, &expSwAttr);
expSwAttr.stAdvanced.enable = true; //important! true means preferring to use
these parameters
uint8_t DayGridWeights[225]={
0, 0, 1, 2, 2, 3, 4, 5, 4, 3, 2, 2, 1, 0, 0,
0, 1, 2, 3, 3, 4, 5, 6, 5, 4, 3, 3, 2, 1, 0,
1, 2, 3, 5, 5, 6, 7, 8, 7, 6, 5, 5, 3, 2, 1,
2, 3, 5, 7, 7, 8, 9, 10, 9, 8, 7, 7, 5, 3, 2,
2, 3, 5, 7, 8, 9, 10, 11, 10, 9, 8, 7, 5, 3, 2,
2, 4, 6, 8, 9, 10, 11, 12, 11,10, 9, 8, 6, 4, 2,
2, 4, 6, 9, 10, 11, 12, 13, 12,11, 10, 9, 6, 4, 2,
3, 5 ,7, 10, 11, 12, 13, 14, 13,12, 11, 10, 7, 5, 3,
2, 4, 6, 9, 10, 11, 12, 13, 12,11, 10, 9, 6, 4, 2,
2, 4, 6, 8, 9, 10, 11, 12, 11,10, 9, 8, 6, 4, 2,
2, 3, 5, 7, 8, 9, 10, 11, 10, 9, 8, 7, 5, 3, 2,
2, 3, 5, 7, 7, 8, 9, 10, 9, 8, 7, 7, 5, 3, 2,
1, 2, 4, 6, 6, 7, 8, 9, 8, 7, 6, 6, 4, 2, 1,
0, 1, 3, 5, 5, 6, 7, 8, 7, 6, 5, 5, 3, 1, 0,
0, 1, 3, 5, 5, 6, 7, 8, 7, 6, 5, 5, 3, 1, 0
};
uint8_t NightGridWeights[225]={
0, 0, 1, 2, 2, 3, 4, 5, 4, 3, 2, 2, 1, 0, 0,
0, 1, 2, 3, 3, 4, 5, 6, 5, 4, 3, 3, 2, 1, 0,
1, 2, 3, 5, 5, 6, 7, 8, 7, 6, 5, 5, 3, 2, 1,
2, 3, 5, 7, 7, 8, 9, 10, 9, 8, 7, 7, 5, 3, 2,
2, 3, 5, 7, 8, 9, 10, 11, 10, 9, 8, 7, 5, 3, 2,
2, 4, 6, 8, 9, 10, 11, 12, 11,10, 9, 8, 6, 4, 2,
2, 4, 6, 9, 10, 11, 12, 13, 12,11, 10, 9, 6, 4, 2,
3, 5 ,7, 10, 11, 12, 13, 14, 13,12, 11, 10, 7, 5, 3,
2, 4, 6, 9, 10, 11, 12, 13, 12,11, 10, 9, 6, 4, 2,
2, 4, 6, 8, 9, 10, 11, 12, 11,10, 9, 8, 6, 4, 2,
2, 3, 5, 7, 8, 9, 10, 11, 10, 9, 8, 7, 5, 3, 2,
2, 3, 5, 7, 7, 8, 9, 10, 9, 8, 7, 7, 5, 3, 2,
1, 2, 4, 6, 6, 7, 8, 9, 8, 7, 6, 6, 4, 2, 1,
0, 1, 3, 5, 5, 6, 7, 8, 7, 6, 5, 5, 3, 1, 0,
0, 1, 3, 5, 5, 6, 7, 8, 7, 6, 5, 5, 3, 1, 0
};
memcpy(expSwAttr.stAdvanced.DayGridWeights,DayGridWeights,sizeof(expSwAttr.stAdv
anced.DayGridWeights));
memcpy(expSwAttr.stAdvanced.NightGridWeights,NightGridWeights,sizeof(expSwAttr.s
tAdvanced.DayGridWeights));
rk_aiq_user_api_ae_getExpSwAttr
【Description】
Obtain AE exposure software properties.
【Syntax】
XCamReturn
rk_aiq_user_api_ae_getExpSwAttr(const rk_aiq_sys_ctx_t* ctx, Uapi_ExpSwAttr_t*
pExpSwAttr);
【Parameter】
【Return value】
0 Success
rk_aiq_user_api_ae_setLinAeDayRouteAttr
【Description】
Set the AE's daytime scene exposure allocation strategy in linear mode.
【Syntax】
XCamReturn
rk_aiq_user_api_ae_setLinAeDayRouteAttr(const rk_aiq_sys_ctx_t* ctx, const
Uapi_LinAeRouteAttr_t linAeRouteAttr);
【Parameter】
【Return value】
0 Success
【Requirement】
【Example】
Uapi_LinAeRouteAttr_t stLinDayRoute;
ret = rk_aiq_user_api_ae_getLinAeDayRouteAttr(ctx,&stLinDayRoute);
stLinDayRoute.array_size = 6;
for(int i =0; i < stLinDayRoute.array_size; i++){
stLinDayRoute.TimeDot[i]=TimeDot[i];
stLinDayRoute.GainDot[i]=GainDot[i];
stLinDayRoute.IspgainDot[i]=LinIspDGainDot[i];
stLinDayRoute.PIrisGainDot[i]=LinPirisGainDot[i];
}
ret = rk_aiq_user_api_ae_setLinAeDayRouteAttr(ctx,stLinDayRoute);
rk_aiq_user_api_ae_getLinAeDayRouteAttr
【Description】
Obtain the daytime scene exposure allocation strategy of AE in linear mode.
【Syntax】
XCamReturn
rk_aiq_user_api_ae_getLinAeDayRouteAttr(const rk_aiq_sys_ctx_t* ctx,
Uapi_LinAeRouteAttr_t* pLinAeRouteAttr);
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_user_api_ae_setHdrAeDayRouteAttr
【Description】
Set the AE's daytime scene exposure allocation strategy in HDR mode.
【Syntax】
XCamReturn
rk_aiq_user_api_ae_setHdrAeDayRouteAttr(const rk_aiq_sys_ctx_t* ctx, const
Uapi_HdrAeRouteAttr_t hdrAeRouteAttr);
【Parameter】
【Return value】
Return Value Description
0 Success
【Requirement】
【Example】
Uapi_HdrAeRouteAttr_t stHdrDayRoute;
ret = rk_aiq_user_api_ae_getHdrAeDayRouteAttr(ctx,&stHdrDayRoute);
float HdrTimeDot[3][6] = {0.0, 0.01, 0.01, 0.01, 0.01, 0.01,
0.0, 0.02, 0.02, 0.02, 0.02, 0.02,
0.0, 0.03, 0.03, 0.03, 0.03, 0.03
};
float HdrGainDot[3][6] = {1, 1, 4, 6, 8, 12,
1, 1, 4, 6, 8, 12,
1, 1, 4, 6, 8, 12
};
float HdrIspDGainDot[3][6] = {1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1
};
int HdrPIrisGainDot[6] = {1, 1, 1, 1, 1, 1};
stHdrDayRoute.array_size = 6;
for(int j =0; j < stHdrDayRoute.array_size; j++){
for(int i = 0; i < 3; i++){
stHdrDayRoute.TimeDot[i][j]=HdrTimeDot[i][j];
stHdrDayRoute.GainDot[i][j]=HdrGainDot[i][j];
stHdrDayRoute.IspgainDot[i][j]=HdrIspDGainDot[i][j];
}
stHdrDayRoute.PIrisGainDot[j]=HdrPIrisGainDot[j];
}
ret = rk_aiq_user_api_ae_setHdrAeDayRouteAttr(ctx,stHdrDayRoute);
rk_aiq_user_api_ae_getHdrAeDayRouteAttr
【Description】
Obtain the daytime scene exposure allocation strategy of AE in HDR mode.
【Syntax】
XCamReturn
rk_aiq_user_api_ae_getHdrAeDayRouteAttr(const rk_aiq_sys_ctx_t* ctx,
Uapi_HdrAeRouteAttr_t* pHdrAeRouteAttr);
【Parameter】
Parameter Name Description Input/Output
【Return value】
0 Success
【Requirement】
rk_aiq_user_api_ae_setLinAeNightRouteAttr
【Description】
Set the AE night scene exposure allocation strategy in linear mode.
【Syntax】
XCamReturn
rk_aiq_user_api_ae_setLinAeNightRouteAttr(const rk_aiq_sys_ctx_t* ctx, const
Uapi_LinAeRouteAttr_t linAeRouteAttr);
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_user_api_ae_getLinAeNightRouteAttr
【Description】
Get the AE night scene exposure allocation strategy in linear mode.
【Syntax】
XCamReturn
rk_aiq_user_api_ae_getLinAeNightRouteAttr(const rk_aiq_sys_ctx_t* ctx,
Uapi_LinAeRouteAttr_t* pLinAeRouteAttr);
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_user_api_ae_setHdrAeNightRouteAttr
【Description】
Set the AE night scene exposure allocation strategy in HDR mode.
【Syntax】
XCamReturn
rk_aiq_user_api_ae_setHdrAeNightRouteAttr(const rk_aiq_sys_ctx_t* ctx, const
Uapi_HdrAeRouteAttr_t hdrAeRouteAttr);
【Parameter】
【Return value】
0 Success
【Requirement】
-Header files: rk_aiq_user_api_ae.h, rk_aiq_uapi_ae_int.h
-Library file: librkaiq.so
rk_aiq_user_api_ae_getHdrAeNightRouteAttr
【Description】
Get the AE night scene exposure allocation strategy in HDR mode.
【Syntax】
XCamReturn
rk_aiq_user_api_ae_getHdrAeNightRouteAttr(const rk_aiq_sys_ctx_t* ctx,
Uapi_HdrAeRouteAttr_t* pHdrAeRouteAttr);
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_user_api_ae_queryExpResInfo
【Description】
Obtain AE internal status information.
【Syntax】
XCamReturn
rk_aiq_user_api_ae_queryExpResInfo(const rk_aiq_sys_ctx_t* ctx,
Uapi_ExpQueryInfo_t* pExpResInfo);
【Parameter】
【Return value】
Return Value Description
0 Success
【Requirement】
rk_aiq_user_api_ae_setLinExpAttr
【Description】
Set the AE linear mode exposure parameters.
【Syntax】
XCamReturn
rk_aiq_user_api_ae_setLinExpAttr(const rk_aiq_sys_ctx_t* ctx, const
Uapi_LinExpAttr_t linExpAttr);
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_user_api_ae_getLinExpAttr
【Description】
Get AE linear mode exposure parameters.
【Syntax】
XCamReturn
rk_aiq_user_api_ae_getLinExpAttr(const rk_aiq_sys_ctx_t* ctx, Uapi_LinExpAttr_t*
pLinExpAttr);
【Parameter】
Parameter Name Description Input/Output
【Return value】
0 Success
【Requirement】
rk_aiq_user_api_ae_setHdrExpAttr
【Description】
Set AE HDR mode exposure parameters.
【Syntax】
XCamReturn
rk_aiq_user_api_ae_setHdrExpAttr(const rk_aiq_sys_ctx_t* ctx, const
Uapi_HdrExpAttr_t hdrExpAttr);
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_user_api_ae_getHdrExpAttr
【Description】
Get AE HDR mode exposure parameters.
【Syntax】
XCamReturn
rk_aiq_user_api_ae_getHdrExpAttr(const rk_aiq_sys_ctx_t* ctx, Uapi_HdrExpAttr_t*
pHdrExpAttr);
【Parameter】
【Return value】
0 Success
【Requirement】
【Description】
【Definition】
Aec enable switch. 1. Turn on the Aec algorithm; 0, turn off the Aec
enable
algorithm, and the exposure remains at the value before turning off.
Ae algorithm run interval, the value range is [0,255], and the default
AecRunInterval value is 0. When the value is 0, AE is run every frame; when the value
is 1, AE is run every other frame; and so on.
-Uapi_ExpSwAttr_Advanced_t
-Uapi_IrisAttr_t
-Uapi_AntiFlicker_t
-Uapi_AeAttr_t
-Uapi_MeAttr_t
-Uapi_ExpInitExp_t
Uapi_ExpSwAttr_Advanced_t
【Description】
【Definition】
【Precautions】
-A set of AE weights is defined in the Uapi_ExpSwAttr_t structure, and the number of weights is
5X5. The algorithm internally expands the weights according to the actual hardware
configuration weights. If you need to set a higher-precision weight, you can use a set of AE
weights defined in Uapi_ExpSwAttr_Advanced_t, and the number of weights is 15X15. In the
algorithm, the weights are compressed according to the actual hardware configuration weights.
-To use a set of AE weights defined in Uapi_ExpSwAttr_Advanced_t, you need to turn on enable
and set it to 1.
Uapi_IrisAttr_t
【Description】
【Definition】
【Member】
CalibDb_PIris_Attr_t
【Description】
【Definition】
【Member】
Member
Description
name
The total number of steps of the P-iris stepper motor, the specific size is
TotalStep
related to the P-iris lens.
The number of steps available for the P-iris stepper motor, the specific size is
EffcStep
related to the P-iris lens.
The mapping table of P-iris stepper motor position and iris equivalent gain.
StepTable
The specific value is related to the P-iris lens.
CalibDb_DCIris_Attr_t
【Description】
DC aperture properties
【Definition】
【Member】
Member
Description
name
Integral coefficient, used to adjust the opening and closing speed of the
iris, the greater the value, the greater the opening and closing speed of
the iris. If the value is too large, overshoot is likely to cause oscillation; if
Ki
the value is too small, the iris adjustment speed is slow and the
environment brightness changes drastically, it is prone to oscillation. The
recommended value is 0.2. The value range is [0, 1].
The minimum PWM duty cycle, the specific size is related to the DC-iris
lens and circuit characteristics, and the unit is %. The smaller the value,
MinPwmDuty the faster the supported aperture closing speed, but it is easy to cause
the aperture to oscillate. The value range is [0,100], and the default value
is 0.
The maximum PWM duty cycle, the specific size is related to the DC-iris
lens and circuit characteristics, and the unit is %. The larger the value,
MaxPwmDuty the faster the supported aperture opening speed. If the value is too
small, it may cause the aperture control to exit before the maximum
aperture. The value range is [0,100], and the default value is 100.
The PWM duty cycle threshold when the iris is open. When the PWM
duty cycle of the iris is higher than (excluding) OpenPwmDuty, the iris is
OpenPwmDuty
in the open state. The specific size is related to the DC-iris lens, and the
unit is %.
The PWM duty cycle threshold when the iris is closed. When the PWM
ClosePwmDuty duty cycle of the iris is less than (excluding) ClosePwmDuty, the iris is
closed. The specific size is related to the DC-iris lens, and the unit is %.
【Precautions】
When the auto iris function is turned off, the DC-iris iris will be opened to the maximum by
default; for the P-iris iris, it will be opened to the stepper motor position corresponding to
the maximum iris by default. If you want to change the above aperture position, you can go
to the AecInitValue module to modify InitPIrisGainValue and InitDCIrisDutyValue.
The basic control process of the automatic iris Airis algorithm is as follows:
For the DC-iris lens, Airis controls the aperture size of the DC-iris lens according to the
deviation between the current brightness and the target brightness. When the exposure reaches
the minimum value and the current brightness exceeds the target brightness tolerance range,
the AE control will be exited, the exposure time and exposure gain will be fixed, and the AIris
control range will be entered. If the current image brightness is stable and the PWM duty value of
DC-iris is greater than OpenPwmDuty, it is considered that the current aperture has reached the
maximum, exit AIris aperture control, and the control will be transferred to AE.
For P-iris lenses, the iris is controlled through the AecRoute module. The aperture size of the
P-iris lens is converted into an equivalent gain, which participates in the exposure decomposition
calculation.
P-iris stepper motor position and iris equivalent gain mapping table StepTable is generally
made according to the corresponding relationship between the step motor position and the
iris aperture provided by the lens manufacturer. The control of P-iris is controlled by the
AecRoute module of AE, which converts the size of the iris aperture into an equivalent gain.
Therefore, the iris control of P-iris is required to have good linearity. The value range of the
equivalent gain is [1,1024], the equivalent gain 1024 represents F1.0, the equivalent gain 512
represents F1.4, and so on, the equivalent gain 1 represents F32.0. When making the table,
it is necessary to convert the aperture aperture corresponding to the position of the stepper
motor into an equivalent gain, fill it in the StepTable, and fill it in in the order of increasing
the position of the stepper motor (ie step0, step1...stepN).
TotalStep represents the total number of steps of the P-iris stepper motor, the specific size
is related to the P-iris lens. EffcStep represents the number of steps available for the P-iris
stepper motor, which is generally required to be less than TotalStep. Because the position is
close to the closing end of the iris, the value of the equivalent gain error is relatively large,
and oscillation is prone to occur during the adjustment of the iris, so the step position near
the closing end of the iris is usually not used.
Table 4-1 is the correspondence table of P-iris stepper motor position, iris aperture and
equivalent gain. Take this table as an example to explain how to set StepTable. The
corresponding relationship between the step motor position step and the aperture area of
the 1-2 and 4-5 columns in Table 4-1 is provided by a certain lens manufacturer. The stepper
motor of this P-iris lens has a total number of steps of 81. The corresponding aperture at
step0 is the largest, and the nominal maximum number of apertures is 1.4. When the
aperture is 1.4, the corresponding equivalent gain is 512, so the corresponding equivalent
gain at step 0 is 512. The equivalent gain corresponding to other aperture areas, here is step
3 as an example, the calculation method is as follows: the aperture area of step 3 is 195.869,
the corresponding equivalent gain = 512* (195.869/201.062) = 499 (rounded). By analogy,
the equivalent gain values corresponding to other stepper motor positions can also be
calculated based on this. It can be seen from Table 1-1 that when the stepping motor is
close to the closed end, the corresponding aperture area is very small, and the difference
from the largest aperture area can be several thousand times, and the corresponding
equivalent gain value error is large, so it is recommended to be close to the aperture. Do not
use the stepping motor position at the closed end to avoid exposure oscillation due to
errors. The equivalent gain corresponding to each stepper motor position in the table is
filled into StepTable in the order of stepper motor position increment (ie step0,
step1...stepN).
The values of OpenPwmDuty and ClosePwmDuty of DC-iris need to be measured, and their
specific values are related to the DC-iris lens. For some lenses, when the PWM duty cycle is
greater than OpenPwmDuty, the iris is opened; when the PWM duty cycle is less than
OpenPwmDuty, the iris is closed; when the PWM duty cycle is greater than or equal to
ClosePwmDuty and less than or equal to OpenPwmDuty, the iris is stable The current
position and the value in this interval are all HoldValue. There are also some lenses, there is
only a threshold of the aperture switch, that is, when the PWM duty cycle is greater than the
threshold, the iris performs an opening operation; when the PWM duty cycle is less than the
threshold, the iris performs a closing operation; when the PWM duty cycle When it is equal
to the threshold, the iris is stable at the current position, and the threshold is HoldValue. At
this time, you can set ClosePwmDuty = OpenPwmDuty = HoldValue.
The manual mode parameter setting of the aperture is consistent with the manual mode of
exposure. When you need to use the manual iris function, you need to set AecOpType to
manual mode and enable the ManualIrisEn parameter in the AecManualCtrl module. When
IrisType is P-iris, only PirisGainValue is valid; when IrisType is P-iris, only DCIrisValue is valid.
Table 4-1 Correspondence table of P-iris stepper motor position, iris aperture and
equivalent gain
Aperture Equivalent Aperture Equivalent
Step Step
area(mm^2^) gain area(mm^2^) gain
40 59.923 153
Uapi_AntiFlicker_t
【Description】
Define anti-flash properties
【Definition】
【Member】
Member
Description
Name
【Precautions】
To turn off the anti-flash function, you need to set the anti-flash enable bit enable to 0,
and the algorithm will automatically configure
Frequency=AEC_FLICKER_FREQUENCY_OFF; if the anti-flicker enable bit is set to 1, the
anti-flash frequency is configured as AEC_FLICKER_FREQUENCY_OFF, and the frequency
value will be invalid. Use the default value AEC_FLICKER_FREQUENCY_50HZ.
AEC_ANTIFLICKER_NORMAL_MODE is a normal anti-flash mode. The exposure time can be
adjusted according to the brightness. The minimum exposure time is fixed at 1/120 sec
(60Hz) or 1/100 sec (50Hz), which is not limited by the minimum exposure time.
Lighted environment: The exposure time can be matched with the frequency of the light
source, which can prevent the image from flickering.
High-brightness environment: The higher the brightness, the shortest exposure time is
required. The minimum exposure time of the normal anti-flash mode cannot match the
frequency of the light source, resulting in overexposure.
Uapi_AeAttr_t
【Description】
Define AE auto exposure properties
【Definition】
【Member】
When setting the AE parameter range through the api, you need to set SetAeRangeEn to 1,
otherwise the system auto exposure parameter range is used by default. The setting of the
exposure parameter range is divided into two sets of stLinAeRange and stHdrAeRange according
to the different exposure modes. Among them, stHdrAeRange supports the setting of the
automatic exposure parameter range of each frame.
Member Name Description
【Precautions】
When setting the AE parameter range through the api, you need to set SetAeRangeEn
to 1, otherwise the system auto exposure parameter range is used by default. The setting of the
exposure parameter range is divided into two sets of stLinAeRange and stHdrAeRange according
to the different exposure modes. Among them, stHdrAeRange supports the setting of the
automatic exposure parameter range of each frame.
The AE parameter range queried through api is the parameter range actually used after
verification and correction inside the algorithm. When the AE parameter range set by the api
exceeds the parameter range limited by the sensor, the parameter range limited by the sensor
will be used. For the parameter range restricted by sensor, see the sensorinfo parameter of the
AE module in the Rockchip_Tuning_Guide_ISP2x_CN_v1.x.x.pdf document.
CalibDb_AeSpeed_t
【Description】
Define AE conditional speed attributes
【Definition】
【Member】
Member name Description
CalibDb_AeRange_t
【Description】
Define AE parameter range
【Definition】
【Member】
CalibDb_LinAeRange_t
【Description】
Define the parameter range of AE linear mode
【Definition】
【Member】
Member Name Description
stGainRange Sensor analog gain range, set the maximum and minimum values
stIspDGainRange ISP digital gain range, set the maximum and minimum values
stPIrisRange Iris equivalent gain range, only supports P-Iris aperture size control
【Precautions】
-When the maximum/minimum value of each exposure component is the default value of 0, the
set exposure component range will not take effect. The actual maximum/minimum value of each
exposure component is determined by the minimum and maximum values of the AecRoute
exposure decomposition route node.
-When the maximum/minimum value of each exposure component is not 0, the set exposure
component range takes effect. When the set exposure component range does not exceed the
limit of the sensor or ISP, the actual maximum/minimum value of each exposure component is
based on the set exposure component The range shall prevail, and the AecRoute exposure
decomposition route shall be corrected. The maximum/minimum value of the node is changed to
the maximum/minimum value of the exposure component; if the limit of the sensor or ISP is
exceeded, the actual maximum/minimum value of each exposure component is The maximum
and minimum values of AecRoute exposure decomposition route nodes shall prevail.
CalibDb_HdrAeRange_t
【Description】
Define the parameter range of AE HDR mode
【Definition】
【Member】
Member Name Description
Sensor simulation gain range, set the maximum and minimum values,
stGainRange the array 0/1/2 is short frame, medium frame, and long frame
respectively.
ISP digital gain range, set the maximum and minimum values, the
stIspDGainRange
array 0/1/2 is short frame, medium frame and long frame respectively.
Equivalent gain value range of the iris, set the maximum and minimum
stPIrisRange
values
【Precautions】
CalibDb_AeFrmRateAttr_t
【Description】
Define AE frame rate attributes
【Definition】
【Member】
Member
Description
Name
Enable the auto exposure fixed frame rate mode, the default value is FALSE,
isFpsFix that is, the automatic frame rate reduction mode is adopted; when the value is
TRUE, it indicates the fixed frame rate mode.
It is only valid when the frame rate is fixed. When the default value is 0, the
FpsValue driver's default frame rate is always used; when the value is not 0, the set
frame rate value is used.
Uapi_MeAttr_t
【Description】
Manual exposure parameter setting is divided into two sets of parameters: LinearAE and HdrAE
according to the exposure mode.
【Definition】
-CalibDb_LinMeAttr_t
-CalibDb_HdrMeAttr_t
CalibDb_LinMeAttr_t
【Description】
【Definition】
【Member】
Member name Description
IspDGainValue Manual ISP digital gain value, parameter value is limited by ISP
【Precautions】
-This module is only valid when AeOptype = MANUAL. When ManualTimeEn, ManualGainEn,
ManualIspDgainEn, and ManualPIrisEn are all 1, it is manual mode; as long as any one of the
above four is disabled, it is semi-automatic mode; the above four are all 0, it is equivalent to
automatic mode, and the system will report an error.
-In manual/semi-manual mode, manual exposure time and gain will be limited by the
maximum/minimum exposure time and gain in automatic mode. After the range of auto
exposure limit is exceeded, the maximum/minimum value in auto mode will be used instead.
-ManualIrisEn, manual iris enable. When the aperture type is P aperture, only PirisGainValue is
valid; when the aperture type is DC aperture, only DCIrisValue is valid.
-DCIrisValue, directly set the PWM duty cycle value of the motor in manual mode, the value range
is [0, 100]. In manual mode, if it is set to the HoldValue value (that is, the value in the range from
ClosePwmDuty to OpenPwmDuty in AecIrisCtrl), the DC iris aperture remains at the current size;
if the set value is greater than OpenPwmDuty, the iris is in the open state, and the greater the
value, the opening speed The larger the value is; if the set value is less than ClosePwmDuty, the
iris is closed. The smaller the value, the higher the closing speed.
-RV1109/RV1126 currently does not support ISP digital gain, so ManualIspDgainEn and
IspDGainValue are invalid.
CalibDb_HdrMeAttr_t
【Description】
【Definition】
typedef struct CalibDb_HdrMeAttr_s {
bool ManualTimeEn;
bool ManualGainEn;
bool ManualIspDgainEn;
bool ManualIrisEn;
Cam3x1FloatMatrix_t TimeValue;
Cam3x1FloatMatrix_t GainValue;
Cam3x1FloatMatrix_t IspDGainValue;
int PIrisGainValue;
int DCIrisValue;
} CalibDb_HdrMeAttr_t;
【member】
【Precautions】
-This module is only valid when AeOptype = MANUAL. When ManualTimeEn, ManualGainEn,
ManualIspDgainEn, and ManualPIrisEn are all 1, it is manual mode; as long as any one of the
above four is disabled, it is semi-automatic mode; the above four are all 0, it is equivalent to
automatic mode, and the system will report an error.
-TimeValue/GainValue/IspDGainValue are all arrays with 3 members. In Hdr 2 frame mode, the
members of array [0-1] are valid, representing short and long frames respectively; in Hdr 3 frame
mode, the members of array [0-2] are all valid, corresponding to short, medium, and long frames
respectively.
-In manual/semi-manual mode, manual exposure time and gain will be limited by the
maximum/minimum exposure time and gain in automatic mode. After the range of auto
exposure limit is exceeded, the maximum/minimum value in auto mode will be used instead.
-ManualIrisEn, manual iris enable. When the aperture type is P aperture, only PirisGainValue is
valid; when the aperture type is DC aperture, only DCIrisValue is valid.
-DCIrisValue, directly set the PWM duty cycle value of the motor in manual mode, the value range
is [0, 100]. In manual mode, if it is set to the HoldValue value (that is, the value in the range from
ClosePwmDuty to OpenPwmDuty in AecIrisCtrl), the DC iris aperture remains at the current size;
if the set value is greater than OpenPwmDuty, the iris is in the open state, and the greater the
value, the opening speed The larger the value is; if the set value is less than ClosePwmDuty, the
iris is closed. The smaller the value, the higher the closing speed.
-RV1109/RV1126 currently does not support ISP digital gain, so ManualIspDgainEn and
IspDGainValue are invalid.
Uapi_ExpInitExp_t
【Description】
【Definition】
-CalibDb_HdrExpInitExp_t
CalibDb_LinExpInitExp_t
【Description】
【Definition】
【member】
CalibDb_HdrExpInitExp_t
【Description】
【Definition】
【Member】
【Precautions】
-InitTimeValue/InitGainValue/InitIspDGainValue are all arrays with 3 members. In Hdr 2 frame
mode, the members of array [0-1] are valid, representing short and long frames respectively; in
Hdr 3 frame mode, the members of array [0-2] are all valid, corresponding to short, medium, and
long frames respectively.
Uapi_LinAeRouteAttr_t
【Description】
Define AE linear strategy attributes
【Definition】
【Member】
name Mode name, divided into day mode and night mode
【Precautions】
The number of nodes in the exposure decomposition curve is at most 10, and it is
recommended to set at least 6 nodes
The exposure of the node is the product of the exposure time, sensor gain, ISP digital gain,
and iris equivalent gain. The node exposure must increase monotonically, that is, the
exposure of the next node must be greater than the exposure of the previous node. The
first node has the smallest exposure, and the second node has the largest exposure.
The unit of the exposure time component in the node is seconds, and the minimum allowed
value is 0. The actual minimum exposure time code will be internally corrected according to
the sensor limit.
The aperture component only supports P-Iris, not DC-Iris. The P-iris equivalent gain
component is only valid when the Airis automatic iris function is enabled, otherwise the
default iris is fixed to the initial value. The calculation of P-iris equivalent gain is detailed in
the AecIrisCtrl module.
The set exposure decomposition route node is not the final exposure decomposition route.
The actual maximum/minimum value of each exposure component in the system is
determined by the exposure decomposition node and the maximum/minimum value of the
manually configured exposure component. First calibrate the maximum/minimum value of
the node of the exposure decomposition route. When the maximum/minimum value of the
node does not exceed the limit of the sensor or isp, the maximum/minimum value of the
node does not change; when the maximum/minimum value of the node exceeds the sensor
or isp When limiting, the maximum/minimum value of the node is subject to the limit of the
sensor or isp. When the maximum/minimum value of the manually configured exposure
component is 0, the final effective exposure decomposition route is based on the
decomposition route of the first correction; when the maximum/minimum value of the
manually configured exposure component is not 0, and the maximum value is set /When
the small value does not exceed the limit of the sensor or isp, the exposure decomposition
route is corrected for the second time, and the maximum/minimum value of the node is
subject to the manually set range; if the maximum/minimum value of the set exposure
component exceeds the limit of the sensor or isp When, the maximum/minimum value of
the node of the exposure component of the exposure decomposition route is subject to the
first correction result.
If the exposure of adjacent nodes increases, only one exposure component should increase,
and the other exposure components should be fixed. The added weight determines the
allocation strategy of the route. For example, if the gain component increases and other
components are fixed, then the allocation strategy for this route is gain priority.
RV1109/RV1126 currently does not support ISP digital gain, so IspgainDot is invalid.
-AEC_ROUTE_MAX_NODES
-AecExpSeparateName_t
AecExpSeparateName_t
【Description】
Define the name string type
【Definition】
Uapi_HdrAeRouteAttr_t
【Description】
Define AE HDR policy attributes
【Definition】
name Mode name, divided into day mode and night mode
Sensor exposure time node, the unit is s, and the array 0/1/2 is short
HdrTimeDot
frame, medium frame, and long frame respectively
sensor exposure gain node, array 0/1/2 are short frame, medium
HdrGainDot
frame, long frame respectively
Isp digital gain node, array 0/1/2 are short frame, medium frame, long
HdrIspDGainDot
frame
Aperture node, array 0/1/2 are short frame, medium frame, long frame
PIrisDot
respectively
【Precautions】
The number of nodes in the exposure decomposition curve is at most 10, and it is
recommended to set at least 6 nodes
-HdrTimeDot, HdrGainDot, HdrIspDGainDot are defined as a two-dimensional array, the first
dimension represents the number of frames, and the second dimension represents the
exposure component node corresponding to each frame. In the 2-frame HDR mode, only 0
and 1 in the first dimension are valid, indicating short and long frames respectively; in the 3-
frame HDR mode, 0-2 in the first dimension are all valid, indicating short, medium, and long
frames respectively.
The exposure of the node is the product of the exposure time, sensor gain, ISP digital gain,
and iris equivalent gain. The node exposure must increase monotonically, that is, the
exposure of the next node must be greater than the exposure of the previous node. The
first node has the smallest exposure, and the second node has the largest exposure.
The unit of the exposure time component in the node is seconds, and the minimum allowed
value is 0. The actual minimum exposure time code will be internally corrected according to
the sensor limit.
The aperture component only supports P-Iris, not DC-Iris. The P-iris equivalent gain
component is only valid when the Airis automatic iris function is enabled, otherwise the
default iris is fixed to the initial value. The calculation of P-iris equivalent gain is detailed in
the AecIrisCtrl module.
The set exposure decomposition route node is not the final exposure decomposition route.
The actual maximum/minimum value of each exposure component in the system is
determined by the exposure decomposition node and the maximum/minimum value of the
manually configured exposure component. First calibrate the maximum/minimum value of
the node of the exposure decomposition route. When the maximum/minimum value of the
node does not exceed the limit of the sensor or isp, the maximum/minimum value of the
node does not change; when the maximum/minimum value of the node exceeds the sensor
or isp When limiting, the maximum/minimum value of the node is subject to the limit of the
sensor or isp. When the maximum/minimum value of the manually configured exposure
component is 0, the final effective exposure decomposition route is based on the
decomposition route of the first correction; when the maximum/minimum value of the
manually configured exposure component is not 0, and the maximum value is set /When
the small value does not exceed the limit of the sensor or isp, the exposure decomposition
route is corrected for the second time, and the maximum/minimum value of the node is
subject to the manually set range; if the maximum/minimum value of the set exposure
component exceeds the limit of the sensor or isp When, the maximum/minimum value of
the node of the exposure component of the exposure decomposition route is subject to the
first correction result.
If the exposure of adjacent nodes increases, only one exposure component should increase,
and the other exposure components should be fixed. The added weight determines the
allocation strategy of the route. For example, if the gain component increases and other
components are fixed, then the allocation strategy for this route is gain priority.
RV1109/RV1126 currently does not support ISP digital gain, so HdrIspDGainDot is invalid.
【Related definitions】
-AEC_ROUTE_MAX_NODES
-AecExpSeparateName_t
Uapi_LinExpAttr_t
【Description】
【Definition】
CalibDb_AecBacklight_t BackLightConf;
CalibDb_AecOverExpCtrl_t OverExpCtrl;
} CalibDb_LinearAE_Attr_t;
【Member】
Member Name Description
【Precautions】
-SetPoint represents the target brightness value in normal mode, that is, the target brightness
value used when night mode or IR mode is not turned on. NightSetPoint represents the target
brightness value in night mode or IR mode. Night mode and IR mode cannot be turned on at the
same time. The opening of IR mode requires hardware support.
-When DySetPointEn = TRUE, the fixed target brightness values SetPoint and NightSetPoint are
invalid, and the dynamic target brightness value is used; when DySetPointEn = FALSE, the
dynamic target brightness value is invalid, and all scenes always use the same target brightness.
-Exposure deviation EvBias, used to fine-tune the (fixed/dynamic) target brightness value
(SetPoint/IRSetPoint) in special scenes. The actual effective target brightness is
(SetPoint/IRSetPoint)*(1+EvBias/100)
-The tolerance of the automatic exposure screen brightness is Tolerance. When the automatic
exposure converges, the screen brightness value B should be in the range of [real effective target
brightness X (1-Tolerance/100), real effective target brightness X (1+Tolerance/100)] Inside.
-StrategyMode is temporarily invalid.
-CalibDb_AecDynamicSetpoint_t
-CalibDb_AecBacklight_t
-CalibDb_AecOverExpCtrl_t
CalibDb_AecDynamicSetpoint_t
【Description】
Define AE dynamic target value
【Definition】
#define AEC_SETPOINT_MAX_NODES 10
【Member】
Member
Description
Name
name Mode name, divided into day mode and night mode
Dynamic exposure node attribute, the node value is the ratio of the current
ExpValue exposure to the maximum exposure, set in increasing order, the value range
is [0,1]
Dynamic target brightness value node attribute, the node value changes
dynamically with the exposure, the larger the exposure node value, the
DySetpoint
smaller the target brightness node value, and it corresponds to the exposure
node one-to-one
Uapi_HdrExpAttr_t
【Description】
Define AE HDR exposure debugging parameters
【Definition】
【Member】
MframeCtrl Medium frame control parameters, only valid in HDR 3 frame mode
-ExpRatioType is AUTO, using automatic exposure ratio mode. In 2 frame mode, the maximum
exposure ratio of long and short frames is limited by M2SratioMax; in 3 frame mode, the
maximum exposure ratio of short and medium frames is limited by M2SratioMax, and the
maximum exposure ratio of long and medium frames is limited by L2MratioMax. The minimum
exposure ratio is unlimited and must not be less than 1. ExpRatioType is FIX, using a fixed
exposure ratio mode. In 2 frame mode, the exposure ratio of long and short frames is
M2SRatioFix; in 3 frame mode, the exposure ratio of short and medium frames is M2SRatioFix,
and the exposure ratio of long and medium frames is L2MratioFix.
-CalibDb_LFrameCtrl_t
-CalibDb_MFrameCtrl_t
-CalibDb_SFrameCtrl_t
Uapi_ExpQueryInfo_t
【Description】
Define AE exposure parameter query
【Definition】
bool IsConverged;
bool IsExpMax;
float LumaDeviation;
float HdrLumaDeviation[3];
float MeanLuma;
float HdrMeanLuma[3];
float GlobalEnvLux;
float BlockEnvLux[ISP2_RAWAE_WINNUM_MAX];
RKAiqAecExpInfo_t CurExpInfo;
unsigned short Piris;
float LinePeriodsPerField;
float PixelPeriodsPerLine;
float PixelClockFreqMHZ;
} Uapi_ExpQueryInfo_t;
【Member】
Member Name Description
In linear mode, the difference between the target value of AEC and
the actual screen brightness. This value is positive, indicating that
the actual brightness is greater than the target brightness; the value
LumaDeviation
is negative, indicating that the actual brightness is less than the
target brightness; the value is 0, indicating the actual The screen
brightness is within the tolerance range of the target value.
Piris Aperture
The AecSyncTest function sets N groups of different exposure values cyclically, which can test
whether the sensor's exposure time, exposure gain, and the number of effective frames of DCG
switching are correct. It can also be used to test the linearity of exposure to confirm the register
value conversion of exposure time and exposure gain. Whether the formula and related
parameters are correct.
【Description】
The synchronization test function of exposure and statistics supports the setting of N groups of
different exposure values cyclically according to the number of frames at a given interval, which
is used for debugging and verifying the effective number of frames of exposure components
(exposure time, exposure gain) and whether the sensor exposure parameter settings are correct
.
【member】
-AlterExp
According to the different modes, there are two sets of parameters, LinearAE and HdrAE.
If the parameters are set correctly, the LOG example is as follows (only the key information in the
LOG is intercepted). The red frame shows the exposure switching position. It can be seen that
there is no sudden change in the brightness and it matches the exposure value, there is no delay
or linearity in advance. At this time, it can be basically judged that the sensorinfo and System
parameters are set correctly.
Flickers when exposure changes
(1) The number of frames at the effective moment of gain and time in the EXP_DELAY module is
wrong. Common LOG examples are as follows (only the key LOG lines of each frame are
intercepted):
The red frame marks the location of the brightness error. It can be seen that as the exposure
increases or decreases, the corresponding brightness changes in the opposite trend to the
exposure. Through observation, it can be found that the sudden changes in brightness all occur
in the second frame after the exposure time and the exposure gain are changed at the same
time. The change trend of the brightness is consistent with the change trend of the exposure
time, so it can be judged that the effective frame number of gain and time is wrong, and the
changes of the exposure time and the exposure gain do not take effect at the same time,
resulting in the brightness and exposure mismatch. This problem can be solved by modifying the
number of effective frames for gain and time.
(2) The flicker caused by the AE follow-up module, the common LOG example is as follows (only
the key LOG line of each frame is intercepted):
It can be seen from the LOG that during the decreasing process of SMeanLuma and MMeanLuma
on the left, the brightness output by the TmoMeanluma module has undergone abrupt changes.
When this happens, it is necessary to debug in the TMO module.
AWB
Overview
The function of the AWB module is to make the appearance of obtained images under different
colored light sources to be identical to the canonical image under a white light source, by
correcting the images with the white balance gain of the red, green, blue channel .
Important concepts
-Color temperature: The color temperature of a light source is the temperature of an ideal black-
body radiator that radiates light of a color comparable to that of the light source.Color
temperature is a characteristic of visible light . Color temperature is conventionally expressed in
kelvins, using the symbol K, a unit of measure for absolute temperature
When all are the same, the temperature of the black body at this time is called the color
temperature of the light source.
-White balance: Under light sources with different color temperatures, the white response in the
sensor will be blue or red. White balance calculation
The method adjusts the intensity of the three color channels R, G, B to make the white truly
appear.
Function description
The AWB module consists of two parts: WB information statistics and AWB strategy control
algorithm.
【Description】
Set the white balance working mode.
【Syntax】
【Parameter】
【Return value】
0 Success
-If set to manual mode, the white balance gain value is the gain value at present. If you need to
switch the manual mode and set the gain value at the same time, you should use the
rk_aiq_uapi_setMWBGain interface.
【Requirement】
rk_aiq_uapi_getWBMode
【Description】
Get the white balance working mode.
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_lockAWB
【Description】
Lock the current white balance parameters.
【Syntax】
【Parameter】
0 Success
【Requirement】
rk_aiq_uapi_unlockAWB
【Description】
Unlock the locked white balance parameters.
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_setMWBScene
【Description】
Switch to the manual white balance mode and set the white balance scene.
【Syntax】
【Parameter】
Parameter Name Description Input/Output
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_getMWBScene
【Description】
Get the white balance scene.
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_setMWBGain
【Description】
Switch to the manual white balance mode and set manual white balance value at the same time
【Syntax】
XCamReturn rk_aiq_uapi_setMWBGain(const rk_aiq_sys_ctx_t* ctx, rk_aiq_wb_gain_t
*gain);
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_getMWBGain
【Description】
Get the white balance gain coefficient.
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
【Description】
Switch to the manual white balance mode and set the white balance color temperature
parameter.
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_getMWBCT
【Description】
Get the white balance gain coefficient.
【Syntax】
【Parameter】
【Return value】
0 Success
【Description】
Define white balance working mode
【Definition】
【Member】
rk_aiq_wb_scene_t
See above.
rk_aiq_wb_gain_t
See above.
rk_aiq_wb_cct_t
See above.
【Description】
Get white balance properties.
【Syntax】
XCamReturn
rk_aiq_user_api_awb_SetAttrib(const rk_aiq_sys_ctx_t* sys_ctx,
rk_aiq_wb_attrib_t attr);
【Parameter】
Parameter Name Description Input/Output
【Return value】
0 Success
【Requirement】
rk_aiq_user_api_awb_GetAttrib
【Description】
Get white balance attributes.
【Syntax】
XCamReturn
rk_aiq_user_api_awb_GetAttrib(const rk_aiq_sys_ctx_t* sys_ctx,
rk_aiq_wb_attrib_t *attr);
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_user_api_awb_GetCCT
【Description】
Get the white balance color temperature parameter.
【Syntax】
XCamReturn
rk_aiq_user_api_awb_GetCCT(const rk_aiq_sys_ctx_t* sys_ctx, rk_aiq_wb_cct_t
*cct);
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_user_api_awb_QueryWBInfo
【Description】
Obtain the white balance gain coefficient and color temperature.
【Syntax】
XCamReturn
rk_aiq_user_api_awb_QueryWBInfo(const rk_aiq_sys_ctx_t* sys_ctx,
rk_aiq_wb_querry_info_t *wb_querry_info);
【Parameter】
【Return value】
0 Success
【Requirement】
-Header files: rk_aiq_user_api_awb.h, rk_aiq_uapi_awb_int.h
-Library file: librkaiq.so
【Description】
Define white balance working mode
【Definition】
【Member】
rk_aiq_wb_mwb_mode_t
【Description】
Define the type of manual white balance mode
【Definition】
【Member】
RK_AIQ_MWB_MODE_SCENE Scene
rk_aiq_wb_gain_t
【Description】
Define white balance gain parameters
【Definition】
【Member】
rk_aiq_wb_scene_t
【Description】
Define white balance gain parameters
【Definition】
【Member】
RK_AIQ_WBCT_DAYLIGHT Daylight
RK_AIQ_WBCT_CLOUDY_DAYLIGHT Cloudy
RK_AIQ_WBCT_TWILIGHT Twilight
RK_AIQ_WBCT_SHADE Shadow
rk_aiq_wb_cct_t
【Description】
Define white balance gain parameters
【Definition】
【Member】
rk_aiq_wb_mwb_attrib_t
【Description】
Define manual white balance attributes
【Definition】
【Member】
rk_aiq_wb_awb_attrib_t
【Description】
Define auto white balance attributes
【Definition】
typedef struct rk_aiq_wb_awb_attrib_s {
rk_aiq_wb_awb_alg_method_t algMethod;
float tolerance;
unsigned int runInterval;
bool sceneAdjustEn;
bool colorBalanceEn;
bool cagaEn;
bool wbGainAdjustEn;
bool wbGainDaylightClipEn;
bool wbGainClipEn;
} rk_aiq_wb_awb_attrib_t;
【Member】
algMethod Useless
tolerance tolerance
colorBalanceEn Useless
rk_aiq_wb_attrib_t
【Description】
Define white balance properties
【Definition】
【Member】
Member Name Description
rk_aiq_wb_querry_info_t
【Description】
Define white balance query information
【Definition】
【Member】
gain gain
AF
Overview
The function of the AF module refers to the process of adjusting the camera lens to make the
image of the object clear.
Important concepts
-VCM: Voice coil motor
Function description
The AF module is composed of AF information statistics and AF control algorithm.
The following figure shows the block diagram of the AF information statistics module
Among them, ch0/ch1/ch2 correspond to S/M/L frames in hdr mode, and debayer is a merged
frame in hdr mode.
FV Calc uses fixed operators to calculate the horizontal and vertical edge information of the
image.
The output of window A mainly contains 15*15 FV information. The luminance information is not
provided. You need to set the AE window to be consistent with AF, and then directly use the AE
15x15 luminance statistics.
After that, you can start a separate thread to call rk_aiq_uapi_sysctl_get3AStatsBlk to obtain
af/ae/awb statistics. The corresponding structure of af statistics is rk_aiq_af_algo_stat_t.
The user AF algorithm refers to the af statistics to complete the calculation of the target zoom
and focus positions, and then calls the Lens Driver to move the lens to the specified position.
Reference Code
// Set AF meas config
rk_aiq_user_api_af_SetAttrib(ctx, &attr);
while (1)
{
rk_aiq_isp_stats_t *stats_ref = NULL;
【Description】
Configure AF hardware statistics module, which is generally called when the af algorithm is
implemented by itself.
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
-Header file: rk_aiq_user_api_imgproc.h
-Library file: librkaiq.so
rk_aiq_uapi_setFocusMode
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_getFocusMode
【Syntax】
【Parameter】
【Return value】
0 Success
rk_aiq_uapi_setFixedModeCode
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_getFixedModeCode
【Syntax】
【Parameter】
【Return value】
Return Value Description
0 Success
【Requirement】
rk_aiq_uapi_setFocusWin
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_getFocusWin
【Syntax】
【Parameter】
0 Success
【Requirement】
rk_aiq_uapi_lockFocus
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_unlockFocus
【Syntax】
【Parameter】
【Return value】
Return Value Description
0 Success
【Requirement】
rk_aiq_uapi_oneshotFocus
[Description] Trigger a single focus search. The af will not tracking after the operation.
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_manualTrigerFocus
[Description] Manually trigger the focus. The af will tracking after the operation.
【Syntax】
【Parameter】
【Return value】
Return Value Description
0 Success
【Requirement】
rk_aiq_uapi_trackingFocus
【Description】
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_setVcmCfg
【Syntax】
【Parameter】
0 Success
【Requirement】
rk_aiq_uapi_getVcmCfg
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_setOpZoomPosition
【Syntax】
【Parameter】
Parameter Name Description Input/Output
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_getOpZoomPosition
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
【Description】
Define AF hardware statistics configuration
【Definition】
typedef struct {
unsigned char contrast_af_en;
unsigned char rawaf_sel;
【Member】
Member
Description
Name
Select the source channel for AF hardware statistics, the value range is 0-
3, which corresponds to the long/medium/short/composite video frame
rawaf_sel channel selection of hdr mode. Generally, the medium frame channel is
selected for AF, and the non-hdr mode is set to 0, and the hdr mode is set
to 1
The horizontal coordinate of the first pixel in the upper left corner of
wina_h_offs
wina (main window), the value must be greater than or equal to 2
The vertical coordinate of the first pixel in the upper left corner of wina
wina_v_offs
(main window), the value must be greater than or equal to 1
window width of wina (main window), this value must be smaller than
wina_h_size
image width-2-wina_h_offs and must be a multiple of 15;
window height of wina (main window), this value must be smaller than
wina_v_size
image height-2-wina_v_offs and must be a multiple of 15;
The horizontal coordinate of the first pixel in the upper left corner of
winb_h_offs
winb (independent window), the value must be greater than or equal to 2
The vertical coordinate of the first pixel in the upper left corner of winb
winb_v_offs
(independent window), the value must be greater than or equal to 1
The y value of gamma table, the value range is 0-1023; the x coordinate
gamma_y segment is 0 to 1023: 16 16 16 16 32 32 32 32 64 64 64 128 128 128 128
128
Gaussian filter 3x3 coefficient h0, the middle coefficient value of the 3x3
gaus_h0
coefficient, the value range is 0-255
Gaussian filter 3x3 coefficient h1, the four coefficient values of the upper,
gaus_h1 lower, left and right of the middle coefficient of the 3x3 coefficient, the
value range is 0-127
Gaussian filter 3x3 coefficient h2, other coefficient values in the 3x3
gaus_h2
coefficient, the value range is 0-127
Member
Description
Name
The shit bit value of the luminance value will shift the luminance value to
lum_var_shift the right according to this value to avoid overflow of the obtained
sharpness value. The value range is 0-7
The shit bit value of the sharpness value. The sharpness value will be
afm_var_shift shifted to the right according to this value to avoid overflow of the
obtained sharpness value. The value range is 0-7
opMode_t
【Description】
Define AF work mode
【Definition】
【Member】
Member
Description
Name
Semi-auto focus mode, perform auto focus once after calling set zoom
OP_SEMI_AUTO
position api
rk_aiq_lens_vcmcfg
【Definition】
typedef struct {
int start_ma;
int rated_ma;
int step_mode;
} rk_aiq_lens_vcmcfg;
【Member】
Member
Description
Name
The step control and step period values used in linear slope control
step_mode
mode
【Description】
Set the AF attribute
【Syntax】
XCamReturn
rk_aiq_user_api_af_SetAttrib(const rk_aiq_sys_ctx_t* sys_ctx, rk_aiq_af_attrib_t
attr);
【Parameter】
【Return value】
0 Success
【Requirement】
Header files:rk_aiq_user_api_awb.h、rk_aiq_uapi_awb_int.h
Library files:librkaiq.so
rk_aiq_user_api_af_GetAttrib
【Description】
Get the AF attribute
【Syntax】
XCamReturn
rk_aiq_user_api_af_GetAttrib(const rk_aiq_sys_ctx_t* sys_ctx, rk_aiq_af_attrib_t
*attr);
【Parameter】
【Return value】
0 Success
【Requirement】
Header files:rk_aiq_user_api_af.h、rk_aiq_uapi_af_int.h
Library files:librkaiq.so
【Description】
Define the af working mode
【Definition】
【Member】
Member Name Description
rk_aiq_af_attrib_t
【Description】
Focus configuration information
【Definition】
bool contrast_af;
bool laser_af;
bool pdaf;
bool GammaEnable;
bool GausEnable;
int h_offs;
int v_offs;
unsigned int h_size;
unsigned int v_size;
rk_aiq_af_algo_meas_t manual_meascfg;
} rk_aiq_af_attrib_t;
【Member】
Member Name Description
End code value in macro focus mode, the focus range is 0-this
macroModeDefCode
value
infinityModeDefCode The initial code value in infinity focus mode, the focus range is -64
other instructions
VCM driver verification
1) Whether the starting current and termination current of the vcm drive are set correctly,
First, obtain the relevant information about the starting current and the termination current from
the module factory.
Next, select several modules to confirm whether the information is correct, the method is as
follows:
Set the starting current and ending current in dts to the maximum range that VCM can support.
The focus mode is switched to manual mode, and the vcm position is gradually adjusted from 64.
When the lens starts to move and the far focus object (above 10 meters) is clear, the current
position value is recorded.
Continue to adjust the vcm position, when the close focus object (10cm or 20cm) is clear, record
the current position value,
2) Move vcm in different directions, and whether the final stay position is stable.
Switch the focus mode to manual mode, select a position, move from 0 to this position and from
64 to this position, compare whether the two image sharpness is the same, and whether the AF
statistics are close.
Normal mode improves focus speed
When the sensor is not directly connected to the isp through vicap and uses non-HDR mode, you
can set export normal_no_read_back=1 before the application starts to enable the pass-through
mode,
In this way, the sensor data does not need to be stored in the ddr and then read back to the isp,
which reduces the effective AF statistical value acquisition time and improves the focusing speed.
IMGPROC
Overview
imgproc refers to the module that affects the image effect.
FEC
Function description
The squint distortion, pincushion, barrel distortion, etc. caused by the distortion of the optical
system and the electronic scanning system may cause the geometric characteristics of the image
to be distorted. Image distortion correction is a process of transforming a distorted image into an
ideal image in a certain transformation manner.
Important concepts
-Distortion actually refers to the distortion of the photographed object relative to the object itself.
【Syntax】
【Parameter】
en enable Input
【Return value】
Return Value Description
0 Success
【Note】
-This interface can only be called before rk_aiq_uapi_sysctl_prepare, that is, it cannot support
dynamic switch while AIQ is running. If you need dynamic switch distortion correction effect, you
can use the rk_aiq_uapi_setFecBypass interface.
-After enabling fisheye distortion correction, DDR bandwidth and CPU load will increase, which
may affect the camera's capture frame rate.
【Requirement】
rk_aiq_uapi_setFecCorrectDirection
【Syntax】
XCamReturn
rk_aiq_uapi_setFecCorrectDirection(const rk_aiq_sys_ctx_t* ctx, const
fec_correct_direction_t direction)
【Parameter】
【Definition】
【Member】
【Return value】
Return Value Description
0 Success
【Note】
-This interface can only be called before rk_aiq_uapi_sysctl_prepare, that is, it cannot be call while
AIQ is running.
【Requirement】
rk_aiq_uapi_setFecBypass
【Description】 Bypass fisheye distortion correction function. The data also be processd by FEC,
but correction strength is equivalent to no correction.
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_setFecCorrectLevel
【Syntax】
【Parameter】
Parameter Name Description Input/Output
【Return value】
0 Success
【Requirement】
【Description】
Set the fec attribute.
【Syntax】
XCamReturn
rk_aiq_user_api_afec_SetAttrib(const rk_aiq_sys_ctx_t* sys_ctx,
rk_aiq_fec_attrib_t attr);
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_user_api_afec_GetAttrib
【Description】
Get the fec attribute.
【Syntax】
XCamReturn
rk_aiq_user_api_afec_GetAttrib(const rk_aiq_sys_ctx_t* sys_ctx,
rk_aiq_fec_attrib_t attr);
【Parameter】
【Return value】
0 Success
【Requirement】
【Description】
fec correction direction
【Definition】
【Member】
rk_aiq_fec_attrib_t
【Description】
fec attribute configuration
【Definition】
【Member】
en Enable/Disable fec
Performance optimization
-The throughput rate of the fec module is affected by the ddr bandwidth. The throughput
rate of the fec module that without optimization is show in table bellow:
The kernel dts modifies ispp to use cma buffer, and the size is allocated according to
the actual sensor resolution
-Kernel dts modify ispp to use cma buffer, and size is allocated
according to the actual sensor resolutiondiff --git
a/arch/arm/boot/dts/rv1126-ipc.dtsi b/arch/arm/boot/dts/rv1126-ipc.dtsi
index d9c69e9..3580f0b 100644
--- a/arch/arm/boot/dts/rv1126-ipc.dtsi
+++ b/arch/arm/boot/dts/rv1126-ipc.dtsi
@@ -169,7 +169,7 @@
};
&rkispp_mmu {
- status = "okay";
+ status = "disabled";
};
&rkvdec {
diff --git a/arch/arm/boot/dts/rv1126.dtsi b/arch/arm/boot/dts/rv1126.dtsi
index 59b97244..77a8f81 100644
--- a/arch/arm/boot/dts/rv1126.dtsi
+++ b/arch/arm/boot/dts/rv1126.dtsi
@@ -320,7 +320,7 @@
isp_reserved: isp {
compatible = "shared-dma-pool";
reusable;
- size = <0x10000000>;
+ size = <0x20000000>;
};
ramoops: ramoops@8000000 {
@@ -1962,7 +1962,8 @@
assigned-clock-rates = <500000000>, <250000000>,
<400000000>;
power-domains = <&power RV1126_PD_ISPP>;
- iommus = <&rkispp_mmu>;
+ /* iommus = <&rkispp_mmu>; */
+ memory-region = <&isp_reserved>;
status = "disabled";
};
The app confirms that the Streaming I/O method is the Memory Mapping method
memset(&reqbuf, 0, sizeof(reqbuf));
reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
reqbuf.memory = V4L2_MEMORY_MMAP;
reqbuf.count = 20;
The distortion correction method of this scheme is: ldch correction x direction + fec
correction y direction
LDCH
Function description
The squint distortion, pincushion, barrel distortion, etc. caused by the distortion of the optical
system and the electronic scanning system may cause the geometric characteristics of the image
to be distorted. Image distortion correction is a process of transforming a distorted image into an
ideal image in a certain transformation manner.
【Parameter】
en enable Input
【Return value】
Return Value Description
0 Success
【Requirement】
rk_aiq_uapi_setLdchCorrectLevel
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
【Description】
Set the fec attribute.
【Syntax】
XCamReturn
rk_aiq_user_api_aldch_SetAttrib(const rk_aiq_sys_ctx_t* sys_ctx,
rk_aiq_ldch_attrib_t attr);
【Parameter】
Parameter Name Description Input/Output
【Return value】
0 Success
【Requirement】
rk_aiq_user_api_aldch_GetAttrib
【Description】
Get the fec attribute.
【Syntax】
XCamReturn
rk_aiq_user_api_aldch_GetAttrib(const rk_aiq_sys_ctx_t* sys_ctx,
rk_aiq_ldch_attrib_t attr);
【Parameter】
【Return value】
0 Success
【Requirement】
【Description】
ldch attribute configuration
【Definition】
【Member】
en Enable/Disable ldch
HDR
Function description
HDR (High Dynamic Range Imaging, HDRI or HDR), in computer graphics and photography, is
achieved through calculation using existing equipment to obtain a larger dynamic range than
ordinary digital imaging technology (that is, larger The difference between light and shade) is a
technique for images. The purpose of HDR is to correctly restore the luminance ratio of the real
scene that exceeds the dynamic range of the existing equipment.
Important concepts
-The module contains two parts: Merge and Tmo, Tmo can be used alone, Merge needs to be
used together with Tmo
【Syntax】
【Parameter】
【Return value】
0 Success
rk_aiq_uapi_getHDRMode
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_setMHDRStrth
【Syntax】
【Parameter】
on switch input
Strength
level Input
Value range: [1,100]
【Return value】
Return Value Description
0 Success
【Requirement】
rk_aiq_uapi_getMHDRStrth
【Syntax】
【Parameter】
on switch output
【Return value】
0 Success
【Requirement】
【Description】
Define white balance working mode
【Definition】
typedef enum hdr_OpMode_s {
HDR_OpMode_Api_OFF = 0,
HDR_OpMode_Auto = 1,
HDR_OpMode_MANU = 2,
HDR_OpMode_SET_LEVEL = 3,
HDR_OpMode_DarkArea = 4,
HDR_OpMode_Tool = 5,
} hdr_OpMode_t;
【Member】
HDR_OpMode_SET_LEVEL Fast mode, adjust the HDR effect by setting the level
HDR_OpMode_DarkArea Dark area boost mode, can be used in both linear and HDR
FastMode_t
【Description】
Define HDR fast mode attributes
【Definition】
【Member】
DarkArea_t
【Description】
Define HDR dark area boost mode attributes
【Definition】
【Member】
Member Name Description
【Description】
Set HDR software properties.
【Syntax】
XCamReturn
rk_aiq_uapi_ahdr_SetAttrib(RkAiqAlgoContext* ctx,
ahdr_attrib_t attr,
bool need_sync);
【Parameter】
【Return value】
0 Success
【Requirement】
【Description】
rk_aiq_uapi_ahdr_GetAttrib
【Description】
Obtain HDR software properties.
【Syntax】
XCamReturn
rk_aiq_uapi_ahdr_GetAttrib(RkAiqAlgoContext* ctx,
ahdr_attrib_t attr,
bool need_sync);
【Parameter】
Parameter Name Description Input/Output
【Return value】
0 Success
【Requirement】
【Description】
【Description】
Define HDR working mode
【Definition】
【Member】
HDR_OpMode_SET_LEVEL Fast mode, adjust the HDR effect by setting the level
HDR_OpMode_DarkArea Dark area boost mode, both linear and HDR can be used
mgeCtrlData_t
【Description】
Define automatic Merge parameter attributes
【Definition】
【Member】
amgeAttr_t
【Description】
Define automatic merge properties
【Definition】
【Member】
tmoCtrlData_t
【Description】
Define automatic Tmo parameter properties
【Definition】
【Member】
AGlobalTmoData_t
【Description】
Define Global Tmo parameter attributes in automatic Tmo
【Definition】
【Member】
Member Name Description
en Function switch
atmoAttr_t
【Description】
Define automatic Tmo attributes
【Definition】
【Member】
ahdrAttr_t
【Description】
Define automatic HDR attributes
【Definition】
mmgeAttr_t
【Description】
Define the Merge working mode in manual HDR
【Definition】
【Member】
mtmoAttr_t
【Description】
Define Tmo working mode in manual HDR
【Definition】
【Member】
mhdrAttr_t
【Description】
Define manual HDR working mode
【Definition】
【Member】
FastMode_t
【Description】
Define HDR fast mode attributes
【Definition】
【Member】
DarkArea_t
【Description】
Define HDR dark area boost mode attributes
【Definition】
【Member】
CurrCtlData_t
【Description】
Define the attributes of the current control quantity
【Definition】
【Member】
Member Name Description
ISO ISO
CurrRegData_t
【Description】
Define the attributes of the current controlled quantity
【Definition】
【Member】
Member Name Description
CalibDb_HdrMerge_t
【Description】
Define the Merge attribute in stTool
【Definition】
【Member】
Member Name Description
TMO_en_t
【Description】
Define the switch attributes of Tmo in stTool
【Definition】
【Member】
name name
en Function swtich
GlobalLuma_t
【Description】
Define the overall brightness properties of Tmo in stTool
【Definition】
name name
ISO ISO
DetailsHighLight_t
【Description】
Define the brightness attribute of the highlight of the Tmo in stTool
【Definition】
【Member】
name name
DetailsLowLight_t
【Description】
Define the low-light brightness properties of Tmo in stTool
【Definition】
typedef struct DetailsLowLight_s{
char name[CALIBDB_MAX_MODE_NAME_LENGTH];
float DetailsLowLightMode;
float FocusLuma[13];
float DarkPdf[13];
float ISO[13];
float Tolerance;
float detailsLowLight[13];
} DetailsLowLight_t;
【Member】
name name
ISO ISO
LocalTMO_t
【Description】
Define the Local Tmo attribute of Tmo in stTool
【Definition】
【Member】
Member Name Description
name name
‘GlobaTMO_t
【Description】
Define the Global Tmo attribute of Tmo in stTool
【Definition】
【Member】
name name
en Function switch
CalibDb_HdrTmo_t
【Description】
Define the Tmo attribute in stTool
【Definition】
typedef struct CalibDb_HdrTmo_s{
TMO_en_t en[CALIBDB_MAX_MODE_NUM];
GlobalLuma_t luma[CALIBDB_MAX_MODE_NUM];
DetailsHighLight_t HighLight[CALIBDB_MAX_MODE_NUM];
DetailsLowLight_t LowLight[CALIBDB_MAX_MODE_NUM];
LocalTMO_t LocalTMO[CALIBDB_MAX_MODE_NUM];
GlobaTMO_t GlobaTMO[CALIBDB_MAX_MODE_NUM];
float damp;
} CalibDb_HdrTmo_t;
【Member】
en Function switch
CalibDb_Ahdr_Para_t
【Description】
Define stTool properties
【Definition】
【Member】
hdrAttr_t
【Description】
Define HDR attributes
【Definition】
typedef struct hdrAttr_s {
hdr_OpMode_t opMode;
ahdrAttr_t stAuto;
mhdrAttr_t stManual;
FastMode_t stSetLevel;
DarkArea_t stDarkArea;
CurrCtlData_t CtlInfo;
CurrRegData_t RegInfo;
CalibDb_Ahdr_Para_t stTool;
} hdrAttr_t;
【Member】
stSetLevel HDR fast mode, adjust the HDR effect by setting the level
stDarkArea Dark area enhancement mode, both linear and HDR can be used
Noise Removal
Function description
Image noise refers to unnecessary or redundant interference information existing in image data.
Image denoising is the process of reducing noise in digital images.
【Syntax】
【Parameter】
【Return value】
Return Value Description
0 Success
【Requirement】
rk_aiq_uapi_getNRMode
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_setANRStrth
【Syntax】
【Parameter】
0 Success
【Requirement】
rk_aiq_uapi_getANRStrth
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_setMSpaNRStrth
【Syntax】
【Parameter】
Parameter Name Description Input/Output
on switch input
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_getMSpaNRStrth
【Syntax】
【Parameter】
on switch output
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_setMTNRStrth
【Syntax】
XCamReturn rk_aiq_uapi_setMTNRStrth(const rk_aiq_sys_ctx_t* ctx, bool on,
unsigned int level);
【Parameter】
on switch input
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_getMTNRStrth
【Syntax】
【Parameter】
on switch output
【Return value】
0 Success
【Requirement】
【Description】
Set the properties of the denoising algorithm.
【Syntax】
XCamReturn
rk_aiq_user_api_anr_SetAttrib(const rk_aiq_sys_ctx_t* sys_ctx,
rk_aiq_nr_attrib_t *attr);
【Parameter】
【Return value】
0 Success
【Note】
-This attr attribute parameter is the final parameter structure used by the software
algorithm, not the corresponding parameter structure of IQ xml. Some parameters of IQ
also need to be converted into algorithm values. But the parameters of the two are basically
the same, the difference is small. It is recommended to use rk_aiq_user_api_anr_SetIQPara
to set the automatic parameters, so that the parameters correspond to the IQ parameters
one-to-one.
【Requirement】
rk_aiq_user_api_anr_GetAttrib
【Description】
Get the properties of the denoising algorithm.
【Syntax】
XCamReturn
rk_aiq_user_api_anr_GetAttrib(const rk_aiq_sys_ctx_t* sys_ctx,
rk_aiq_nr_attrib_t *attr);
【Parameter】
Parameter Name Description Input/Output
【Return value】
0 Success
【Note】
-This attr attribute parameter is the final parameter structure used by the software algorithm,
not the corresponding parameter structure of IQ xml. Some parameters of IQ also need to be
converted into algorithm values. But the parameters of the two are basically the same, the
difference is small. It is recommended to use rk_aiq_user_api_anr_GetIQPara to obtain automatic
parameters, so that the parameters and IQ parameters are one-to-one correspondence.
【Requirement】
rk_aiq_user_api_anr_SetIQPara
【Description】
Set the denoising IQxml parameters.
【Syntax】
XCamReturn
rk_aiq_user_api_anr_SetIQPara(const rk_aiq_sys_ctx_t* sys_ctx,
rk_aiq_nr_IQPara_t *para);
【Parameter】
【Return value】
0 Success
【Note】
-This para attribute parameter is the corresponding parameter structure of IQ xml.
【Requirement】
rk_aiq_user_api_anr_GetIQPara
【Description】
Get denoising IQxml parameters.
【Syntax】
XCamReturn
rk_aiq_user_api_anr_GetIQPara(const rk_aiq_sys_ctx_t* sys_ctx,
rk_aiq_nr_IQPara_t *para);
【Parameter】
【Return value】
0 Success
【Note】
【Requirement】
【Description】
Define the parameters of the denoising module
【Definition】
typedef struct rk_aiq_nr_attrib_s {
ANROPMode_t eMode;
ANR_Auto_Attr_t stAuto;
ANR_Manual_Attr_t stManual;
} rk_aiq_nr_attrib_t;
【Member】
ANROPMode_t
【Description】
Define the mode of the denoising module
【Definition】
【Member】
ANR_Auto_Attr_t
【Description】
Define the automatic properties of the denoising module
【Definition】
//mfnr
int mfnrEn;
RKAnr_Mfnr_Params_t stMfnrParams;
RKAnr_Mfnr_Params_Select_t stMfnrParamSelect;
//ynr
int ynrEn;
RKAnr_Ynr_Params_t stYnrParams;
RKAnr_Ynr_Params_Select_t stYnrParamSelect;
//uvnr
int uvnrEn;
RKAnr_Uvnr_Params_t stUvnrParams;
RKAnr_Uvnr_Params_Select_t stUvnrParamSelect;
RKAnr_Mfnr_Dynamic_t stMfnr_dynamic;
} ANR_Auto_Attr_t;
【Member】
【Description】
Define the manual properties of the denoising module
【Definition】
int mfnrEn;
RKAnr_Mfnr_Params_Select_t stMfnrParamSelect;
int ynrEn;
RKAnr_Ynr_Params_Select_t stYnrParamSelect;
int uvnrEn;
RKAnr_Uvnr_Params_Select_t stUvnrParamSelect;
} ANR_Manual_Attr_t;
【Member】
rk_aiq_nr_IQPara_t
【Description】
Define the IQ parameter structure of the denoising module
【Definition】
typedef struct rk_aiq_nr_IQPara_s {
int module_bits;
To
CalibDb_BayerNr_t stBayernrPara;
CalibDb_MFNR_t stMfnrPara;
CalibDb_UVNR_t stUvnrPara;
CalibDb_YNR_t stYnrPara;
} rk_aiq_nr_IQPara_t;
【Member】
Member
Description
Name
nr4 modules corresponding to the flag bit, according to the flag bit to set
module_bits
each module IQ parameters
rk_aiq_nr_module_t
【Description】
Define the setting of the denoising module IQ parameters correspond to the corresponding flag
bit of the module, each module can be set separately or set uniformly, and it is recognized by this
flag bit.
【Definition】
【Member】
CalibDb_BayerNr_t
【Description】
IQ parameter structure of bayernr module
【Definition】
【Member】
Member
Description
Name
CalibDb_BayerNr_ModeCell_t
【Description】
IQ parameter structure of bayernr module
【Definition】
【Member】
Member
Description
Name
The names of the different modes of the bayernr module, three modes of
name
normal, hdr, and gray
CalibDb_BayerNR_Params_t
【Description】
Define the IQ parameters of the bayernr module.
【Definition】
【Member】
Member
Description
Name
sensor hcg, lcg mode, if these two modes are not available, the
sensor_mode
parameters in lcg are used by default
Single frame noise reduction intensity, the value range is [0, 15.9]. The
filtPara
larger the value, the stronger the noise reduction.
Adjust the noise reduction intensity according to the pixel brightness, this
luLevel
is the x-axis brightness, and 8 points are divided from 0-255.
Segmented noise threshold, the larger the lamda, the larger the
lamda
adjustment range. The value range is [0 16383].
The
The remaining parameters are not used by the module at present and are
remaining
ignored directly.
parameters
CalibDb_MFNR_t
【Description】
mfnr module IQ parameter structure
【Definition】
【Member】
Member
Description
Name
Whether to support the local gain mode of the previous stage. 1: Pre-stage
local_gain_en
local gain mode, 0: Global gain mode
mode_3to1 Whether to use 3to1 mode. 1: Use 3to1 mode, 0: Use 2to1 mode.
Other
Parameters are not currently used
parameters
CalibDb_MFNR_ModeCell_t
【Description】
mfnr module IQ parameter structure
【Definition】
【Member】
Member
Description
Name
name Different mode names of mfnr module, three modes of normal, hdr, gray
dynamic Turn on or off the mfnr function dynamically according to the exposure.
CalibDb_MFNR_Dynamic_t
【Description】
mfnr module IQ parameter structure
【Definition】
【Member】
Member
Description
Name
Exposure corresponds to the low iso threshold. When it is lower than the
lowth_iso low threshold of the exposure iso and the following exposure time, mfnr is
turned off.
lowth_time The exposure corresponds to the low threshold of the exposure time.
Exposure corresponds to the iso high threshold. When it is higher than the
highth_iso high threshold of the exposure iso and the following exposure time, mfnr is
turned on.
CalibDb_MFNR_Setting_t
【Description】
mfnr module IQ parameter structure
【Definition】
typedef struct CalibDb_MFNR_Setting_s {
char snr_mode[CALIBDB_NR_SHARP_NAME_LENGTH];
char sensor_mode[CALIBDB_NR_SHARP_MODE_LENGTH];
struct CalibDb_MFNR_ISO_s mfnr_iso[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
} CalibDb_MFNR_Setting_t;
【Member】
Member
Description
Name
Under the mfnr module, there are HSNR and LSNR, corresponding to two
snr_mode
configurations such as hcg and lcg.
CalibDb_MFNR_ISO_s
【Description】
mfnr module IQ parameter structure
【Definition】
struct CalibDb_MFNR_ISO_s {
float iso;
float weight_limit_y[4];
float weight_limit_uv[3];
float ratio_frq[4];
float luma_w_in_chroma[3];
double noise_curve[5];
double noise_curve_x00;
float y_lo_noiseprofile[4];
float y_hi_noiseprofile[4];
float y_lo_bfscale[4];
float y_hi_bfscale[4];
float y_lumanrpoint[6];
float y_lumanrcurve[6];
float y_denoisestrength;
float uv_lo_noiseprofile[3];
float uv_hi_noiseprofile[3];
float uv_lo_bfscale[3];
float uv_hi_bfscale[3];
float uv_lumanrpoint[6];
float uv_lumanrcurve[6];
float uv_denoisestrength;
float y_lo_lvl0_gfdelta[6];
float y_hi_lvl0_gfdelta[6];
float y_lo_lvl1_gfdelta[3];
float y_hi_lvl1_gfdelta[3];
float y_lo_lvl2_gfdelta[3];
float y_hi_lvl2_gfdelta[3];
float y_lo_lvl3_gfdelta[3];
float y_hi_lvl3_gfdelta[3];
float uv_lo_lvl0_gfdelta[6];
float uv_hi_lvl0_gfdelta[6];
float uv_lo_lvl1_gfdelta[3];
float uv_hi_lvl1_gfdelta[3];
float uv_lo_lvl2_gfdelta[3];
float uv_hi_lvl2_gfdelta[3];
float lvl0_gfsigma[6];
float lvl1_gfsigma[3];
float lvl2_gfsigma[3];
float lvl3_gfsigma[3];
【Member】
Member Name Description
The low and high boundary when judging the low-frequency layer 0
ratio_frq
texture value of luminance/chroma.
The remaining
Currently not used.
parameters
CalibDb_UVNR_t
【Description】
uvnr module IQ parameter structure
【Definition】
【Member】
Member
Description
Name
CalibDb_UVNR_ModeCell_t
【Description】
uvnr module IQ parameter structure
【Definition】
Member
Description
Name
name Different mode names of uvnr module, three modes of normal, hdr, gray
CalibDb_UVNR_Params_t
【Description】
uvnr module IQ parameter structure
【Definition】
float step1_median_ratio[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step1_bf_sigmaR[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step1_bf_uvgain[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step1_bf_ratio[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step2_median_ratio[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step2_bf_sigmaR[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step2_bf_uvgain[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step2_bf_ratio[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step3_bf_sigmaR[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step3_bf_uvgain[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step3_bf_ratio[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float kernel_3x3[3];
float kernel_5x5[5];
float kernel_9x9[8];
float kernel_9x9_num;
float step1_bf_isRowIIR[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step1_bf_isYcopy[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step2_nonExt_block[4];
float step2_nonMed[4];
float step2_nonBf[4];
float step2_downSample_w[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step2_downSample_h[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step2_downSample_meansize[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step2_median_size[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step2_median_IIR[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step2_bf_size[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step2_bf_sigmaD[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step2_bf_isRowIIR[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step2_bf_isYcopy[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step3_nonBf3[4];
float step3_bf_size[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step3_bf_isRowIIR[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step3_bf_isYcopy[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float step3_bf_sigmaD[CALIBDB_NR_SHARP_MAX_ISO_LEVEL];
float sigma_adj_luma[9];
float sigma_adj_ratio[9];
float threshold_adj_luma[9];
float threshold_adj_thre[9];
} CalibDb_UVNR_Params_t;
【Member】
Member Name Description
Under the mfnr module, there are HSNR and LSNR, corresponding
snr_mode
to two configurations such as hcg and lcg.
Gradient scale factor, the smaller the value, the more color loss is in
step0_uvgrad_ratio
the place where the gradient is large. The value range is [1 63].
Gradient weighting factor, the larger the value, the more the color
step0_uvgrad_offset
loss of the image. The value range is [0, 1].
Bilateral 1 filter sigma scale factor, the greater the value, the greater
step1_bf_sigmaR
the denoising.
The uv scale factor of bilateral 1, that is, the y channel guides the uv
step1_bf_uvgain
channel denoising weight, the value range is [0, 7.9].
Bilateral 2 filter sigma scale factor, the greater the value, the greater
step2_bf_sigmaR
the denoising.
Bilateral 3 filter sigma scale factor, the greater the value, the greater
step3_bf_sigmaR
the denoising.
The uv scale factor of bilateral 3, that is, the y channel guides the uv
step3_bf_uvgain
channel denoising weight, the value range is [0, 7.9].
The remaining
Currently not used.
parameters
CalibDb_YNR_t
【Description】
ynr module IQ parameter structure
【Definition】
【Member】
Member
Description
Name
CalibDb_YNR_ModeCell_t
【Description】
ynr module IQ parameter structure
【Definition】
【Member】
Member
Description
Name
name Different mode names of ynr module, three modes of normal, hdr, gray
Under the ynr module, there are two configurations corresponding to lcg
setting
and hcg.
CalibDb_YNR_Setting_t
【Description】
ynr module IQ parameter structure
【Definition】
【Member】
Member
Description
Name
Under the ynr module, there are HSNR and LSNR, corresponding to two
snr_mode
configurations such as hcg and lcg.
CalibDb_YNR_ISO_t
【Description】
ynr module IQ parameter structure
【Definition】
float lo_lumaPoint[6];
float lo_lumaRatio[6];
float lo_directionStrength;
float lo_bfScale[4];
float imerge_ratio;
float imerge_bound;
float denoise_weight[4];
float hi_lumaPoint[6];
float hi_lumaRatio[6];
float hi_bfScale[4];
float hwith_d[4];
float hi_denoiseStrength;
float hi_detailMinAdjDnW;
float hi_denoiseWeight[4];
float y_luma_point[6];
float hgrad_y_level1[6];
float hgrad_y_level2[6];
float hgrad_y_level3[6];
float hgrad_y_level4[6];
float hi_soft_thresh_scale[4];
} CalibDb_YNR_ISO_t;
【Member】
Member Name Description
Noise sigma curve. The noise curve value calibrated by the ynr
sigma_curve
module calibration tool.
Defog
Function description
【Description】
【Syntax】
【Parameter】
0 Success
【Requirement】
rk_aiq_uapi_getDhzMode
【Description】
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_setMDhzStrth
【Description】
【Syntax】
【Parameter】
Parameter Name Description Input/Output
on switch input
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_getMDhzStrth
【Description】
【Syntax】
【Parameter】
on switch output
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_enableDhz
【Description】
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_disableDhz
【Description】
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
ACM (Auto Color Managment) provides basic preference color adjustment function,
Adjust the degree, contrast, saturation and chroma to achieve the adjustment of the color
preference.
API Reference
rk_aiq_uapi_setBrightness
【Description】
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_getBrightness
【Description】
【Syntax】
【Parameter】
Parameter Name Description Input/Output
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_setContrast
【Description】
【Syntax】
【Parameter】
Contrast level
level Value range: [0,255] Input
The default value is 128
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_getContrast
【Description】
Get the contrast level.
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_setSaturation
【Description】
【Syntax】
【Parameter】
Saturation level
level Value range: [0,255] Input
The default value is 128
【Return value】
0 Success
rk_aiq_uapi_getSaturation
【Description】
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_setHue
【Description】
【Syntax】
【Parameter】
Chroma level
level Value range: [0,255] Input
The default value is 128
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_getHue
【Description】
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
Sharpen
Function description
The Sharpen module is used to enhance the sharpness of the image, including adjusting the
sharpening properties of the edge of the image and enhancing the details of the image
And texture.
【Syntax】
【Parameter】
Sharpening level
level Value range: [0,100] Input
The default value is 50
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_getSharpness
【Description】
【Syntax】
【Parameter】
【Return value】
Return Value Description
0 Success
【Requirement】
Gamma
Function description
Gamma performs a non-linear conversion of the luminance space of the image to adapt to the
output device.
【Description】
Set gamma.
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
【Description】
The gamma curve in Api is not switched according to the scene. If the scene changes, please set
the gamma curve through the api again.
Function-level API data types
rk_aiq_gamma_op_mode_t
【Description】
Define Gamma working mode
【Definition】
【Member】
rk_gamma_curve_type_t
【Description】
Define the Gamma curve working mode in manual mode
【Definition】
【Member】
rk_gamma_curve_usr_define1_para_t
【Description】
Define user-defined Gamma curve 1 attributes in manual mode
【Definition】
【Member】
rk_gamma_curve_usr_define2_para_t
【Description】
Define user-defined Gamma curve 2 attributes in manual mode
【Definition】
【Member】
Agamma_api_manual_t
【Description】
Define manual Gamma attributes
【Definition】
en Function switch
CalibDb_Gamma_t
【Description】
Define Gamma attributes in tool mode
【Definition】
【Member】
rk_aiq_gamma_attr_t
【Description】
Define Gamma attributes
【Definition】
typedef struct rk_aiq_gamma_attr_s {
rk_aiq_gamma_op_mode_t mode;
Agamma_api_manual_t stManual;
CalibDb_Gamma_t stTool;
int Scene_mode;
} rk_aiq_gamma_attr_t;
【Member】
【Description】
Set Gamma software properties.
【Syntax】
XCamReturn
rk_aiq_uapi_agamma_SetAttrib(RkAiqAlgoContext *ctx,
rk_aiq_gamma_attrib_t attr,
bool need_sync);
【Parameter】
【Return value】
0 Success
【Requirement】
The gamma curve in Api is not switched according to the scene. If the scene changes, please set
the gamma curve through the api again.
rk_aiq_uapi_agamma_GetAttrib
【Description】
Get Gamma software properties.
【Syntax】
XCamReturn
rk_aiq_uapi_agamma_GetAttrib(RkAiqAlgoContext *ctx,
rk_aiq_gamma_attrib_t *attr);
【Parameter】
【Return value】
0 Success
【Requirement】
【Description】
DPCC
Function description
【Description】
Set the DPCC software properties.
【Syntax】
XCamReturn
rk_aiq_uapi_agamma_SetAttrib(RkAiqAlgoContext *ctx,
rk_aiq_dpcc_attrib_t attr,
bool need_sync);
【Parameter】
【Return value】
0 Success
【Requirement】
【Description】
rk_aiq_uapi_adpcc_GetAttrib
【Description】
Obtain DPCC software properties.
【Syntax】
XCamReturn
rk_aiq_uapi_adpcc_GetAttrib(RkAiqAlgoContext *ctx,
rk_aiq_dpcc_attrib_t *attr);
【Parameter】
【Return value】
0 Success
【Requirement】
【Description】
Define DPCC working mode
【Definition】
【Member】
ADPCC_OP_MODE_MAX
Adpcc_basic_params_select_t
【Description】
Define the basic parameter attributes of DPCC
【Definition】
} Adpcc_basic_params_select_t;
Adpcc_basic_params_t
【Description】
Define the basic parameter attributes of DPCC
【Definition】
【Member】
Adpcc_bpt_params_t
【Description】
Define automatic DPCC properties
【Definition】
dpcc_pdaf_point_t
【Description】
【Definition】
Adpcc_pdaf_params_t
【Description】
Define PDAF mode attributes in automatic mode
【Definition】
【Description】
Define Fast mode attributes in automatic mode
【定义】
【Member】
ISO ISO
fast_mode_single_level Single dead pixel correction strength, value range [0, 10]
fast_mode_double_level Double dead pixel correction strength, value range [0, 10]
CalibDb_Dpcc_Sensor_t
【Description】
Define Fast mode attributes in automatic mode
【Definition】
【Member】
Member name Description
Adpcc_bpt_params_select_t
【Description】
Define the Fast mode attribute selected in automatic mode
【Definition】
Adpcc_pdaf_params_select_t
【Description】
Define the attributes of PDAF mode selected in automatic mode
【Definition】
Adpcc_Auto_Attr_t
【Description】
Define automatic DPCC properties
【Definition】
} Adpcc_Auto_Attr_t;
【Member】
Member Name Description
Adpcc_fast_mode_attr_t
【Description】
Define quick mode properties in manual mode
【Definition】
【Member】
fast_mode_single_level Single dead pixel correction strength, value range [0, 10]
fast_mode_double_level Double dead pixel correction strength, value range [0, 10]
Adpcc_sensor_dpcc_attr_t
【Description】
Define sensor dead pixel function attributes in manual mode
【Definition】
【Member】
Adpcc_Manual_Attr_t
【Description】
Define manual DPCC attributes
【Definition】
【Member】
CalibDb_Dpcc_Pdaf_t
【Description】
Define tool PDAF mode attributes
【Definition】
CalibDb_Dpcc_set_RK_t
【Description】
Define RK algorithm properties
【Definition】
【Member】
CalibDb_Dpcc_set_LC_t
【Description】
Define LC algorithm properties
【Definition】
typedef struct CalibDb_Dpcc_set_LC_s
{
unsigned char rb_enable[CALIBDB_DPCC_MAX_ISO_LEVEL];
unsigned char g_enable[CALIBDB_DPCC_MAX_ISO_LEVEL];
unsigned char rb_line_thr[CALIBDB_DPCC_MAX_ISO_LEVEL];
unsigned char g_line_thr[CALIBDB_DPCC_MAX_ISO_LEVEL];
unsigned char rb_line_mad_fac[CALIBDB_DPCC_MAX_ISO_LEVEL];
unsigned char g_line_mad_fac[CALIBDB_DPCC_MAX_ISO_LEVEL];
} CalibDb_Dpcc_set_LC_t;
【Member】
CalibDb_Dpcc_set_PG_t
【Description】
Define PG algorithm attributes
【Definition】
【Member】
CalibDb_Dpcc_set_RND_t
【Description】
Define RND algorithm properties
【Definition】
【Member】
CalibDb_Dpcc_set_RG_t
【Description】
Define RK algorithm properties
【Definition】
【Member】
CalibDb_Dpcc_set_RO_t
【Description】
Define RO algorithm properties
【Definition】
【Member】
CalibDb_Dpcc_set_t
【Description】
Define dead pixel judgment condition attributes
【Definition】
【Member】
rk RK Algorithm
lc LC algorithm
pg PG algorithm
rg RG algorithm
ro RO algorithm
CalibDb_Dpcc_Expert_Mode_t
【Description】
Define tool expert mode attributes
【Definition】
【Member】
Member name Description
iso ISO
CalibDb_Dpcc_t
【Description】
Define tool DPCC attributes
【Definition】
【Member】
Member Name Description
version Version
pdaf PADF
rk_aiq_dpcc_attrib_t
【Description】
Define DPCC attributes
【Definition】
【Member】
ASD
Functional API Reference
rk_aiq_user_api_asd_GetAttrib
【Description】
【Syntax】
【Parameter】
Parameter Name Description Input/Output
【Return value】
0 Success
【Requirement】
type of data
asd_attrib_t
【Description】
【Definition】
【Member】
Demosaic
Function description
Demosaicing mainly refers to converting the input Bayer data into RGB domain data.
【Description】
Set demosaicing properties.
【Syntax】
XCamReturn
rk_aiq_user_api_adebayer_SetAttrib(const rk_aiq_sys_ctx_t* sys_ctx,
adebayer_attrib_t attr);
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_user_api_adebayer_GetAttrib
【Description】
Get demosaicing properties.
【Syntax】
XCamReturn
rk_aiq_user_api_adebayer_GetAttrib(const rk_aiq_sys_ctx_t* sys_ctx,
adebayer_attrib_t *attr);
【Parameter】
【Return value】
0 Success
【Requirement】
【Description】
Define ISP demosaicing attributes.
【Definition】
【Member】
Other
API Reference
rk_aiq_uapi_setGrayMode
【Description】
Set how the black and white image mode works.
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_getGrayMode
【Description】
【Syntax】
【Parameter】
【Return value】
【Requirement】
rk_aiq_uapi_setFrameRate
【Description】
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_getFrameRate
【Description】
【Syntax】
【Parameter】
【Return value】
0 Success
rk_aiq_uapi_setMirroFlip
【Description】
【Syntax】
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_getMirroFlip
【Description】
【Syntax】
【Parameter】
Parameter Name Description Input/Output
【Return value】
0 Success
【Requirement】
type of data
rk_aiq_gray_mode_t
【Description】
【Definition】
【Member】
Statistics
Overview
3A statistical information and related configuration provided by ISP
Function description
AE Statistics
AE hardware statistics mainly include the following parts: 256-segment weighted histogram
statistics based on raw graphs, block R/G/B/Y average statistics based on raw graphs; 32-
segment bands based on RGB graph before gamma Weight histogram statistics, block
R/G/B/Y average statistics based on the RGB image before gamma.
-The module statistics are divided into block brightness statistics and histogram statistics.
According to the supported block size and whether it contains sub-window statistics, the
statistical mode can be divided into big mode and lite mode.
-big mode: maximum support global 15X15 block, minimum support 1X1 block, each block
can output 10bit R/B channel brightness average and 12bit G channel average, default
15X15 block; on the basis of global block , Supports independent setting of 4 sub-windows,
each sub-window can output the sum of 29bit R/B channel brightness and 32bit G channel
sum. The average brightness value needs to be obtained by dividing the number of pixels in
each sub-window in the software. In this mode, the weighted histogram statistics, according
to the number of blocks and the corresponding assigned weights, perform 256-segment 8bit
brightness statistics, and the effective number of pixels in each brightness segment is 28bit.
-Lite mode: Maximum support 5X5 block, minimum support 1X1 block, each block can
output 10bit R/B channel average brightness and 12bit G channel average, default 5X5
block; does not support independent setting of sub-windows. In this mode, the weighted
histogram statistics, according to the number of blocks and the corresponding assigned
weights, perform 256-segment 8bit brightness statistics, and the effective number of pixels
in each brightness segment is 28bit.
-The module statistics are divided into block brightness statistics and histogram statistics.
-Block brightness statistics, maximum support 15X15 block, minimum support 1x1 block,
each block can output 10bit R/B channel brightness average and 12bit G channel average,
default 15X15 block; based on global block Above, it supports independent setting of 4 sub-
windows. Each sub-window can output the sum of 32-bit Y channel brightness. The average
brightness value needs to be obtained by dividing the number of pixels in each sub-window
in the software.
-Histogram statistics, the largest support 15X15 block, the latest support 5X5 block, the
weighted histogram statistics in this mode, according to the number of blocks and the
corresponding assigned weight, 32 segments of 8bit brightness statistics, within each
brightness segment The effective bit number of the number of pixels is 16 bits.
AWB statistics
Global statistical information: the average value of R, G, B of the color temperature area in
the global AWB statistical window of the image, and the number of effective statistical
points. The color temperature area supports 7 color temperatures.
Block statistics: 15x15 blocks in the global AWB statistics window of the image, and the
average value of R, G, B for each block.
AF statistics
The AF hardware statistics include 2 main window statistics and 1 main window block
statistics.
API Reference
rk_aiq_uapi_sysctl_get3AStats
【Description】
Get 3A statistics.
【Syntax】
XCamReturn
rk_aiq_uapi_sysctl_get3AStats(const rk_aiq_sys_ctx_t* ctx,
rk_aiq_isp_stats_t *stats);
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_uapi_sysctl_get3AStatsBlk
【Description】
Obtain 3A statistics simultaneously.
【Syntax】
XCamReturn
rk_aiq_uapi_sysctl_get3AStatsBlk(const rk_aiq_sys_ctx_t* ctx,
rk_aiq_isp_stats_t **stats, int timeout_ms);
【Parameter】
Parameter
Description Input/Output
Name
【Return value】
0 Success
【Requirement】
-Header file: rk_aiq_user_api_sysctl.h
rk_aiq_uapi_sysctl_release3AStatsRef
【Description】
Release the acquired 3A statistics, and use it with rk_aiq_uapi_sysctl_get3AStatsBlk.
【Syntax】
void
rk_aiq_uapi_sysctl_release3AStatsRef(const rk_aiq_sys_ctx_t* ctx,
rk_aiq_isp_stats_t *stats);
【Parameter】
【Return value】
0 Success
【Requirement】
rk_aiq_user_api_af_SetAttrib(ctx, &attr);
while (1)
{
rk_aiq_isp_stats_t *stats_ref = NULL;
Type of data
rk_aiq_isp_stats_t
【Description】
AIQ 3A statistics
【Definition】
typedef struct {
rk_aiq_isp_aec_stats_t aec_stats;
rk_aiq_awb_stat_res_v200_t awb_stats_v200;
rk_aiq_isp_af_stats_t af_stats;
} rk_aiq_isp_stats_t;
【Member】
aec_stats ae statistics
af_stats af statistics
RKAiqAecStats_t
【Description】
Define AE data information. For details, see the function description in the AE chapter.
【Definition】
【Member】
RKAiqAecExpInfo_t
【Description】
AE module exposure parameter information
【Definition】
【Member】
【Precautions】
HdrExp represents the exposure parameter information in HDR mode, and supports 3TO1 at
most. HDR 2TO1: subscript 0 means short frame exposure parameters, subscript 1 means long
frame exposure parameters, subscript 2 is invalid; HDR 3TO1: subscript 0 means short frame
exposure parameters, subscript 1 means medium frame exposure parameters, subscript 2
Represents long frame exposure parameters.
RkAiqExpParamComb_t
【Description】
AE module exposure parameter information details
【Definition】
typedef struct {
RkAiqExpRealParam_t exp_real_params; //real value
RkAiqExpSensorParam_t exp_sensor_params;//reg value
} RkAiqExpParamComb_t;
【Member】
【Precautions】
-Different sensors have different functions of digital gain, some are used to increase the
sensitivity range, and some are used to complement the accuracy of analog gain. Therefore, the
digital gain is not listed separately at present, and its size and corresponding register value are all
incorporated into the analog gain.
-The dual conversion gain mode has three states. A value of -1 means that the sensor does not
support dcg, a value of 0 means LCG, and a value of 1 means HCG.
RkAiqAecHwStatsRes_t
【Description】
AE module hardware statistics
【Definition】
【Member】
Member
Description
Name
The AE module is based on raw graph statistics, compatible with HDR and
Aec_Stat_Res_t
non-HDR modes, and supports at most HDR 3TO1 S/M/L statistics.
【Precautions】
Aec_Stat_Res_t chn[3]: Represents the statistical information of the first 3 Raw data channels of
the HDR Merge module. In non-HDR mode, the corresponding subscript is 0, and other
subscripts are invalid; HDR 2TO1 mode, when the corresponding subscript is 0, it means short-
frame data path statistics, subscript 1 means long-frame data path statistics, and subscript 2 is
invalid; In HDR 3TO1 mode, when the corresponding subscript is 0, it indicates the statistics of
the short frame data path, the subscript 1 indicates the statistics of the medium frame data path,
and the subscript 2 indicates the statistics of the long frame data path. The statistics module
based on raw graphs has the BLC AWB module before, so the statistics based on raw graphs are
affected by the gain values of BLC and AWB.
Aec_Stat_Res_t extra: In HDR mode, extra represents the raw image statistics of debayer after
HDR synthesis. Before this statistical module has BLC, AWB, HDRMERGE, TMO module, so the
statistical information of this module is affected by the gain of BLC, AWB, HDRMERGE, TMO.
Aec_Stat_Res_t
【Description】
The AE module is based on the statistical information of the raw graph
【Definition】
typedef struct Aec_Stat_Res_s {
//rawae
struct rawaebig_stat rawae_big;
struct rawaelite_stat rawae_lite;
//rawhist
struct rawhist_stat rawhist_big;
struct rawhist_stat rawhist_lite;
} Aec_Stat_Res_t;
【Member】
【Precautions】
For the difference between big and lite modes based on raw graph statistics, see the function
description module. Since the main difference between the big and lite modes is the number of
blocks to count the average brightness of the block and whether to support the sub-window
average brightness statistics, the histogram statistics of the big and lite modes based on the raw
image here have the same data structure.
rawaebig_stat
【Description】
Big mode statistics based on raw images, including global window block R/G/B average
brightness, sub-window R/G/B brightness sum
【Definition】
struct rawaebig_stat {
unsigned short channelr_xy[RAWAEBIG_WIN_NUM];
unsigned short channelg_xy[RAWAEBIG_WIN_NUM];
unsigned short channelb_xy[RAWAEBIG_WIN_NUM];
unsigned int channely_xy[RAWAEBIG_WIN_NUM]; //not HW!
unsigned long int wndx_sumr[RAWAEBIG_SUBWIN_NUM];
unsigned long int wndx_sumg[RAWAEBIG_SUBWIN_NUM];
unsigned long int wndx_sumb[RAWAEBIG_SUBWIN_NUM];
unsigned short wndx_channelr[RAWAEBIG_SUBWIN_NUM]; //not HW!
unsigned short wndx_channelg[RAWAEBIG_SUBWIN_NUM]; //not HW!
unsigned short wndx_channelb[RAWAEBIG_SUBWIN_NUM]; //not HW!
unsigned char wndx_channely[RAWAEBIG_SUBWIN_NUM]; //not HW!
};
#define RAWAEBIG_WIN_NUM 225
#define RAWAEBIG_SUBWIN_NUM 4
【Member】
Member
Description
Name
The b-channel mean brightness information of the big mode global window
channelb_xy
block. Number of effective bits: 10bit.
【Precautions】
The big mode statistics information based on the raw graph only contains the statistics
information of the R/G/B 3 channels. If you need the statistics information of the Y channel, you
can add code to the software to calculate based on the R/G/B statistics.
The big mode global window block statistics based on the raw graph is the divided average
brightness statistics, but the sub-window is the brightness and information of the entire window.
You need to add code in the software to calculate the average brightness statistics of the sub-
window.
The channely_xy, wndx_channelr, wndx_channelg, wndx_channelb, wndx_channely
parameters in the structure are all software calculation parameters, and you need to add code
and calculate them based on hardware statistics.
rawaelite_stat
【Description】
Lite mode statistics based on raw image, including global window block R/G/B average brightness
【Definition】
struct rawaelite_stat {
unsigned short channelr_xy[RAWAELITE_WIN_NUM];
unsigned short channelg_xy[RAWAELITE_WIN_NUM];
unsigned short channelb_xy[RAWAELITE_WIN_NUM];
unsigned int channely_xy[RAWAELITE_WIN_NUM]; //not HW!
};
#define RAWAELITE_WIN_NUM 25
【Member】
Member
Description
Name
The b-channel mean brightness information of the big mode global window
channelb_xy
block. Number of effective bits: 10bit.
【Precautions】
The lite mode statistical information based on the raw graph only contains the statistical
information of the R/G/B 3 channels. If you need the Y channel statistical information, you can
add code to the software to calculate based on the R/G/B statistical value.
The channely_xy in the structure is a software calculation parameter, and you need to add
code to calculate it based on the hardware statistics.
rawhist_stat
【Description】
Histogram statistics based on raw graphs
【Definition】
struct rawhist_stat {
unsigned int bins[RAWHIST_BIN_N_MAX];
};
#define RAWHIST_BIN_N_MAX 256
【Member】
Member
Description
Name
yuvae_stat
【Description】
Based on the block average brightness statistics of the RGB map before gamma, including the
block Y channel average brightness of the global window and the sum of the sub-window Y
channel brightness
【Definition】
struct yuvae_stat {
unsigned long int ro_yuvae_sumy[YUVAE_SUBWIN_NUM];
unsigned char mean[YUVAE_WIN_NUM];
};
#define YUVAE_SUBWIN_NUM 4
#define YUVAE_WIN_NUM 225
【Member】
Member
Description
Name
【Precautions】
-The lite mode statistical information based on the raw graph only contains the statistical
information of the R/G/B 3 channels. If you need the Y channel statistical information, you can
add code to the software to calculate based on the R/G/B statistical value.
-The channely_xy in the structure is a software calculation parameter, and you need to add code
to calculate it based on the hardware statistics.
sihist_stat
【Description】
Histogram meter information based on RGB image before gamma
【Definition】
struct sihist_stat {
unsigned int bins[SIHIST_BIN_N_MAX];
};
#define SIHIST_BIN_N_MAX 32
【Member】
Member
Description
Name
rk_aiq_awb_stat_res_v200_t
【Description】
Define white balance hardware statistics
【Definition】
【Precautions】
If the user wants to obtain the global white point statistical results of the main window, it can be
simply converted according to the white point statistical results under all light sources.
rk_aiq_awb_stat_wp_res_light_v200_t
【Description】
Define the white point statistics under a certain light source
【Definition】
【Member】
Member
Description
Name
White point statistical results of XY boxes of different sizes under a certain light
xYType
source, up to RK_AIQ_AWB_XY_TYPE_MAX_V200 boxes
rk_aiq_awb_stat_wp_res_v200_t
【Description】
Define the statistical result of the white point under the XY frame of a certain size of a certain
light source, and the statistical result of the non-white point in the back non-white point area
【Definition】
typedef struct rk_aiq_awb_stat_wp_res_v200_s {
unsigned int WpNo;
unsigned int Rvalue;
unsigned int Gvalue;
unsigned int Bvalue;
} rk_aiq_awb_stat_wp_res_v200_t;
【Member】
rk_aiq_awb_stat_blk_res_v200_t
【Description】
Define the statistical results of each block
【Definition】
【Member】
Member
Description
Name
Whether the block contains a white point flag of a light source, and records the
isWP
flags of RK_AIQ_AWB_STORE_LS_WPFLAG_NUM light sources at most
Rvalue The cumulative sum of the R channel of all points in the block
rk_aiq_af_algo_stat_t
【Description】
Define AF statistics
【Definition】
typedef struct {
unsigned int roia_sharpness;
unsigned int roia_luminance;
unsigned int roib_sharpness;
unsigned int roib_luminance;
unsigned int global_sharpness[RKAIQ_RAWAF_SUMDATA_NUM];
struct timeval focus_starttim;
struct timeval focus_endtim;
int64_t sof_tim;
} rk_aiq_af_algo_stat_t;
【Member】
【Precautions】
roia_sharpness/roia_luminance/roib_sharpness/roib_luminance/global_sharpness is the AF
hardware statistics.
focus_starttim/focus_endtim/sof_tim are the VCM movement time and the frame start time of
the data frame, to assist in confirming whether the VCM movement is over, and the AF hardware
statistics are reliable.
export persist_camera_engine_log=0x1000000ff2
The version matching rules of AIQ, IQ Tool and ISP Driver are as follows:
v A. B. C
Where B is hexadecimal representation, bit[0:3] indicates the matching version of AIQ and IQ
Tool, bit[4:7] indicates the matching version of AIQ and ISP driver, for example:
ISP driver: v 1. 0x3.0 matches AIQ: v1.0x30.0, but does not match AIQ: v1.0x40.0.
IQ tool: v 1. 0x3.0 matches AIQ: v1.0x33.0, but does not match AIQ: v1.0x30.0, where the AIQ
version number C is not 0, and there may be version mismatches. It is recommended to use the
AIQ version with C version number 0 first for IQ Tool matching.
AIQ Log
Log switch
1. aiq uses 64bits to represent the log level of all modules, and the bitmap and description of
each module are as follows:
bit: [63-39] 38 37 36 35 34 33 32 31
mean: [U] [CAMHW][ANALYZER][XCORE][ASD][AFEC][ACGC][AORB][ASHARP]
bit: 30 29 28 27 26 25 24 23 22
mean:[AIE][ACP][AR2Y][ALDCH][A3DLUT][ADEHAZE][AWDR][AGAMMA][ACCM]
bit: 21 20 19 18 17 16 15 14 13 12
mean:[ADEBAYER][AGIC][ALSC][ANR][AHDR][ADPCC][ABLC][AF][AWB][AEC]
As explained above, in the Linux environment, the switch level of each module is controlled
by setting the environment variable persist_camera_engine_log.
For example, if the log switch of the af module is turned on and the level is verbose, then
bit[14] = 1, bit[3-0] = 4, so execute before the application is executed:
export persist_camera_engine_log=0x4014
To view the current log level, you can use the following command:
export export
AE
persist_camera_engine_log=0x1ff3 persist_camera_engine_log=0x1ff4
export export
AF
persist_camera_engine_log=0x4ff3 persist_camera_engine_log=0x4ff4
export export
AWB
persist_camera_engine_log=0x2ff3 persist_camera_engine_log=0x2ff4
export
NR
persist_camera_engine_log=0x40fff
Log interpretation
AE
Due to space limitations, only the debug level log is interpreted here.
Cur-Exp: FrmId=270,gain=0x36a,time=0x576,envChange=0,dcg=-1,pirs=0
The dcg mode corresponding to the current frame. -1: The sensor does
dcg not support the dcg mode or the dcg mode is switched inside the
sensor; 0: LCG mode; 1: HCG mode
Line2:
Last-Res:FrmId=269,gain=0x356,time=0x576,pirs=0
Some of the new exposure parameters set by the last AE run have the same meaning as in
(1), so I won’t repeat them here. By comparing the exposure parameter LOG information of
Line1 and Line2, it can be known whether the current exposure is consistent with the new
exposure, that is, whether the new exposure has taken effect.
Line3:
================================= Linear-AE
(enter)=================================================================
======================================================================
======================================================================
================================================= =====================
Enter the AE control algorithm module, Linear-AE means the current linear exposure mode.
Line4:
Framenum=270
Cur gain=6.826667, time=0.029987, pirisGain=0, RawMeanluma=29.564444,
YuvMeanluma=34.875557, IsConverged=0
Member
Description
name
gain The sensor exposure gain value corresponding to the current frame
time The sensor exposure time value corresponding to the current frame
Line 5:
Line6:
calc result:
SetPoint=22.000000,gain=6.023529,time=0.029987,piris=0,reggain=854,regtime=1398
The final new p-iris iris equivalent gain value. If the Airis function is turned
piris
off, this parameter is invalid and meaningless.
reggain Register value corresponding to the final new exposure gain value
regtime Register value corresponding to the final new exposure time value
In summary, we can know the current frame's screen brightness RawMeanLuma and the
corresponding target brightness setpoint. Calculate the new exposure by comparing the
brightness of the screen and the target brightness.
-Hdr mode AE LOG:
Cur-Exp: FrmId=22,S-gain=0x0,S-time=0x2b6,M-gain=0xb,M-time=0x1a5e,L-gain=0x0,L-
time=0x0,envChange=1,dcg=-1--1--1,Piris=0
Line2:
Last-Res:FrmId=20,S-gain=0x5,S-time=0x8ca,M-gain=0x11,M-time=0x1a5e,L-
gain=0x0,L-time=0x0
Some of the new exposure parameters set by the last AE run have the same meaning as in
(1), so I won’t repeat them here. By comparing the exposure parameter LOG information of
Line1 and Line2, it can be known whether the current exposure is consistent with the new
exposure, that is, whether the new exposure has taken effect.
Line3:
================================= HDR-AE
(enter)=================================================================
======================================================================
======================================================================
======== =====================
Enter the AE control algorithm module, HDR-AE means the current HDR exposure mode.
Line4:
AecRun: SMeanLuma=9.342692,
MMeanLuma=37.698597,LMeanLuma=0.000000,TmoMeanluma=37.571430,Isconverg
ed=0,Longfrm=0
Member name Description
The average value of the brightness output from the TMO module
TmoMeanluma
of the current frame.
The long frame mode status of the current frame. 0: Long frame
Longfrm
mode is off; 1: Long frame mode is on.
Line5:
Member
Description
name
The p-iris iris equivalent gain value corresponding to the current frame.
piris If the Airis function is turned off, this parameter is invalid and
meaningless.
Line6:
S-
Brightness of the highlight area of the current short frame.
HighLightLuma
S-Target The target brightness of the current short frame highlight area.
Line7:
L-LowLightLuma=29.626642, L-Target=48.572094, L-GlobalLuma=37.698597, L-
Target=77.620155
L-
Current long frame dark area brightness
LowLightLuma
L-Target The current target brightness in the dark area of the long frame.
Line8:
calc
result:piris=0,sgain=1.000000,stime=0.005081,mgain=1.862087,mtime=0.025000,lgain
=0.000000,ltime=0.000000
Member
Description
name
The final exposure gain value of the new sensor. In HDR 2 frame mode,
s/m/lgain
s/m is valid; in HDR 3 frame mode, s/m/l is valid.
The final exposure time value of the new sensor. In HDR 2 frame mode,
s/m/ltime
s/m is valid; in HDR 3 frame mode, s/m/l is valid.
The final new p-iris iris equivalent gain value. If the Airis function is
piris
turned off, this parameter is invalid and meaningless.
AF
sof_tim The start time of frame data transmission of the current frame, in ms
2) Focus trigger:
When the change of the FV value of the current frame and the FV value of the last successful
focus is greater than TrigThers, and the FV change of consecutive StableFrames frames is less
than StableThers, the focus is triggered.
3) Search path:
4) Display the current iso value, and update the relevant configuration according to the iso value
5) Rough-tune result
6)Fine-tune results
7) Focus result
AWB
Refer to "Rockchip_Color_Optimization_Guide_ISP2x_CN"
1. The rough data flow process of the current software isp is:
sensor(raw) -> csi-tx -> isp-rx -> ... -> isp-> ... ->ispp -> ... -> out-yuv, where csi-tx -> isp- The raw
image data of rx can be obtained in the hwi layer of aiq.
aiq obtains the number of frames the user wants to save the raw file according to the
/tmp/.capture_cnt intermediate file, and aiq writes the raw image corresponding to the number
of frames into the /tmp directory.
1. Run rkaiq.
2. The number of raw image frames to be captured by echo, for example, capture 3 frames
3. The captured raw image and corresponding meta information will be generated in the
/tmp/capture_image or /data/capture_image directory
rkisp_demo --device /dev/video14 --width 1280 --height 720 --vop --rkaiq --hdr 2
--sync-to-raw
2. The number of raw/yuv image frames to be captured by echo, for example, 3 frames are
captured
error code
Error Code Description
0 Success
-1 Failure
-2 Invalid parameter
-3 Insufficient memory
-20 Timeout
Acronyms