[libcamera-devel,2/3] camera_sensor_properties: Add blackLevels
diff mbox series

Message ID 20211221052117.2665228-3-paul.elder@ideasonboard.com
State New
Delegated to: Paul Elder
Headers show
Series
  • android: Plumb static black levels
Related show

Commit Message

Paul Elder Dec. 21, 2021, 5:21 a.m. UTC
Add an entry to the sensor database for the static black levels. As
these are approximate static values for the black levels, they can
reasonably be tied to the sensor model. Thus add it to the sensor
database.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=48
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
---
 .../libcamera/internal/camera_sensor_properties.h   |  2 ++
 src/libcamera/camera_sensor.cpp                     |  1 +
 src/libcamera/camera_sensor_properties.cpp          | 13 +++++++++++++
 3 files changed, 16 insertions(+)

Patch
diff mbox series

diff --git a/include/libcamera/internal/camera_sensor_properties.h b/include/libcamera/internal/camera_sensor_properties.h
index 1ee3cb99..91826e2d 100644
--- a/include/libcamera/internal/camera_sensor_properties.h
+++ b/include/libcamera/internal/camera_sensor_properties.h
@@ -7,6 +7,7 @@ 
 
 #pragma once
 
+#include <array>
 #include <map>
 #include <string>
 
@@ -20,6 +21,7 @@  struct CameraSensorProperties {
 
 	Size unitCellSize;
 	std::map<controls::draft::TestPatternModeEnum, int32_t> testPatternModes;
+	std::array<int32_t, 4> blackLevels;
 };
 
 } /* namespace libcamera */
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index c3999d35..f9dd00bb 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -306,6 +306,7 @@  void CameraSensor::initStaticProperties()
 
 	/* Register the properties retrieved from the sensor database. */
 	properties_.set(properties::UnitCellSize, staticProps_->unitCellSize);
+	properties_.set(properties::SensorFixedBlackLevels, staticProps_->blackLevels);
 
 	initTestPatternModes();
 }
diff --git a/src/libcamera/camera_sensor_properties.cpp b/src/libcamera/camera_sensor_properties.cpp
index 48305ac4..d4485f45 100644
--- a/src/libcamera/camera_sensor_properties.cpp
+++ b/src/libcamera/camera_sensor_properties.cpp
@@ -41,6 +41,11 @@  LOG_DEFINE_CATEGORY(CameraSensorProperties)
  * \brief Map that associates the TestPattern control value with the indexes of
  * the corresponding sensor test pattern modes as returned by
  * V4L2_CID_TEST_PATTERN.
+ *
+ * \var CameraSensorProperties::blackLevels
+ * \brief Fixed black level offset for each of the four color filter
+ * arrangement (CFA) mosaic channels, specified in the same order as the order
+ * of color filters.
  */
 
 /**
@@ -69,6 +74,7 @@  const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
 				 * 9: "Resolution Pattern"
 				 */
 			},
+			.blackLevels = {},
 		} },
 		{ "imx219", {
 			.unitCellSize = { 1120, 1120 },
@@ -79,6 +85,7 @@  const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
 				{ controls::draft::TestPatternModeColorBarsFadeToGray, 3 },
 				{ controls::draft::TestPatternModePn9, 4 },
 			},
+			.blackLevels = {},
 		} },
 		{ "imx258", {
 			.unitCellSize = { 1120, 1120 },
@@ -89,10 +96,12 @@  const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
 				{ controls::draft::TestPatternModeColorBarsFadeToGray, 3 },
 				{ controls::draft::TestPatternModePn9, 4 },
 			},
+			.blackLevels = {},
 		} },
 		{ "ov5647", {
 			.unitCellSize = { 1400, 1400 },
 			.testPatternModes = {},
+			.blackLevels = {},
 		} },
 		{ "ov5670", {
 			.unitCellSize = { 1120, 1120 },
@@ -100,6 +109,7 @@  const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
 				{ controls::draft::TestPatternModeOff, 0 },
 				{ controls::draft::TestPatternModeColorBars, 1 },
 			},
+			.blackLevels = {},
 		} },
 		{ "ov5693", {
 			.unitCellSize = { 1400, 1400 },
@@ -112,6 +122,7 @@  const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
 				 * Rolling Bar".
 				 */
 			},
+			.blackLevels = {},
 		} },
 		{ "ov8865", {
 			.unitCellSize = { 1400, 1400 },
@@ -126,6 +137,7 @@  const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
 				 * 5: "Color squares with rolling bar"
 				 */
 			},
+			.blackLevels = {},
 		} },
 		{ "ov13858", {
 			.unitCellSize = { 1120, 1120 },
@@ -133,6 +145,7 @@  const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
 				{ controls::draft::TestPatternModeOff, 0 },
 				{ controls::draft::TestPatternModeColorBars, 1 },
 			},
+			.blackLevels = {},
 		} },
 	};