[libcamera-devel] [PATCH 1/7] libcamera: ipu3: imgu: Update BDS calculation process
Jean-Michel Hautbois
jeanmichel.hautbois at ideasonboard.com
Wed Mar 24 08:12:08 CET 2021
Hi Jacopo,
Thanks for the patch !
On 18/03/2021 11:39, Jacopo Mondi wrote:
> Apply the last three hunks of commit 243d134 ("Fix some bug for some
> resolutions") from https://github.com/intel/intel-ipu3-pipecfg.git
> to the BSD calculation procedure.
s/BSD/BDS ?
> The BSD calculation is now perfomed by scaling both width and height,
> and repeated by scaling width first.
s/BSD/BDS ?
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois at ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois at ideasonboard.com>
> ---
> src/libcamera/pipeline/ipu3/imgu.cpp | 30 +++++++++++++++++++++++-----
> 1 file changed, 25 insertions(+), 5 deletions(-)
>
> diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp
> index d5cf05b0c421..4a1b0a9528f2 100644
> --- a/src/libcamera/pipeline/ipu3/imgu.cpp
> +++ b/src/libcamera/pipeline/ipu3/imgu.cpp
> @@ -394,19 +394,39 @@ ImgUDevice::PipeConfig ImgUDevice::calculatePipeConfig(Pipe *pipe)
> const Size &in = pipe->input;
> Size gdc = calculateGDC(pipe);
>
> - unsigned int ifWidth = utils::alignUp(in.width, IF_ALIGN_W);
> - unsigned int ifHeight = in.height;
> - unsigned int minIfWidth = in.width - IF_CROP_MAX_W;
> float bdsSF = static_cast<float>(in.width) / gdc.width;
> float sf = findScaleFactor(bdsSF, bdsScalingFactors, true);
>
> + /* Populate the configurations vector by scaling widht and height. */
> + unsigned int ifWidth = utils::alignUp(in.width, IF_ALIGN_W);
> + unsigned int ifHeight = utils::alignUp(in.height, IF_ALIGN_H);
> + unsigned int minIfWidth = in.width - IF_CROP_MAX_W;
> + unsigned int minIfHeight = in.height - IF_CROP_MAX_H;
> while (ifWidth >= minIfWidth) {
> - Size iif{ ifWidth, ifHeight };
> - calculateBDS(pipe, iif, gdc, sf);
> + while (ifHeight >= minIfHeight) {
> + Size iif{ ifWidth, ifHeight };
> + calculateBDS(pipe, iif, gdc, sf);
> + ifHeight -= IF_ALIGN_H;
> + }
>
> ifWidth -= IF_ALIGN_W;
> }
>
> + /* Repeat search by scaling width first. */
> + ifWidth = utils::alignUp(in.width, IF_ALIGN_W);
> + ifHeight = utils::alignUp(in.height, IF_ALIGN_H);
> + minIfWidth = in.width - IF_CROP_MAX_W;
> + minIfHeight = in.height - IF_CROP_MAX_H;
> + while (ifHeight >= minIfHeight) {
> + while (ifWidth >= minIfWidth) {
> + Size iif{ ifWidth, ifHeight };
> + calculateBDS(pipe, iif, gdc, sf);
> + ifWidth -= IF_ALIGN_W;
> + }
> +
> + ifHeight -= IF_ALIGN_H;
> + }
> +
> if (pipeConfigs.size() == 0) {
> LOG(IPU3, Error) << "Failed to calculate pipe configuration";
> return {};
>
More information about the libcamera-devel
mailing list