From: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
To: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Subject: [PATCH v4 3/4] media: vsp1: Split out pre-filter calculation
Date: Mon, 13 May 2019 21:13:54 +0100 [thread overview]
Message-ID: <20190513201355.994-4-kieran.bingham+renesas@ideasonboard.com> (raw)
In-Reply-To: <20190513201355.994-1-kieran.bingham+renesas@ideasonboard.com>
The 'mp' value is used through several calculations in determining the
scaling factors of the UDS. This determines the pre-scaling filter
binning value. Factor this out so that it can be reused in further
calculations, and also ensure that if the BLADV control is ever changed
only a single function needs to be modified.
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
---
drivers/media/platform/vsp1/vsp1_uds.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/drivers/media/platform/vsp1/vsp1_uds.c b/drivers/media/platform/vsp1/vsp1_uds.c
index 27012af973b2..effebfc0c862 100644
--- a/drivers/media/platform/vsp1/vsp1_uds.c
+++ b/drivers/media/platform/vsp1/vsp1_uds.c
@@ -46,6 +46,22 @@ void vsp1_uds_set_alpha(struct vsp1_entity *entity, struct vsp1_dl_body *dlb,
alpha << VI6_UDS_ALPVAL_VAL0_SHIFT);
}
+/*
+ * Determine the pre-filter binning divider.
+ *
+ * The UDS uses a two stage filter scaler process. This determines the
+ * rate at which pixels are reduced for large down-scaling ratios before
+ * being fed into the bicubic filter.
+ *
+ * This calculation assumes that the BLADV bit is unset.
+ */
+static unsigned int uds_pre_scaling_divisor(int ratio)
+{
+ unsigned int mp = ratio / 4096;
+
+ return mp < 4 ? 1 : (mp < 8 ? 2 : 4);
+}
+
/*
* uds_output_size - Return the output size for an input size and scaling ratio
* @input: input size in pixels
@@ -55,10 +71,7 @@ static unsigned int uds_output_size(unsigned int input, unsigned int ratio)
{
if (ratio > 4096) {
/* Down-scaling */
- unsigned int mp;
-
- mp = ratio / 4096;
- mp = mp < 4 ? 1 : (mp < 8 ? 2 : 4);
+ unsigned int mp = uds_pre_scaling_divisor(ratio);
return (input - 1) / mp * mp * 4096 / ratio + 1;
} else {
@@ -88,10 +101,7 @@ static unsigned int uds_passband_width(unsigned int ratio)
{
if (ratio >= 4096) {
/* Down-scaling */
- unsigned int mp;
-
- mp = ratio / 4096;
- mp = mp < 4 ? 1 : (mp < 8 ? 2 : 4);
+ unsigned int mp = uds_pre_scaling_divisor(ratio);
return 64 * 4096 * mp / ratio;
} else {
--
2.20.1
next prev parent reply other threads:[~2019-05-13 20:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-13 20:13 [PATCH v4 0/4] media: vsp1: Phased partition overlap support Kieran Bingham
2019-05-13 20:13 ` [PATCH v4 1/4] media: vsp1: Define partition algorithm helper Kieran Bingham
2019-05-13 20:13 ` [PATCH v4 2/4] media: vsp1: Document partition algorithm in code header Kieran Bingham
2019-05-13 20:13 ` Kieran Bingham [this message]
2019-05-16 12:03 ` [PATCH v4 3/4] media: vsp1: Split out pre-filter calculation Laurent Pinchart
2019-05-13 20:13 ` [PATCH v4 4/4] media: vsp1: Provide partition overlap algorithm Kieran Bingham
2019-05-16 20:51 ` Laurent Pinchart
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=20190513201355.994-4-kieran.bingham+renesas@ideasonboard.com \
--to=kieran.bingham+renesas@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).