[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y3t9tNlXZCHcw4jd@smile.fi.intel.com>
Date: Mon, 21 Nov 2022 15:31:32 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Hans de Goede <hdegoede@...hat.com>
Cc: linux-media@...r.kernel.org, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH v1 1/1] atomisp: Make bds_factors_list be type of struct
u32_fract
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@...hat.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
Powered by blists - more mailing lists