summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacek Anaszewski <j.anaszewski@samsung.com>2014-07-11 15:19:46 (GMT)
committerChanho Park <chanho61.park@samsung.com>2014-11-18 03:01:14 (GMT)
commitc6830dd2465c9a3d40af7dde5ac997b5127424e0 (patch)
tree0bfefe2934f2e4492ec26f276e0514104830f5b0
parentc95b93f297995d3888e779e81b5eea1717d6e5b1 (diff)
downloadlinux-3.10-c6830dd2465c9a3d40af7dde5ac997b5127424e0.zip
linux-3.10-c6830dd2465c9a3d40af7dde5ac997b5127424e0.tar.gz
linux-3.10-c6830dd2465c9a3d40af7dde5ac997b5127424e0.tar.bz2
[media] s5p-jpeg: Assure proper crop rectangle initialization
Assure proper crop_rect initialization in case the user space doesn't call S_SELECTION ioctl. Change-Id: I0ad267a1f3480efa83e78e714fb4ba94e08494be Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/platform/s5p-jpeg/jpeg-core.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index d11357f..3e3d94d 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -1367,6 +1367,21 @@ static int s5p_jpeg_s_fmt(struct s5p_jpeg_ctx *ct, struct v4l2_format *f)
V4L2_CID_JPEG_CHROMA_SUBSAMPLING);
if (ctrl_subs)
v4l2_ctrl_s_ctrl(ctrl_subs, q_data->fmt->subsampling);
+ ct->crop_altered = false;
+ }
+
+ /*
+ * For decoding init crop_rect with capture buffer dimmensions which
+ * contain aligned dimensions of the input JPEG image and do it only
+ * if crop rectangle hasn't been altered by the user space e.g. with
+ * S_SELECTION ioctl. For encoding assign output buffer dimensions.
+ */
+ if (!ct->crop_altered &&
+ ((ct->mode == S5P_JPEG_DECODE && f_type == FMT_TYPE_CAPTURE) ||
+ (ct->mode == S5P_JPEG_ENCODE && f_type == FMT_TYPE_OUTPUT))) {
+ ct->crop_rect.width = pix->width;
+ ct->crop_rect.height = pix->height;
+ }
}
return 0;