Show a patch.

GET /api/patches/18007/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 18007,
    "url": "https://patchwork.libcamera.org/api/patches/18007/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18007/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20221214093330.3345421-7-chenghaoyang@google.com>",
    "date": "2022-12-14T09:33:29",
    "name": "[libcamera-devel,v8,6/7] Pass StreamBuffer to Encoder::encoder",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "5bf5c9453169afb8f4a0248edc555ebcd0f72aad",
    "submitter": {
        "id": 117,
        "url": "https://patchwork.libcamera.org/api/people/117/?format=api",
        "name": "Cheng-Hao Yang",
        "email": "chenghaoyang@chromium.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18007/mbox/",
    "series": [
        {
            "id": 3671,
            "url": "https://patchwork.libcamera.org/api/series/3671/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3671",
            "date": "2022-12-14T09:33:23",
            "name": "Add CrOS JEA implementation",
            "version": 8,
            "mbox": "https://patchwork.libcamera.org/series/3671/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18007/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18007/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 326FABDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 14 Dec 2022 09:33:46 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D7D976336F;\n\tWed, 14 Dec 2022 10:33:45 +0100 (CET)",
            "from mail-pf1-x431.google.com (mail-pf1-x431.google.com\n\t[IPv6:2607:f8b0:4864:20::431])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7C1D563354\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 14 Dec 2022 10:33:43 +0100 (CET)",
            "by mail-pf1-x431.google.com with SMTP id c13so4034127pfp.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 14 Dec 2022 01:33:43 -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\td206-20020a621dd7000000b0056bc742d21esm9331190pfd.176.2022.12.14.01.33.40\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 14 Dec 2022 01:33:41 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1671010425;\n\tbh=ErYqdVqhpoIWvbfYMXa+CbV5cQYoYhOzBhpewCex/m4=;\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=NHqDZskY12GUYOoR4P+uPUkJt7/G9bXosX3LDtCd/QKCu7wfJkBdrqs7zQv1t9GYo\n\tT72Hv33exRrY7NMUmFuHruRV/MWqA1WC70999/FGHh393C/gCKO0loxfbjzDCMFRs+\n\tK1XU8fgMrfFw+ucIaBzBVZV8GLE1NFk9TVzwHWNm0NLKg3KTN0n6m/Zbp5OpTK9CYq\n\tVoMUWIO3gnvkl6PZlYleF9eHRMXLmVZLYMDORRi8iCI/xCxBMFXYTSFfYL04+MduLT\n\tgbcHSo7rvXj3N/qf7gZB2o8V/eVakV/yU0cR/KwG5j4Xpl8ak+Ylh+auEg1mJy06CF\n\t8zL1FvFdF+SpA==",
            "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=CIUd5dIW+pI9vncdTZ/Ndg5zNWGbOMPW6DkXVoCZ9fs=;\n\tb=P22vYc12tNyzMa96G5KqFVK0/9aShLHGaN77uir3sUDemS86T9PQ+DYHweZrxz4tW+\n\tnWLS9uZ1oYOc5bspRitbFCmAZ0ukMf4OgZgzPFpIh9jmvniCK3oz+MZZ71PERDgTAvR/\n\tck6t0NNzpe+aNqb0Ldf9htH3AZ71I3Eyb+uto="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"P22vYc12\"; \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=CIUd5dIW+pI9vncdTZ/Ndg5zNWGbOMPW6DkXVoCZ9fs=;\n\tb=T536iwseWzRoWArKImAzeMmYfCAUdwGcDPz5xYYKYT8we4aC34a8MVzzXyPEs6/zoL\n\tQtFjXv37nlTZdUjU0kzGZz66LECCKOk/jPS2BUjFbXy5fPPNsPcapLS5sdFwE5oW2WDZ\n\ttFH8bpCmOxX9yT2w9EP7FbDPN7XQvCmBtm2WrnvTeUoQa/vcFJi1M1cHPEyJgEm4HhUb\n\tsWBBMTlwUiwsnOJIivbeR27+6xabgSML0qIioboZyN9hi9qUdzoOUMrnIwKg7NUYIrvM\n\tCvwyJTo3Al1ubxceXU0rdU78voHcGsEtZEcMajmsW2CZfYiSqLcpHAjQhB4TrQ0z19J7\n\t8TIA==",
        "X-Gm-Message-State": "ANoB5pnowwa3xT5dFAWxNzu2vCY4sT7ln4LuA9EIdJxszYiUIHbpxLjE\n\tK95zVKjfn8akxELaBke9JWdL3OeshHirrxYV",
        "X-Google-Smtp-Source": "AA0mqf77AKt91V2l9Qmt+86ma6CxOW6asst5g2GS2besj7UoMmt7N1AG99x25J9MY3932apqJ1us5g==",
        "X-Received": "by 2002:aa7:8e4c:0:b0:56b:7b9f:5cb6 with SMTP id\n\td12-20020aa78e4c000000b0056b7b9f5cb6mr24251268pfr.19.1671010421924; \n\tWed, 14 Dec 2022 01:33:41 -0800 (PST)",
        "X-Google-Original-From": "Harvey Yang <chenghaoyang@google.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 14 Dec 2022 09:33:29 +0000",
        "Message-Id": "<20221214093330.3345421-7-chenghaoyang@google.com>",
        "X-Mailer": "git-send-email 2.39.0.rc1.256.g54fd8350bd-goog",
        "In-Reply-To": "<20221214093330.3345421-1-chenghaoyang@google.com>",
        "References": "<20221214093330.3345421-1-chenghaoyang@google.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v8 6/7] 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>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Han-Lin Chen <hanlinchen@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       |  3 +--\n src/android/jpeg/post_processor_jpeg.cpp |  3 +--\n 4 files changed, 12 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/src/android/jpeg/encoder.h b/src/android/jpeg/encoder.h\nindex 5f9ef890..14b1ab45 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 void generateThumbnail(const libcamera::FrameBuffer &source,\ndiff --git a/src/android/jpeg/encoder_libjpeg.cpp b/src/android/jpeg/encoder_libjpeg.cpp\nindex cc5f37be..8bbba6e0 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@@ -187,17 +189,18 @@ void EncoderLibJpeg::Encoder::compressNV(const std::vector<Span<uint8_t>> &plane\n \t}\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+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-\tMappedFrameBuffer frame(&source, MappedFrameBuffer::MapFlag::Read);\n+\tMappedFrameBuffer frame(streamBuffer->srcBuffer, MappedFrameBuffer::MapFlag::Read);\n \tif (!frame.isValid()) {\n \t\tLOG(JPEG, Error) << \"Failed to map FrameBuffer : \"\n \t\t\t\t << strerror(frame.error());\n \t\treturn frame.error();\n \t}\n \n-\treturn captureEncoder_.encode(frame.planes(), dest, exifData, quality);\n+\treturn captureEncoder_.encode(frame.planes(), streamBuffer->dstBuffer->plane(0), exifData, quality);\n }\n \n void EncoderLibJpeg::generateThumbnail(const libcamera::FrameBuffer &source,\ndiff --git a/src/android/jpeg/encoder_libjpeg.h b/src/android/jpeg/encoder_libjpeg.h\nindex fa077b8d..f4bf99ba 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 \tvoid generateThumbnail(const libcamera::FrameBuffer &source,\ndiff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp\nindex 69b18a2e..918ab492 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",
        "v8",
        "6/7"
    ]
}