diff options
author | Liu Ying <b17645@freescale.com> | 2009-10-26 15:56:42 -0400 |
---|---|---|
committer | Alejandro Gonzalez <alex.gonzalez@digi.com> | 2010-02-12 17:19:27 +0100 |
commit | b669ea76cbcbdf5e6c3dcdc2d7a0dee9d045d470 (patch) | |
tree | c0ed48a5026a1a9c93da8fba7a3a16e6c6695a36 /drivers/media | |
parent | 2a14be5f45507671feebea27c156c89bfa0246ef (diff) |
ENGR00117261 V4L2 capture:CSI input cropping improvement
1) When using CSI->MEM to capture frames, the output frame resolution of
channel CSI->MEM should be the same with that of cropping input frame.
2) Enable to capture frames bigger than the cropped input frames.
Signed-off-by: Liu Ying <b17645@freescale.com>
(cherry picked from commit eee5a08306df7d9b1f23f463c9e9439e04293b57)
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/mxc/capture/mxc_v4l2_capture.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/drivers/media/video/mxc/capture/mxc_v4l2_capture.c b/drivers/media/video/mxc/capture/mxc_v4l2_capture.c index be733338c1b5..edbd2ca606d1 100644 --- a/drivers/media/video/mxc/capture/mxc_v4l2_capture.c +++ b/drivers/media/video/mxc/capture/mxc_v4l2_capture.c @@ -674,18 +674,8 @@ static int mxc_v4l2_s_fmt(cam_data *cam, struct v4l2_format *f) */ if (strcmp(mxc_capture_inputs[cam->current_input].name, "CSI MEM") == 0) { - f->fmt.pix.width = cam->crop_bounds.width; - f->fmt.pix.height = cam->crop_bounds.height; - } - - /* Handle case where size requested is larger than cuurent - * camera setting. */ - if ((f->fmt.pix.width > cam->crop_bounds.width) - || (f->fmt.pix.height > cam->crop_bounds.height)) { - /* Need the logic here, calling vidioc_s_param if - * camera can change. */ - /* For the moment, just return an error. */ - return -EINVAL; + f->fmt.pix.width = cam->crop_current.width; + f->fmt.pix.height = cam->crop_current.height; } if (cam->rotation >= IPU_ROTATE_90_RIGHT) { @@ -700,10 +690,10 @@ static int mxc_v4l2_s_fmt(cam_data *cam, struct v4l2_format *f) *width -= *width % 8; *height -= *height % 8; - if ((cam->crop_bounds.width / *width > 8) || - ((cam->crop_bounds.width / *width == 8) && - (cam->crop_bounds.width % *width))) { - *width = cam->crop_bounds.width / 8; + if ((cam->crop_current.width / *width > 8) || + ((cam->crop_current.width / *width == 8) && + (cam->crop_current.width % *width))) { + *width = cam->crop_current.width / 8; if (*width % 8) *width += 8 - *width % 8; pr_err("ERROR: v4l2 capture: width exceeds limit " @@ -711,10 +701,10 @@ static int mxc_v4l2_s_fmt(cam_data *cam, struct v4l2_format *f) *width); } - if ((cam->crop_bounds.height / *height > 8) || - ((cam->crop_bounds.height / *height == 8) && - (cam->crop_bounds.height % *height))) { - *height = cam->crop_bounds.height / 8; + if ((cam->crop_current.height / *height > 8) || + ((cam->crop_current.height / *height == 8) && + (cam->crop_current.height % *height))) { + *height = cam->crop_current.height / 8; if (*height % 8) *height += 8 - *height % 8; pr_err("ERROR: v4l2 capture: height exceeds limit " @@ -1143,6 +1133,13 @@ static int mxc_v4l2_s_param(cam_data *cam, struct v4l2_streamparm *parm) cam->crop_bounds.width = cam_fmt.fmt.pix.width; cam->crop_bounds.height = cam_fmt.fmt.pix.height; + /* + * Set the default current cropped resolution to be the same with + * the cropping boundary. + */ + cam->crop_current.width = cam->crop_bounds.width; + cam->crop_current.height = cam->crop_bounds.height; + /* This essentially loses the data at the left and bottom of the image * giving a digital zoom image, if crop_current is less than the full * size of the image. */ |