summaryrefslogtreecommitdiff
path: root/src/ipa/libipa/camera_sensor_helper.h
diff options
context:
space:
mode:
authorBarnabás Pőcze <pobrn@protonmail.com>2024-12-09 10:04:17 +0000
committerBarnabás Pőcze <pobrn@protonmail.com>2024-12-09 13:52:39 +0100
commit65dd707f7492d63a79f069422f9c3f351e1c7dfb (patch)
tree03004749b3b86dd2324892fce3c3af3868b4dc46 /src/ipa/libipa/camera_sensor_helper.h
parent3930b9402110472ef2e8d4a997f4ebc4925e864b (diff)
libcamera: libipa: camera_sensor_helper: Use `variant` instead of `union`
Use an `std::variant` to store the analogue gain instead of a bare union + tag. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/ipa/libipa/camera_sensor_helper.h')
-rw-r--r--src/ipa/libipa/camera_sensor_helper.h18
1 files changed, 4 insertions, 14 deletions
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 <optional>
#include <stdint.h>
#include <string>
+#include <variant>
#include <vector>
#include <libcamera/base/class.h>
@@ -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<int16_t> blackLevel_;
- AnalogueGainType gainType_;
- AnalogueGainConstants gainConstants_;
+ std::variant<std::monostate, AnalogueGainLinear, AnalogueGainExp> gain_;
private:
LIBCAMERA_DISABLE_COPY_AND_MOVE(CameraSensorHelper)