Show a patch.

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

{
    "id": 15747,
    "url": "https://patchwork.libcamera.org/api/patches/15747/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15747/",
    "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": "<20220428095544.2795980-6-chenghaoyang@chromium.org>",
    "date": "2022-04-28T09:55:43",
    "name": "[libcamera-devel,v4,5/6] Pass StreamBuffer to Encoder::encoder",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "f3952c98e064f14204b2fb79e40dec9584482645",
    "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/15747/mbox/",
    "series": [
        {
            "id": 3081,
            "url": "https://patchwork.libcamera.org/api/series/3081/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3081",
            "date": "2022-04-28T09:55:38",
            "name": "Add CrOS JEA implementation",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/3081/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15747/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15747/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 5F04EC3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 28 Apr 2022 09:56:06 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1FA3265657;\n\tThu, 28 Apr 2022 11:56:06 +0200 (CEST)",
            "from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com\n\t[IPv6:2607:f8b0:4864:20::62e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9FEB065643\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Apr 2022 11:56:03 +0200 (CEST)",
            "by mail-pl1-x62e.google.com with SMTP id n18so3900306plg.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Apr 2022 02:56:03 -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\tx6-20020a17090a46c600b001d960eaed66sm5861256pjg.42.2022.04.28.02.56.00\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 28 Apr 2022 02:56:01 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1651139766;\n\tbh=29NvjNNGYmp4T2wEstIfpQt73wZ5u1ezQfoHG255vRE=;\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=tzj3TwSVDCeZSEzCabm3mYCB5qB36zXDumapquwLZ2bOml3/CmWdUVSQ1/w5GrciA\n\tqOoScNNldkhT0nsENII3mFP8DUa47JH9SKV7VlF1vysIFkcJscNpNZcum2sY5TvLgZ\n\tsN8IUunSWzPCeL568H92ocbZdfS1g78wzf43z+LIf8RkjZN91kXmo/gyZkfGSQsExj\n\tBpPICbK4FY2q48Mjsj2IfVtyIdpRhbHvz1/UusCGhb5vrlGXf7mJsdNeJ1cDcPGxWf\n\talzdY6kIOH7kbN9BUgl6ccVScTqqr3mJvYycHQt5xghms27KPvJQF+71LxjdjEYXIf\n\ti1FJhwlhgXmpQ==",
            "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=WjtlR5sTJO49edn+9TX/1f+nmLNOmaXlAscT0oLbJpM=;\n\tb=Cjz+owoyPrF45cRDmgzlgRXv/hQDLJ9enzBKJhpnO5pMWu8ztBupwxOhtdxc6EhopV\n\tTovhu+9gDECpVlve8a1XOl5BRJTDQ90AhYcjB2s4e44lhGqZf3h/NI/05nBCF6WTRVtI\n\t8GefPFVXgzV1r7FKeE8MtLZzo7iwcMbd5iNmo="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"Cjz+owoy\"; \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=WjtlR5sTJO49edn+9TX/1f+nmLNOmaXlAscT0oLbJpM=;\n\tb=Klt4ob7w889wptCPg8jPxD6orDZ0rlmoiTrUwuI6MQaUhbgif1SL7bwX8/azoigu/p\n\tA83l58bResVJ5uvqXuqRpgrI1xG/S0QxluofxQw05a0LC/XjYavA2zQKSYnme7O0pOSL\n\tGfwSuDQtMcbu8465yVlb+jcVuiGT75TmUBBMW+RAS3z/YOZ5upl6AGEGvcPGYFGQ5BkZ\n\ts4JCKRuT3sYQuK/WwRVqBj+DS4isF4gDA9ISuwj6bgSRL0m1KOsza2VQTH6umjPSE3Kr\n\tR8SFyc3vgwikHK96/YHQ2BMW8pkHC5BlagO7Sk4Eq4JV+g8n2u6TjBF+NxHI1s8fjzxE\n\tXPvw==",
        "X-Gm-Message-State": "AOAM531Ctlzs8tArx59j/3awkPDPLZ3fyiFVuyD8/4dxcHEYqANI3q1F\n\t4IMTF9SJ1+iLlC/rx1ANkPRNw4OhgeMqO2NR",
        "X-Google-Smtp-Source": "ABdhPJzyiQJPLj4aVDXCI6iAwM7D/Jl1zCwDdfEgb8wsGYmJKu19aUxrT0bxbF5Bd1J3bTBY4iG45Q==",
        "X-Received": "by 2002:a17:902:9307:b0:154:78ba:ed40 with SMTP id\n\tbc7-20020a170902930700b0015478baed40mr33303613plb.92.1651139761860; \n\tThu, 28 Apr 2022 02:56:01 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 28 Apr 2022 09:55:43 +0000",
        "Message-Id": "<20220428095544.2795980-6-chenghaoyang@chromium.org>",
        "X-Mailer": "git-send-email 2.36.0.rc2.479.g8af0fa9b8e-goog",
        "In-Reply-To": "<20220428095544.2795980-1-chenghaoyang@chromium.org>",
        "References": "<20220428095544.2795980-1-chenghaoyang@chromium.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 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": "To 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 e76947d7..9237fa12 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 d9a20b67..2ec0a311 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@@ -189,6 +191,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(\n \t\t      const libcamera::FrameBuffer &source,\n \t\t      const libcamera::Size &targetSize,\ndiff --git a/src/android/jpeg/encoder_libjpeg.h b/src/android/jpeg/encoder_libjpeg.h\nindex 7b6131a4..5d94df3a 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@@ -38,6 +37,10 @@ private:\n \tint configureEncoder(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 332ce1ca..ed85bd48 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",
        "v4",
        "5/6"
    ]
}