Camera Hal OEM模块 ---- 3dnr算法流程

static cmr_int threednr_open(cmr_handle ipm_handle, struct ipm_open_in *in,struct ipm_open_out *out, cmr_handle *class_handle);static cmr_int threednr_close(cmr_handle class_handle);static cmr_int threednr_transfer_frame(cmr_handle class_handle,struct ipm_frame_in *in,struct ipm_frame_out *out);static cmr_int threednr_open_prev(cmr_handle ipm_handle, struct ipm_open_in *in,struct ipm_open_out *out,cmr_handle *class_handle);static cmr_int threednr_close_prev(cmr_handle class_handle);static cmr_int threednr_transfer_prev_frame(cmr_handle class_handle,struct ipm_frame_in *in,struct ipm_frame_out *out);
可以看到是比较对称的 不带prev 和 带prev 的3个流程 。不带prev的应该就是拍照的时候跑的,带prev的显然就是预览的时候跑的 。按照之前的经验,3dnr是比较耗时的,我们一般是不在预览跑的,只在拍照阶段去跑 。所以我们要关注上面那个函数 。
1,申请的空间
ret = cam_cxt->hal_malloc(CAMERA_SNAPSHOT_3DNR, &small_buf_size, &small_buf_num,(cmr_uint *)threednr_handle->small_buf_phy,(cmr_uint *)threednr_handle->small_buf_vir,threednr_handle->small_buf_fd, cam_cxt->client_data);
2,获取效果参数
cmr_u32 param_3dnr_index = 0;sensor_id = ipm_cxt->init_in.sensor_id;param_3dnr_index = threednr_get_sns_match_index(sensor_id);cap_3dnr_param = sns_3dnr_param_tab[param_3dnr_index].cap_param;
的实现在 .h
const struct threednr_sns_match_tab sns_3dnr_param_tab[] = {{"default", &prev_default_3dnr_param, &cap_default_3dnr_param},#ifdef OV13855{"ov13855", &ov13855_prev_3dnr_param, &ov13855_cap_3dnr_param},#endif#ifdef OV8856_SHINE{"ov8856_shine", &ov8856_shine_prev_3dnr_param, &ov8856_shine_cap_3dnr_param},#endif#ifdef OV5675{"ov5675", &ov5675_prev_3dnr_param, &ov5675_cap_3dnr_param},#endif{"null", NULL, NULL}};
本项目配置是,对应的参数如下
#ifdef OV13855static struct threednr_tuning_param ov13855_prev_3dnr_param = {{{0, 2, 2, 4, 9, 9}, {0, 1, 3, 5, 9, 9}, {0, 1, 3, 5, 9, 9}, {0, 1, 4, 6, 9, 9}},{{255, 5, 5, 6, 9, 9}, {255, 5, 5, 6, 9, 9}, {255, 5, 5, 6, 9, 9}, {255, 4, 5, 5, 9, 9}},{12, 24, 36, 64, 80, 96}, 11, 11, 1, 0, 12, 100, 5, 588, 435, {1,3,247,3342362,6684749,10027136,13369523,16711910}};static struct threednr_tuning_param ov13855_cap_3dnr_param = {{{3, 4, 6, 9, 9, 9}, {3, 5, 6, 9, 9, 9}, {3, 5, 6, 9, 9, 9}, {2, 6, 7, 9, 9, 9}},{{5, 6, 7, 9, 9, 9}, {5, 6, 7, 9, 9, 9}, {5, 6, 7, 9, 9, 9}, {5, 6, 6, 9, 9, 9}},{12, 24, 36, 64, 80, 96}, 11, 11, -1, 0, 12, 100, 6, 588, 435, {0}};#endif
3,赋值给 m
cap_3dnr_tuning_param.SearchWindow_x = cap_3dnr_param->searchWindow_x;cap_3dnr_tuning_param.SearchWindow_y = cap_3dnr_param->searchWindow_y;cap_3dnr_tuning_param.threthold = cap_3dnr_param->threshold;cap_3dnr_tuning_param.slope = cap_3dnr_param->slope;cap_3dnr_tuning_param.recur_str = cap_3dnr_param->recur_str;cap_3dnr_tuning_param.match_ratio_sad = cap_3dnr_param->match_ratio_sad;cap_3dnr_tuning_param.match_ratio_pro = cap_3dnr_param->match_ratio_pro;cap_3dnr_tuning_param.feat_thr = cap_3dnr_param->feat_thr;cap_3dnr_tuning_param.luma_ratio_high = cap_3dnr_param->luma_ratio_high;cap_3dnr_tuning_param.luma_ratio_low = cap_3dnr_param->luma_ratio_low;cap_3dnr_tuning_param.zone_size = cap_3dnr_param->zone_size;memcpy(cap_3dnr_tuning_param.gain_thr, cap_3dnr_param->gain_thr, (6 * sizeof(int)));memcpy(cap_3dnr_tuning_param.reserved, cap_3dnr_param->reserverd, (16 * sizeof(int)));
4,通过 isp 获取参数
ret = ipm_in->ipm_isp_ioctl(oem_handle, COM_ISP_GET_MFNR_PARAM,&isp_cmd_parm);
5,在次赋值给 m