Commit dfd96900 authored by Jacek Anaszewski's avatar Jacek Anaszewski Committed by Mauro Carvalho Chehab

[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: default avatarJacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent fac4d961
...@@ -1367,6 +1367,21 @@ static int s5p_jpeg_s_fmt(struct s5p_jpeg_ctx *ct, struct v4l2_format *f) ...@@ -1367,6 +1367,21 @@ static int s5p_jpeg_s_fmt(struct s5p_jpeg_ctx *ct, struct v4l2_format *f)
V4L2_CID_JPEG_CHROMA_SUBSAMPLING); V4L2_CID_JPEG_CHROMA_SUBSAMPLING);
if (ctrl_subs) if (ctrl_subs)
v4l2_ctrl_s_ctrl(ctrl_subs, q_data->fmt->subsampling); 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; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment