From patchwork Thu May 13 15:21:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 12278 X-Patchwork-Delegate: jacopo@jmondi.org Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 901C7C31F1 for ; Thu, 13 May 2021 15:20:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 229CC68926; Thu, 13 May 2021 17:20:50 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B3F24688E4 for ; Thu, 13 May 2021 17:20:47 +0200 (CEST) X-Originating-IP: 79.53.131.195 Received: from uno.homenet.telecomitalia.it (host-79-53-131-195.retail.telecomitalia.it [79.53.131.195]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id E8E90C0013; Thu, 13 May 2021 15:20:45 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Thu, 13 May 2021 17:21:15 +0200 Message-Id: <20210513152116.17666-8-jacopo@jmondi.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210513152116.17666-1-jacopo@jmondi.org> References: <20210513152116.17666-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 7/8] libcamera: ipu3: imgu: Add pipe calculation debug X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add pipe calculation debug with a new associated log category. This helps compare the pipe calculation with the one performed by the python script. Signed-off-by: Jacopo Mondi Tested-by: Jean-Michel Hautbois Reviewed-by: Jean-Michel Hautbois Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Reviewed-by: Hirokazu Honda --- 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 df5a1b5b0826..07e64e957999 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 foundIfHeight = 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(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) { @@ -170,9 +176,15 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc if (foundIfHeight) { unsigned int bdsIntHeight = static_cast(bdsHeight); + Size foundIf{ iif.width, foundIfHeight }; + Size foundBds{ bdsWidth, bdsIntHeight }; - pipeConfigs.push_back({ bdsSF, { iif.width, foundIfHeight }, - { bdsWidth, bdsIntHeight }, gdc }); + LOG(ImgUPipe, Debug) + << "IF: " << foundIf.toString() + << ", BDS: " << foundBds.toString() + << ", GDC: " << gdc.toString(); + + pipeConfigs.push_back({ bdsSF, foundIf, foundBds, gdc }); return; } } else { @@ -185,8 +197,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 }); } } @@ -264,6 +283,8 @@ Size calculateGDC(ImgUDevice::Pipe *pipe) gdc.width = main.width * sf; gdc.height = main.height * sf; + LOG(ImgUPipe, Debug) << "GDC: " << gdc.toString(); + return gdc; } @@ -281,6 +302,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; }