diff options
author | Jacopo Mondi <jacopo@jmondi.org> | 2021-03-17 13:31:00 +0100 |
---|---|---|
committer | Jacopo Mondi <jacopo@jmondi.org> | 2021-05-20 10:44:28 +0200 |
commit | 92411679b1197754e29dd4824de8533f482f7c07 (patch) | |
tree | be18e9a47baaaabd7ce6b1fcd9f2e7d38a290728 | |
parent | 2a103ba17ef2984dd59a31c1138414c4e0177cb0 (diff) |
libcamera: ipu3: imgu: Update BDS calculation process
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 BDS calculation procedure.
The BDS calculation is now perfomed by scaling both width and height,
and repeated by scaling width first.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Acked-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
-rw-r--r-- | src/libcamera/pipeline/ipu3/imgu.cpp | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp index d5cf05b0..acc625ab 100644 --- a/src/libcamera/pipeline/ipu3/imgu.cpp +++ b/src/libcamera/pipeline/ipu3/imgu.cpp @@ -394,19 +394,45 @@ 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 width 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 = std::min(IF_ALIGN_W, + in.width - IF_CROP_MAX_W); + unsigned int minIfHeight = std::min(IF_ALIGN_H, + 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 = std::min(IF_ALIGN_W, in.width - IF_CROP_MAX_W); + minIfHeight = std::min(IF_ALIGN_H, in.height - IF_CROP_MAX_H); + while (ifHeight >= minIfHeight) { + /* + * \todo This procedure is probably broken: + * https://github.com/intel/intel-ipu3-pipecfg/issues/2 + */ + 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 {}; |