[libcamera-devel,6/7] ipa: raspberrypi: lux: Supply missing method and remove atomic variable
diff mbox series

Message ID 20210204093457.6879-7-david.plowman@raspberrypi.com
State Accepted
Headers show
Series
  • Raspberry Pi IPA maintenance
Related show

Commit Message

David Plowman Feb. 4, 2021, 9:34 a.m. UTC
Supply the missing SetCurrentAperture() method (even though no one is
calling it). If we did call it, it would be called synchronously so
the atomic variable is not required.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
---
 src/ipa/raspberrypi/controller/rpi/lux.cpp | 5 +++++
 src/ipa/raspberrypi/controller/rpi/lux.hpp | 3 +--
 2 files changed, 6 insertions(+), 2 deletions(-)

Comments

Laurent Pinchart Feb. 7, 2021, 2:08 p.m. UTC | #1
Hi David,

Thank you for the patch.

On Thu, Feb 04, 2021 at 09:34:56AM +0000, David Plowman wrote:
> Supply the missing SetCurrentAperture() method (even though no one is
> calling it). If we did call it, it would be called synchronously so
> the atomic variable is not required.
> 
> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/ipa/raspberrypi/controller/rpi/lux.cpp | 5 +++++
>  src/ipa/raspberrypi/controller/rpi/lux.hpp | 3 +--
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/ipa/raspberrypi/controller/rpi/lux.cpp b/src/ipa/raspberrypi/controller/rpi/lux.cpp
> index aefd92d4..f74381ca 100644
> --- a/src/ipa/raspberrypi/controller/rpi/lux.cpp
> +++ b/src/ipa/raspberrypi/controller/rpi/lux.cpp
> @@ -46,6 +46,11 @@ void Lux::Read(boost::property_tree::ptree const &params)
>  	current_aperture_ = reference_aperture_;
>  }
>  
> +void Lux::SetCurrentAperture(double aperture)
> +{
> +	current_aperture_ = aperture;
> +}
> +
>  void Lux::Prepare(Metadata *image_metadata)
>  {
>  	std::unique_lock<std::mutex> lock(mutex_);
> diff --git a/src/ipa/raspberrypi/controller/rpi/lux.hpp b/src/ipa/raspberrypi/controller/rpi/lux.hpp
> index 7b6c7258..f9090484 100644
> --- a/src/ipa/raspberrypi/controller/rpi/lux.hpp
> +++ b/src/ipa/raspberrypi/controller/rpi/lux.hpp
> @@ -6,7 +6,6 @@
>   */
>  #pragma once
>  
> -#include <atomic>
>  #include <mutex>
>  
>  #include "../lux_status.h"
> @@ -34,7 +33,7 @@ private:
>  	double reference_aperture_; // units of 1/f
>  	double reference_Y_; // out of 65536
>  	double reference_lux_;
> -	std::atomic<double> current_aperture_;
> +	double current_aperture_;
>  	LuxStatus status_;
>  	std::mutex mutex_;
>  };

Patch
diff mbox series

diff --git a/src/ipa/raspberrypi/controller/rpi/lux.cpp b/src/ipa/raspberrypi/controller/rpi/lux.cpp
index aefd92d4..f74381ca 100644
--- a/src/ipa/raspberrypi/controller/rpi/lux.cpp
+++ b/src/ipa/raspberrypi/controller/rpi/lux.cpp
@@ -46,6 +46,11 @@  void Lux::Read(boost::property_tree::ptree const &params)
 	current_aperture_ = reference_aperture_;
 }
 
+void Lux::SetCurrentAperture(double aperture)
+{
+	current_aperture_ = aperture;
+}
+
 void Lux::Prepare(Metadata *image_metadata)
 {
 	std::unique_lock<std::mutex> lock(mutex_);
diff --git a/src/ipa/raspberrypi/controller/rpi/lux.hpp b/src/ipa/raspberrypi/controller/rpi/lux.hpp
index 7b6c7258..f9090484 100644
--- a/src/ipa/raspberrypi/controller/rpi/lux.hpp
+++ b/src/ipa/raspberrypi/controller/rpi/lux.hpp
@@ -6,7 +6,6 @@ 
  */
 #pragma once
 
-#include <atomic>
 #include <mutex>
 
 #include "../lux_status.h"
@@ -34,7 +33,7 @@  private:
 	double reference_aperture_; // units of 1/f
 	double reference_Y_; // out of 65536
 	double reference_lux_;
-	std::atomic<double> current_aperture_;
+	double current_aperture_;
 	LuxStatus status_;
 	std::mutex mutex_;
 };