<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 Fri, May 14, 2021 at 12:20 AM Jacopo Mondi <<a href="mailto:jacopo@jmondi.org">jacopo@jmondi.org</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">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>
Signed-off-by: Jacopo Mondi <<a href="mailto:jacopo@jmondi.org" target="_blank">jacopo@jmondi.org</a>><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>
Acked-by: Niklas Söderlund <<a href="mailto:niklas.soderlund@ragnatech.se" target="_blank">niklas.soderlund@ragnatech.se</a>><br></blockquote><div><br></div><div>Reviewed-by: Hirokazu Honda <<a href="mailto:hiroh@chromium.org">hiroh@chromium.org</a>> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"></blockquote><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
src/libcamera/pipeline/ipu3/imgu.cpp | 36 ++++++++++++++++++++++++----<br>
1 file changed, 31 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp<br>
index d5cf05b0c421..acc625ab0fac 100644<br>
--- a/src/libcamera/pipeline/ipu3/imgu.cpp<br>
+++ b/src/libcamera/pipeline/ipu3/imgu.cpp<br>
@@ -394,19 +394,45 @@ 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 = std::min(IF_ALIGN_W,<br>
+ in.width - IF_CROP_MAX_W);<br>
+ unsigned int minIfHeight = std::min(IF_ALIGN_H,<br>
+ in.height - IF_CROP_MAX_H);<br>
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 = std::min(IF_ALIGN_W, in.width - IF_CROP_MAX_W);<br>
+ minIfHeight = std::min(IF_ALIGN_H, 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>
</blockquote></div></div>