Re: [PATCH v1 1/1] atomisp: Make bds_factors_list be type of struct u32_fract

From: Andy Shevchenko
Date: Mon Nov 21 2022 - 08:32:08 EST


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@xxxxxxxxxx>
>
> 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