From 894ca69f60435e3402de5786682d621362979171 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 6 Sep 2021 16:25:06 +0300 Subject: android: jpeg: Support multi-planar buffers The JPEG post-processor uses MappedFrameBuffer to access pixel data, but only uses data from the first plane. Pass the vector of planes to the encode() function to correctly handle multi-planar formats (currently limited to NV12). Signed-off-by: Laurent Pinchart Acked-by: Umang Jain Tested-by: Umang Jain Reviewed-by: Hirokazu Honda Reviewed-by: Kieran Bingham --- src/android/jpeg/encoder_libjpeg.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/android/jpeg/encoder_libjpeg.h') diff --git a/src/android/jpeg/encoder_libjpeg.h b/src/android/jpeg/encoder_libjpeg.h index 61fbd1a6..45ffbd7f 100644 --- a/src/android/jpeg/encoder_libjpeg.h +++ b/src/android/jpeg/encoder_libjpeg.h @@ -9,6 +9,8 @@ #include "encoder.h" +#include + #include "libcamera/internal/formats.h" #include @@ -24,14 +26,14 @@ public: libcamera::Span destination, libcamera::Span exifData, unsigned int quality) override; - int encode(libcamera::Span source, + int encode(const std::vector> &planes, libcamera::Span destination, libcamera::Span exifData, unsigned int quality); private: - void compressRGB(libcamera::Span frame); - void compressNV(libcamera::Span frame); + void compressRGB(const std::vector> &planes); + void compressNV(const std::vector> &planes); struct jpeg_compress_struct compress_; struct jpeg_error_mgr jerr_; -- cgit v1.2.1