@@ -10,11 +10,13 @@
#include <string>
#include <libcamera/geometry.h>
+#include <libcamera/span.h>
namespace libcamera {
struct SensorInfo {
Size unitCellSize;
+ Span<const std::pair<const char *, int32_t>> testPatternModeMap;
};
class SensorDatabase
@@ -9,6 +9,8 @@
#include <algorithm>
+#include "libcamera/control_ids.h"
+
namespace libcamera {
/**
@@ -43,25 +45,54 @@ namespace libcamera {
namespace {
+constexpr std::pair<const char *, int32_t> imx219TestPatternModeMap[] = {
+ { "Disabled", controls::draft::SensorTestPatternModeOff },
+ { "Color Bars", controls::draft::SensorTestPatternModeColorBars },
+ { "Solid Color", controls::draft::SensorTestPatternModeSolidColor },
+ { "Grey Color Bars", controls::draft::SensorTestPatternModeColorBarsFadeToGray },
+ { "PN9", controls::draft::SensorTestPatternModePn9 },
+};
+
+constexpr std::pair<const char *, int32_t> ov5670TestPatternModeMap[] = {
+ { "Disabled", controls::draft::SensorTestPatternModeOff },
+ { "Vertical Color Bar Type 1", controls::draft::SensorTestPatternModeColorBars },
+};
+
+constexpr std::pair<const char *, int32_t> ov13858TestPatternModeMap[] = {
+ { "Disabled", controls::draft::SensorTestPatternModeOff },
+ { "Vertical Color Bar Type 1", controls::draft::SensorTestPatternModeColorBars },
+ { "Vertical Color Bar Type 2", controls::draft::SensorTestPatternModeColorBarsFadeToGray },
+};
+
/**
* \brief Sony IMX219 sensor properties
*/
constexpr SensorInfo imx219Info = {
- .unitCellSize = { 1120, 1120 }
+ .unitCellSize = { 1120, 1120 },
+ .testPatternModeMap =
+ libcamera::Span<const std::pair<const char *, int32_t>>(
+ imx219TestPatternModeMap),
};
/**
* \brief Omnivision ov5670 sensor properties
*/
constexpr SensorInfo ov5670Info = {
- .unitCellSize = { 1120, 1120 }
+ .unitCellSize = { 1120, 1120 },
+ .testPatternModeMap =
+ libcamera::Span<const std::pair<const char *, int32_t>>(
+ ov5670TestPatternModeMap),
};
/**
* \brief Omnivision 13858 sensor properties
*/
constexpr SensorInfo ov13858Info = {
- .unitCellSize = { 1120, 1120 }
+ .unitCellSize = { 1120, 1120 },
+ .testPatternModeMap =
+ libcamera::Span<const std::pair<const char *, int32_t>>(
+ ov13858TestPatternModeMap),
+
};
#define SENSOR_INFO(_sensor) \
In V4L2 API, a driver returns a name to represent a test pattern, but it is a driver specific what test pattern is represented by the name. Therefore, this adds a mapping table from the name to a test pattern into a static configuration of a sensor. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> --- include/libcamera/internal/sensor_database.h | 2 ++ src/libcamera/sensor_database.cpp | 37 ++++++++++++++++++-- 2 files changed, 36 insertions(+), 3 deletions(-)