5.16. ISP - AF统计模块功能
5.16.1. 功能描述
自动
AFM模块
5.16.2. 通路介绍

5.16.3. AFM统计模块接口
AFM统计数据
int32_t hbn_isp_get_af_statistics(hbn_vnode_handle_t vnode_fd, hbn_isp_af_statistics_t *p_data);
typedef struct hbn_isp_af_statistics_s {
uint32_t sharpnessLowPass[HBN_ISP_AFM_BLOCK_NUM];
uint32_t sharpnessHighPass[HBN_ISP_AFM_BLOCK_NUM];
uint32_t histLowData[HBN_ISP_AFM_BLOCK_NUM];
uint32_t histHighData[HBN_ISP_AFM_BLOCK_NUM];
uint32_t frame_id; // 当前对应frame id(备用)
} hbn_isp_af_statistics_t;
AFM统计
int32_t hbn_isp_get_afm_attr(hbn_vnode_handle_t vnode_fd, hbn_isp_afm_attr_t *p_attr);
int32_t hbn_isp_set_afm_attr(hbn_vnode_handle_t vnode_fd, hbn_isp_afm_attr_t *p_attr);
typedef struct hbn_isp_afm_ldg_s {
float iir_highpass_y[HBN_ISP_AFM_LDG_Y_NUM]; /**< IIR high pass on Y axis */
uint8_t iir_highpass_x[HBN_ISP_AFM_LDG_X_NUM]; /**< IIR high pass on X axis */
float iir_lowpass_y[HBN_ISP_AFM_LDG_Y_NUM]; /**< IIR low pass on Y axis */
uint8_t iir_lowpass_x[HBN_ISP_AFM_LDG_X_NUM]; /**< IIR low pass on X axis */
float fir_highpass_y[HBN_ISP_AFM_LDG_Y_NUM]; /**< FIR high pass on Y axis */
uint8_t fir_highpass_x[HBN_ISP_AFM_LDG_X_NUM]; /**< FIR high pass on X axis */
float fir_lowpass_y[HBN_ISP_AFM_LDG_Y_NUM]; /**< FIR low pass on Y axis */
uint8_t fir_lowpass_x[HBN_ISP_AFM_LDG_X_NUM]; /**< FIR low pass on X axis */
} hbn_isp_afm_ldg_t;
typedef struct hbn_isp_afm_coring_s {
uint8_t iir_highpass[HBN_ISP_AFM_CORING_COEFF_NUM]; /**< IIR high pass */
uint8_t iir_lowpass[HBN_ISP_AFM_CORING_COEFF_NUM]; /**< IIR low pass */
uint8_t fir_highpass[HBN_ISP_AFM_CORING_COEFF_NUM]; /**< FIR high pass */
uint8_t fir_lowpass[HBN_ISP_AFM_CORING_COEFF_NUM]; /**< FIR low pass */
} hbn_isp_afm_coring_t;
typedef struct hbn_isp_afm_iir_s {
uint8_t data_shift; /**< Data shift */
uint8_t data_shift_v; /**< Data shift Vetical*/
float highpass_weight; /**< High pass weight */
float lowpass_weight; /**< Low pass weight */
float highpass_coeff[HBN_ISP_AFM_IIR_FILTER_NUM][HBN_ISP_AFM_IIR_FILTER_COEFF_NUM]; /**< High pass coefficient */
float lowpass_coeff[HBN_ISP_AFM_IIR_FILTER_NUM][HBN_ISP_AFM_IIR_FILTER_COEFF_NUM]; /**< Low pass coefficient */
} hbn_isp_afm_iir_t;
typedef struct hbn_isp_afm_fir_s {
uint8_t data_shift; /**< Data shift */
uint8_t data_shift_v; /**< Data shift Vetical*/
float highpass_weight; /**< High pass weight */
float lowpass_weight; /**< Low pass weight */
uint8_t highdata_shift;
uint8_t highdata_shift_v;
uint8_t lowdata_shift;
uint8_t lowdata_shift_v;
uint8_t highpass_coeff[HBN_ISP_AFM_FIR_HIGHPASS_COEFF_NUM]; /**< High pass coefficient */
uint8_t lowpass_coeff[HBN_ISP_AFM_FIR_LOWPASS_COEFF_NUM]; /**< Low pass coefficient */
} hbn_isp_afm_fir_t;
typedef struct hbn_isp_afm_attr_s {
uint16_t bls; /**< BLS components */
uint8_t hist_threshold; /**< Histogram threshold */
float gamma; /**< Gamma value */
uint16_t hw_roi[HBN_ISP_AFM_BLOCK_POINT_NUM]; /**< Hardware ROI */
hbn_isp_afm_ldg_t ldg; /**< Level Dependent Gain configuration */
hbn_isp_afm_coring_t coring; /**< Coring configuration */
hbn_isp_afm_iir_t iir; /**< IIR configuration */
hbn_isp_afm_fir_t fir; /**< FIR configuration */
} hbn_isp_afm_attr_t;
5.16.4. 输入图像裁剪
AFM模块hbn_isp_afm_attr_t中hw_roi参数
5.16.5. 输入图像预处理
AFM模块
这hbn_isp_afm_attr_t中bls与gamma参数。
5.16.6. 输出数据后处理
AFM模块hbn_isp_afm_attr_t中coring与ldg参数。
coring功能

