From patchwork Tue Feb 8 10:04:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 15343 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 693ADBF415 for ; Tue, 8 Feb 2022 10:04:44 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BD415610BF; Tue, 8 Feb 2022 11:04:43 +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="rLBhzwnc"; dkim-atps=neutral Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B6680610AD for ; Tue, 8 Feb 2022 11:04:42 +0100 (CET) Received: by mail-wr1-x42b.google.com with SMTP id h6so10987678wrb.9 for ; Tue, 08 Feb 2022 02:04:42 -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=3l5ahQqrMGYFZaVyouoJR+LZS1VSkX3VWjwpdI73BIQ=; b=rLBhzwnc7in3StFnZh6XLKOxE0UI7qQM1zYcOY5Q/0Rrndj+Cjw2BpYkdTeAkHnXth ETYckGMRVhbUoJBS7nDKKhHb6P4+Ffo7er3wDrq2Zc7Txlx8rL/KWr7yUlWdZvxocbCL GizRRXaIPUzbdHsvrUmzxV0Ed90KjWCBWWdREjKmUxtDLd5UM5mctZ87URYM8Q8zyVsw 8Uqv6+qXVq7/bXjI7POv2MC1gWHXYshbObMF4BugbGiSsCJdZRQdHc3JjblTmCl1gOg+ a/nAOgZu/XLyXDqXpQH5MScXUr7hEhF0TqLT1sSy0apZuiAGJHhKmV2hzMFpF3fcUaJ5 +BwA== 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=3l5ahQqrMGYFZaVyouoJR+LZS1VSkX3VWjwpdI73BIQ=; b=bc7YmP2+pUL7Xm7r7qJvCaOfVXdCHmxIEPyjBxcZ4q5bM5c6rqvh0mJ/0lmYz3xh80 nF1/PmLOwUgNVcaEhMQRguOJT3jiMBx1xKflbVoW9QB02Epr/sCoxpEy20nONlGHlKAH /Zopcs77wYu1h1j574JVNfzBONdRA9uCBMc6vepLW35u4PODGSeM7sWWWG1eZEx57Nu9 5GiM3dlOpWoqKA4fyc6G9PTR0CV/N7OJbtpfDTOUanRjBd3rPOZUVJXL0QBKfUseecvQ +xNqKFkmQbK1jb5sWPe1iaCpoe8ihVozHkiElDmp6OGe08yPlmVMCjQ0pG2km2Dbtk3P CisA== X-Gm-Message-State: AOAM531b9DkPzdIgoE8sgACP5dNmjQTKiRuHQFXB9eS7arVEBmGahztg /6TrKPPfS5jgN98u7mUJOwmPZ9Ec4TJd0MHl X-Google-Smtp-Source: ABdhPJyYK1f/opU1PR5t3LPZw5u1oAX0c8xSf3M+3qL+syKLFO6JdZP76NJDa7XPDui1+d8LMZf78Q== X-Received: by 2002:a05:6000:1a8c:: with SMTP id f12mr2773073wry.124.1644314682142; Tue, 08 Feb 2022 02:04:42 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id o10sm13540033wri.19.2022.02.08.02.04.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 02:04:41 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Tue, 8 Feb 2022 10:04:36 +0000 Message-Id: <20220208100436.2348-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2] 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 Reviewed-by: Laurent Pinchart --- src/ipa/raspberrypi/controller/rpi/awb.cpp | 20 ++++++++++++++++++++ src/ipa/raspberrypi/controller/rpi/awb.hpp | 4 ++++ 2 files changed, 24 insertions(+) diff --git a/src/ipa/raspberrypi/controller/rpi/awb.cpp b/src/ipa/raspberrypi/controller/rpi/awb.cpp index 5cfd33a3..d4c93447 100644 --- a/src/ipa/raspberrypi/controller/rpi/awb.cpp +++ b/src/ipa/raspberrypi/controller/rpi/awb.cpp @@ -172,6 +172,26 @@ 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_.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;