From patchwork Fri Oct 6 13:19:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 19121 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 2E29DC32C1 for ; Fri, 6 Oct 2023 13:20:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C66B462963; Fri, 6 Oct 2023 15:20:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1696598422; bh=g0p94eYnymjkLMt3XLjiCvHtkzKp0QFmMWMNtcKxvcE=; 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=a+3ZaSRPeUjXY1/dQdYhQlW+xxFAJgfkwd7qQv14AzcNc4uiaCBJdN0+0T3vHr0eh DqjWNtelc0azi7o2oRuQr1bUOAVWXSpPGrbiPonNtP6qpwLn6p197GR1pFA2Z/qAJi fPlLLM0vdQBtxuSYjHnvoMr/pVduV0m5FGPoGK9i0rb48CVzWBJ0iclUo2V0Fpdnm5 VyIv/SPDhZ/Ilw49Fvi6hPyETPSRtU/Nh0xv9UR3SVKGEHelglb7qOvo/11jzOs4NL tAGHP766M69n68JW7R3ORHJ12FWw/0i6VyxeskkooRtF4ITEY2aREz4mpg8R7FiVUO RHVn1zSfB6Q4g== Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4AFF462969 for ; Fri, 6 Oct 2023 15:20:21 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="pFKtpafj"; dkim-atps=neutral Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-317c3ac7339so1867532f8f.0 for ; Fri, 06 Oct 2023 06:20:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1696598420; x=1697203220; 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=wX6bWO/uDRnRFXGdanoRa7WRWmc0W9jFOPexu58lLy8=; b=pFKtpafjJk40xxqt/ku+pBgfeLO1yepcJx8E1yKjI+0GcBIiy3nGTgXzLovMJlrVSX an+/H8lq87lqcHYdTvk3ZAL5Ug9r7HjaYES4zExsLY+eICcVAf87sU3to1vqrSVuUe3G hxbqN05mUpNUx5/MILder6V34r2g2wGglAJAYskd0qS/XV6thrECFY/LKuezcxttTMPm PZ/8iL2F77TUejACYTusVcVBkXNOtLStOZXfvqF1WHLToVQn4k7JjLQ/1zr6Lxerz0Nb bw4rMwEX4ExQvJI66Vs/Tj/pjrFCBTO2/LQ3H05qWOpIiOjeE0kImuEabtZrBGOpETJ3 JnvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696598420; x=1697203220; 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=wX6bWO/uDRnRFXGdanoRa7WRWmc0W9jFOPexu58lLy8=; b=g4Nc3lgig7HTBfolxiCedVUejFV4WAcsRfOpDNw7NiZ0wmBWRFYV5luK7cdC7eCv7x RHz8SEeqhNs5J2UwhJtNv1psL6Wm4sC+nHauW8IylrByzIuNPT9Ck8Dwpgh7hq93XGTE QB0Va+UHbzaiwxysr6iL+38ju/o6V+HNjRKcm/UHb7I3//mwIQ7WTosjsHVf6oE3ZJyv frS4iS2ueyG4JbmI4CLTzuERDOjPNF85bFLjsDpv0EkKPSdCq++H7tD3EN7kIfuDFMGP ZI0TzqDLRZ8t5kvhfMEy8jo/FSWYtyhBsQHCoTxwb5uD7KHNiFvBaMjtEyTW4/TpRnI5 IIeg== X-Gm-Message-State: AOJu0Yx5ie10kFwNtfEc3uXj3F4s22Cn2XGe3sEMSc2u0sKmjPIb3pPq 7un5lMEfRdybz4+wmQCj1z+gS0zPzOS3ZStH3TJd6A== X-Google-Smtp-Source: AGHT+IGEIspYzvmqFi9ifORU42ujjKZ1tTt6JZfU+irJoH6zVUcR2cQ1eCJcx+10aJubiwhEpdNu8A== X-Received: by 2002:adf:e8ca:0:b0:31f:e1b4:583d with SMTP id k10-20020adfe8ca000000b0031fe1b4583dmr8183927wrn.56.1696598420605; Fri, 06 Oct 2023 06:20:20 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id m8-20020a056000180800b00321773bb933sm1639478wrh.77.2023.10.06.06.20.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 06:20:19 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 6 Oct 2023 14:19:59 +0100 Message-Id: <20231006132000.23504-20-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231006132000.23504-1-naush@raspberrypi.com> References: <20231006132000.23504-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 19/20] ipa: rpi: agc: Avoid overwriting caller's statistics pointer 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 The code was inadvertently overwriting the caller's StatisticsPtr, meaning that subsequent algorithms would get the wrong image statistics when AGC channels changed. This could be fix using std::ref, though I find the C-style pointer fix easier to understand! Signed-off-by: David Plowman Reviewed-by: Naushir Patuck Reviewed-by: Jacopo Mondi --- src/ipa/rpi/controller/rpi/agc.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ipa/rpi/controller/rpi/agc.cpp b/src/ipa/rpi/controller/rpi/agc.cpp index 870cb4315c42..758da0719b9b 100644 --- a/src/ipa/rpi/controller/rpi/agc.cpp +++ b/src/ipa/rpi/controller/rpi/agc.cpp @@ -311,15 +311,16 @@ void Agc::process(StatisticsPtr &stats, Metadata *imageMetadata) * exist, and call process(). We must make the agc.status metadata record correctly * which channel this is. */ + StatisticsPtr *statsPtr = &stats; if (channelData.statistics && channelData.deviceStatus) { deviceStatus = *channelData.deviceStatus; - stats = channelData.statistics; + statsPtr = &channelData.statistics; } else { /* Can also happen when new channels start. */ LOG(RPiAgc, Debug) << "process: channel " << channelIndex << " not seen yet"; } - channelData.channel.process(stats, deviceStatus, imageMetadata, channelTotalExposures_); + channelData.channel.process(*statsPtr, deviceStatus, imageMetadata, channelTotalExposures_); auto dur = setCurrentChannelIndexGetExposure(imageMetadata, "process: no AGC status found", channelIndex); if (dur)