Android8.0 高通PDAF 调试 - actuator sensitivity
有一说一
遇到的问题点
调试过程中发现进不来pdaf流程 log显示如下:
01-01 08:08:54.425 2414 6352 D mm-camera: <STATS_AF >< LOW> 3994: af_port_handle_module_event: Handle AF module event of type: 0
01-01 08:08:54.425 2414 6352 D mm-camera: <STATS_AF >< LOW> 3158: af_port_handle_sensor_update: Sensor Res width: 4208 height: 3120 FocalLength: 3.460000 and FNum: 2.200000
01-01 08:08:54.425 2414 6352 E mm-camera: <STATS_AF ><ERROR> 3167: af_port_handle_sensor_update: Depth_Err: actuator sensitivity: 0.000000 is invalid
01-01 08:08:54.425 2414 6352 D mm-camera: <STATS_AF >< LOW> 3173: af_port_handle_sensor_update: Depth_Err: pdaf cal data from sensor supported 1 pdaf_ptr 0xef1e4010
01-01 08:08:54.701 2414 6370 D mm-camera: <STATS_AF >< LOW> 4216: af_port_handle_module_event: Received PDAF stats: frame_id: 3, buf_idx: 0
01-01 08:08:54.701 2414 6370 D mm-camera: <STATS_AF >< HIGH> 3831: af_port_handle_pdaf_stats: Depth_Err Pdaf not supported. Shouldn't get PDAF stats
问题分析:
Review 代码发现逻辑如下:
/* update depth service cal data */
af_port->ds_input.cal_data.eff_focal_length = sensor_info->actuator_info.focal_length;
af_port->ds_input.cal_data.f_num = sensor_info->actuator_info.af_f_num;
af_port->ds_input.cal_data.pixel_size = sensor_info->actuator_info.af_f_pix;
af_port->ds_input.cal_data.is_pdaf_supported = sensor_update->is_pdaf_supported;
af_port->ds_input.cal_data.actuator_sensitivity = sensor_update->actuator_sensitivity;
if(sensor_update->actuator_sensitivity <= 0) {
AF_ERR("Depth_Err: actuator sensitivity: %f is invalid",
sensor_update->actuator_sensitivity);
rc = FALSE;
}
if(sensor_update->is_pdaf_supported && FALSE == rc) {
AF_LOW("Depth_Err: pdaf cal data from sensor supported %d pdaf_ptr %p",
sensor_update->is_pdaf_supported, sensor_update->pdaf_data);
af_port->ds_input.cal_data.is_pdaf_supported = 0;
}
actuator_sensitivity invalid时, 无法启用pdaf support
那么这个问题是哪里来的呢?
sensor初始化的时候 我们可以发现 计算actuator_sensitivity的过程
boolean module_sensor_actuator_init_calibrate(
module_sensor_bundle_info_t *s_bundle)
{
/* calcualte actuator sensitivity
assuming total_steps is tuned to number of um */
s_bundle->actuator_sensitivity =
(float)af_driver_ptr->actuator_tuned_params.region_params[0].qvalue /
af_driver_ptr->actuator_tuned_params.region_params[0].code_per_step;
}
/* protect the qvalue */
else {
af_driver_ptr->actuator_tuned_params.region_params[0].qvalue = 1;
}
}
这个时候 需要马达的qvuale值,经过对比
发现马达驱动没有此设置
遂改之
.actuator_tuned_params =
{
.scenario_size =
{
2, /* MOVE_NEAR */
3, /* MOVE_FAR */
},
.ringing_scenario =
{
/* MOVE_NEAR */
{
36,
243,
},
/* MOVE_FAR */
{
72,
198,
243,
},
},
.initial_code = 136,
.region_size = 1,
.region_params =
{
{
.step_bound =
{
243, /* Macro step boundary*/
0, /* Infinity step boundary*/
},
.code_per_step = 1,
.qvalue = 1,
},
},