Message ID | 20210503092705.15562-3-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:00 +0200, Jacopo Mondi wrote: > Apply to calculateBDS() function the content of commit 243d134 ("Fix > some bug for some resolutions") from > https://github.com/intel/intel-ipu3-pipecfg.git. > > The calculated BDS sizes are filtered by height and not only by width > anymore. > > Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> > Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Acked-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > --- > src/libcamera/pipeline/ipu3/imgu.cpp | 20 +++++++++++++++----- > 1 file changed, 15 insertions(+), 5 deletions(-) > > diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp > index 8373dc165a61..36fee31c1962 100644 > --- a/src/libcamera/pipeline/ipu3/imgu.cpp > +++ b/src/libcamera/pipeline/ipu3/imgu.cpp > @@ -33,6 +33,7 @@ namespace { > * at revision: 61e83f2f7606 ("Add more information into README") > */ > > +static constexpr unsigned int FILTER_W = 4; > static constexpr unsigned int FILTER_H = 4; > > static constexpr unsigned int IF_ALIGN_W = 2; > @@ -194,15 +195,20 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc > > void calculateBDS(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc, float bdsSF) > { > - unsigned int minBDSWidth = gdc.width + FILTER_H * 2; > + unsigned int minBDSWidth = gdc.width + FILTER_W * 2; > + unsigned int minBDSHeight = gdc.height + FILTER_H * 2; > > float sf = bdsSF; > while (sf <= BDS_SF_MAX && sf >= BDS_SF_MIN) { > float bdsWidth = static_cast<float>(iif.width) / sf; > + float bdsHeight = static_cast<float>(iif.height) / sf; > > - if (std::fmod(bdsWidth, 1.0) == 0) { > + if (std::fmod(bdsWidth, 1.0) == 0 && > + std::fmod(bdsHeight, 1.0) == 0) { > unsigned int bdsIntWidth = static_cast<unsigned int>(bdsWidth); > - if (!(bdsIntWidth % BDS_ALIGN_W) && bdsWidth >= minBDSWidth) > + unsigned int bdsIntHeight = static_cast<unsigned int>(bdsHeight); > + if (!(bdsIntWidth % BDS_ALIGN_W) && bdsWidth >= minBDSWidth && > + !(bdsIntHeight % BDS_ALIGN_H) && bdsHeight >= minBDSHeight) > calculateBDSHeight(pipe, iif, gdc, bdsIntWidth, sf); > } > > @@ -212,10 +218,14 @@ void calculateBDS(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc, floa > sf = bdsSF; > while (sf <= BDS_SF_MAX && sf >= BDS_SF_MIN) { > float bdsWidth = static_cast<float>(iif.width) / sf; > + float bdsHeight = static_cast<float>(iif.height) / sf; > > - if (std::fmod(bdsWidth, 1.0) == 0) { > + if (std::fmod(bdsWidth, 1.0) == 0 && > + std::fmod(bdsHeight, 1.0) == 0) { > unsigned int bdsIntWidth = static_cast<unsigned int>(bdsWidth); > - if (!(bdsIntWidth % BDS_ALIGN_W) && bdsWidth >= minBDSWidth) > + unsigned int bdsIntHeight = static_cast<unsigned int>(bdsHeight); > + if (!(bdsIntWidth % BDS_ALIGN_W) && bdsWidth >= minBDSWidth && > + !(bdsIntHeight % BDS_ALIGN_H) && bdsHeight >= minBDSHeight) > calculateBDSHeight(pipe, iif, gdc, bdsIntWidth, sf); > } > > -- > 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:56 PM Niklas Söderlund < niklas.soderlund@ragnatech.se> wrote: > Hi Jacopo, > > Thanks for your patch. > > On 2021-05-03 11:27:00 +0200, Jacopo Mondi wrote: > > Apply to calculateBDS() function the content of commit 243d134 ("Fix > > some bug for some resolutions") from > > https://github.com/intel/intel-ipu3-pipecfg.git. > > > > The calculated BDS sizes are filtered by height and not only by width > > anymore. > > > > Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> > > Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > > Acked-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > > > --- > > src/libcamera/pipeline/ipu3/imgu.cpp | 20 +++++++++++++++----- > > 1 file changed, 15 insertions(+), 5 deletions(-) > > > > diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp > b/src/libcamera/pipeline/ipu3/imgu.cpp > > index 8373dc165a61..36fee31c1962 100644 > > --- a/src/libcamera/pipeline/ipu3/imgu.cpp > > +++ b/src/libcamera/pipeline/ipu3/imgu.cpp > > @@ -33,6 +33,7 @@ namespace { > > * at revision: 61e83f2f7606 ("Add more information into README") > > */ > > > > +static constexpr unsigned int FILTER_W = 4; > > static constexpr unsigned int FILTER_H = 4; > > Would you mind adding comments about these const variables in another patch? By the way, static is unnecessary to the variables. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> > > > static constexpr unsigned int IF_ALIGN_W = 2; > > @@ -194,15 +195,20 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, > const Size &iif, const Size &gdc > > > > void calculateBDS(ImgUDevice::Pipe *pipe, const Size &iif, const Size > &gdc, float bdsSF) > > { > > - unsigned int minBDSWidth = gdc.width + FILTER_H * 2; > > + unsigned int minBDSWidth = gdc.width + FILTER_W * 2; > > + unsigned int minBDSHeight = gdc.height + FILTER_H * 2; > > > > float sf = bdsSF; > > while (sf <= BDS_SF_MAX && sf >= BDS_SF_MIN) { > > float bdsWidth = static_cast<float>(iif.width) / sf; > > + float bdsHeight = static_cast<float>(iif.height) / sf; > > > > - if (std::fmod(bdsWidth, 1.0) == 0) { > > + if (std::fmod(bdsWidth, 1.0) == 0 && > > + std::fmod(bdsHeight, 1.0) == 0) { > > unsigned int bdsIntWidth = static_cast<unsigned > int>(bdsWidth); > > - if (!(bdsIntWidth % BDS_ALIGN_W) && bdsWidth >= > minBDSWidth) > > + unsigned int bdsIntHeight = static_cast<unsigned > int>(bdsHeight); > > + if (!(bdsIntWidth % BDS_ALIGN_W) && bdsWidth >= > minBDSWidth && > > + !(bdsIntHeight % BDS_ALIGN_H) && bdsHeight >= > minBDSHeight) > > calculateBDSHeight(pipe, iif, gdc, > bdsIntWidth, sf); > > } > > > > @@ -212,10 +218,14 @@ void calculateBDS(ImgUDevice::Pipe *pipe, const > Size &iif, const Size &gdc, floa > > sf = bdsSF; > > while (sf <= BDS_SF_MAX && sf >= BDS_SF_MIN) { > > float bdsWidth = static_cast<float>(iif.width) / sf; > > + float bdsHeight = static_cast<float>(iif.height) / sf; > > > > - if (std::fmod(bdsWidth, 1.0) == 0) { > > + if (std::fmod(bdsWidth, 1.0) == 0 && > > + std::fmod(bdsHeight, 1.0) == 0) { > > unsigned int bdsIntWidth = static_cast<unsigned > int>(bdsWidth); > > - if (!(bdsIntWidth % BDS_ALIGN_W) && bdsWidth >= > minBDSWidth) > > + unsigned int bdsIntHeight = static_cast<unsigned > int>(bdsHeight); > > + if (!(bdsIntWidth % BDS_ALIGN_W) && bdsWidth >= > minBDSWidth && > > + !(bdsIntHeight % BDS_ALIGN_H) && bdsHeight >= > minBDSHeight) > > calculateBDSHeight(pipe, iif, gdc, > bdsIntWidth, sf); > > } > > > > -- > > 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 8373dc165a61..36fee31c1962 100644 --- a/src/libcamera/pipeline/ipu3/imgu.cpp +++ b/src/libcamera/pipeline/ipu3/imgu.cpp @@ -33,6 +33,7 @@ namespace { * at revision: 61e83f2f7606 ("Add more information into README") */ +static constexpr unsigned int FILTER_W = 4; static constexpr unsigned int FILTER_H = 4; static constexpr unsigned int IF_ALIGN_W = 2; @@ -194,15 +195,20 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc void calculateBDS(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc, float bdsSF) { - unsigned int minBDSWidth = gdc.width + FILTER_H * 2; + unsigned int minBDSWidth = gdc.width + FILTER_W * 2; + unsigned int minBDSHeight = gdc.height + FILTER_H * 2; float sf = bdsSF; while (sf <= BDS_SF_MAX && sf >= BDS_SF_MIN) { float bdsWidth = static_cast<float>(iif.width) / sf; + float bdsHeight = static_cast<float>(iif.height) / sf; - if (std::fmod(bdsWidth, 1.0) == 0) { + if (std::fmod(bdsWidth, 1.0) == 0 && + std::fmod(bdsHeight, 1.0) == 0) { unsigned int bdsIntWidth = static_cast<unsigned int>(bdsWidth); - if (!(bdsIntWidth % BDS_ALIGN_W) && bdsWidth >= minBDSWidth) + unsigned int bdsIntHeight = static_cast<unsigned int>(bdsHeight); + if (!(bdsIntWidth % BDS_ALIGN_W) && bdsWidth >= minBDSWidth && + !(bdsIntHeight % BDS_ALIGN_H) && bdsHeight >= minBDSHeight) calculateBDSHeight(pipe, iif, gdc, bdsIntWidth, sf); } @@ -212,10 +218,14 @@ void calculateBDS(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc, floa sf = bdsSF; while (sf <= BDS_SF_MAX && sf >= BDS_SF_MIN) { float bdsWidth = static_cast<float>(iif.width) / sf; + float bdsHeight = static_cast<float>(iif.height) / sf; - if (std::fmod(bdsWidth, 1.0) == 0) { + if (std::fmod(bdsWidth, 1.0) == 0 && + std::fmod(bdsHeight, 1.0) == 0) { unsigned int bdsIntWidth = static_cast<unsigned int>(bdsWidth); - if (!(bdsIntWidth % BDS_ALIGN_W) && bdsWidth >= minBDSWidth) + unsigned int bdsIntHeight = static_cast<unsigned int>(bdsHeight); + if (!(bdsIntWidth % BDS_ALIGN_W) && bdsWidth >= minBDSWidth && + !(bdsIntHeight % BDS_ALIGN_H) && bdsHeight >= minBDSHeight) calculateBDSHeight(pipe, iif, gdc, bdsIntWidth, sf); }