ipa: rasberrypi: contrast: Remove unnecessary atomic variables

SetBrightness() and SetContrast() are only called synchronously so
there is no need for brightness_ and contrast_ to be atomic.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
David Plowman 2021-02-04 09:34:54 +00:00 committed by Laurent Pinchart
parent df3a86ace3
commit 7a8150c5b9
2 changed files with 6 additions and 8 deletions

View file

@ -150,7 +150,6 @@ Pwl apply_manual_contrast(Pwl const &gamma_curve, double brightness,
void Contrast::Process(StatisticsPtr &stats, void Contrast::Process(StatisticsPtr &stats,
[[maybe_unused]] Metadata *image_metadata) [[maybe_unused]] Metadata *image_metadata)
{ {
double brightness = brightness_, contrast = contrast_;
Histogram histogram(stats->hist[0].g_hist, NUM_HISTOGRAM_BINS); Histogram histogram(stats->hist[0].g_hist, NUM_HISTOGRAM_BINS);
// We look at the histogram and adjust the gamma curve in the following // 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 // 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 // 2. Finally apply any manually selected brightness/contrast
// adjustment. // adjustment.
if (brightness != 0 || contrast != 1.0) if (brightness_ != 0 || contrast_ != 1.0)
gamma_curve = apply_manual_contrast(gamma_curve, brightness, gamma_curve = apply_manual_contrast(gamma_curve, brightness_,
contrast); contrast_);
// And fill in the status for output. Use more points towards the bottom // And fill in the status for output. Use more points towards the bottom
// of the curve. // of the curve.
ContrastStatus status; ContrastStatus status;
fill_in_status(status, brightness, contrast, gamma_curve); fill_in_status(status, brightness_, contrast_, gamma_curve);
{ {
std::unique_lock<std::mutex> lock(mutex_); std::unique_lock<std::mutex> lock(mutex_);
status_ = status; status_ = status;

View file

@ -6,7 +6,6 @@
*/ */
#pragma once #pragma once
#include <atomic>
#include <mutex> #include <mutex>
#include "../contrast_algorithm.hpp" #include "../contrast_algorithm.hpp"
@ -42,8 +41,8 @@ public:
private: private:
ContrastConfig config_; ContrastConfig config_;
std::atomic<double> brightness_; double brightness_;
std::atomic<double> contrast_; double contrast_;
ContrastStatus status_; ContrastStatus status_;
std::mutex mutex_; std::mutex mutex_;
}; };