From 65dd707f7492d63a79f069422f9c3f351e1c7dfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Mon, 9 Dec 2024 10:04:17 +0000 Subject: libcamera: libipa: camera_sensor_helper: Use `variant` instead of `union` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use an `std::variant` to store the analogue gain instead of a bare union + tag. Signed-off-by: Barnabás Pőcze Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/ipa/libipa/camera_sensor_helper.h | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'src/ipa/libipa/camera_sensor_helper.h') diff --git a/src/ipa/libipa/camera_sensor_helper.h b/src/ipa/libipa/camera_sensor_helper.h index 75868205..a9300a64 100644 --- a/src/ipa/libipa/camera_sensor_helper.h +++ b/src/ipa/libipa/camera_sensor_helper.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -30,31 +31,20 @@ public: virtual double gain(uint32_t gainCode) const; protected: - enum AnalogueGainType { - AnalogueGainLinear, - AnalogueGainExponential, - }; - - struct AnalogueGainLinearConstants { + struct AnalogueGainLinear { int16_t m0; int16_t c0; int16_t m1; int16_t c1; }; - struct AnalogueGainExpConstants { + struct AnalogueGainExp { double a; double m; }; - union AnalogueGainConstants { - AnalogueGainLinearConstants linear; - AnalogueGainExpConstants exp; - }; - std::optional blackLevel_; - AnalogueGainType gainType_; - AnalogueGainConstants gainConstants_; + std::variant gain_; private: LIBCAMERA_DISABLE_COPY_AND_MOVE(CameraSensorHelper) -- cgit v1.2.1