From patchwork Mon Sep 9 13:22:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 21202 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 84AC5C324C for ; Mon, 9 Sep 2024 13:22:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 48003634F8; Mon, 9 Sep 2024 15:22:18 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="qXtxzk2p"; dkim-atps=neutral Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 37C3B634EE for ; Mon, 9 Sep 2024 15:22:16 +0200 (CEST) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-42cb1e623d1so15289335e9.0 for ; Mon, 09 Sep 2024 06:22:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1725888135; x=1726492935; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=jEFbbNV4LothFiZLCissoTU9VSYV3NqGfnrPBZFM0G0=; b=qXtxzk2pdAr58SJMoPIt9UOFSP+TbK3vGdQTZqI5PJrQue+S4jZgKWExCSQ0ehKB+U 5cAzKcKelFYFNAkiNT+c+KLGLTespsz7GuxFN3uDS9ZlNHhJMzTYp2BjqH0iXBwtNMw9 Tlkqqb9LwIhCMgVGT86vzY9GRGWhZksEVbVPAuOFYXcHjsOFemgTjilmQ3Nhol97YZai MGHbTkkmTyPojczy1wL2KvjpOoJSV/FG1f+Jaftwr9K4WQAGpPWM2o4oT039MNGHvWLr Y2Oxv6EapOkGm2Fyap0UqwMdL1XaDGAq1Vt+ozn+tvYkCyAsIR8tZXfUrK3bh5QbY+KR ZI3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725888135; x=1726492935; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jEFbbNV4LothFiZLCissoTU9VSYV3NqGfnrPBZFM0G0=; b=LFdW1IxtxbjeguFNSDnH7Yf6UIA7sgYkt4UTOrqHDGNL+epcEnY81EnWCFRGd7R+KO QX08tHc6f+ej6pP2pHT8PAdw7nm4JXsQbX33NpcdG96mUeKOsdsJ0gYNtdSfeaNTmAXM 48oOwjGWiMgf+N49aQZABIUqfN1/TDiBm6gLNRonysypw1BDqgGTutbK871+uj4Zle1d ZSDqju0O/mku2gMxzhXXeKbrXBlvaaP13m2CHj8gawZ8kJ6eCjGV1JElgiLjDMSlDgMQ 5BXOVCMVarUBHLDWjIQCWQFQ1ngEywWdD5xThVxUHBQpwypKnTzK++1JgM5P/WD5DKzf zHBQ== X-Gm-Message-State: AOJu0YygKDzf59IZP9bM5FFlIB7CZribasMY9fsMbOVC708ytvzpsZHI KAUB81CGHEiIxq/iBHtUzkA6DdcHpVdu+U8MFaZMwEcEf/VNliuvQJkBynVUGC6GTEaqhpbRAiv W X-Google-Smtp-Source: AGHT+IHqNMweRXDzni6Kuqp2TOkUgOL+hPB1Ki67A/LuGYMRhx52z4vAkNjhb327zEbTuzvvdb1lyQ== X-Received: by 2002:adf:f34c:0:b0:367:9d05:cf1f with SMTP id ffacd0b85a97d-378895cafc0mr6814326f8f.14.1725888134602; Mon, 09 Sep 2024 06:22:14 -0700 (PDT) Received: from davidp-xps-13.pitowers.org ([2a00:1098:3142:1f:fd43:a9ee:72a9:6fe2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42caeb21a4esm77996675e9.7.2024.09.09.06.22.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 06:22:14 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Cc: David Plowman Subject: [PATCH] ipa: rpi: agc: Ignore stable region when exposure/gain set manually Date: Mon, 9 Sep 2024 14:22:04 +0100 Message-Id: <20240909132204.14147-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" When a user is taking control of exposure and gain, setting them manually, we set the AGC "stable region" to zero. This means that any user changes, however small, will be applied, and they won't be regarded as "too small to bother with". Signed-off-by: David Plowman Reviewed-by: Naushir Patuck Reviewed-by: Kieran Bingham --- src/ipa/rpi/controller/rpi/agc_channel.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ipa/rpi/controller/rpi/agc_channel.cpp b/src/ipa/rpi/controller/rpi/agc_channel.cpp index cf2565a8..c9df9b5b 100644 --- a/src/ipa/rpi/controller/rpi/agc_channel.cpp +++ b/src/ipa/rpi/controller/rpi/agc_channel.cpp @@ -883,11 +883,14 @@ void AgcChannel::filterExposure() /* * AGC adapts instantly if both shutter and gain are directly specified - * or we're in the startup phase. + * or we're in the startup phase. Also disable the stable region, because we want + * to reflect any user exposure/gain updates, however small. */ if ((status_.fixedShutter && status_.fixedAnalogueGain) || - frameCount_ <= config_.startupFrames) + frameCount_ <= config_.startupFrames) { speed = 1.0; + stableRegion = 0.0; + } if (!filtered_.totalExposure) { filtered_.totalExposure = target_.totalExposure; } else if (filtered_.totalExposure * (1.0 - stableRegion) < target_.totalExposure &&