From patchwork Thu Feb 4 09:34:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 11134 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 6FFB4BD162 for ; Thu, 4 Feb 2021 09:35:08 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CFDA861425; Thu, 4 Feb 2021 10:35:07 +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="pWF4egGt"; dkim-atps=neutral Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 02EBA61413 for ; Thu, 4 Feb 2021 10:35:04 +0100 (CET) Received: by mail-wr1-x433.google.com with SMTP id z6so2619312wrq.10 for ; Thu, 04 Feb 2021 01:35:04 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=qrlk1z5ecjKEw43jec01YanZO3wmUgfvHSyZL+t2pMg=; b=pWF4egGt+B5Dkxh71zypPw8zloFIs9LZeqDMtav+Lucp/37gvkqG1NpUGkadiBGkPt 2OlT7PDljdOcvy5m2m1m4oneqjnFfln7LidYoTARdRH5x/oZ+JaX45jUDaUijkAta2qZ evvbQezKXFUEsbrf6Bjb4eFFUQgmPxwPxDccBr3zQBtuG7eIWtWfHIfF40kJcMs2wdQR QGrtA3NHkYv50+UB5ljDSHa3hnFEIhxlv6Sl5sko3Xv5yGjLd79hQNzPQU/zQfkWVU+Z V2V4o5aLsGtBxc47g562yeJUf1aQk6J0BD+tWKl+Zkfc7a+c7SrANUchhC67SNabSOqw MqEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qrlk1z5ecjKEw43jec01YanZO3wmUgfvHSyZL+t2pMg=; b=rn4TwVyOcPg+Bl6kfX99UiO4drOFOltZMnsNqcaiQyp8Xi6cE8113VzXzB2O1SabaL zodbryWFzWSpHhoZ0qwfuzTBOqbxDM9vbAvko5bxQlYzoIzC/nlVEUmBg5JNv5iUgs0Q hPRR4Bw4eroZTSsAn68M/ZxbFz1xzIIDirE1lEcoW2kYFP2olCgsGluPf4MYEcvNijB0 M7R4WLw3W1IX0NAwiwWuuRtM8ykrqECtRkRLR8ilcbRtub2/nSt/Td+MQ6vI+XSYoMm7 q1Jifyo9VgA8uU00RbaGSc635AvVgy3pahJcUn3Zk7mJRrhWyQQqUBU9+ND7Q38dX0FV /bFA== X-Gm-Message-State: AOAM531zetTe0IESzK5yMpqVRIeU8g4nw5qvqykWcbDeAUFEgv0XHCyk Jg6luVIikvhy/vbYcOH1SE1JbwTFrUpzqF0n X-Google-Smtp-Source: ABdhPJx142e8s2wtlBp9MHBJ6tDsPtfn1X2XS72pbTD2hBjw+kqvFm8XGnRygS9fy6EB6wxC8gcEog== X-Received: by 2002:adf:d850:: with SMTP id k16mr8226194wrl.191.1612431304425; Thu, 04 Feb 2021 01:35:04 -0800 (PST) Received: from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72]) by smtp.gmail.com with ESMTPSA id g16sm5280580wmi.30.2021.02.04.01.35.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 01:35:03 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Thu, 4 Feb 2021 09:34:54 +0000 Message-Id: <20210204093457.6879-5-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210204093457.6879-1-david.plowman@raspberrypi.com> References: <20210204093457.6879-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 4/7] ipa: rasberrypi: contrast: Remove unnecessary atomic variables 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" SetBrightness() and SetContrast() are only called synchronously so there is no need for brightness_ and contrast_ to be atomic. Signed-off-by: David Plowman Reviewed-by: Laurent Pinchart --- src/ipa/raspberrypi/controller/rpi/contrast.cpp | 9 ++++----- src/ipa/raspberrypi/controller/rpi/contrast.hpp | 5 ++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/ipa/raspberrypi/controller/rpi/contrast.cpp b/src/ipa/raspberrypi/controller/rpi/contrast.cpp index 05ed139f..2bc43027 100644 --- a/src/ipa/raspberrypi/controller/rpi/contrast.cpp +++ b/src/ipa/raspberrypi/controller/rpi/contrast.cpp @@ -150,7 +150,6 @@ Pwl apply_manual_contrast(Pwl const &gamma_curve, double brightness, void Contrast::Process(StatisticsPtr &stats, [[maybe_unused]] Metadata *image_metadata) { - double brightness = brightness_, contrast = contrast_; Histogram histogram(stats->hist[0].g_hist, NUM_HISTOGRAM_BINS); // We look at the histogram and adjust the gamma curve in the following // ways: 1. Adjust the gamma curve so as to pull the start of the @@ -165,13 +164,13 @@ void Contrast::Process(StatisticsPtr &stats, } // 2. Finally apply any manually selected brightness/contrast // adjustment. - if (brightness != 0 || contrast != 1.0) - gamma_curve = apply_manual_contrast(gamma_curve, brightness, - contrast); + if (brightness_ != 0 || contrast_ != 1.0) + gamma_curve = apply_manual_contrast(gamma_curve, brightness_, + contrast_); // And fill in the status for output. Use more points towards the bottom // of the curve. ContrastStatus status; - fill_in_status(status, brightness, contrast, gamma_curve); + fill_in_status(status, brightness_, contrast_, gamma_curve); { std::unique_lock lock(mutex_); status_ = status; diff --git a/src/ipa/raspberrypi/controller/rpi/contrast.hpp b/src/ipa/raspberrypi/controller/rpi/contrast.hpp index 6836f181..85624539 100644 --- a/src/ipa/raspberrypi/controller/rpi/contrast.hpp +++ b/src/ipa/raspberrypi/controller/rpi/contrast.hpp @@ -6,7 +6,6 @@ */ #pragma once -#include #include #include "../contrast_algorithm.hpp" @@ -42,8 +41,8 @@ public: private: ContrastConfig config_; - std::atomic brightness_; - std::atomic contrast_; + double brightness_; + double contrast_; ContrastStatus status_; std::mutex mutex_; };