@@ -7,6 +7,7 @@
#ifndef __LIBCAMERA_SENSOR_DATABASE_H__
#define __LIBCAMERA_SENSOR_DATABASE_H__
+#include <map>
#include <string>
#include <libcamera/geometry.h>
@@ -15,6 +16,7 @@ namespace libcamera {
struct SensorInfo {
Size unitCellSize;
+ std::map<std::string, int32_t> testPatternModeMap;
};
class SensorDatabase
@@ -9,6 +9,8 @@
#include <algorithm>
+#include "libcamera/control_ids.h"
+
namespace libcamera {
/**
@@ -43,25 +45,48 @@ namespace libcamera {
namespace {
+const std::map<std::string, int32_t> imx219TestPatternModeMap = {
+ { "Disabled", controls::draft::TestPatternModeOff },
+ { "Color Bars", controls::draft::TestPatternModeColorBars },
+ { "Solid Color", controls::draft::TestPatternModeSolidColor },
+ { "Grey Color Bars", controls::draft::TestPatternModeColorBarsFadeToGray },
+ { "PN9", controls::draft::TestPatternModePn9 },
+};
+
+const std::map<std::string, int32_t> ov5670TestPatternModeMap = {
+ { "Disabled", controls::draft::TestPatternModeOff },
+ { "Vertical Color Bar Type 1", controls::draft::TestPatternModeColorBars },
+};
+
+const std::map<std::string, int32_t> ov13858TestPatternModeMap = {
+ { "Disabled", controls::draft::TestPatternModeOff },
+ { "Vertical Color Bar Type 1", controls::draft::TestPatternModeColorBars },
+ { "Vertical Color Bar Type 2", controls::draft::TestPatternModeColorBarsFadeToGray },
+};
+
/**
* \brief Sony IMX219 sensor properties
*/
-constexpr SensorInfo imx219Info = {
- .unitCellSize = { 1120, 1120 }
+const SensorInfo imx219Info = {
+ .unitCellSize = { 1120, 1120 },
+ .testPatternModeMap = imx219TestPatternModeMap,
};
/**
* \brief Omnivision ov5670 sensor properties
*/
-constexpr SensorInfo ov5670Info = {
- .unitCellSize = { 1120, 1120 }
+const SensorInfo ov5670Info = {
+ .unitCellSize = { 1120, 1120 },
+ .testPatternModeMap = ov5670TestPatternModeMap,
};
/**
* \brief Omnivision 13858 sensor properties
*/
-constexpr SensorInfo ov13858Info = {
- .unitCellSize = { 1120, 1120 }
+const SensorInfo ov13858Info = {
+ .unitCellSize = { 1120, 1120 },
+ .testPatternModeMap = ov13858TestPatternModeMap,
+
};
#define SENSOR_INFO(_sensor) \
@@ -70,7 +95,7 @@ constexpr SensorInfo ov13858Info = {
/*
* \brief The database of sensor properties
*/
-constexpr std::pair<const char *const, const SensorInfo *> sensorDatabase__[] = {
+const std::pair<const char *const, const SensorInfo *> sensorDatabase__[] = {
SENSOR_INFO(imx219),
SENSOR_INFO(ov5670),
SENSOR_INFO(ov13858),
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 | 39 ++++++++++++++++---- 2 files changed, 34 insertions(+), 7 deletions(-)