[libcamera-devel] [PATCH 04/15] libcamera: camera_sensor_properties: Add sensor delays
Jacopo Mondi
jacopo at jmondi.org
Mon Jun 27 18:27:21 CEST 2022
Add to the camera sensor properties a map of control identifiers to
their latencies.
Some camera sensor controls take a variable number of frames to take
effect, hence they should be set in advance. The newly introduced map
records that information as a property of the camera sensor class.
Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
.../internal/camera_sensor_properties.h | 2 ++
src/libcamera/camera_sensor_properties.cpp | 32 +++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/include/libcamera/internal/camera_sensor_properties.h b/include/libcamera/internal/camera_sensor_properties.h
index 1ee3cb994106..868b992196de 100644
--- a/include/libcamera/internal/camera_sensor_properties.h
+++ b/include/libcamera/internal/camera_sensor_properties.h
@@ -9,6 +9,7 @@
#include <map>
#include <string>
+#include <unordered_map>
#include <libcamera/control_ids.h>
#include <libcamera/geometry.h>
@@ -20,6 +21,7 @@ struct CameraSensorProperties {
Size unitCellSize;
std::map<controls::draft::TestPatternModeEnum, int32_t> testPatternModes;
+ std::unordered_map<const ControlId *, unsigned int> sensorDelays;
};
} /* namespace libcamera */
diff --git a/src/libcamera/camera_sensor_properties.cpp b/src/libcamera/camera_sensor_properties.cpp
index e5f27f06eb1d..5ff28eb04b9f 100644
--- a/src/libcamera/camera_sensor_properties.cpp
+++ b/src/libcamera/camera_sensor_properties.cpp
@@ -13,6 +13,8 @@
#include <libcamera/control_ids.h>
+#include <libcamera/internal/control_ids.h>
+
/**
* \file camera_sensor_properties.h
* \brief Database of camera sensor properties
@@ -41,6 +43,10 @@ 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::sensorDelays
+ * \brief Map that associates control identifiers with their latencies,
+ * expressed in frame periods.
*/
/**
@@ -69,6 +75,7 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
* 9: "Resolution Pattern"
*/
},
+ .sensorDelays = { },
} },
{ "imx219", {
.unitCellSize = { 1120, 1120 },
@@ -79,6 +86,11 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
{ controls::draft::TestPatternModeColorBarsFadeToGray, 3 },
{ controls::draft::TestPatternModePn9, 4 },
},
+ .sensorDelays = {
+ { &controls::internal::FrameDuration, 2 },
+ { &controls::internal::ExposureTime, 2 },
+ { &controls::internal::draft::SensorAnalogueGain, 1 },
+ },
} },
{ "imx258", {
.unitCellSize = { 1120, 1120 },
@@ -89,18 +101,26 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
{ controls::draft::TestPatternModeColorBarsFadeToGray, 3 },
{ controls::draft::TestPatternModePn9, 4 },
},
+ .sensorDelays = { },
} },
{ "imx290", {
.unitCellSize = { 2900, 2900 },
.testPatternModes = {},
+ .sensorDelays = {
+ { &controls::internal::FrameDuration, 2 },
+ { &controls::internal::ExposureTime, 2 },
+ { &controls::internal::draft::SensorAnalogueGain, 2 },
+ },
} },
{ "imx296", {
.unitCellSize = { 3450, 3450 },
.testPatternModes = {},
+ .sensorDelays = { },
} },
{ "imx477", {
.unitCellSize = { 1550, 1550 },
.testPatternModes = {},
+ .sensorDelays = { },
} },
{ "ov2740", {
.unitCellSize = { 1400, 1400 },
@@ -108,6 +128,7 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
{ controls::draft::TestPatternModeOff, 0 },
{ controls::draft::TestPatternModeColorBars, 1},
},
+ .sensorDelays = { },
} },
{ "ov5640", {
.unitCellSize = { 1400, 1400 },
@@ -115,10 +136,16 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
{ controls::draft::TestPatternModeOff, 0 },
{ controls::draft::TestPatternModeColorBars, 1 },
},
+ .sensorDelays = { },
} },
{ "ov5647", {
.unitCellSize = { 1400, 1400 },
.testPatternModes = {},
+ .sensorDelays = {
+ { &controls::internal::FrameDuration, 2 },
+ { &controls::internal::ExposureTime, 2 },
+ { &controls::internal::draft::SensorAnalogueGain, 2 },
+ },
} },
{ "ov5670", {
.unitCellSize = { 1120, 1120 },
@@ -126,6 +153,7 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
{ controls::draft::TestPatternModeOff, 0 },
{ controls::draft::TestPatternModeColorBars, 1 },
},
+ .sensorDelays = { },
} },
{ "ov5675", {
.unitCellSize = { 1120, 1120 },
@@ -133,6 +161,7 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
{ controls::draft::TestPatternModeOff, 0 },
{ controls::draft::TestPatternModeColorBars, 1 },
},
+ .sensorDelays = { },
} },
{ "ov5693", {
.unitCellSize = { 1400, 1400 },
@@ -145,6 +174,7 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
* Rolling Bar".
*/
},
+ .sensorDelays = { },
} },
{ "ov8865", {
.unitCellSize = { 1400, 1400 },
@@ -159,6 +189,7 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
* 5: "Color squares with rolling bar"
*/
},
+ .sensorDelays = { },
} },
{ "ov13858", {
.unitCellSize = { 1120, 1120 },
@@ -166,6 +197,7 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen
{ controls::draft::TestPatternModeOff, 0 },
{ controls::draft::TestPatternModeColorBars, 1 },
},
+ .sensorDelays = { },
} },
};
--
2.36.1
More information about the libcamera-devel
mailing list