public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [media] omap3isp: preview: Fix the crop margins
@ 2014-01-17 19:37 Florian Vaussard
  2014-01-19 10:57 ` Laurent Pinchart
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Vaussard @ 2014-01-17 19:37 UTC (permalink / raw)
  To: Laurent Pinchart, Mauro Carvalho Chehab; +Cc: linux-media, Florian Vaussard

Commit 3fdfedaaa "[media] omap3isp: preview: Lower the crop margins"
accidentally changed the previewer's cropping, causing the previewer
to miss four pixels on each line, thus corrupting the final image.
Restored the removed setting.

Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/platform/omap3isp/isppreview.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/media/platform/omap3isp/isppreview.c b/drivers/media/platform/omap3isp/isppreview.c
index cd8831a..e2e4610 100644
--- a/drivers/media/platform/omap3isp/isppreview.c
+++ b/drivers/media/platform/omap3isp/isppreview.c
@@ -1079,6 +1079,7 @@ static void preview_config_input_format(struct isp_prev_device *prev,
  */
 static void preview_config_input_size(struct isp_prev_device *prev, u32 active)
 {
+	const struct v4l2_mbus_framefmt *format = &prev->formats[PREV_PAD_SINK];
 	struct isp_device *isp = to_isp_device(prev);
 	unsigned int sph = prev->crop.left;
 	unsigned int eph = prev->crop.left + prev->crop.width - 1;
@@ -1086,6 +1087,14 @@ static void preview_config_input_size(struct isp_prev_device *prev, u32 active)
 	unsigned int elv = prev->crop.top + prev->crop.height - 1;
 	u32 features;
 
+	if (format->code != V4L2_MBUS_FMT_Y8_1X8 &&
+	    format->code != V4L2_MBUS_FMT_Y10_1X10) {
+		sph -= 2;
+		eph += 2;
+		slv -= 2;
+		elv += 2;
+	}
+
 	features = (prev->params.params[0].features & active)
 		 | (prev->params.params[1].features & ~active);
 
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] [media] omap3isp: preview: Fix the crop margins
  2014-01-17 19:37 [PATCH] [media] omap3isp: preview: Fix the crop margins Florian Vaussard
@ 2014-01-19 10:57 ` Laurent Pinchart
  0 siblings, 0 replies; 2+ messages in thread
From: Laurent Pinchart @ 2014-01-19 10:57 UTC (permalink / raw)
  To: Florian Vaussard; +Cc: Mauro Carvalho Chehab, linux-media

Hi Florian,

Thank you for the patch.

On Friday 17 January 2014 20:37:38 Florian Vaussard wrote:
> Commit 3fdfedaaa "[media] omap3isp: preview: Lower the crop margins"
> accidentally changed the previewer's cropping, causing the previewer
> to miss four pixels on each line, thus corrupting the final image.
> Restored the removed setting.
> 
> Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>
> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

I've applied this to my tree and will send a pull request.

> ---
>  drivers/media/platform/omap3isp/isppreview.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/media/platform/omap3isp/isppreview.c
> b/drivers/media/platform/omap3isp/isppreview.c index cd8831a..e2e4610
> 100644
> --- a/drivers/media/platform/omap3isp/isppreview.c
> +++ b/drivers/media/platform/omap3isp/isppreview.c
> @@ -1079,6 +1079,7 @@ static void preview_config_input_format(struct
> isp_prev_device *prev, */
>  static void preview_config_input_size(struct isp_prev_device *prev, u32
> active) {
> +	const struct v4l2_mbus_framefmt *format = &prev->formats[PREV_PAD_SINK];
>  	struct isp_device *isp = to_isp_device(prev);
>  	unsigned int sph = prev->crop.left;
>  	unsigned int eph = prev->crop.left + prev->crop.width - 1;
> @@ -1086,6 +1087,14 @@ static void preview_config_input_size(struct
> isp_prev_device *prev, u32 active) unsigned int elv = prev->crop.top +
> prev->crop.height - 1;
>  	u32 features;
> 
> +	if (format->code != V4L2_MBUS_FMT_Y8_1X8 &&
> +	    format->code != V4L2_MBUS_FMT_Y10_1X10) {
> +		sph -= 2;
> +		eph += 2;
> +		slv -= 2;
> +		elv += 2;
> +	}
> +
>  	features = (prev->params.params[0].features & active)
> 
>  		 | (prev->params.params[1].features & ~active);
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-19 10:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-17 19:37 [PATCH] [media] omap3isp: preview: Fix the crop margins Florian Vaussard
2014-01-19 10:57 ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox