From patchwork Fri Oct 20 08:39:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 19163 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 9C4E1C3272 for ; Fri, 20 Oct 2023 08:40:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 33FF062984; Fri, 20 Oct 2023 10:40:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1697791232; bh=hyrcppkQ/aLO8GrgZTPwyUsByDlFOAsouuRaaeZJT+w=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=CycwwHNirE9AuTtU6HBmolrruVpdOv+sDHxQbXKJT9k7u0DDOfx4bJEe+8sNj334F Ry3q3TTq2fO0INQYKpMKsZbMqzyYsc9QEfN8pGc2CNnIYOwrJGvJu623M9/qV2R8Kr Vpn8gvnmKtQLhGuX+gB3zZFqegWyp3NcSlVHnauaTB3XgZx1lYp2OiedOcvgybX8ST NPOhVDqXugZ5kAuz2rKZnVvRZUv5cy3rYc+3wO5ftiddj+/GoaGUODVHSDGweFBDqb e5LMJ0by19LyyyQ/icTRPzNtD8rHgQIANpg/d/KnZ37q/384RZGKBwt+AusZRIJAm6 s2t6BFyB2PVig== Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 457F961DCF for ; Fri, 20 Oct 2023 10:40:29 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="shik20/7"; dkim-atps=neutral Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-408382da7f0so4642275e9.0 for ; Fri, 20 Oct 2023 01:40:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1697791228; x=1698396028; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XphytegKuvdJqBcBAhm4YNfDa2jw6aybWVFS0aOqByI=; b=shik20/7xFw/ZnuJXnGYANJgcS8Y04EST2y5yRnEXILyrlG+x50EvyMiQdoZaLkAJn rLohkvmpcQ26HoixjwRZu8QkSdNDzs5R6+q9MF+PTjrUzlrpFY62DFbMMhuOSacpQvLw BVhTqqQczG0TngSUIS6WRALai5X9FMUZBq8L0s/kPoPddvpyfUa8XD96di8dmBTAUToI 8sEUU4b9xb4crdBTqPIWY0tywIsdRn20li2mculnNKon0TXZWGzyDH2JF7lxapcsUhvx PI44FXkbJBP5fgd+MYnJxgbHXh8TItWuSkWOXRmCCrywkueQCrsnXmdKWkN7HIFgyCEC P3nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697791228; x=1698396028; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XphytegKuvdJqBcBAhm4YNfDa2jw6aybWVFS0aOqByI=; b=EwA++qncni3nt79azexmMAgu+jZZu06WrcJMGvk1QMI+6wqEXpIgGkHhiix3qZQ4Ni /SO6hM9Pyq3hqq1L1eeiTbfeekERZ/OQeMkDOrK1wC551FOTWdR03QUuw5TjeJB4Ah6+ eIJk4jpUqvlM9lPQVuvFrq9c6ly8GFexu8IOTAKT6I1voO0sF6VWiIQDB0UC2pyVw3gd MSszeVSUAZxbawUU1LJXB9u0xNf0OPfEFFunmh48/09s/onFHrrWIpTJPz9sk7X0YDpY TYac3BxST7bwSMyDV3VAbF2CDkFdDI1q/5O7n2Oo80qEDiIx2WnsVun4JLkzsySBuCI1 fAPA== X-Gm-Message-State: AOJu0YxvnRG0Zm3Q4fwAr+I6xedGvA+tu62ESPHfSuRNDExqmbNTVPcu GP8/HMfaft0h+N8dFIEHHbrr4karfAuOVTji1h5M+w== X-Google-Smtp-Source: AGHT+IHXSRqUlzdTvS53QtTxpvTpAbOZIQAxc2coYpUh2KUHH5n+9YZNFU3nSheEHC1UMfCslUSNkg== X-Received: by 2002:a05:600c:4747:b0:408:2b:3ae with SMTP id w7-20020a05600c474700b00408002b03aemr868043wmo.6.1697791228433; Fri, 20 Oct 2023 01:40:28 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id r3-20020adff103000000b0032d9337e7d1sm1213356wro.11.2023.10.20.01.40.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 01:40:28 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 20 Oct 2023 09:39:58 +0100 Message-Id: <20231020084002.30665-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231020084002.30665-1-naush@raspberrypi.com> References: <20231020084002.30665-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 2/6] ipa: rpi: alsc: Do not re-read the alsc.status metadata 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: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: David Plowman This was being re-read in order to determine what LSC gains had been applied. We can just retrieve these numbers from the prevAsyncResults_ instead. This will also enable other future algorithms to manipulate the LSC tables in the alsc.status, without it breaking the core ALSC algorithm here. Signed-off-by: David Plowman Reviewed-by: Naushir Patuck --- src/ipa/rpi/controller/rpi/alsc.cpp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/ipa/rpi/controller/rpi/alsc.cpp b/src/ipa/rpi/controller/rpi/alsc.cpp index f1ccef87c70c..b7413611cdae 100644 --- a/src/ipa/rpi/controller/rpi/alsc.cpp +++ b/src/ipa/rpi/controller/rpi/alsc.cpp @@ -338,14 +338,14 @@ double getCt(Metadata *metadata, double defaultCt) } static void copyStats(RgbyRegions ®ions, StatisticsPtr &stats, - AlscStatus const &status) + std::array, 3> &prevSyncResults) { if (!regions.numRegions()) regions.init(stats->awbRegions.size()); - const std::vector &rTable = status.r; - const std::vector &gTable = status.g; - const std::vector &bTable = status.b; + const std::vector &rTable = prevSyncResults[0].data(); //status.r; + const std::vector &gTable = prevSyncResults[1].data(); //status.g; + const std::vector &bTable = prevSyncResults[2].data(); //status.b; for (unsigned int i = 0; i < stats->awbRegions.numRegions(); i++) { auto r = stats->awbRegions.get(i); if (stats->colourStatsPos == Statistics::ColourStatsPos::PostLsc) { @@ -367,18 +367,10 @@ void Alsc::restartAsync(StatisticsPtr &stats, Metadata *imageMetadata) ct_ = getCt(imageMetadata, ct_); /* * We have to copy the statistics here, dividing out our best guess of - * the LSC table that the pipeline applied to them. + * the LSC table that the pipeline applied to them which we get from + * prevSyncResults_. */ - AlscStatus alscStatus; - if (stats->colourStatsPos == Statistics::ColourStatsPos::PostLsc && - imageMetadata->get("alsc.status", alscStatus) != 0) { - LOG(RPiAlsc, Warning) - << "No ALSC status found for applied gains!"; - alscStatus.r.resize(config_.tableSize.width * config_.tableSize.height, 1.0); - alscStatus.g.resize(config_.tableSize.width * config_.tableSize.height, 1.0); - alscStatus.b.resize(config_.tableSize.width * config_.tableSize.height, 1.0); - } - copyStats(statistics_, stats, alscStatus); + copyStats(statistics_, stats, prevSyncResults_); framePhase_ = 0; asyncStarted_ = true; {