All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: dri-devel@lists.freedesktop.org
Cc: kernel@pengutronix.de, Steve Longerbeam <slongerbeam@gmail.com>
Subject: [PATCH 2/7] gpu: ipu-v3: image-convert: move output seam valid interval calculation into find_best_seam
Date: Wed, 14 Aug 2019 13:54:39 +0200	[thread overview]
Message-ID: <20190814115444.13024-2-p.zabel@pengutronix.de> (raw)
In-Reply-To: <20190814115444.13024-1-p.zabel@pengutronix.de>

This reduces code duplication and allows to easily calculate the valid
interval for the input seam position in the same place.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/gpu/ipu-v3/ipu-image-convert.c | 30 +++++++++++---------------
 1 file changed, 12 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c
index c9909f1c9ffb..4ac7377cfe5c 100644
--- a/drivers/gpu/ipu-v3/ipu-image-convert.c
+++ b/drivers/gpu/ipu-v3/ipu-image-convert.c
@@ -442,12 +442,10 @@ static int calc_image_resize_coefficients(struct ipu_image_convert_ctx *ctx,
 #define round_closest(x, y) round_down((x) + (y)/2, (y))
 
 /*
- * Find the best aligned seam position in the inverval [out_start, out_end].
+ * Find the best aligned seam position for the given column / row index.
  * Rotation and image offsets are out of scope.
  *
- * @out_start: start of inverval, must be within 1024 pixels / lines
- *             of out_end
- * @out_end: end of interval, smaller than or equal to out_edge
+ * @index: column / row index, used to calculate valid interval
  * @in_edge: input right / bottom edge
  * @out_edge: output right / bottom edge
  * @in_align: input alignment, either horizontal 8-byte line start address
@@ -463,8 +461,7 @@ static int calc_image_resize_coefficients(struct ipu_image_convert_ctx *ctx,
  * @_out_seam: aligned output seam position return value
  */
 static void find_best_seam(struct ipu_image_convert_ctx *ctx,
-			   unsigned int out_start,
-			   unsigned int out_end,
+			   unsigned int index,
 			   unsigned int in_edge,
 			   unsigned int out_edge,
 			   unsigned int in_align,
@@ -482,6 +479,13 @@ static void find_best_seam(struct ipu_image_convert_ctx *ctx,
 	unsigned int out_seam = 0;
 	unsigned int in_seam = 0;
 	unsigned int min_diff = UINT_MAX;
+	unsigned int out_start;
+	unsigned int out_end;
+
+	/* Start within 1024 pixels of the right / bottom edge */
+	out_start = max_t(int, index * out_align, out_edge - 1024);
+	/* End before having to add more columns to the left / rows above */
+	out_end = min_t(unsigned int, out_edge, index * 1024 + 1);
 
 	/*
 	 * Output tiles must start at a multiple of 8 bytes horizontally and
@@ -722,12 +726,7 @@ static void find_seams(struct ipu_image_convert_ctx *ctx,
 		 * horizontally.
 		 */
 
-		/* Start within 1024 pixels of the right edge */
-		out_start = max_t(int, col * out_left_align, out_right - 1024);
-		/* End before having to add more columns to the left */
-		out_end = min_t(unsigned int, out_right, col * 1024 + 1);
-
-		find_best_seam(ctx, out_start, out_end,
+		find_best_seam(ctx, col,
 			       in_right, out_right,
 			       in_left_align, out_left_align,
 			       allow_in_overshoot ? 1 : 8 /* burst length */,
@@ -767,12 +766,7 @@ static void find_seams(struct ipu_image_convert_ctx *ctx,
 		unsigned int in_top;
 		unsigned int out_top;
 
-		/* Start within 1024 lines of the bottom edge */
-		out_start = max_t(int, row * out_top_align, out_bottom - 1024);
-		/* End before having to add more rows above */
-		out_end = min_t(unsigned int, out_bottom, row * 1024 + 1);
-
-		find_best_seam(ctx, out_start, out_end,
+		find_best_seam(ctx, row,
 			       in_bottom, out_bottom,
 			       in_top_align, out_top_align,
 			       1, allow_overshoot ? 1 : out_height_align,
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-08-14 11:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-14 11:54 [PATCH 1/7] gpu: ipu-v3: image-convert: fix output seam valid interval Philipp Zabel
2019-08-14 11:54 ` Philipp Zabel [this message]
2019-08-14 15:09   ` [PATCH 2/7] gpu: ipu-v3: image-convert: move output seam valid interval calculation into find_best_seam Philipp Zabel
2019-08-14 11:54 ` [PATCH 3/7] gpu: ipu-v3: image-convert: limit input seam position to hardware requirements Philipp Zabel
2019-08-14 11:54 ` [PATCH 4/7] gpu: ipu-v3: image-convert: fix image downsize coefficients and tiling calculation Philipp Zabel
2019-08-14 11:54 ` [PATCH 5/7] gpu: ipu-v3: image-convert: bail on invalid tile sizes Philipp Zabel
2019-08-14 11:54 ` [PATCH 6/7] gpu: ipu-v3: image-convert: move tile burst alignment out of loop Philipp Zabel
2019-08-14 11:54 ` [PATCH 7/7] gpu: ipu-v3: image-convert: only sample into the next tile if necessary Philipp Zabel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190814115444.13024-2-p.zabel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@pengutronix.de \
    --cc=slongerbeam@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.