From 4dcbac5343b00219daffcd34912a7c3da6019871 Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Mon, 17 Oct 2022 20:34:54 +0900 Subject: cam: dng_writer: Add support for 8-bit raw formats Add support for 8-bit raw formats in DNGWriter. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- src/cam/dng_writer.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src') diff --git a/src/cam/dng_writer.cpp b/src/cam/dng_writer.cpp index 6dd7d0f4..c945edce 100644 --- a/src/cam/dng_writer.cpp +++ b/src/cam/dng_writer.cpp @@ -126,6 +126,14 @@ struct Matrix3d { float m[9]; }; +void packScanlineSBGGR8(void *output, const void *input, unsigned int width) +{ + const uint8_t *in = static_cast(input); + uint8_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); @@ -274,6 +282,30 @@ void thumbScanlineIPU3([[maybe_unused]] const FormatInfo &info, void *output, } static const std::map formatInfo = { + { formats::SBGGR8, { + .bitsPerSample = 8, + .pattern = { CFAPatternBlue, CFAPatternGreen, CFAPatternGreen, CFAPatternRed }, + .packScanline = packScanlineSBGGR8, + .thumbScanline = thumbScanlineSBGGRxxP, + } }, + { formats::SGBRG8, { + .bitsPerSample = 8, + .pattern = { CFAPatternGreen, CFAPatternBlue, CFAPatternRed, CFAPatternGreen }, + .packScanline = packScanlineSBGGR8, + .thumbScanline = thumbScanlineSBGGRxxP, + } }, + { formats::SGRBG8, { + .bitsPerSample = 8, + .pattern = { CFAPatternGreen, CFAPatternRed, CFAPatternBlue, CFAPatternGreen }, + .packScanline = packScanlineSBGGR8, + .thumbScanline = thumbScanlineSBGGRxxP, + } }, + { formats::SRGGB8, { + .bitsPerSample = 8, + .pattern = { CFAPatternRed, CFAPatternGreen, CFAPatternGreen, CFAPatternBlue }, + .packScanline = packScanlineSBGGR8, + .thumbScanline = thumbScanlineSBGGRxxP, + } }, { formats::SBGGR10_CSI2P, { .bitsPerSample = 10, .pattern = { CFAPatternBlue, CFAPatternGreen, CFAPatternGreen, CFAPatternRed }, -- cgit v1.2.1