电平

5.16.7. 数据融合
AF的
highdata = (fir.highdata * fir.highpassweight + iir.highdata * iir.highpassweight) / 2;
lowdata = (fir.lowdata * fir.lowpassweight + iir.lowdata * iir.lowpassweight) / 2;
iir与fir的highpassweight建议
5.16.8. 点光源处理
当
亮度hbn_isp_afm_attr_t中hist_threshold参数。
5.16.9. 数据移位
| 参数 | 含义 |
|---|---|
| fir.highDataShift/fir.lowDataShift | 每个 |
| fir.lowDataShiftV/fir.highDataShiftV | 每个 |
| fir.data_shift/iir.data_shift | 每个block统计 |
| fir.data_shift_v/iir.data_shift_v | 每个block统计 |
5.16.10. IIR参数生成步骤参考
接口
a2的
三个 参数 对应json第一列 的 前 三个 参数,b3的 第二个 参数 对应json中 第一列 的 第四个 参数。 a3的
三个 参数 对应json第二列 的 前 三个 参数,b2的 第二个 参数 对应json中 第二列 的 第四个 参数。 a1的
三个 参数 对应json第三列 的 前 三个 参数,b1的 第二个 参数 对应json中 第三列 的 第四个 参数。

5.16.11. 推荐参数配置
"AFM_3": {
"bls": 0,
"coring": {
"firHighPass": [32,230,16],
"firLowPass": [32,230,16],
"iirHighPass": [32,230,16],
"iirLowPass": [32,230,16]
},
"fir": {
"dataShift": 12,
"dataShiftV": 3,
"highPassWeight": 1.0,
"lowPassWeight": 1.0,
"highDataShift": 0,
"highDataShiftV": 0,
"lowDataShift": 3,
"lowDataShiftV": 3,
"highPassCoeff": [2, 1],
"lowPassCoeff": [12, 6, 4, 3]
},
"gamma": 2.2,
"histThreshold": 128,
"hwRoi": [0,0,1920,1080],
"iir": {
"dataShift": 3,
"dataShiftV": 3,
"highPassWeight": 1.0,
"highPassCoeff": [[0.573, -1.4474, 0.774, -1.98],[0.573, -1.875, 0.915, -1.31],[0.217, -1.467, 0.566, 0.0]],
"lowPassWeight": 1.0,
"lowPassCoeff": [[0.6, -0.445, 0.624, -1.92],[0.6, -1.67, 0.823, 0.215],[0.383, -1.465, 0.566, 0.0]]
},
"ldg": {
"firHighPassX": [16, 96, 160, 208],
"firHighPassY": [4.0, 8.0, 4.0],
"firLowPassX": [16, 96, 160, 208],
"firLowPassY": [4.0, 8.0, 4.0],
"iirHighPassX": [16, 96, 160, 208],
"iirHighPassY": [1.0, 2.0, 1.0],
"iirLowPassX": [16, 96, 160, 208],
"iirLowPassY": [1.0, 2.0, 1.0]
},
}
5.16.12. 调试建议
coring参数
用于 去除 噪声 的 影响,在 曝光 增益 较 高 的 场景,可以 适当 增加coring的 第一个 参数,能够 减弱 噪声 导致 的 数值 波动,但 整体FV值 会后 所 下降。 高对比度
的 场景 如果 出现 双 波峰 曲线,这 可能 是 垂直 方向 的 滤波 数据 过大 导致 的,可以 调整fir的 滤波 核 参数,适当 减少 垂直 方向 的 参数,来 减少 垂直 方向 的 对比度 影响。 信息
不足 的 场景,经过AFM输出 的 统计数据 通常 较 小,可以 适当 减少 各级datashift,适当 增加ldg中间 区域 的 数值 以 增大 最终 的 统计数据,不 建议 将 参数 调整 偏离 过大,会 影响 到 普通 场景 的 统计数据 结果。