Message ID | 20221017171741.3803909-4-paul.elder@ideasonboard.com |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Hi Paul, Thank you for the patch. On Tue, Oct 18, 2022 at 02:17:41AM +0900, Paul Elder via libcamera-devel wrote: > Add support for 8-bit raw formats in DNGWriter. > > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> > --- > src/cam/dng_writer.cpp | 33 +++++++++++++++++++++++++++++++++ > 1 file changed, 33 insertions(+) > > diff --git a/src/cam/dng_writer.cpp b/src/cam/dng_writer.cpp > index 6dd7d0f4..47ebe033 100644 > --- a/src/cam/dng_writer.cpp > +++ b/src/cam/dng_writer.cpp > @@ -126,6 +126,15 @@ struct Matrix3d { > float m[9]; > }; > > +void packScanlineSBGGR8(void *output, const void *input, unsigned int width) > +{ > + const uint8_t *in = static_cast<const uint8_t *>(input); > + uint8_t *out = static_cast<uint8_t *>(output); > + > + for (unsigned int i = 0; i < width; i++) > + out[i] = in[i]; std::copy(in, in + width, out); or memcpy(). Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > +} > + > void packScanlineSBGGR10P(void *output, const void *input, unsigned int width) > { > const uint8_t *in = static_cast<const uint8_t *>(input); > @@ -274,6 +283,30 @@ void thumbScanlineIPU3([[maybe_unused]] const FormatInfo &info, void *output, > } > > static const std::map<PixelFormat, FormatInfo> 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 },
diff --git a/src/cam/dng_writer.cpp b/src/cam/dng_writer.cpp index 6dd7d0f4..47ebe033 100644 --- a/src/cam/dng_writer.cpp +++ b/src/cam/dng_writer.cpp @@ -126,6 +126,15 @@ struct Matrix3d { float m[9]; }; +void packScanlineSBGGR8(void *output, const void *input, unsigned int width) +{ + const uint8_t *in = static_cast<const uint8_t *>(input); + uint8_t *out = static_cast<uint8_t *>(output); + + for (unsigned int i = 0; i < width; i++) + out[i] = in[i]; +} + void packScanlineSBGGR10P(void *output, const void *input, unsigned int width) { const uint8_t *in = static_cast<const uint8_t *>(input); @@ -274,6 +283,30 @@ void thumbScanlineIPU3([[maybe_unused]] const FormatInfo &info, void *output, } static const std::map<PixelFormat, FormatInfo> 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 },
Add support for 8-bit raw formats in DNGWriter. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> --- src/cam/dng_writer.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)