Patch Detail
Show a patch.
GET /api/1.1/patches/17927/?format=api
{ "id": 17927, "url": "https://patchwork.libcamera.org/api/1.1/patches/17927/?format=api", "web_url": "https://patchwork.libcamera.org/patch/17927/", "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": "<20221201092733.2042078-6-chenghaoyang@google.com>", "date": "2022-12-01T09:27:32", "name": "[libcamera-devel,v7,5/6] Pass StreamBuffer to Encoder::encoder", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "d690f2658593922e8f95c26f6227773d0768c054", "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/17927/mbox/", "series": [ { "id": 3652, "url": "https://patchwork.libcamera.org/api/1.1/series/3652/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3652", "date": "2022-12-01T09:27:27", "name": "Add CrOS JEA implementation", "version": 7, "mbox": "https://patchwork.libcamera.org/series/3652/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/17927/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/17927/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 43B4ABDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 1 Dec 2022 09:27:53 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 021816333E;\n\tThu, 1 Dec 2022 10:27:53 +0100 (CET)", "from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com\n\t[IPv6:2607:f8b0:4864:20::42b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D01A863336\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 1 Dec 2022 10:27:49 +0100 (CET)", "by mail-pf1-x42b.google.com with SMTP id z17so1344263pff.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 01 Dec 2022 01:27:49 -0800 (PST)", "from chenghaoyang-low.c.googlers.com.com\n\t(46.165.189.35.bc.googleusercontent.com. [35.189.165.46])\n\tby smtp.gmail.com with ESMTPSA id\n\tz9-20020a1709027e8900b00186b8752a78sm3108050pla.80.2022.12.01.01.27.46\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 01 Dec 2022 01:27:47 -0800 (PST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1669886873;\n\tbh=iplbMEuMQO3zWgqhsm6dmOUFei8hsF9XV0txEyxKm8E=;\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=1r0F0SfeXzlPUW7oprwW2D0FiY+vTFYDidk2zfg/glZC5g3LwAJSjYOfQN7IdlzDG\n\tnnYd2lFtY0RniKV5D398dp03zPTR4Yjq85y8ZeCva3o8ed6g1GTeB2JqiWLmaO9s0b\n\tpL/k8uhFPjSGwWzGdHl1EbimWSR1pCxSOyGUVf+T5Eo3aYxGSEaZ7oNzdySCdo186P\n\t0n2i0KoH3PXq2a+hapndNITFEi0l8G7xPTell95hgQ3/S8Lv3u/fG7g+ZGrhBccnQR\n\t+CHuydJ+Xj2IRuEt7lNXfDFrCcB8DnIyLHU9DpqVIqFvZ5g9pcJ4RfvfOkDk5YAeow\n\tB9AsFutwEha4w==", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=q4mGcQFCHXSpFTQW/mKzrNKX6SYNHLglksp+4sXhYVo=;\n\tb=UILyxLEt32tAD48nkJxWe+UOKlFSe4xg4MoDxxgGvzmTJtMXey2qLRaHJIrCOuGhcR\n\t5O5A/BiGvtYY36P8I7q5gmUQQTxAG5tGxoHViYw6AOCEE+VrUE4SAkbRZ7BYkBjyLOjk\n\toBykJkHFHAwBJ5+DPlfk+0GNrfIrjPZJ5J6Oc=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"UILyxLEt\"; \n\tdkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=q4mGcQFCHXSpFTQW/mKzrNKX6SYNHLglksp+4sXhYVo=;\n\tb=RS+q/rK9k+yf9YoY5xAEBJ6iOUOHlyLWVAFVS5ukdQtWvwN1nuDq13qRVA2aQOgwQ1\n\tHWLfkkpm7OX4xa8LDn9WXc4b1nlzh7Lb+WPALyu2xTp3bDMOfadWmGWOvAzx0wU1Iu/5\n\twI6S+0ob8ZK8ZpclA7RvEIj9IWApDcsyS2TT4UXZfuPdsG4Hd7IrNho1hSfMXSI0Wn01\n\tAFkDAjtLvdrIygRTcVZOOoedYmbKwVckPd6KMG/LN2VXPnUe6ZXkd2ufXlWlaRCKP+br\n\tYhtnMVTLXFOHZa4btmBik81jQiL0VIfMn1XAZU6VcBN+4wPrreREtwhpDMT6n1w8l36r\n\ttwWw==", "X-Gm-Message-State": "ANoB5pleErEZuQkQ/tWhxU+n5NPRfw1WBDpESn7ew2lv/zeIjVAmj1hW\n\tLwvP87nVpjC6wytDcyIYT1gpyfl1ZR+aI4qQ", "X-Google-Smtp-Source": "AA0mqf5NONTrG0ruo0fw6YErsI2CZZTJ3Zlmb2sw71XHgicFOewmPUySpavbkEkGFw0PNtzrtHtkOA==", "X-Received": "by 2002:a05:6a00:408b:b0:56b:ca57:ba8c with SMTP id\n\tbw11-20020a056a00408b00b0056bca57ba8cmr47103000pfb.43.1669886867979; \n\tThu, 01 Dec 2022 01:27:47 -0800 (PST)", "X-Google-Original-From": "Harvey Yang <chenghaoyang@google.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 1 Dec 2022 09:27:32 +0000", "Message-Id": "<20221201092733.2042078-6-chenghaoyang@google.com>", "X-Mailer": "git-send-email 2.38.1.584.g0f3c55d4c2-goog", "In-Reply-To": "<20221201092733.2042078-1-chenghaoyang@google.com>", "References": "<20221201092733.2042078-1-chenghaoyang@google.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v7 5/6] Pass StreamBuffer to\n\tEncoder::encoder", "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": "From: Harvey Yang <chenghaoyang@chromium.org>\n\nTo prepare for the JEA encoder in the following patches, StreamBuffer is\npassed to Encoder::encoder, which contains the original FrameBuffer and\nSpan |destination|.\n\nSigned-off-by: Harvey Yang <chenghaoyang@chromium.org>\n---\n src/android/jpeg/encoder.h | 5 +++--\n src/android/jpeg/encoder_libjpeg.cpp | 11 +++++++++++\n src/android/jpeg/encoder_libjpeg.h | 7 +++++--\n src/android/jpeg/post_processor_jpeg.cpp | 3 +--\n 4 files changed, 20 insertions(+), 6 deletions(-)", "diff": "diff --git a/src/android/jpeg/encoder.h b/src/android/jpeg/encoder.h\nindex 7dc1ee27..eeff87b1 100644\n--- a/src/android/jpeg/encoder.h\n+++ b/src/android/jpeg/encoder.h\n@@ -12,14 +12,15 @@\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(\ndiff --git a/src/android/jpeg/encoder_libjpeg.cpp b/src/android/jpeg/encoder_libjpeg.cpp\nindex cc37fde3..d8d72fbd 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@@ -192,6 +194,15 @@ 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+\treturn encode(*streamBuffer->srcBuffer,\n+\t\t streamBuffer->dstBuffer.get()->plane(0), exifData,\n+\t\t quality);\n+}\n+\n int EncoderLibJpeg::generateThumbnail(const libcamera::FrameBuffer &source,\n \t\t\t\t const libcamera::Size &targetSize,\n \t\t\t\t unsigned int quality,\ndiff --git a/src/android/jpeg/encoder_libjpeg.h b/src/android/jpeg/encoder_libjpeg.h\nindex 1ec2ba13..6e9b65d4 100644\n--- a/src/android/jpeg/encoder_libjpeg.h\n+++ b/src/android/jpeg/encoder_libjpeg.h\n@@ -24,8 +24,7 @@ public:\n \t~EncoderLibJpeg();\n \n \tint configure(const libcamera::StreamConfiguration &cfg) override;\n-\tint encode(const libcamera::FrameBuffer &source,\n-\t\t libcamera::Span<uint8_t> destination,\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@@ -44,6 +43,10 @@ private:\n \t\t\t libcamera::PixelFormat pixelFormat,\n \t\t\t libcamera::Size size);\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);\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,\ndiff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp\nindex 60eebb11..10ac4666 100644\n--- a/src/android/jpeg/post_processor_jpeg.cpp\n+++ b/src/android/jpeg/post_processor_jpeg.cpp\n@@ -146,8 +146,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);\n", "prefixes": [ "libcamera-devel", "v7", "5/6" ] }