<div dir="ltr"><div dir="ltr">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:55 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 patch.<br>
<br>
On 2021-05-03 11:27:04 +0200, Jacopo Mondi wrote:<br>
> Add pipe calculation debug with a new associated log category.<br>
> <br>
> This helps compare the pipe calculation with the one performed by the<br>
> python script.<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>
> Reviewed-by: Laurent Pinchart <<a href="mailto:laurent.pinchart@ideasonboard.com" target="_blank">laurent.pinchart@ideasonboard.com</a>><br>
> Signed-off-by: Jacopo Mondi <<a href="mailto:jacopo@jmondi.org" target="_blank">jacopo@jmondi.org</a>><br>
> ---<br>
>  src/libcamera/pipeline/ipu3/imgu.cpp | 34 ++++++++++++++++++++++++----<br>
>  1 file changed, 30 insertions(+), 4 deletions(-)<br>
> <br>
> diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp<br>
> index fa8cf7eeef19..c874a07e8da6 100644<br>
> --- a/src/libcamera/pipeline/ipu3/imgu.cpp<br>
> +++ b/src/libcamera/pipeline/ipu3/imgu.cpp<br>
> @@ -23,6 +23,7 @@<br>
>  namespace libcamera {<br>
>  <br>
>  LOG_DECLARE_CATEGORY(IPU3)<br>
> +LOG_DEFINE_CATEGORY(ImgUPipe)<br>
<br>
I like how easy it is to do tings like this.<br>
<br>
Reviewed-by: Niklas Söderlund <<a href="mailto:niklas.soderlund@ragnatech.se" target="_blank">niklas.soderlund@ragnatech.se</a>><br>
<br></blockquote><div><br></div><div>Reviewed-by: Hirokazu Honda <<a href="mailto:hiroh@chromium.org">hiroh@chromium.org</a>></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">
>  <br>
>  namespace {<br>
>  <br>
> @@ -128,6 +129,8 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc<br>
>       unsigned int ifHeight;<br>
>       float bdsHeight;<br>
>  <br>
> +     LOG(ImgUPipe, Debug) << "BDS sf: " << bdsSF << ", BDS width: " << bdsWidth;<br>
> +<br>
>       if (!isSameRatio(pipe->input, gdc)) {<br>
>               unsigned int foundIfHeights[2] = { 0, 0 };<br>
>               float estIFHeight = (iif.width * gdc.height) /<br>
> @@ -135,6 +138,9 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc<br>
>               estIFHeight = std::clamp<float>(estIFHeight, minIFHeight, iif.height);<br>
>  <br>
>               ifHeight = utils::alignUp(estIFHeight, IF_ALIGN_H);<br>
> +             LOG(ImgUPipe, Debug) << "Estimated IF Height: " << estIFHeight<br>
> +                                  << ", IF Height: " << ifHeight;<br>
> +<br>
>               while (ifHeight >= minIFHeight && ifHeight <= iif.height &&<br>
>                      ifHeight / bdsSF >= minBDSHeight) {<br>
>  <br>
> @@ -175,9 +181,15 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc<br>
>  <br>
>               if (foundIfHeights[0] || foundIfHeights[1]) {<br>
>                       unsigned int bdsIntHeight = static_cast<unsigned int>(bdsHeight);<br>
> +                     Size foundIf{ iif.width, ifHeight };<br>
> +                     Size foundBds{ bdsWidth, bdsIntHeight };<br>
>  <br>
> -                     pipeConfigs.push_back({ bdsSF, { iif.width, ifHeight },<br>
> -                                             { bdsWidth, bdsIntHeight }, gdc });<br>
> +                     LOG(ImgUPipe, Debug)<br>
> +                             << "IF: " << foundIf.toString()<br>
> +                             << ", BDS: " << foundBds.toString()<br>
> +                             << ", GDC: " << gdc.toString();<br>
> +<br>
> +                     pipeConfigs.push_back({ bdsSF, foundIf, foundBds, gdc });<br>
>                       return;<br>
>               }<br>
>       } else {<br>
> @@ -190,8 +202,15 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc<br>
>  <br>
>                               if (!(ifHeight % IF_ALIGN_H) &&<br>
>                                   !(bdsIntHeight % BDS_ALIGN_H)) {<br>
> -                                     pipeConfigs.push_back({ bdsSF, { iif.width, ifHeight },<br>
> -                                                             { bdsWidth, bdsIntHeight }, gdc });<br>
> +                                     Size foundIf{ iif.width, ifHeight };<br>
> +                                     Size foundBds{ bdsWidth, bdsIntHeight };<br>
> +<br>
> +                                     LOG(ImgUPipe, Debug)<br>
> +                                             << "IF: " << foundIf.toString()<br>
> +                                             << ", BDS: " << foundBds.toString()<br>
> +                                             << ", GDC: " << gdc.toString();<br>
> +<br>
> +                                     pipeConfigs.push_back({ bdsSF, foundIf, foundBds, gdc });<br>
>                               }<br>
>                       }<br>
>  <br>
> @@ -269,6 +288,8 @@ Size calculateGDC(ImgUDevice::Pipe *pipe)<br>
>       gdc.width = main.width * sf;<br>
>       gdc.height = main.height * sf;<br>
>  <br>
> +     LOG(ImgUPipe, Debug) << "GDC: " << gdc.toString();<br>
> +<br>
>       return gdc;<br>
>  }<br>
>  <br>
> @@ -286,6 +307,11 @@ FOV calcFOV(const Size &in, const ImgUDevice::PipeConfig &pipe)<br>
>       fov.w = (inW - (ifCropW + gdcCropW)) / inW;<br>
>       fov.h = (inH - (ifCropH + gdcCropH)) / inH;<br>
>  <br>
> +     LOG(ImgUPipe, Debug)<br>
> +             << "IF (" << pipe.iif.toString() << ") - BDS ("<br>
> +             << pipe.bds.toString() << ") - GDC (" << pipe.gdc.toString()<br>
> +             << ") -> FOV: " << fov.w << "x" << fov.h;<br>
> +<br>
>       return fov;<br>
>  }<br>
>  <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>