[{"id":19651,"web_url":"https://patchwork.libcamera.org/comment/19651/","msgid":"<YUAR4xE/bRc87t9M@pendragon.ideasonboard.com>","date":"2021-09-14T03:07:15","subject":"Re: [libcamera-devel] [PATCH 02/11] ipa: ipu3: Improve the\n\tdocumentation of BDS grid","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jean-Michel,\n\nThank you for the patch.\n\nOn Mon, Sep 13, 2021 at 04:58:01PM +0200, Jean-Michel Hautbois wrote:\n> The BDS grid has its own limitations for the log2 width and height for\n> each cell of pixels. Use constexpr for those and comment it to help\n> understanding their usage.\n> \n> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> ---\n>  src/ipa/ipu3/ipu3.cpp | 16 +++++++++++++---\n>  1 file changed, 13 insertions(+), 3 deletions(-)\n> \n> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n> index 90053069..c71f2a6c 100644\n> --- a/src/ipa/ipu3/ipu3.cpp\n> +++ b/src/ipa/ipu3/ipu3.cpp\n> @@ -345,6 +345,8 @@ int IPAIPU3::start()\n>  }\n>  \n>  /**\n> + * \\brief Calculate a grid for the AWB statistics\n> + *\n>   * This function calculates a grid for the AWB algorithm in the IPU3 firmware.\n>   * Its input is the BDS output size calculated in the ImgU.\n>   * It is limited for now to the simplest method: find the lesser error\n> @@ -364,16 +366,24 @@ void IPAIPU3::calculateBdsGrid(const Size &bdsOutputSize)\n>  \t/* Set the BDS output size in the IPAConfiguration structure */\n>  \tcontext_.configuration.grid.bdsOutputSize = bdsOutputSize;\n>  \n> -\tfor (uint32_t widthShift = 3; widthShift <= 7; ++widthShift) {\n> +\t/*\n> +\t * The log2 of the width and height of each cell is limited by the ImgU\n> +\t * in the interval [3, 7] according to the kernel header.\n\ns/in the interval/to the interval/\n\n> +\t */\n> +\tconstexpr uint32_t kCellMin = 3;\n> +\tconstexpr uint32_t kCellMax = 7;\n\nI think these should be kCellMinShift and kCellMaxShift. Should they\nalso be moved to the top of the file with kMaxCellWidthPerSet and\nkMaxCellHeightPerSet ?\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\n> +\tfor (uint32_t widthShift = kCellMin; widthShift <= kCellMax; ++widthShift) {\n>  \t\tuint32_t width = std::min(kMaxCellWidthPerSet,\n>  \t\t\t\t\t  bdsOutputSize.width >> widthShift);\n>  \t\twidth = width << widthShift;\n> -\t\tfor (uint32_t heightShift = 3; heightShift <= 7; ++heightShift) {\n> +\n> +\t\tfor (uint32_t heightShift = kCellMin; heightShift <= kCellMax; ++heightShift) {\n>  \t\t\tint32_t height = std::min(kMaxCellHeightPerSet,\n>  \t\t\t\t\t\t  bdsOutputSize.height >> heightShift);\n>  \t\t\theight = height << heightShift;\n>  \t\t\tuint32_t error  = std::abs(static_cast<int>(width - bdsOutputSize.width))\n> -\t\t\t\t\t\t\t+ std::abs(static_cast<int>(height - bdsOutputSize.height));\n> +\t\t\t\t\t+ std::abs(static_cast<int>(height - bdsOutputSize.height));\n>  \n>  \t\t\tif (error > minError)\n>  \t\t\t\tcontinue;","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 0A9D6BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Sep 2021 03:07:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7C87769187;\n\tTue, 14 Sep 2021 05:07:41 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 368AB6916F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Sep 2021 05:07:40 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 96B3E2A5;\n\tTue, 14 Sep 2021 05:07:39 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"YO/RCW2O\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1631588859;\n\tbh=eTQevpWbkzqXIjrxFaeOf1rhmrUIufNGahfPydXn//4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=YO/RCW2OnucevEq0Q+0/9QT4CiKlkvlS1eBQDlkKi/7vO5l+dPC/nPRN16f9ohaXT\n\tdBF5+Y989Ab6bqMHTWyFG/hhvve6fOASTP9HcE9IUIlwIa9eKq3pudC2cI4kCp203y\n\tSF8hskFafWdEc0HdbbCiokArV99V8PP6slM47LMw=","Date":"Tue, 14 Sep 2021 06:07:15 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","Message-ID":"<YUAR4xE/bRc87t9M@pendragon.ideasonboard.com>","References":"<20210913145810.66515-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20210913145810.66515-3-jeanmichel.hautbois@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210913145810.66515-3-jeanmichel.hautbois@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 02/11] ipa: ipu3: Improve the\n\tdocumentation of BDS grid","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]