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