From 54340ef70f7ece5354dd4b62cecf833da400fdd9 Mon Sep 17 00:00:00 2001 From: Naushir Patuck Date: Mon, 5 Jun 2023 09:26:04 +0100 Subject: camera_sensor: ipa: core: Add CFA pattern to IPACameraSensorInfo Add a new cfaPattern field to the IPACameraSensorInfo to pass the CFA/Bayer pattern for the current sensor configuration to the IPA. This field takes a value from properties::draft::ColorFilterArrangementEnum. Populate cfaPattern in CameraSensor::sensorInfo(), called by the pipeline handler before it calls ipa->init() and ipa->config(). Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- include/libcamera/ipa/core.mojom | 13 +++++++++++++ src/libcamera/camera_sensor.cpp | 3 +++ 2 files changed, 16 insertions(+) diff --git a/include/libcamera/ipa/core.mojom b/include/libcamera/ipa/core.mojom index 5cef340d..bce79724 100644 --- a/include/libcamera/ipa/core.mojom +++ b/include/libcamera/ipa/core.mojom @@ -140,6 +140,18 @@ module libcamera; * image sensor */ +/** + * \var IPACameraSensorInfo::cfaPattern + * \brief The arrangement of colour filters on the image sensor + * + * This takes a value defined by properties::draft::ColorFilterArrangementEnum. + * For non-Bayer colour sensors, the cfaPattern will be set to + * properties::draft::ColorFilterArrangementEnum::RGB. + * + * \todo Make this variable optional once mojom supports it, instead of using + * RGB for sensors that don't have a CFA. + */ + /** * \var IPACameraSensorInfo::activeAreaSize * \brief The size of the pixel array active area of the sensor @@ -229,6 +241,7 @@ struct IPACameraSensorInfo { string model; uint32 bitsPerPixel; + uint32 cfaPattern; Size activeAreaSize; Rectangle analogCrop; diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 06f31521..60bf87b4 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -956,6 +956,9 @@ int CameraSensor::sensorInfo(IPACameraSensorInfo *info) const info->bitsPerPixel = format.bitsPerPixel(); info->outputSize = format.size; + std::optional cfa = properties_.get(properties::draft::ColorFilterArrangement); + info->cfaPattern = cfa ? *cfa : properties::draft::RGB; + /* * Retrieve the pixel rate, line length and minimum/maximum frame * duration through V4L2 controls. Support for the V4L2_CID_PIXEL_RATE, -- cgit v1.2.1