summaryrefslogtreecommitdiff
path: root/drivers/staging/media/rkisp1/rkisp1-resizer.c
diff options
context:
space:
mode:
authorDafna Hirschfeld <dafna.hirschfeld@collabora.com>2020-04-12 14:05:03 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-05-05 17:07:01 +0200
commit0b64a837817ec562ed7079964236890e29cbc666 (patch)
tree73ab3376fd255d8d9e61fa0f03de967fddd4f2d6 /drivers/staging/media/rkisp1/rkisp1-resizer.c
parent21e4cdcb62ae60b9dc23917e9d65b7283fbc8bc7 (diff)
media: staging: rkisp1: rsz: change (hv)div only if capture format is YUV
RGB formats in selfpath should receive input format as YUV422. The resizer input format is always YUV422 and therefore if the capture format is RGB, the resizer should not change the YUV rations. Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/staging/media/rkisp1/rkisp1-resizer.c')
-rw-r--r--drivers/staging/media/rkisp1/rkisp1-resizer.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/staging/media/rkisp1/rkisp1-resizer.c b/drivers/staging/media/rkisp1/rkisp1-resizer.c
index c28919b9af44..d049374413dc 100644
--- a/drivers/staging/media/rkisp1/rkisp1-resizer.c
+++ b/drivers/staging/media/rkisp1/rkisp1-resizer.c
@@ -394,9 +394,14 @@ static void rkisp1_rsz_config(struct rkisp1_resizer *rsz,
* but also to change the scale for YUV formats,
* (4:2:2 -> 4:2:0 for example). So the width/height of the CbCr
* streams should be set according to the pixel format in the capture.
+ * The resizer always gets the input as YUV422. If the capture format
+ * is RGB then the memory input should be YUV422 so we don't change the
+ * default hdiv, vdiv in that case.
*/
- hdiv = cap->pix.info->hdiv;
- vdiv = cap->pix.info->vdiv;
+ if (v4l2_is_format_yuv(cap->pix.info)) {
+ hdiv = cap->pix.info->hdiv;
+ vdiv = cap->pix.info->vdiv;
+ }
src_c.width = src_y.width / hdiv;
src_c.height = src_y.height / vdiv;