From a9d43c4710ba0db092c2abbf7d3423f4ac58352a Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 24 Feb 2022 21:55:44 +0200 Subject: libipa: camera_sensor_helper: Reorganize gain constants To prepare for other gain models than the linear model, store the gain constants in a union with per-model members. Due to the lack of designated initializer support in gcc with C++17, initializing a single complex structure that includes a union will be difficult. Split the gain model type to a separate variable to work around this issue. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Reviewed-by: Umang Jain Reviewed-by: Paul Elder --- src/ipa/libipa/camera_sensor_helper.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 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 26adfcb5..6b96520b 100644 --- a/src/ipa/libipa/camera_sensor_helper.h +++ b/src/ipa/libipa/camera_sensor_helper.h @@ -34,15 +34,19 @@ protected: AnalogueGainExponential, }; - struct AnalogueGainConstants { - AnalogueGainType type; + struct AnalogueGainLinearConstants { int16_t m0; int16_t c0; int16_t m1; int16_t c1; }; - AnalogueGainConstants analogueGainConstants_; + union AnalogueGainConstants { + AnalogueGainLinearConstants linear; + }; + + AnalogueGainType gainType_; + AnalogueGainConstants gainConstants_; private: LIBCAMERA_DISABLE_COPY_AND_MOVE(CameraSensorHelper) -- cgit v1.2.1