From patchwork Fri Feb 4 09:24:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 15324 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 5ADF0BF415 for ; Fri, 4 Feb 2022 09:25:11 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7E1E2609F3; Fri, 4 Feb 2022 10:25:10 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="Vxvzjofa"; dkim-atps=neutral Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0D9DF6017A for ; Fri, 4 Feb 2022 10:25:07 +0100 (CET) Received: by mail-wm1-x32c.google.com with SMTP id o30-20020a05600c511e00b0034f4c3186f4so8967391wms.3 for ; Fri, 04 Feb 2022 01:25:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qSV/HSk0po+pFQRz6xepFbbJAua08vbyGzK/VyWkkOw=; b=Vxvzjofa6spjZcll1qQlqmWSEfMkN/hdyoFDUc8XGXFBJpk0QL1SF2Y8rNERpYQoql CnWLDNduPrkqY0RP/5B3UvQzbT5D2Ro10zt8X/gZXQ7XxKkLgX52RgtL4qMBoiAr4IG8 1/A9oWogG+gKOWxuTYOjYcqo3K4DmkZlpbuMoYq7WN9X2Gct9BbYvINT9rHmQnbs6tW6 2w2qKKbTLV3hoRAKp3w7MMhtdiN61PHTw1m/tqordNtRqOGdgKYVpUd3CVrzx/UfDsbJ lYfL3Xojf7vvn8wEEZ5m7i7vuv2gw2ZbPKBEpLZB63Cs9ZnJFBFzQCd7wfSHilkUwfp8 pQQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qSV/HSk0po+pFQRz6xepFbbJAua08vbyGzK/VyWkkOw=; b=h5KTmpj6CDmxCttEPEGvnRXO3TlmMnovpexeGDNXJGBdIlEQkcJ2yyfZzdrqAMjFIE iuFaJ5UlOjfoGdEfi1rq5UOlV4k3ZLxveJM89hL6rZvUWlZAwMXpFCU06oytsx6syGYx 0v/+B3lOEh6qkGi53uOxH5Bei31PaOBLkpF8KYsB7p/6btbvvuiM13Iq76y5lLXQMfEe VYgaPA1jJ12s3C/1ITqOWiKau6pU39ujzohhTRenyXRhfdIHjPjaPdNsZ7gRlxW5fKIu KKj3pAP94LFlzyA0L9felH45tTVrvLMeuFvr5hWU3n2fw92efn5Z6cAWohzI4uuKnlIw 4UbA== X-Gm-Message-State: AOAM530ER7uXv7Wo3Hk0RKbqHMfckdyFFMfD98j4eLwDGSw4hsne8oV5 MXmxbGumrpQvBi8Uy0kBf8DE5095TT/gpxBK X-Google-Smtp-Source: ABdhPJxQPPE8KEbxePFz0dZMAC9i+MqMSeAN9TkfRLSKimkchJparlIII0bbQ1yaNDBNzuFW2b8H/g== X-Received: by 2002:a7b:c4c5:: with SMTP id g5mr1415657wmk.139.1643966707192; Fri, 04 Feb 2022 01:25:07 -0800 (PST) Received: from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72]) by smtp.gmail.com with ESMTPSA id n8sm1022458wmk.18.2022.02.04.01.25.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 01:25:06 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Fri, 4 Feb 2022 09:24:35 +0000 Message-Id: <20220204092435.6343-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] ipa: raspberrypi: awb: Better handling of how we disable AWB 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" We now handle disabling ("pausing") AWB in the same way as AEC/AGC. Instead of letting the pause flag be set so that the code never runs at all, we instead fix the manual settings to the current values (but continue to be called). The algorithm does not restart any calculations in this state, but continues to add AWB metadata to every frame. Therefore certain other algorithms that want to know it (CCM and ALSC, for example) can still find it. Signed-off-by: David Plowman Reviewed-by: Naushir Patuck --- src/ipa/raspberrypi/controller/rpi/awb.cpp | 21 +++++++++++++++++++++ src/ipa/raspberrypi/controller/rpi/awb.hpp | 4 ++++ 2 files changed, 25 insertions(+) diff --git a/src/ipa/raspberrypi/controller/rpi/awb.cpp b/src/ipa/raspberrypi/controller/rpi/awb.cpp index 5cfd33a3..1ad912c7 100644 --- a/src/ipa/raspberrypi/controller/rpi/awb.cpp +++ b/src/ipa/raspberrypi/controller/rpi/awb.cpp @@ -172,6 +172,27 @@ void Awb::Initialise() async_results_ = sync_results_; } +bool Awb::IsPaused() const +{ + return false; +} + +void Awb::Pause() +{ + // "Pause" by fixing everything to the most recent values. + manual_r_ = sync_results_.gain_r = prev_sync_results_.gain_r; + manual_b_ = sync_results_.gain_b = prev_sync_results_.gain_b; + sync_results_.gain_g = prev_sync_results_.gain_g; + sync_results_.gain_g = prev_sync_results_.gain_g; + sync_results_.temperature_K = prev_sync_results_.temperature_K; +} + +void Awb::Resume() +{ + manual_r_ = 0.0; + manual_b_ = 0.0; +} + unsigned int Awb::GetConvergenceFrames() const { // If not in auto mode, there is no convergence diff --git a/src/ipa/raspberrypi/controller/rpi/awb.hpp b/src/ipa/raspberrypi/controller/rpi/awb.hpp index 8af1f27c..ac3dca6f 100644 --- a/src/ipa/raspberrypi/controller/rpi/awb.hpp +++ b/src/ipa/raspberrypi/controller/rpi/awb.hpp @@ -83,6 +83,10 @@ public: char const *Name() const override; void Initialise() override; void Read(boost::property_tree::ptree const ¶ms) override; + // AWB handles "pausing" for itself. + bool IsPaused() const override; + void Pause() override; + void Resume() override; unsigned int GetConvergenceFrames() const override; void SetMode(std::string const &name) override; void SetManualGains(double manual_r, double manual_b) override;