linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v4 3/4] media: vsp1: Split out pre-filter calculation
Date: Thu, 16 May 2019 15:03:50 +0300	[thread overview]
Message-ID: <20190516120350.GJ14820@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20190513201355.994-4-kieran.bingham+renesas@ideasonboard.com>

Hi Kieran,

Thank you for the patch.

On Mon, May 13, 2019 at 09:13:54PM +0100, Kieran Bingham wrote:
> 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

I would say "reduced by binning". Apart from this,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> + * 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 {

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2019-05-16 12:04 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 ` [PATCH v4 3/4] media: vsp1: Split out pre-filter calculation Kieran Bingham
2019-05-16 12:03   ` Laurent Pinchart [this message]
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=20190516120350.GJ14820@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=kieran.bingham+renesas@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).