summaryrefslogtreecommitdiff
path: root/src/android/jpeg/encoder_libjpeg.h
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-09-06 16:25:06 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-09-07 19:18:37 +0300
commit894ca69f60435e3402de5786682d621362979171 (patch)
treecc4f97a6d9df60fb079534f7dc9f3cd83668c73b /src/android/jpeg/encoder_libjpeg.h
parent2dca2b2fc6af4cee79a16b466a3cc1b92c3d036f (diff)
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 <laurent.pinchart@ideasonboard.com> Acked-by: Umang Jain <umang.jain@ideasonboard.com> Tested-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/android/jpeg/encoder_libjpeg.h')
-rw-r--r--src/android/jpeg/encoder_libjpeg.h8
1 files changed, 5 insertions, 3 deletions
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 <vector>
+
#include "libcamera/internal/formats.h"
#include <jpeglib.h>
@@ -24,14 +26,14 @@ public:
libcamera::Span<uint8_t> destination,
libcamera::Span<const uint8_t> exifData,
unsigned int quality) override;
- int encode(libcamera::Span<const uint8_t> source,
+ int encode(const std::vector<libcamera::Span<uint8_t>> &planes,
libcamera::Span<uint8_t> destination,
libcamera::Span<const uint8_t> exifData,
unsigned int quality);
private:
- void compressRGB(libcamera::Span<const uint8_t> frame);
- void compressNV(libcamera::Span<const uint8_t> frame);
+ void compressRGB(const std::vector<libcamera::Span<uint8_t>> &planes);
+ void compressNV(const std::vector<libcamera::Span<uint8_t>> &planes);
struct jpeg_compress_struct compress_;
struct jpeg_error_mgr jerr_;