{"id":15520,"url":"https://patchwork.libcamera.org/api/1.1/patches/15520/?format=json","web_url":"https://patchwork.libcamera.org/patch/15520/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220323135614.865252-3-kieran.bingham@ideasonboard.com>","date":"2022-03-23T13:56:11","name":"[libcamera-devel,v2,2/5] ipa: ipu3: af: Use geometry classes to perform grid centering","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"91c017cc87605819e1acdead67e9fcc8c0c7d59a","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15520/mbox/","series":[{"id":2989,"url":"https://patchwork.libcamera.org/api/1.1/series/2989/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2989","date":"2022-03-23T13:56:09","name":"ipa: ipu3: af: Small improvements","version":2,"mbox":"https://patchwork.libcamera.org/series/2989/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15520/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15520/checks/","tags":{},"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 41A8DC3264\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 23 Mar 2022 13:56:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 546AC604DC;\n\tWed, 23 Mar 2022 14:56:23 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 08307604C4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Mar 2022 14:56:21 +0100 (CET)","from Monstersaurus.ksquared.org.uk.beta.tailscale.net\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9E42E130D;\n\tWed, 23 Mar 2022 14:56:20 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1648043783;\n\tbh=rq/501rDmA76E3DPYoKB5MxCRbLMz8+YX2gCqye4RxM=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=CA2yoesZhMcFmzWwTJUdD/J4ctRn2B1f5L2wkyttNuDEtgng92g7flHLi4bGjLz1k\n\tAQTTmJBHhE6PWQ9sW0zWsrybRW77wWNsCiCRi9HEMZQWvNpUsBz3QpBqqEaZYHziGy\n\tiodU1txEaPv//TauF/Wou1ti0QzA6vScnV71L7XIWN70nJuXbiwfgjMxi6h+xcVRMc\n\tOtJziPcsdEcdU0+3pIuG6pqRwt8VfHWGhNAMEEQn98VxbhuzxVP2tfWWp6riFlYgVj\n\tf1lvzaYyON/kKP98rPOrY5kP7oRLNP5j2wlHoVIrYfOvOpV1ECBH9F1wuT4fXz+rX3\n\trMFb0AaJdmsew==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1648043780;\n\tbh=rq/501rDmA76E3DPYoKB5MxCRbLMz8+YX2gCqye4RxM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=VDWxlG0E/pGKS0OT3bYlXETY4x/r1HPOO1W2qcwfB+BTe8tIunNiYZ6VrTyeMmHNh\n\tjw1xenNr537G3JJ243llPnG41PkSi6D/1Rbz5TP0FHznZYrb0g8MzRecWIySECHrIh\n\tsYDu0BRWqHsE1iMM7O9BusUe392RuPrk9cbpBOFw="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"VDWxlG0E\"; dkim-atps=neutral","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Wed, 23 Mar 2022 13:56:11 +0000","Message-Id":"<20220323135614.865252-3-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.32.0","In-Reply-To":"<20220323135614.865252-1-kieran.bingham@ideasonboard.com>","References":"<20220323135614.865252-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 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":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Use our geometry classes for Rectangle, Size and Point to identify\nthe region of interest for the autofocus, and center it on the BDS output.\n\nThis will facilitate custom ROI being passed in through controls at a later\ntime.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/ipu3/algorithms/af.cpp | 24 ++++++++++++++++--------\n 1 file changed, 16 insertions(+), 8 deletions(-)","diff":"diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp\nindex 634d0f2e3176..f5a489412a9e 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;\n","prefixes":["libcamera-devel","v2","2/5"]}