From 5155150bbfd8a76fcc4dab5b7a9a88b614767bc6 Mon Sep 17 00:00:00 2001 From: Daniel Scally Date: Thu, 13 Jun 2024 16:09:49 +0100 Subject: apps: common: dng_writer: Support RAW16 formats 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 Reviewed-by: Laurent Pinchart Reviewed-by: Stefan Klug Signed-off-by: Laurent Pinchart --- 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 123f18a0..d37b0d62 100644 --- a/src/apps/common/dng_writer.cpp +++ b/src/apps/common/dng_writer.cpp @@ -136,6 +136,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(input); + uint16_t *out = static_cast(output); + + std::copy(in, in + width, out); +} + void packScanlineSBGGR10P(void *output, const void *input, unsigned int width) { const uint8_t *in = static_cast(input); @@ -309,6 +317,30 @@ const std::map 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 }, -- cgit v1.2.1