<div dir="ltr"><div>Hi Jacopo, thank you for the patch.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 3, 2021 at 7:56 PM Niklas Söderlund <<a href="mailto:niklas.soderlund@ragnatech.se">niklas.soderlund@ragnatech.se</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Jacopo,<br>
<br>
Thanks for your work.<br>
<br>
On 2021-05-03 11:26:59 +0200, Jacopo Mondi wrote:<br>
> Apply the last three hunks of commit 243d134 ("Fix some bug for some<br>
> resolutions") from <a href="https://github.com/intel/intel-ipu3-pipecfg.git" rel="noreferrer" target="_blank">https://github.com/intel/intel-ipu3-pipecfg.git</a><br>
> to the BDS calculation procedure.<br>
> <br>
> The BDS calculation is now perfomed by scaling both width and height,<br>
> and repeated by scaling width first.<br>
> <br>
> Tested-by: Jean-Michel Hautbois <<a href="mailto:jeanmichel.hautbois@ideasonboard.com" target="_blank">jeanmichel.hautbois@ideasonboard.com</a>><br>
> Reviewed-by: Jean-Michel Hautbois <<a href="mailto:jeanmichel.hautbois@ideasonboard.com" target="_blank">jeanmichel.hautbois@ideasonboard.com</a>><br>
> Signed-off-by: Jacopo Mondi <<a href="mailto:jacopo@jmondi.org" target="_blank">jacopo@jmondi.org</a>><br>
<br>
Acked-by: Niklas Söderlund <<a href="mailto:niklas.soderlund@ragnatech.se" target="_blank">niklas.soderlund@ragnatech.se</a>><br>
<br>
> ---<br>
>  src/libcamera/pipeline/ipu3/imgu.cpp | 34 ++++++++++++++++++++++++----<br>
>  1 file changed, 29 insertions(+), 5 deletions(-)<br>
> <br>
> diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp<br>
> index d5cf05b0c421..8373dc165a61 100644<br>
> --- a/src/libcamera/pipeline/ipu3/imgu.cpp<br>
> +++ b/src/libcamera/pipeline/ipu3/imgu.cpp<br>
> @@ -394,19 +394,43 @@ ImgUDevice::PipeConfig ImgUDevice::calculatePipeConfig(Pipe *pipe)<br>
>       const Size &in = pipe->input;<br>
>       Size gdc = calculateGDC(pipe);<br>
>  <br>
> -     unsigned int ifWidth = utils::alignUp(in.width, IF_ALIGN_W);<br>
> -     unsigned int ifHeight = in.height;<br>
> -     unsigned int minIfWidth = in.width - IF_CROP_MAX_W;<br>
>       float bdsSF = static_cast<float>(in.width) / gdc.width;<br>
>       float sf = findScaleFactor(bdsSF, bdsScalingFactors, true);<br>
>  <br>
> +     /* Populate the configurations vector by scaling width and height. */<br>
> +     unsigned int ifWidth = utils::alignUp(in.width, IF_ALIGN_W);<br>
> +     unsigned int ifHeight = utils::alignUp(in.height, IF_ALIGN_H);<br>
> +     unsigned int minIfWidth = in.width - IF_CROP_MAX_W;<br>
> +     unsigned int minIfHeight = in.height - IF_CROP_MAX_H;<br></blockquote><div><br></div><div>Should we std::max(0u, in.width - IF_CROP_MAX_W)?</div><div>If in.width < IF_CROP_MAX_W, an overflow happens and minIfWidth becomes very large.</div><div>Ditto to height.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
>       while (ifWidth >= minIfWidth) {<br>
> -             Size iif{ ifWidth, ifHeight };<br>
> -             calculateBDS(pipe, iif, gdc, sf);<br>
> +             while (ifHeight >= minIfHeight) {<br>
> +                     Size iif{ ifWidth, ifHeight };<br>
> +                     calculateBDS(pipe, iif, gdc, sf);<br>
> +                     ifHeight -= IF_ALIGN_H;<br>
> +             }<br>
>  <br>
>               ifWidth -= IF_ALIGN_W;<br>
>       }<br>
>  <br>
> +     /* Repeat search by scaling width first. */<br>
> +     ifWidth = utils::alignUp(in.width, IF_ALIGN_W);<br>
> +     ifHeight = utils::alignUp(in.height, IF_ALIGN_H);<br>
> +     minIfWidth = in.width - IF_CROP_MAX_W;<br>
> +     minIfHeight = in.height - IF_CROP_MAX_H;<br>
> +     while (ifHeight >= minIfHeight) {<br>
> +             /*<br>
> +              * \todo This procedure is probably broken:<br>
> +              * <a href="https://github.com/intel/intel-ipu3-pipecfg/issues/2" rel="noreferrer" target="_blank">https://github.com/intel/intel-ipu3-pipecfg/issues/2</a><br>
> +              */<br>
> +             while (ifWidth >= minIfWidth) {<br>
> +                     Size iif{ ifWidth, ifHeight };<br>
> +                     calculateBDS(pipe, iif, gdc, sf);<br>
> +                     ifWidth -= IF_ALIGN_W;<br>
> +             }<br>
> +<br>
> +             ifHeight -= IF_ALIGN_H;<br>
> +     }<br>
> +<br>
>       if (pipeConfigs.size() == 0) {<br>
>               LOG(IPU3, Error) << "Failed to calculate pipe configuration";<br>
>               return {};<br>
> -- <br>
> 2.31.1<br>
> <br>
> _______________________________________________<br>
> libcamera-devel mailing list<br>
> <a href="mailto:libcamera-devel@lists.libcamera.org" target="_blank">libcamera-devel@lists.libcamera.org</a><br>
> <a href="https://lists.libcamera.org/listinfo/libcamera-devel" rel="noreferrer" target="_blank">https://lists.libcamera.org/listinfo/libcamera-devel</a><br>
<br>
-- <br>
Regards,<br>
Niklas Söderlund<br>
_______________________________________________<br>
libcamera-devel mailing list<br>
<a href="mailto:libcamera-devel@lists.libcamera.org" target="_blank">libcamera-devel@lists.libcamera.org</a><br>
<a href="https://lists.libcamera.org/listinfo/libcamera-devel" rel="noreferrer" target="_blank">https://lists.libcamera.org/listinfo/libcamera-devel</a><br>
</blockquote></div></div>