Show a patch.

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

{
    "id": 10091,
    "url": "https://patchwork.libcamera.org/api/patches/10091/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10091/",
    "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": "<20201019080323.2236548-1-hiroh@chromium.org>",
    "date": "2020-10-19T08:03:23",
    "name": "[libcamera-devel] android: Modify PostProcessor interface",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "85fda4cca3fc4a0af284806a3803e690f781f060",
    "submitter": {
        "id": 63,
        "url": "https://patchwork.libcamera.org/api/people/63/?format=api",
        "name": "Hirokazu Honda",
        "email": "hiroh@chromium.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/10091/mbox/",
    "series": [
        {
            "id": 1382,
            "url": "https://patchwork.libcamera.org/api/series/1382/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1382",
            "date": "2020-10-19T08:03:23",
            "name": "[libcamera-devel] android: Modify PostProcessor interface",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1382/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10091/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10091/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 6BAE5BDB1F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 19 Oct 2020 08:03:38 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D87E561161;\n\tMon, 19 Oct 2020 10:03:37 +0200 (CEST)",
            "from mail-pg1-x541.google.com (mail-pg1-x541.google.com\n\t[IPv6:2607:f8b0:4864:20::541])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 986EE603AF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Oct 2020 10:03:35 +0200 (CEST)",
            "by mail-pg1-x541.google.com with SMTP id n9so5553716pgf.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Oct 2020 01:03:35 -0700 (PDT)",
            "from hiroh.tok.corp.google.com\n\t([2401:fa00:8f:2:de4a:3eff:fe7d:f78f])\n\tby smtp.gmail.com with ESMTPSA id\n\tt20sm10996135pfe.61.2020.10.19.01.03.31\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 19 Oct 2020 01:03:32 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"dulcV0z3\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; h=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=8L1ugKInDx+d87eaT2HA2bMi3sxRyIb/ajUMJu3cNcc=;\n\tb=dulcV0z3ZscV2nfM6f8onhSixUpVY6FiD07fNvA/7SG8qEEhKNQvwv6sZIQo6eo78N\n\tk/Qzu64SZpvYJF7syV3rx5SjgXI+OM8VM0b1PmvOJLFAKMKtSoaEt6Tqiv77uwkeiXx2\n\twacG8EppJP5mTGuaxDT3g9nsInT3CJ99PWF4Q=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=8L1ugKInDx+d87eaT2HA2bMi3sxRyIb/ajUMJu3cNcc=;\n\tb=Zn4t2LP4h8TV2dkJV+t2FDpEVzkGSi2T5K30PccXV1zW8MqW5uwmN2K+Yr/KsSvKYE\n\tNFTmoUVSwYULwen7lLzInXsvejZsoEOWqgMPd9+RyhRTtPCmhLXbepm6uAwtvtOMiZR1\n\tMcae95OkVEJzGhbJ7BBBTmfO+egsz/wW6/997OVgTB/tvY+E343Mwtj9jJL9qBNCqYCm\n\tvmyqY7J1hmu3hcZ0jey1ydbQ+8xQdMJPZsAbNMfyzboiRzxIonrnlXrYC6zFt9lIuBAq\n\tv860ioqjaKKEI7jiMGyDA2lep9ahWRAakmK0ckjmj6lb2Q9itiezW8MbX6P/YRAHGp7N\n\tMqUg==",
        "X-Gm-Message-State": "AOAM5323MHuB+yBPQmp+CKjBhrqaxhjIKwSR+h3r3LANiWwQ8WkL89sH\n\t1MBWntLIC63mALZW0CGeHFR+nQK2dZaQSA==",
        "X-Google-Smtp-Source": "ABdhPJx8zaY5pn3HwoP85BMkBXBtanSkn8O6mKJ4wPGZLqBPd0pzvu7PCgjhfnlcLPSwn9Mytwicnw==",
        "X-Received": "by 2002:a63:5a11:: with SMTP id\n\to17mr12694785pgb.287.1603094613431; \n\tMon, 19 Oct 2020 01:03:33 -0700 (PDT)",
        "From": "Hirokazu Honda <hiroh@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 19 Oct 2020 17:03:23 +0900",
        "Message-Id": "<20201019080323.2236548-1-hiroh@chromium.org>",
        "X-Mailer": "git-send-email 2.29.0.rc1.297.gfa9743e501-goog",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH] android: Modify PostProcessor interface",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "This modifies PostProcessor interface and polishes the code\naround the PostProcessor.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/android/camera_stream.cpp            | 9 ++++-----\n src/android/camera_stream.h              | 8 ++++----\n src/android/jpeg/encoder.h               | 6 +++---\n src/android/jpeg/encoder_libjpeg.cpp     | 6 +++---\n src/android/jpeg/encoder_libjpeg.h       | 4 ++--\n src/android/jpeg/post_processor_jpeg.cpp | 8 +++++---\n src/android/jpeg/post_processor_jpeg.h   | 6 +++---\n src/android/post_processor.h             | 4 ++--\n 8 files changed, 26 insertions(+), 25 deletions(-)",
    "diff": "diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\nindex 1b8afa8..cc8691d 100644\n--- a/src/android/camera_stream.cpp\n+++ b/src/android/camera_stream.cpp\n@@ -40,11 +40,10 @@ LOG_DECLARE_CATEGORY(HAL);\n \n CameraStream::CameraStream(CameraDevice *cameraDevice, Type type,\n \t\t\t   camera3_stream_t *camera3Stream, unsigned int index)\n-\t: cameraDevice_(cameraDevice), type_(type),\n+\t: cameraDevice_(cameraDevice),\n+\t  config_(cameraDevice_->cameraConfiguration()), type_(type),\n \t  camera3Stream_(camera3Stream), index_(index)\n {\n-\tconfig_ = cameraDevice_->cameraConfiguration();\n-\n \tif (type_ == Type::Internal || type_ == Type::Mapped) {\n \t\t/*\n \t\t * \\todo There might be multiple post-processors. The logic\n@@ -52,7 +51,7 @@ CameraStream::CameraStream(CameraDevice *cameraDevice, Type type,\n \t\t * future. For now, we only have PostProcessorJpeg and that\n \t\t * is what we instantiate here.\n \t\t */\n-\t\tpostProcessor_ = std::make_unique<PostProcessorJpeg>(cameraDevice_);\n+\t\tpostProcessor_ = std::make_unique<PostProcessorJpeg>(cameraDevice);\n \t}\n \n \tif (type == Type::Internal) {\n@@ -102,7 +101,7 @@ int CameraStream::process(const libcamera::FrameBuffer &source,\n \tif (!postProcessor_)\n \t\treturn 0;\n \n-\treturn postProcessor_->process(&source, dest->maps()[0], metadata);\n+\treturn postProcessor_->process(source, dest->maps()[0], metadata);\n }\n \n FrameBuffer *CameraStream::getBuffer()\ndiff --git a/src/android/camera_stream.h b/src/android/camera_stream.h\nindex c367a5f..24e66bb 100644\n--- a/src/android/camera_stream.h\n+++ b/src/android/camera_stream.h\n@@ -124,11 +124,11 @@ public:\n \tvoid putBuffer(libcamera::FrameBuffer *buffer);\n \n private:\n-\tCameraDevice *cameraDevice_;\n-\tlibcamera::CameraConfiguration *config_;\n-\tType type_;\n+\tCameraDevice const *cameraDevice_;\n+\tconst libcamera::CameraConfiguration *config_;\n+\tconst Type type_;\n \tcamera3_stream_t *camera3Stream_;\n-\tunsigned int index_;\n+\tconst unsigned int index_;\n \n \tstd::unique_ptr<libcamera::FrameBufferAllocator> allocator_;\n \tstd::vector<libcamera::FrameBuffer *> buffers_;\ndiff --git a/src/android/jpeg/encoder.h b/src/android/jpeg/encoder.h\nindex 4483153..270ea60 100644\n--- a/src/android/jpeg/encoder.h\n+++ b/src/android/jpeg/encoder.h\n@@ -14,11 +14,11 @@\n class Encoder\n {\n public:\n-\tvirtual ~Encoder() {};\n+\tvirtual ~Encoder() {}\n \n \tvirtual int configure(const libcamera::StreamConfiguration &cfg) = 0;\n-\tvirtual int encode(const libcamera::FrameBuffer *source,\n-\t\t\t   const libcamera::Span<uint8_t> &destination,\n+\tvirtual int encode(const libcamera::FrameBuffer &source,\n+\t\t\t   libcamera::Span<uint8_t> destination,\n \t\t\t   const libcamera::Span<const uint8_t> &exifData) = 0;\n };\n \ndiff --git a/src/android/jpeg/encoder_libjpeg.cpp b/src/android/jpeg/encoder_libjpeg.cpp\nindex 8995ba5..4236c9d 100644\n--- a/src/android/jpeg/encoder_libjpeg.cpp\n+++ b/src/android/jpeg/encoder_libjpeg.cpp\n@@ -179,11 +179,11 @@ void EncoderLibJpeg::compressNV(const libcamera::MappedBuffer *frame)\n \t}\n }\n \n-int EncoderLibJpeg::encode(const FrameBuffer *source,\n-\t\t\t   const libcamera::Span<uint8_t> &dest,\n+int EncoderLibJpeg::encode(const FrameBuffer &source,\n+\t\t\t   libcamera::Span<uint8_t> dest,\n \t\t\t   const libcamera::Span<const uint8_t> &exifData)\n {\n-\tMappedFrameBuffer frame(source, PROT_READ);\n+\tMappedFrameBuffer frame(&source, PROT_READ);\n \tif (!frame.isValid()) {\n \t\tLOG(JPEG, Error) << \"Failed to map FrameBuffer : \"\n \t\t\t\t << strerror(frame.error());\ndiff --git a/src/android/jpeg/encoder_libjpeg.h b/src/android/jpeg/encoder_libjpeg.h\nindex 934caef..391a53c 100644\n--- a/src/android/jpeg/encoder_libjpeg.h\n+++ b/src/android/jpeg/encoder_libjpeg.h\n@@ -21,8 +21,8 @@ public:\n \t~EncoderLibJpeg();\n \n \tint configure(const libcamera::StreamConfiguration &cfg) override;\n-\tint encode(const libcamera::FrameBuffer *source,\n-\t\t   const libcamera::Span<uint8_t> &destination,\n+\tint encode(const libcamera::FrameBuffer &source,\n+\t\t   libcamera::Span<uint8_t> destination,\n \t\t   const libcamera::Span<const uint8_t> &exifData) override;\n \n private:\ndiff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp\nindex 753c28e..4ded3e3 100644\n--- a/src/android/jpeg/post_processor_jpeg.cpp\n+++ b/src/android/jpeg/post_processor_jpeg.cpp\n@@ -44,8 +44,8 @@ int PostProcessorJpeg::configure(const StreamConfiguration &inCfg,\n \treturn encoder_->configure(inCfg);\n }\n \n-int PostProcessorJpeg::process(const libcamera::FrameBuffer *source,\n-\t\t\t       const libcamera::Span<uint8_t> &destination,\n+int PostProcessorJpeg::process(const libcamera::FrameBuffer &source,\n+\t\t\t       libcamera::Span<uint8_t> destination,\n \t\t\t       CameraMetadata *metadata)\n {\n \tif (!encoder_)\n@@ -64,8 +64,10 @@ int PostProcessorJpeg::process(const libcamera::FrameBuffer *source,\n \t * second, it is good enough.\n \t */\n \texif.setTimestamp(std::time(nullptr));\n-\tif (exif.generate() != 0)\n+\tif (exif.generate() != 0) {\n \t\tLOG(JPEG, Error) << \"Failed to generate valid EXIF data\";\n+\t\treturn -EINVAL;\n+\t}\n \n \tint jpeg_size = encoder_->encode(source, destination, exif.data());\n \tif (jpeg_size < 0) {\ndiff --git a/src/android/jpeg/post_processor_jpeg.h b/src/android/jpeg/post_processor_jpeg.h\nindex 62c8650..4d8edf5 100644\n--- a/src/android/jpeg/post_processor_jpeg.h\n+++ b/src/android/jpeg/post_processor_jpeg.h\n@@ -23,12 +23,12 @@ public:\n \n \tint configure(const libcamera::StreamConfiguration &incfg,\n \t\t      const libcamera::StreamConfiguration &outcfg) override;\n-\tint process(const libcamera::FrameBuffer *source,\n-\t\t    const libcamera::Span<uint8_t> &destination,\n+\tint process(const libcamera::FrameBuffer &source,\n+\t\t    libcamera::Span<uint8_t> destination,\n \t\t    CameraMetadata *metadata) override;\n \n private:\n-\tCameraDevice *cameraDevice_;\n+\tCameraDevice const *cameraDevice_;\n \tstd::unique_ptr<Encoder> encoder_;\n \tlibcamera::Size streamSize_;\n };\ndiff --git a/src/android/post_processor.h b/src/android/post_processor.h\nindex a891c43..5f87a5d 100644\n--- a/src/android/post_processor.h\n+++ b/src/android/post_processor.h\n@@ -20,8 +20,8 @@ public:\n \n \tvirtual int configure(const libcamera::StreamConfiguration &inCfg,\n \t\t\t      const libcamera::StreamConfiguration &outCfg) = 0;\n-\tvirtual int process(const libcamera::FrameBuffer *source,\n-\t\t\t    const libcamera::Span<uint8_t> &destination,\n+\tvirtual int process(const libcamera::FrameBuffer &source,\n+\t\t\t    libcamera::Span<uint8_t> destination,\n \t\t\t    CameraMetadata *metadata) = 0;\n };\n \n",
    "prefixes": [
        "libcamera-devel"
    ]
}