[PATCH] soc-camera: fix rectangle adjustment in cropping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Koji Matsuoka <koji.matsuoka.xm@xxxxxxxxxxx>

update_subrect() adjusts the sub-rectangle to be inside a base area.
It checks width and height to not exceed those of the area, then it
checks the low border (left or top) to lie within the area, then the
high border (right or bottom) to lie there too. This latter check has
a bug, which is fixed by this patch.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@xxxxxxxxxxx>
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@xxxxxxxxx>
[g.liakhovetski@xxxxxx: dropped supposedly wrong hunks]
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@xxxxxx>
---

This is a part of the https://patchwork.linuxtv.org/patch/26441/ submitted 
almost 2.5 years ago. Back then I commented to the patch but never got a 
reply or an update. I preserved original authorship and Sob tags, although 
this version only uses a small portion of the original patch. This version 
is of course completely untested, any testing (at least regression) would 
be highly appreciated! This code is only used by the SH CEU driver and 
only in cropping / zooming scenarios.

 drivers/media/platform/soc_camera/soc_scale_crop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/soc_camera/soc_scale_crop.c b/drivers/media/platform/soc_camera/soc_scale_crop.c
index f77252d..4bfc1bf 100644
--- a/drivers/media/platform/soc_camera/soc_scale_crop.c
+++ b/drivers/media/platform/soc_camera/soc_scale_crop.c
@@ -70,14 +70,14 @@ static void update_subrect(struct v4l2_rect *rect, struct v4l2_rect *subrect)
 	if (rect->height < subrect->height)
 		subrect->height = rect->height;
 
-	if (rect->left > subrect->left)
+	if (rect->left < subrect->left)
 		subrect->left = rect->left;
 	else if (rect->left + rect->width >
 		 subrect->left + subrect->width)
 		subrect->left = rect->left + rect->width -
 			subrect->width;
 
-	if (rect->top > subrect->top)
+	if (rect->top < subrect->top)
 		subrect->top = rect->top;
 	else if (rect->top + rect->height >
 		 subrect->top + subrect->height)
-- 
1.9.3




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux