[PATCH] apps: common: dng_writer: Support RAW16 formats

Daniel Scally dan.scally at ideasonboard.com
Thu Jun 13 17:09:49 CEST 2024


Add support for RAW16 formats to the DNGWriter helpers so that we can
produce dng files from the mali-c55.

Signed-off-by: Daniel Scally <dan.scally at ideasonboard.com>
---
 src/apps/common/dng_writer.cpp | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/src/apps/common/dng_writer.cpp b/src/apps/common/dng_writer.cpp
index 59f1fa23..150782e8 100644
--- a/src/apps/common/dng_writer.cpp
+++ b/src/apps/common/dng_writer.cpp
@@ -134,6 +134,14 @@ void packScanlineSBGGR8(void *output, const void *input, unsigned int width)
 	std::copy(in, in + width, out);
 }
 
+void packScanlineSBGGR16(void *output, const void *input, unsigned int width)
+{
+	const uint16_t *in = static_cast<const uint16_t *>(input);
+	uint16_t *out = static_cast<uint16_t *>(output);
+
+	std::copy(in, in + width, out);
+}
+
 void packScanlineSBGGR10P(void *output, const void *input, unsigned int width)
 {
 	const uint8_t *in = static_cast<const uint8_t *>(input);
@@ -307,6 +315,30 @@ static const std::map<PixelFormat, FormatInfo> formatInfo = {
 		.packScanline = packScanlineSBGGR8,
 		.thumbScanline = thumbScanlineSBGGRxxP,
 	} },
+	{ formats::SBGGR16, {
+		.bitsPerSample = 16,
+		.pattern = { CFAPatternBlue, CFAPatternGreen, CFAPatternGreen, CFAPatternRed },
+		.packScanline = packScanlineSBGGR16,
+		.thumbScanline = thumbScanlineSBGGRxxP,
+	} },
+	{ formats::SGBRG16, {
+		.bitsPerSample = 16,
+		.pattern = { CFAPatternGreen, CFAPatternBlue, CFAPatternRed, CFAPatternGreen },
+		.packScanline = packScanlineSBGGR16,
+		.thumbScanline = thumbScanlineSBGGRxxP,
+	} },
+	{ formats::SGRBG16, {
+		.bitsPerSample = 16,
+		.pattern = { CFAPatternGreen, CFAPatternRed, CFAPatternBlue, CFAPatternGreen },
+		.packScanline = packScanlineSBGGR16,
+		.thumbScanline = thumbScanlineSBGGRxxP,
+	} },
+	{ formats::SRGGB16, {
+		.bitsPerSample = 16,
+		.pattern = { CFAPatternRed, CFAPatternGreen, CFAPatternGreen, CFAPatternBlue },
+		.packScanline = packScanlineSBGGR16,
+		.thumbScanline = thumbScanlineSBGGRxxP,
+	} },
 	{ formats::SBGGR10_CSI2P, {
 		.bitsPerSample = 10,
 		.pattern = { CFAPatternBlue, CFAPatternGreen, CFAPatternGreen, CFAPatternRed },
-- 
2.30.2



More information about the libcamera-devel mailing list