/* ************************************************************************** * FunctionName: imx219_liteon_set_framesizes; * Description : NA; * Input : flag: if 1, set framesize to sensor, * if 0, only store framesize to camera_interface; * Output : NA; * ReturnValue : NA; * Other : NA; ************************************************************************** */ static int imx219_liteon_set_framesizes(camera_state state, struct v4l2_frmsize_discrete *fs, int flag, camera_setting_view_type view_type, bool zsl_preview, camera_b_shutter_mode b_shutter_mode,ecgc_support_type_s ecgc_type) { int i = 0; bool match = false; assert(fs); if(NULL == fs) { return -EINVAL; } (void)b_shutter_mode;//front sensor does not support b_shutter_mode (void)ecgc_type; print_debug("Enter Function:%s State(%d), flag=%d, width=%d, height=%d, b_shutter_mode=0x%x, ecgc_type=0x%x", __func__, state, flag, fs->width, fs->height,b_shutter_mode,ecgc_type); if (VIEW_FULL == view_type) { for (i = 0; i < ARRAY_SIZE(imx219_liteon_framesizes); i++) { if ((imx219_liteon_framesizes[i].width >= fs->width) && (imx219_liteon_framesizes[i].height >= fs->height) && (VIEW_FULL == imx219_liteon_framesizes[i].view_type) && (camera_get_resolution_type(fs->width, fs->height) <= imx219_liteon_framesizes[i].resolution_type)) { fs->width = imx219_liteon_framesizes[i].width; fs->height = imx219_liteon_framesizes[i].height; match = true; break; } } } if (false == match) { for (i = 0; i < ARRAY_SIZE(imx219_liteon_framesizes); i++) { if ((imx219_liteon_framesizes[i].width >= fs->width) && (imx219_liteon_framesizes[i].height >= fs->height) && (camera_get_resolution_type(fs->width, fs->height) <= imx219_liteon_framesizes[i].resolution_type)) { fs->width = imx219_liteon_framesizes[i].width; fs->height = imx219_liteon_framesizes[i].height; break; } } } if (i >= ARRAY_SIZE(imx219_liteon_framesizes)) { print_error("request resolution larger than sensor's max resolution"); return -EINVAL; } if (state == STATE_PREVIEW) imx219_liteon_sensor.preview_frmsize_index = i; else imx219_liteon_sensor.capture_frmsize_index = i; return 0; }
/*sonyimx214_set_framesizes,flag=1, set framesize to sensor,flag=0, only store framesize to camera_interface*/ static int sonyimx214_set_framesizes(camera_state state, struct v4l2_frmsize_discrete *fs, int flag, camera_setting_view_type view_type, bool zsl_preview) { int i = 0; bool match = false; int size = ARRAY_SIZE(sonyimx214_framesizes); if(!fs) { return -EINVAL; } print_info("Enter %s State(%d), flag=%d, width=%d, height=%d", __func__, state, flag, fs->width, fs->height); if (VIEW_FULL == view_type) { for (i = 0; i < size; i++) { if ((!zsl_preview && sonyimx214_framesizes[i].zsl_only) || (zsl_preview && !sonyimx214_framesizes[i].zsl_only)) { continue; } if ((sonyimx214_framesizes[i].width >= fs->width) && (sonyimx214_framesizes[i].height >= fs->height) && (VIEW_FULL == sonyimx214_framesizes[i].view_type) && (camera_get_resolution_type(fs->width, fs->height) <= sonyimx214_framesizes[i].resolution_type)) { fs->width = sonyimx214_framesizes[i].width; fs->height = sonyimx214_framesizes[i].height; match = true; break; } } } if (false == match) { for (i = 0; i < size; i++) { if ((zsl_preview == false) && sonyimx214_framesizes[i].zsl_only) { continue; } if ((sonyimx214_framesizes[i].width >= fs->width) && (sonyimx214_framesizes[i].height >= fs->height) && (camera_get_resolution_type(fs->width, fs->height) <= sonyimx214_framesizes[i].resolution_type) && (VIEW_HDR_MOVIE != sonyimx214_framesizes[i].view_type)) { fs->width = sonyimx214_framesizes[i].width; fs->height = sonyimx214_framesizes[i].height; break; } } } if (i >= size) { print_error("request resolution larger than sensor's max resolution"); return -EINVAL; } if (state == STATE_PREVIEW) { sonyimx214_sensor.preview_frmsize_index = i; } else { sonyimx214_sensor.capture_frmsize_index = i; } return 0; }
/* ************************************************************************** * FunctionName: sonyimx105_set_framesizes; * Description : NA; * Input : flag: if 1, set framesize to sensor, * if 0, only store framesize to camera_interface; * Output : NA; * ReturnValue : NA; * Other : NA; ************************************************************************** */ static int sonyimx105_set_framesizes(camera_state state, struct v4l2_frmsize_discrete *fs, int flag, camera_setting_view_type view_type) { int i = 0; bool match = false; assert(fs); print_info("Enter Function:%s State(%d), flag=%d, width=%d, height=%d", __func__, state, flag, fs->width, fs->height); if (VIEW_FULL == view_type) { for (i = 0; i < ARRAY_SIZE(sonyimx105_framesizes); i++) { if ((sonyimx105_framesizes[i].width >= fs->width) && (sonyimx105_framesizes[i].height >= fs->height) && (VIEW_FULL == sonyimx105_framesizes[i].view_type) && (camera_get_resolution_type(fs->width, fs->height) <= sonyimx105_framesizes[i].resolution_type)) { fs->width = sonyimx105_framesizes[i].width; fs->height = sonyimx105_framesizes[i].height; match = true; break; } } } if (false == match) { for (i = 0; i < ARRAY_SIZE(sonyimx105_framesizes); i++) { if ((sonyimx105_framesizes[i].width >= fs->width) && (sonyimx105_framesizes[i].height >= fs->height) && (camera_get_resolution_type(fs->width, fs->height) <= sonyimx105_framesizes[i].resolution_type)) { fs->width = sonyimx105_framesizes[i].width; fs->height = sonyimx105_framesizes[i].height; break; } } } if (i >= ARRAY_SIZE(sonyimx105_framesizes)) { print_error("request resolution larger than sensor's max resolution"); return -EINVAL; } if (state == STATE_PREVIEW) { sonyimx105_sensor.preview_frmsize_index = i; } else { sonyimx105_sensor.capture_frmsize_index = i; } return 0; }
/* ************************************************************************** * FunctionName: ov13850_set_framesizes; * Description : NA; * Input : flag: if 1, set framesize to sensor, * if 0, only store framesize to camera_interface; * Output : NA; * ReturnValue : NA; * Other : NA; ************************************************************************** */ static int ov13850_set_framesizes(camera_state state, struct v4l2_frmsize_discrete *fs, int flag, camera_setting_view_type view_type,bool zsl_preview) { int i = 0; bool match = false; int size = 0; assert(fs); if(NULL == fs) { return -EINVAL; } print_info("Enter Function:%s State(%d), flag=%d, width=%d, height=%d", __func__, state, flag, fs->width, fs->height); size = ARRAY_SIZE(ov13850_framesizes); if (VIEW_FULL == view_type) { for (i = 0; i < ARRAY_SIZE(ov13850_framesizes); i++) { if ((zsl_preview == false) && ov13850_framesizes[i].zsl_only ) { continue; } if ((ov13850_framesizes[i].width >= fs->width) && (ov13850_framesizes[i].height >= fs->height) && (VIEW_FULL == ov13850_framesizes[i].view_type) && (camera_get_resolution_type(fs->width, fs->height) <= ov13850_framesizes[i].resolution_type)) { fs->width = ov13850_framesizes[i].width; fs->height = ov13850_framesizes[i].height; match = true; break; } } } if (false == match) { for (i = 0; i < size; i++) { if ((zsl_preview == false) && ov13850_framesizes[i].zsl_only) { continue; } if ((ov13850_framesizes[i].width >= fs->width) && (ov13850_framesizes[i].height >= fs->height) && (camera_get_resolution_type(fs->width, fs->height) <= ov13850_framesizes[i].resolution_type)) { fs->width = ov13850_framesizes[i].width; fs->height = ov13850_framesizes[i].height; break; } } } if (i >= ARRAY_SIZE(ov13850_framesizes)) { print_error("request resolution larger than sensor's max resolution"); return -EINVAL; } if (state == STATE_PREVIEW) { ov13850_lit171.preview_frmsize_index = i; } else { ov13850_lit171.capture_frmsize_index = i; } print_info("Enter Function:%s preview index =%d, capture=%d ", __func__, ov13850_lit171.preview_frmsize_index, ov13850_lit171.capture_frmsize_index); return 0; }