[{"id":22502,"web_url":"https://patchwork.libcamera.org/comment/22502/","msgid":"<37689945-faf4-9130-1e00-9fe5e0a460c3@ideasonboard.com>","date":"2022-03-29T05:55:49","subject":"Re: [libcamera-devel] [PATCH v3 2/5] ipa: ipu3: af: Use geometry\n\tclasses to perform grid centering","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/people/75/","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"content":"Hi Kieran,\n\nThanks for the patch !\n\nOn 25/03/2022 10:25, Kieran Bingham wrote:\n> Use our geometry classes for Rectangle, Size and Point to identify\n> the region of interest for the autofocus, and center it on the BDS output.\n> \n> This will facilitate custom ROI being passed in through controls at a later\n> time.\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nReviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n\n> ---\n>   src/ipa/ipu3/algorithms/af.cpp | 23 +++++++++++++++--------\n>   1 file changed, 15 insertions(+), 8 deletions(-)\n> \n> diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp\n> index 634d0f2e3176..4476857fa772 100644\n> --- a/src/ipa/ipu3/algorithms/af.cpp\n> +++ b/src/ipa/ipu3/algorithms/af.cpp\n> @@ -141,16 +141,23 @@ int Af::configure(IPAContext &context, const IPAConfigInfo &configInfo)\n>   \tgrid.block_height_log2 = kAfMinGridBlockHeight;\n>   \tgrid.height_per_slice = kAfDefaultHeightPerSlice;\n>   \n> -\t/* x_start and y start are default to BDS center */\n> -\tgrid.x_start = (configInfo.bdsOutputSize.width / 2) -\n> -\t\t       (((grid.width << grid.block_width_log2) / 2));\n> -\tgrid.y_start = (configInfo.bdsOutputSize.height / 2) -\n> -\t\t       (((grid.height << grid.block_height_log2) / 2));\n> +\t/* Position the AF grid in the center of the BDS output. */\n> +\tRectangle bds(configInfo.bdsOutputSize);\n> +\tSize gridSize(grid.width << grid.block_width_log2,\n> +\t\t      grid.height << grid.block_height_log2);\n> +\n> +\t/*\n> +\t * \\todo - Support request metadata\n> +\t * - Set the ROI based on any input controls in the request\n> +\t * - Return the AF ROI as metadata in the Request\n> +\t */\n> +\tRectangle roi = gridSize.centeredTo(bds.center());\n> +\tPoint start = roi.topLeft();\n>   \n>   \t/* x_start and y_start should be even */\n> -\tgrid.x_start = (grid.x_start / 2) * 2;\n> -\tgrid.y_start = (grid.y_start / 2) * 2;\n> -\tgrid.y_start = grid.y_start | IPU3_UAPI_GRID_Y_START_EN;\n> +\tgrid.x_start = utils::alignDown(start.x, 2);\n> +\tgrid.y_start = utils::alignDown(start.y, 2);\n> +\tgrid.y_start |= IPU3_UAPI_GRID_Y_START_EN;\n>   \n>   \t/* Initial max focus step */\n>   \tmaxStep_ = kMaxFocusSteps;","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 191ECC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 29 Mar 2022 05:55:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C47B665631;\n\tTue, 29 Mar 2022 07:55:54 +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 B68BD604BC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 29 Mar 2022 07:55:52 +0200 (CEST)","from [IPV6:2a01:e0a:169:7140:46c7:900e:3d98:76e7] (unknown\n\t[IPv6:2a01:e0a:169:7140:46c7:900e:3d98:76e7])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 70539E27;\n\tTue, 29 Mar 2022 07:55:52 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1648533354;\n\tbh=evREiDFZYhDpR9Jkdo3s+ae7F1Czc1DrTTScZQr/qD0=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=WuMazOnNUt6WUnEKzbMnr6HMF757U0NIGrVk6RftKUtehCiOnujVNziOLo6RCe7J5\n\t9so8qkqcTK9eajvIATSfY8o3XBjuNfVspI+82AJs1dFKybx92W2BRcpYJaIsMuNhvd\n\t3VosZNNd7Td0M5GkIi5XAKP6ku4xCq7nnTMCz/ig4Ybd5aUubsXyUOtEejJhQZt+Ej\n\tssx1h90ok6D0eI1fMyFBQLTcZ7RXJr9Yr0pLAvCKtmXiozwydRpadHhw1IydiLOc/b\n\tTBRS0yROXEeCJ8Zb4TrZBYNrvEOzDk9MNgE3LyFwGHv82KC1H/H7qMe6GFiN/pEUyK\n\t1hlHk9rW15QUA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1648533352;\n\tbh=evREiDFZYhDpR9Jkdo3s+ae7F1Czc1DrTTScZQr/qD0=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=kD9iYo2YXocYcv0kmnNgqG6Be9byTdWzB0/RxI3KBVCoMrSNY2hw1uFmF0ToMcf6i\n\t3Z8Y0JKbTbpLTdKP/1ZmxHF08/e0tKtc02k/X5q21F2dlXmMZdTotrIa0GhlOIH0Y4\n\tQfZBddcYZb2nbOnusedEB/zXLbK7Rb1jEB0weKAQ="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"kD9iYo2Y\"; dkim-atps=neutral","Message-ID":"<37689945-faf4-9130-1e00-9fe5e0a460c3@ideasonboard.com>","Date":"Tue, 29 Mar 2022 07:55:49 +0200","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.7.0","Content-Language":"en-US","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera devel <libcamera-devel@lists.libcamera.org>,\n\tKate Hsuan <hpa@redhat.com>","References":"<20220325092555.1799897-1-kieran.bingham@ideasonboard.com>\n\t<20220325092555.1799897-3-kieran.bingham@ideasonboard.com>","In-Reply-To":"<20220325092555.1799897-3-kieran.bingham@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v3 2/5] ipa: ipu3: af: Use geometry\n\tclasses to perform grid centering","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>","From":"Jean-Michel Hautbois via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]