{"id":11134,"url":"https://patchwork.libcamera.org/api/1.1/patches/11134/?format=json","web_url":"https://patchwork.libcamera.org/patch/11134/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210204093457.6879-5-david.plowman@raspberrypi.com>","date":"2021-02-04T09:34:54","name":"[libcamera-devel,4/7] ipa: rasberrypi: contrast: Remove unnecessary atomic variables","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"7a8ba810ae8481fdf3f0c731bf47515908cfe03e","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/1.1/people/42/?format=json","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11134/mbox/","series":[{"id":1649,"url":"https://patchwork.libcamera.org/api/1.1/series/1649/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1649","date":"2021-02-04T09:34:50","name":"Raspberry Pi IPA maintenance","version":1,"mbox":"https://patchwork.libcamera.org/series/1649/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11134/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11134/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 6FFB4BD162\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  4 Feb 2021 09:35:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CFDA861425;\n\tThu,  4 Feb 2021 10:35:07 +0100 (CET)","from mail-wr1-x433.google.com (mail-wr1-x433.google.com\n\t[IPv6:2a00:1450:4864:20::433])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 02EBA61413\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  4 Feb 2021 10:35:04 +0100 (CET)","by mail-wr1-x433.google.com with SMTP id z6so2619312wrq.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 04 Feb 2021 01:35:04 -0800 (PST)","from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tg16sm5280580wmi.30.2021.02.04.01.35.03\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 04 Feb 2021 01:35:03 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"pWF4egGt\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=qrlk1z5ecjKEw43jec01YanZO3wmUgfvHSyZL+t2pMg=;\n\tb=pWF4egGt+B5Dkxh71zypPw8zloFIs9LZeqDMtav+Lucp/37gvkqG1NpUGkadiBGkPt\n\t2OlT7PDljdOcvy5m2m1m4oneqjnFfln7LidYoTARdRH5x/oZ+JaX45jUDaUijkAta2qZ\n\tevvbQezKXFUEsbrf6Bjb4eFFUQgmPxwPxDccBr3zQBtuG7eIWtWfHIfF40kJcMs2wdQR\n\tQGrtA3NHkYv50+UB5ljDSHa3hnFEIhxlv6Sl5sko3Xv5yGjLd79hQNzPQU/zQfkWVU+Z\n\tV2V4o5aLsGtBxc47g562yeJUf1aQk6J0BD+tWKl+Zkfc7a+c7SrANUchhC67SNabSOqw\n\tMqEw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=qrlk1z5ecjKEw43jec01YanZO3wmUgfvHSyZL+t2pMg=;\n\tb=rn4TwVyOcPg+Bl6kfX99UiO4drOFOltZMnsNqcaiQyp8Xi6cE8113VzXzB2O1SabaL\n\tzodbryWFzWSpHhoZ0qwfuzTBOqbxDM9vbAvko5bxQlYzoIzC/nlVEUmBg5JNv5iUgs0Q\n\thPRR4Bw4eroZTSsAn68M/ZxbFz1xzIIDirE1lEcoW2kYFP2olCgsGluPf4MYEcvNijB0\n\tM7R4WLw3W1IX0NAwiwWuuRtM8ykrqECtRkRLR8ilcbRtub2/nSt/Td+MQ6vI+XSYoMm7\n\tq1Jifyo9VgA8uU00RbaGSc635AvVgy3pahJcUn3Zk7mJRrhWyQQqUBU9+ND7Q38dX0FV\n\t/bFA==","X-Gm-Message-State":"AOAM531zetTe0IESzK5yMpqVRIeU8g4nw5qvqykWcbDeAUFEgv0XHCyk\n\tJg6luVIikvhy/vbYcOH1SE1JbwTFrUpzqF0n","X-Google-Smtp-Source":"ABdhPJx142e8s2wtlBp9MHBJ6tDsPtfn1X2XS72pbTD2hBjw+kqvFm8XGnRygS9fy6EB6wxC8gcEog==","X-Received":"by 2002:adf:d850:: with SMTP id\n\tk16mr8226194wrl.191.1612431304425; \n\tThu, 04 Feb 2021 01:35:04 -0800 (PST)","From":"David Plowman <david.plowman@raspberrypi.com>","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\n\tunnecessary atomic variables","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"SetBrightness() and SetContrast() are only called synchronously so\nthere is no need for brightness_ and contrast_ to be atomic.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/raspberrypi/controller/rpi/contrast.cpp | 9 ++++-----\n src/ipa/raspberrypi/controller/rpi/contrast.hpp | 5 ++---\n 2 files changed, 6 insertions(+), 8 deletions(-)","diff":"diff --git a/src/ipa/raspberrypi/controller/rpi/contrast.cpp b/src/ipa/raspberrypi/controller/rpi/contrast.cpp\nindex 05ed139f..2bc43027 100644\n--- a/src/ipa/raspberrypi/controller/rpi/contrast.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/contrast.cpp\n@@ -150,7 +150,6 @@ Pwl apply_manual_contrast(Pwl const &gamma_curve, double brightness,\n void Contrast::Process(StatisticsPtr &stats,\n \t\t       [[maybe_unused]] Metadata *image_metadata)\n {\n-\tdouble brightness = brightness_, contrast = contrast_;\n \tHistogram histogram(stats->hist[0].g_hist, NUM_HISTOGRAM_BINS);\n \t// We look at the histogram and adjust the gamma curve in the following\n \t// ways: 1. Adjust the gamma curve so as to pull the start of the\n@@ -165,13 +164,13 @@ void Contrast::Process(StatisticsPtr &stats,\n \t}\n \t// 2. Finally apply any manually selected brightness/contrast\n \t// adjustment.\n-\tif (brightness != 0 || contrast != 1.0)\n-\t\tgamma_curve = apply_manual_contrast(gamma_curve, brightness,\n-\t\t\t\t\t\t    contrast);\n+\tif (brightness_ != 0 || contrast_ != 1.0)\n+\t\tgamma_curve = apply_manual_contrast(gamma_curve, brightness_,\n+\t\t\t\t\t\t    contrast_);\n \t// And fill in the status for output. Use more points towards the bottom\n \t// of the curve.\n \tContrastStatus status;\n-\tfill_in_status(status, brightness, contrast, gamma_curve);\n+\tfill_in_status(status, brightness_, contrast_, gamma_curve);\n \t{\n \t\tstd::unique_lock<std::mutex> lock(mutex_);\n \t\tstatus_ = status;\ndiff --git a/src/ipa/raspberrypi/controller/rpi/contrast.hpp b/src/ipa/raspberrypi/controller/rpi/contrast.hpp\nindex 6836f181..85624539 100644\n--- a/src/ipa/raspberrypi/controller/rpi/contrast.hpp\n+++ b/src/ipa/raspberrypi/controller/rpi/contrast.hpp\n@@ -6,7 +6,6 @@\n  */\n #pragma once\n \n-#include <atomic>\n #include <mutex>\n \n #include \"../contrast_algorithm.hpp\"\n@@ -42,8 +41,8 @@ public:\n \n private:\n \tContrastConfig config_;\n-\tstd::atomic<double> brightness_;\n-\tstd::atomic<double> contrast_;\n+\tdouble brightness_;\n+\tdouble contrast_;\n \tContrastStatus status_;\n \tstd::mutex mutex_;\n };\n","prefixes":["libcamera-devel","4/7"]}