The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: linux-media@vger.kernel.org, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH v1 1/1] atomisp: Make bds_factors_list be type of struct u32_fract
Date: Mon, 21 Nov 2022 15:31:32 +0200	[thread overview]
Message-ID: <Y3t9tNlXZCHcw4jd@smile.fi.intel.com> (raw)
In-Reply-To: <837c5412-5019-c78a-d890-7fedd4064a9e@redhat.com>

On Mon, Nov 21, 2022 at 02:21:30PM +0100, Hans de Goede wrote:
> On 11/18/22 19:43, Andy Shevchenko wrote:

...

> Thanks, patch looks good to me:
> 
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> 
> I've added this to my media-atomisp branch now and will
> include this in the pull-req which I will send to Mauro after I've
> run some quick tests (tonight or tomorrow).

Thank you!

...

> >  	res->sc_bayer_origin_x_bqs_on_shading_table =
> >  		((left_padding_adjusted_bqs + bad_bqs_on_left_before_bs)
> > -		* bs_hor_ratio_out + bs_hor_ratio_in / 2) / bs_hor_ratio_in
> > +		* bds.denominator + bds.numerator / 2) / bds.numerator
> >  		+ bad_bqs_on_left_after_bs;
> > -	/* "+ bs_hor_ratio_in/2": rounding for division by bs_hor_ratio_in */
> > +	/* "+ bds.numerator / 2": rounding for division by bds.numerator */
> >  	res->sc_bayer_origin_y_bqs_on_shading_table =
> > -		(bad_bqs_on_top_before_bs * bs_ver_ratio_out + bs_ver_ratio_in / 2) / bs_ver_ratio_in
> > +		(bad_bqs_on_top_before_bs * bds.denominator + bds.numerator / 2) / bds.numerator
> >  		+ bad_bqs_on_top_after_bs;
> > -	/* "+ bs_ver_ratio_in/2": rounding for division by bs_ver_ratio_in */
> > +	/* "+ bds.numerator / 2": rounding for division by bds.numerator */

While reading this code again I just realized this is open coded
DIV_ROUND_CLOSEST(). But, thinking more, I believe we may rather introduce
the FRACT_DIV_ROUND_CLOSEST() macro in the math.h and take struct *_fract
as a parameter. In any case, it's for the future improvements.

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2022-11-21 13:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-18 18:43 [PATCH v1 1/1] atomisp: Make bds_factors_list be type of struct u32_fract Andy Shevchenko
2022-11-21 13:21 ` Hans de Goede
2022-11-21 13:31   ` Andy Shevchenko [this message]

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=Y3t9tNlXZCHcw4jd@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox