[libcamera-devel] [PATCH] libcamera: imx8-isi: Enumerate supported stream formats
Jacopo Mondi
jacopo at jmondi.org
Fri Nov 18 17:40:35 CET 2022
Add to the formats map all the supported ISI video capture
stream formats.
This allows to populate the list of stream formats for all the non-RAW
use cases, as the ISI can perform colorspace conversion between YUV and
RGB.
Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
src/libcamera/pipeline/imx8-isi/imx8-isi.cpp | 62 +++++++++++++++++++-
1 file changed, 59 insertions(+), 3 deletions(-)
diff --git a/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp b/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp
index 14d699b7a42b..a3dfd3fc529c 100644
--- a/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp
+++ b/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp
@@ -188,11 +188,51 @@ const ISICameraConfiguration::FormatMap ISICameraConfiguration::formatsMap_ = {
{ MEDIA_BUS_FMT_YUV8_1X24,
MEDIA_BUS_FMT_UYVY8_1X16 },
},
+ {
+ formats::AVUY8888,
+ { MEDIA_BUS_FMT_YUV8_1X24,
+ MEDIA_BUS_FMT_UYVY8_1X16 },
+ },
+ {
+ formats::NV12,
+ { MEDIA_BUS_FMT_YUV8_1X24,
+ MEDIA_BUS_FMT_UYVY8_1X16 },
+ },
+ {
+ formats::NV16,
+ { MEDIA_BUS_FMT_YUV8_1X24,
+ MEDIA_BUS_FMT_UYVY8_1X16 },
+ },
+ {
+ formats::YUV444,
+ { MEDIA_BUS_FMT_YUV8_1X24,
+ MEDIA_BUS_FMT_UYVY8_1X16 },
+ },
{
formats::RGB565,
{ MEDIA_BUS_FMT_RGB888_1X24,
MEDIA_BUS_FMT_RGB565_1X16 },
},
+ {
+ formats::BGR888,
+ { MEDIA_BUS_FMT_RGB888_1X24,
+ MEDIA_BUS_FMT_RGB565_1X16 },
+ },
+ {
+ formats::RGB888,
+ { MEDIA_BUS_FMT_RGB888_1X24,
+ MEDIA_BUS_FMT_RGB565_1X16 },
+ },
+ {
+ formats::XRGB8888,
+ { MEDIA_BUS_FMT_RGB888_1X24,
+ MEDIA_BUS_FMT_RGB565_1X16 },
+ },
+ {
+ formats::ABGR8888,
+ { MEDIA_BUS_FMT_RGB888_1X24,
+ MEDIA_BUS_FMT_RGB565_1X16 },
+ },
{
formats::SBGGR8,
{ MEDIA_BUS_FMT_SBGGR8_1X8,
@@ -546,6 +586,7 @@ PipelineHandlerISI::generateConfiguration(Camera *camera,
return nullptr;
}
+ bool isRaw = false;
for (const auto &role : roles) {
/*
* Prefer the following formats
@@ -553,6 +594,7 @@ PipelineHandlerISI::generateConfiguration(Camera *camera,
* - ViewFinder/VideoRecording: 1080p YUYV
* - RAW: sensor's native format and resolution
*/
+ std::map<PixelFormat, std::vector<SizeRange>> streamFormats;
PixelFormat pixelFormat;
Size size;
@@ -614,6 +656,9 @@ PipelineHandlerISI::generateConfiguration(Camera *camera,
size = data->sensor_->resolution();
pixelFormat = rawPipeFormat->first;
+ streamFormats[pixelFormat] = { { kMinISISize, size } };
+ isRaw = true;
+
break;
}
@@ -622,9 +667,20 @@ PipelineHandlerISI::generateConfiguration(Camera *camera,
return nullptr;
}
- /* \todo Add all supported formats. */
- std::map<PixelFormat, std::vector<SizeRange>> streamFormats;
- streamFormats[pixelFormat] = { { kMinISISize, size } };
+ /*
+ * For non-RAW configurations the ISI can perform colorspace
+ * conversion. List all the supported output formats here.
+ */
+ if (!isRaw) {
+ for (const auto &[pixFmt, pipeFmt] : ISICameraConfiguration::formatsMap_) {
+ const PixelFormatInfo &info = PixelFormatInfo::info(pixFmt);
+ if (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW)
+ continue;
+
+ streamFormats[pixFmt] = { { kMinISISize, size } };
+ }
+ }
+
StreamFormats formats(streamFormats);
StreamConfiguration cfg(formats);
--
2.38.1
More information about the libcamera-devel
mailing list