Patch Detail
Show a patch.
GET /api/1.1/patches/15716/?format=api
{ "id": 15716, "url": "https://patchwork.libcamera.org/api/1.1/patches/15716/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15716/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220426090029.1350103-4-chenghaoyang@chromium.org>", "date": "2022-04-26T09:00:28", "name": "[libcamera-devel,v2,3/4] Rework JPEG encoder API and update PostProcessorJpeg and EncoderLibJpeg", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "28013381f8dacf2b7f96dfbc8b1fc8b6e197415c", "submitter": { "id": 117, "url": "https://patchwork.libcamera.org/api/1.1/people/117/?format=api", "name": "Cheng-Hao Yang", "email": "chenghaoyang@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/15716/mbox/", "series": [ { "id": 3070, "url": "https://patchwork.libcamera.org/api/1.1/series/3070/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3070", "date": "2022-04-26T09:00:25", "name": "Add CrOS JEA implementation", "version": 2, "mbox": "https://patchwork.libcamera.org/series/3070/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15716/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15716/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 1877CC3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Apr 2022 09:01:21 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B698265650;\n\tTue, 26 Apr 2022 11:01:20 +0200 (CEST)", "from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com\n\t[IPv6:2607:f8b0:4864:20::62c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 87B336564D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Apr 2022 11:01:19 +0200 (CEST)", "by mail-pl1-x62c.google.com with SMTP id n18so29638431plg.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Apr 2022 02:01:19 -0700 (PDT)", "from chenghaoyang.c.googlers.com.com\n\t(93.135.240.35.bc.googleusercontent.com. [35.240.135.93])\n\tby smtp.gmail.com with ESMTPSA id\n\tc18-20020a056a000ad200b004cdccd3da08sm15449379pfl.44.2022.04.26.02.01.16\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 26 Apr 2022 02:01:17 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1650963680;\n\tbh=85v4ddmkw5CsLQrMwp41bYY0QRSC/UPx+xtv8L59H9U=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=YFjMH1TyHtRPtTBsO4S7qWVCz7uT6ec6G7QEJ+FQYD/w+6M6I4VgQj+3SEGo4Z9lQ\n\tBLH4mInxOjM41m0vHq9QLYNVkYgj4w0N7FRVn3j7C3flGsQroTiFsVA2THYuK6He0E\n\tO6uo1trbRDELzdLbco/8eVDpB2Ei+HGsliMpPxoP+16O8VrDna/B107sfZJJ4+WlVn\n\tY1lo9jBV1bZuuuvI+DBdfLwH4C8OSI4FR7AmjQxNvLqgDq0sZeovkKdiipe8iUzvX6\n\trCmFjC5qsHmULtMRePeqgc09x5KUUiq+2tVM6r+6NWFNXf8pihDWScSGyDhoZV/aIY\n\tGal35oEGnHT3w==", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=JWPwtnCSDf/GMocsIOhTk+B2KQEvYtvW++ofo5vlZ6g=;\n\tb=h67FdW3SItd8LedG01ZtW1MRzF6QxW3V8rAQfTOxzta6Y1jN3XQci62hllOhAhES3o\n\tc5CUN6n7+KihCEqcU4g/cvoyGNe66qBPDYhP95hQKHcmCcBzEwTsIayPlEbquYwHFwnV\n\txJDcXL++isod6e9ZDMI4e8v+8zoUVbW4TYRKI=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"h67FdW3S\"; \n\tdkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=JWPwtnCSDf/GMocsIOhTk+B2KQEvYtvW++ofo5vlZ6g=;\n\tb=rZ7aiw4lfxMfzMhAsfpzBODB6r9pr9Qp1nbwD0pTR7UurIr9BRXa5NvAOfWpFCPajo\n\tVR2IquIUOBeDbAMjFi/hzUtBGMiS3UfaKCrzahOQXCzniMO6Sa+C2LNgHyztq39oNmeK\n\t13VxZF+lAoGKZwjfzbPW6D6UYx9fK3CsSUpq9oynHxJHFqa4n8ZoKUDETJpm4Y5jpIgF\n\tFk+aw95n4CjhX8ZuDwos5c3nj59rLVYs6VBiYNZi6Y0g0RQBFWcdBAajMJ+uUPo7KZau\n\tEV//6QfYJobZar5EaG4yfvWC4TBdeIIGqov9ix06JfvmZkwwlM/xFAT6F3M6JJfQxgYg\n\t6t/A==", "X-Gm-Message-State": "AOAM533fXNaXHo2lxcvxAvYKjdSoOatSS+qL6zq+11m8ulQmHbOkctrc\n\ta0eYIZvVpue5du5NTZxI/1aFNJ+ktGtThGCR", "X-Google-Smtp-Source": "ABdhPJwTDkHKnjOrJF9reOs0RxqTRkySpZd0uZZGCW5Z+F0wZMznhnEvqGczK2U2EsAP29kE4a58uw==", "X-Received": "by 2002:a17:90a:5882:b0:1d9:7f80:de79 with SMTP id\n\tj2-20020a17090a588200b001d97f80de79mr9173288pji.231.1650963677629; \n\tTue, 26 Apr 2022 02:01:17 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 26 Apr 2022 09:00:28 +0000", "Message-Id": "<20220426090029.1350103-4-chenghaoyang@chromium.org>", "X-Mailer": "git-send-email 2.36.0.rc2.479.g8af0fa9b8e-goog", "In-Reply-To": "<20220426090029.1350103-1-chenghaoyang@chromium.org>", "References": "<20220426090029.1350103-1-chenghaoyang@chromium.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 3/4] Rework JPEG encoder API and update\n\tPostProcessorJpeg and EncoderLibJpeg", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "From": "Harvey Yang via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Harvey Yang <chenghaoyang@chromium.org>", "Cc": "Harvey Yang <chenghaoyang@chromium.org>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "To add JEA in the next CL, this CL reworks JPEG encoder API and move\nthumbnail encoding code into EncoderLibJpeg's implementation, as JEA\nsupports that as well.\n---\n src/android/jpeg/encoder.h | 9 ++-\n src/android/jpeg/encoder_libjpeg.cpp | 70 +++++++++++++++++++\n src/android/jpeg/encoder_libjpeg.h | 21 +++++-\n .../jpeg/generic_post_processor_jpeg.cpp | 14 ++++\n src/android/jpeg/meson.build | 9 +++\n src/android/jpeg/post_processor_jpeg.cpp | 60 ++--------------\n src/android/jpeg/post_processor_jpeg.h | 11 +--\n src/android/meson.build | 5 +-\n 8 files changed, 128 insertions(+), 71 deletions(-)\n create mode 100644 src/android/jpeg/generic_post_processor_jpeg.cpp\n create mode 100644 src/android/jpeg/meson.build", "diff": "diff --git a/src/android/jpeg/encoder.h b/src/android/jpeg/encoder.h\nindex b974d367..6d527d91 100644\n--- a/src/android/jpeg/encoder.h\n+++ b/src/android/jpeg/encoder.h\n@@ -12,14 +12,19 @@\n #include <libcamera/framebuffer.h>\n #include <libcamera/stream.h>\n \n+#include \"../camera_request.h\"\n+\n class Encoder\n {\n public:\n \tvirtual ~Encoder() = default;\n \n \tvirtual int configure(const libcamera::StreamConfiguration &cfg) = 0;\n-\tvirtual int encode(const libcamera::FrameBuffer &source,\n-\t\t\t libcamera::Span<uint8_t> destination,\n+\tvirtual int encode(Camera3RequestDescriptor::StreamBuffer *streamBuffer,\n \t\t\t libcamera::Span<const uint8_t> exifData,\n \t\t\t unsigned int quality) = 0;\n+\tvirtual int generateThumbnail(const libcamera::FrameBuffer &source,\n+\t\t\t\t const libcamera::Size &targetSize,\n+\t\t\t\t unsigned int quality,\n+\t\t\t\t std::vector<unsigned char> *thumbnail) = 0;\n };\ndiff --git a/src/android/jpeg/encoder_libjpeg.cpp b/src/android/jpeg/encoder_libjpeg.cpp\nindex 21a3b33d..b5591e33 100644\n--- a/src/android/jpeg/encoder_libjpeg.cpp\n+++ b/src/android/jpeg/encoder_libjpeg.cpp\n@@ -24,6 +24,8 @@\n #include \"libcamera/internal/formats.h\"\n #include \"libcamera/internal/mapped_framebuffer.h\"\n \n+#include \"../camera_buffer.h\"\n+\n using namespace libcamera;\n \n LOG_DECLARE_CATEGORY(JPEG)\n@@ -82,8 +84,17 @@ EncoderLibJpeg::~EncoderLibJpeg()\n }\n \n int EncoderLibJpeg::configure(const StreamConfiguration &cfg)\n+{\n+\tthumbnailer_.configure(cfg.size, cfg.pixelFormat);\n+\tcfg_ = cfg;\n+\n+\treturn internalConfigure(cfg);\n+}\n+\n+int EncoderLibJpeg::internalConfigure(const StreamConfiguration &cfg)\n {\n \tconst struct JPEGPixelFormatInfo info = findPixelInfo(cfg.pixelFormat);\n+\n \tif (info.colorSpace == JCS_UNKNOWN)\n \t\treturn -ENOTSUP;\n \n@@ -178,6 +189,65 @@ void EncoderLibJpeg::compressNV(const std::vector<Span<uint8_t>> &planes)\n \t}\n }\n \n+int EncoderLibJpeg::encode(Camera3RequestDescriptor::StreamBuffer *streamBuffer,\n+\t\t\t libcamera::Span<const uint8_t> exifData,\n+\t\t\t unsigned int quality)\n+{\n+\tinternalConfigure(cfg_);\n+\treturn encode(*streamBuffer->srcBuffer, streamBuffer->dstBuffer.get()->plane(0), exifData, quality);\n+}\n+\n+int EncoderLibJpeg::generateThumbnail(\n+\tconst libcamera::FrameBuffer &source,\n+\tconst libcamera::Size &targetSize,\n+\tunsigned int quality,\n+\tstd::vector<unsigned char> *thumbnail)\n+{\n+\t/* Stores the raw scaled-down thumbnail bytes. */\n+\tstd::vector<unsigned char> rawThumbnail;\n+\n+\tthumbnailer_.createThumbnail(source, targetSize, &rawThumbnail);\n+\n+\tStreamConfiguration thCfg;\n+\tthCfg.size = targetSize;\n+\tthCfg.pixelFormat = thumbnailer_.pixelFormat();\n+\tint ret = internalConfigure(thCfg);\n+\n+\tif (!rawThumbnail.empty() && !ret) {\n+\t\t/*\n+\t\t * \\todo Avoid value-initialization of all elements of the\n+\t\t * vector.\n+\t\t */\n+\t\tthumbnail->resize(rawThumbnail.size());\n+\n+\t\t/*\n+\t\t * Split planes manually as the encoder expects a vector of\n+\t\t * planes.\n+\t\t *\n+\t\t * \\todo Pass a vector of planes directly to\n+\t\t * Thumbnailer::createThumbnailer above and remove the manual\n+\t\t * planes split from here.\n+\t\t */\n+\t\tstd::vector<Span<uint8_t>> thumbnailPlanes;\n+\t\tconst PixelFormatInfo &formatNV12 = PixelFormatInfo::info(formats::NV12);\n+\t\tsize_t yPlaneSize = formatNV12.planeSize(targetSize, 0);\n+\t\tsize_t uvPlaneSize = formatNV12.planeSize(targetSize, 1);\n+\t\tthumbnailPlanes.push_back({ rawThumbnail.data(), yPlaneSize });\n+\t\tthumbnailPlanes.push_back({ rawThumbnail.data() + yPlaneSize, uvPlaneSize });\n+\n+\t\tint jpeg_size = encode(thumbnailPlanes, *thumbnail, {}, quality);\n+\t\tthumbnail->resize(jpeg_size);\n+\n+\t\tLOG(JPEG, Debug)\n+\t\t\t<< \"Thumbnail compress returned \"\n+\t\t\t<< jpeg_size << \" bytes\";\n+\n+\t\treturn jpeg_size;\n+\t}\n+\n+\treturn -1;\n+}\n+\n int EncoderLibJpeg::encode(const FrameBuffer &source, Span<uint8_t> dest,\n \t\t\t Span<const uint8_t> exifData, unsigned int quality)\n {\ndiff --git a/src/android/jpeg/encoder_libjpeg.h b/src/android/jpeg/encoder_libjpeg.h\nindex 1b3ac067..56b27bae 100644\n--- a/src/android/jpeg/encoder_libjpeg.h\n+++ b/src/android/jpeg/encoder_libjpeg.h\n@@ -15,6 +15,8 @@\n \n #include <jpeglib.h>\n \n+#include \"thumbnailer.h\"\n+\n class EncoderLibJpeg : public Encoder\n {\n public:\n@@ -22,19 +24,32 @@ public:\n \t~EncoderLibJpeg();\n \n \tint configure(const libcamera::StreamConfiguration &cfg) override;\n+\tint encode(Camera3RequestDescriptor::StreamBuffer *streamBuffer,\n+\t\t libcamera::Span<const uint8_t> exifData,\n+\t\t unsigned int quality) override;\n+\tint generateThumbnail(\n+\t\tconst libcamera::FrameBuffer &source,\n+\t\tconst libcamera::Size &targetSize,\n+\t\tunsigned int quality,\n+\t\tstd::vector<unsigned char> *thumbnail) override;\n+\n+private:\n+\tint internalConfigure(const libcamera::StreamConfiguration &cfg);\n+\n \tint encode(const libcamera::FrameBuffer &source,\n \t\t libcamera::Span<uint8_t> destination,\n \t\t libcamera::Span<const uint8_t> exifData,\n-\t\t unsigned int quality) override;\n+\t\t unsigned int quality);\n \tint encode(const std::vector<libcamera::Span<uint8_t>> &planes,\n \t\t libcamera::Span<uint8_t> destination,\n \t\t libcamera::Span<const uint8_t> exifData,\n \t\t unsigned int quality);\n \n-private:\n \tvoid compressRGB(const std::vector<libcamera::Span<uint8_t>> &planes);\n \tvoid compressNV(const std::vector<libcamera::Span<uint8_t>> &planes);\n \n+\tlibcamera::StreamConfiguration cfg_;\n+\n \tstruct jpeg_compress_struct compress_;\n \tstruct jpeg_error_mgr jerr_;\n \n@@ -42,4 +57,6 @@ private:\n \n \tbool nv_;\n \tbool nvSwap_;\n+\n+\tThumbnailer thumbnailer_;\n };\ndiff --git a/src/android/jpeg/generic_post_processor_jpeg.cpp b/src/android/jpeg/generic_post_processor_jpeg.cpp\nnew file mode 100644\nindex 00000000..890f6972\n--- /dev/null\n+++ b/src/android/jpeg/generic_post_processor_jpeg.cpp\n@@ -0,0 +1,14 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2022, Google Inc.\n+ *\n+ * generic_post_processor_jpeg.cpp - Generic JPEG Post Processor\n+ */\n+\n+#include \"encoder_libjpeg.h\"\n+#include \"post_processor_jpeg.h\"\n+\n+void PostProcessorJpeg::SetEncoder()\n+{\n+\tencoder_ = std::make_unique<EncoderLibJpeg>();\n+}\ndiff --git a/src/android/jpeg/meson.build b/src/android/jpeg/meson.build\nnew file mode 100644\nindex 00000000..94522dc0\n--- /dev/null\n+++ b/src/android/jpeg/meson.build\n@@ -0,0 +1,9 @@\n+# SPDX-License-Identifier: CC0-1.0\n+\n+android_hal_sources += files([\n+ 'exif.cpp',\n+ 'post_processor_jpeg.cpp'])\n+\n+android_hal_sources += files(['encoder_libjpeg.cpp',\n+ 'generic_post_processor_jpeg.cpp',\n+ 'thumbnailer.cpp'])\ndiff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp\nindex d72ebc3c..7ceba60e 100644\n--- a/src/android/jpeg/post_processor_jpeg.cpp\n+++ b/src/android/jpeg/post_processor_jpeg.cpp\n@@ -9,10 +9,10 @@\n \n #include <chrono>\n \n+#include \"../android_framebuffer.h\"\n #include \"../camera_device.h\"\n #include \"../camera_metadata.h\"\n #include \"../camera_request.h\"\n-#include \"encoder_libjpeg.h\"\n #include \"exif.h\"\n \n #include <libcamera/base/log.h>\n@@ -44,60 +44,11 @@ int PostProcessorJpeg::configure(const StreamConfiguration &inCfg,\n \n \tstreamSize_ = outCfg.size;\n \n-\tthumbnailer_.configure(inCfg.size, inCfg.pixelFormat);\n-\n-\tencoder_ = std::make_unique<EncoderLibJpeg>();\n+\tSetEncoder();\n \n \treturn encoder_->configure(inCfg);\n }\n \n-void PostProcessorJpeg::generateThumbnail(const FrameBuffer &source,\n-\t\t\t\t\t const Size &targetSize,\n-\t\t\t\t\t unsigned int quality,\n-\t\t\t\t\t std::vector<unsigned char> *thumbnail)\n-{\n-\t/* Stores the raw scaled-down thumbnail bytes. */\n-\tstd::vector<unsigned char> rawThumbnail;\n-\n-\tthumbnailer_.createThumbnail(source, targetSize, &rawThumbnail);\n-\n-\tStreamConfiguration thCfg;\n-\tthCfg.size = targetSize;\n-\tthCfg.pixelFormat = thumbnailer_.pixelFormat();\n-\tint ret = thumbnailEncoder_.configure(thCfg);\n-\n-\tif (!rawThumbnail.empty() && !ret) {\n-\t\t/*\n-\t\t * \\todo Avoid value-initialization of all elements of the\n-\t\t * vector.\n-\t\t */\n-\t\tthumbnail->resize(rawThumbnail.size());\n-\n-\t\t/*\n-\t\t * Split planes manually as the encoder expects a vector of\n-\t\t * planes.\n-\t\t *\n-\t\t * \\todo Pass a vector of planes directly to\n-\t\t * Thumbnailer::createThumbnailer above and remove the manual\n-\t\t * planes split from here.\n-\t\t */\n-\t\tstd::vector<Span<uint8_t>> thumbnailPlanes;\n-\t\tconst PixelFormatInfo &formatNV12 = PixelFormatInfo::info(formats::NV12);\n-\t\tsize_t yPlaneSize = formatNV12.planeSize(targetSize, 0);\n-\t\tsize_t uvPlaneSize = formatNV12.planeSize(targetSize, 1);\n-\t\tthumbnailPlanes.push_back({ rawThumbnail.data(), yPlaneSize });\n-\t\tthumbnailPlanes.push_back({ rawThumbnail.data() + yPlaneSize, uvPlaneSize });\n-\n-\t\tint jpeg_size = thumbnailEncoder_.encode(thumbnailPlanes,\n-\t\t\t\t\t\t\t *thumbnail, {}, quality);\n-\t\tthumbnail->resize(jpeg_size);\n-\n-\t\tLOG(JPEG, Debug)\n-\t\t\t<< \"Thumbnail compress returned \"\n-\t\t\t<< jpeg_size << \" bytes\";\n-\t}\n-}\n-\n void PostProcessorJpeg::process(Camera3RequestDescriptor::StreamBuffer *streamBuffer)\n {\n \tASSERT(encoder_);\n@@ -164,8 +115,8 @@ void PostProcessorJpeg::process(Camera3RequestDescriptor::StreamBuffer *streamBu\n \n \t\tif (thumbnailSize != Size(0, 0)) {\n \t\t\tstd::vector<unsigned char> thumbnail;\n-\t\t\tgenerateThumbnail(source, thumbnailSize, quality, &thumbnail);\n-\t\t\tif (!thumbnail.empty())\n+\t\t\tret = encoder_->generateThumbnail(source, thumbnailSize, quality, &thumbnail);\n+\t\t\tif (ret > 0 && !thumbnail.empty())\n \t\t\t\texif.setThumbnail(thumbnail, Exif::Compression::JPEG);\n \t\t}\n \n@@ -194,8 +145,7 @@ void PostProcessorJpeg::process(Camera3RequestDescriptor::StreamBuffer *streamBu\n \tconst uint8_t quality = ret ? *entry.data.u8 : 95;\n \tresultMetadata->addEntry(ANDROID_JPEG_QUALITY, quality);\n \n-\tint jpeg_size = encoder_->encode(source, destination->plane(0),\n-\t\t\t\t\t exif.data(), quality);\n+\tint jpeg_size = encoder_->encode(streamBuffer, exif.data(), quality);\n \tif (jpeg_size < 0) {\n \t\tLOG(JPEG, Error) << \"Failed to encode stream image\";\n \t\tprocessComplete.emit(streamBuffer, PostProcessor::Status::Error);\ndiff --git a/src/android/jpeg/post_processor_jpeg.h b/src/android/jpeg/post_processor_jpeg.h\nindex 98309b01..a09f8798 100644\n--- a/src/android/jpeg/post_processor_jpeg.h\n+++ b/src/android/jpeg/post_processor_jpeg.h\n@@ -8,11 +8,11 @@\n #pragma once\n \n #include \"../post_processor.h\"\n-#include \"encoder_libjpeg.h\"\n-#include \"thumbnailer.h\"\n \n #include <libcamera/geometry.h>\n \n+#include \"encoder.h\"\n+\n class CameraDevice;\n \n class PostProcessorJpeg : public PostProcessor\n@@ -25,14 +25,9 @@ public:\n \tvoid process(Camera3RequestDescriptor::StreamBuffer *streamBuffer) override;\n \n private:\n-\tvoid generateThumbnail(const libcamera::FrameBuffer &source,\n-\t\t\t const libcamera::Size &targetSize,\n-\t\t\t unsigned int quality,\n-\t\t\t std::vector<unsigned char> *thumbnail);\n+\tvoid SetEncoder();\n \n \tCameraDevice *const cameraDevice_;\n \tstd::unique_ptr<Encoder> encoder_;\n \tlibcamera::Size streamSize_;\n-\tEncoderLibJpeg thumbnailEncoder_;\n-\tThumbnailer thumbnailer_;\n };\ndiff --git a/src/android/meson.build b/src/android/meson.build\nindex 27be27bb..026b8b3c 100644\n--- a/src/android/meson.build\n+++ b/src/android/meson.build\n@@ -48,10 +48,6 @@ android_hal_sources = files([\n 'camera_ops.cpp',\n 'camera_request.cpp',\n 'camera_stream.cpp',\n- 'jpeg/encoder_libjpeg.cpp',\n- 'jpeg/exif.cpp',\n- 'jpeg/post_processor_jpeg.cpp',\n- 'jpeg/thumbnailer.cpp',\n 'yuv/post_processor_yuv.cpp'\n ])\n \n@@ -59,6 +55,7 @@ android_cpp_args = []\n \n subdir('cros')\n subdir('mm')\n+subdir('jpeg')\n \n android_camera_metadata_sources = files([\n 'metadata/camera_metadata.c',\n", "prefixes": [ "libcamera-devel", "v2", "3/4" ] }