diff options
author | Jacek Anaszewski <j.anaszewski@samsung.com> | 2014-07-11 11:19:46 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-30 18:19:30 -0400 |
commit | dfd96900b29601f44410c9e85de8309ce8eadd02 (patch) | |
tree | 714f1a17757c450cb08931d5e25f501408166ecb /drivers/media/platform | |
parent | fac4d961263d054658f42328ca7b7384d11a0487 (diff) |
[media] s5p-jpeg: Assure proper crop rectangle initialization
Assure proper crop_rect initialization in case the user space
doesn't call S_SELECTION ioctl.
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>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r-- | drivers/media/platform/s5p-jpeg/jpeg-core.c | 15 |
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 d11357f5fc45..3e3d94dd03f8 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) | |||
1367 | V4L2_CID_JPEG_CHROMA_SUBSAMPLING); | 1367 | V4L2_CID_JPEG_CHROMA_SUBSAMPLING); |
1368 | if (ctrl_subs) | 1368 | if (ctrl_subs) |
1369 | v4l2_ctrl_s_ctrl(ctrl_subs, q_data->fmt->subsampling); | 1369 | v4l2_ctrl_s_ctrl(ctrl_subs, q_data->fmt->subsampling); |
1370 | ct->crop_altered = false; | ||
1371 | } | ||
1372 | |||
1373 | /* | ||
1374 | * For decoding init crop_rect with capture buffer dimmensions which | ||
1375 | * contain aligned dimensions of the input JPEG image and do it only | ||
1376 | * if crop rectangle hasn't been altered by the user space e.g. with | ||
1377 | * S_SELECTION ioctl. For encoding assign output buffer dimensions. | ||
1378 | */ | ||
1379 | if (!ct->crop_altered && | ||
1380 | ((ct->mode == S5P_JPEG_DECODE && f_type == FMT_TYPE_CAPTURE) || | ||
1381 | (ct->mode == S5P_JPEG_ENCODE && f_type == FMT_TYPE_OUTPUT))) { | ||
1382 | ct->crop_rect.width = pix->width; | ||
1383 | ct->crop_rect.height = pix->height; | ||
1384 | } | ||
1370 | } | 1385 | } |
1371 | 1386 | ||
1372 | return 0; | 1387 | return 0; |