Show a patch.

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

{
    "id": 13517,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/13517/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/13517/",
    "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": "<20210826213016.1829504-3-umang.jain@ideasonboard.com>",
    "date": "2021-08-26T21:30:13",
    "name": "[libcamera-devel,RFC,2/5] android: camera_stream: Pass FrameBuffer pointer instead of reference",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "7f3562a2149e6616e09afef5afdce85932a941f8",
    "submitter": {
        "id": 86,
        "url": "https://patchwork.libcamera.org/api/1.1/people/86/?format=api",
        "name": "Umang Jain",
        "email": "umang.jain@ideasonboard.com"
    },
    "delegate": {
        "id": 12,
        "url": "https://patchwork.libcamera.org/api/1.1/users/12/?format=api",
        "username": "uajain",
        "first_name": "Umang",
        "last_name": "Jain",
        "email": "umang.jain@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/13517/mbox/",
    "series": [
        {
            "id": 2401,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2401/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2401",
            "date": "2021-08-26T21:30:11",
            "name": "android: Async post-processing",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2401/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/13517/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/13517/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 CC5E7BD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 Aug 2021 21:30:32 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8347468932;\n\tThu, 26 Aug 2021 23:30:32 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 43F6B6893C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Aug 2021 23:30:30 +0200 (CEST)",
            "from perceval.ideasonboard.com (unknown [103.251.226.246])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4CDE51924;\n\tThu, 26 Aug 2021 23:30:29 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"H0pr7Phj\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1630013430;\n\tbh=zSSi/qzqcSSLZaa7u1Ebf/V66KKjje2PliCj7Jnvjdo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=H0pr7PhjomyUqRj4e8ay6wVBLkhMEbI+dkl+Lhk/gCtdF8DPDeZDZhrOCB9wv+rui\n\tg/1c5J6VHOg/Yr5cigES599dfk5VS/AFfppXCBVwHZcUPdSoCBLSHsXLcslv838UlS\n\tkq2QilNfPYRscfHVaccYPppM0Bx4x10GJOZkxWmM=",
        "From": "Umang Jain <umang.jain@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 27 Aug 2021 03:00:13 +0530",
        "Message-Id": "<20210826213016.1829504-3-umang.jain@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.31.1",
        "In-Reply-To": "<20210826213016.1829504-1-umang.jain@ideasonboard.com>",
        "References": "<20210826213016.1829504-1-umang.jain@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [RFC PATCH 2/5] android: camera_stream: Pass\n\tFrameBuffer pointer instead of reference",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Pass the libcamera::FrameBuffer pointer to the post-processor instead\nof passing it by reference. Passing by reference is fine as long as\nthe post processing is done synchronously.\n\nHowever in subsequent commits, the post processing is planned to be\nmoved to a separate thread. This will conflict as the reference\nargument (in current case 'source') is copied when we will try to\ninvoke a method on the post-processor using Object::invokeMethod().\nThe cause of conflict is the LIBCAMERA_DISABLE_COPY_AND_MOVE rule\napplied on the FrameBuffer class.\n\nTo resolve the conflict, pass in the FrameBuffer pointer instead of\nreference. This requires changes to the existing PostProcessor interface\nand all its implemented classes.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/android/camera_device.cpp            |  2 +-\n src/android/camera_stream.cpp            |  2 +-\n src/android/camera_stream.h              |  2 +-\n src/android/jpeg/encoder.h               |  2 +-\n src/android/jpeg/encoder_libjpeg.cpp     |  4 ++--\n src/android/jpeg/encoder_libjpeg.h       |  2 +-\n src/android/jpeg/post_processor_jpeg.cpp |  4 ++--\n src/android/jpeg/post_processor_jpeg.h   |  4 ++--\n src/android/jpeg/thumbnailer.cpp         |  4 ++--\n src/android/jpeg/thumbnailer.h           |  2 +-\n src/android/post_processor.h             |  2 +-\n src/android/yuv/post_processor_yuv.cpp   | 18 +++++++++---------\n src/android/yuv/post_processor_yuv.h     |  4 ++--\n 13 files changed, 26 insertions(+), 26 deletions(-)",
    "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex a69b687a..fea59ce6 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -1149,7 +1149,7 @@ void CameraDevice::requestComplete(Request *request)\n \t\t\tcontinue;\n \t\t}\n \n-\t\tint ret = cameraStream->process(*src, *buffer.buffer,\n+\t\tint ret = cameraStream->process(src, *buffer.buffer,\n \t\t\t\t\t\tdescriptor.settings_,\n \t\t\t\t\t\tresultMetadata.get());\n \t\t/*\ndiff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\nindex 61b44183..59b1df6e 100644\n--- a/src/android/camera_stream.cpp\n+++ b/src/android/camera_stream.cpp\n@@ -98,7 +98,7 @@ int CameraStream::configure()\n \treturn 0;\n }\n \n-int CameraStream::process(const libcamera::FrameBuffer &source,\n+int CameraStream::process(const libcamera::FrameBuffer *source,\n \t\t\t  buffer_handle_t camera3Dest,\n \t\t\t  const CameraMetadata &requestMetadata,\n \t\t\t  CameraMetadata *resultMetadata)\ndiff --git a/src/android/camera_stream.h b/src/android/camera_stream.h\nindex 2dab6c3a..5c232cb6 100644\n--- a/src/android/camera_stream.h\n+++ b/src/android/camera_stream.h\n@@ -118,7 +118,7 @@ public:\n \tlibcamera::Stream *stream() const;\n \n \tint configure();\n-\tint process(const libcamera::FrameBuffer &source,\n+\tint process(const libcamera::FrameBuffer *source,\n \t\t    buffer_handle_t camera3Dest,\n \t\t    const CameraMetadata &requestMetadata,\n \t\t    CameraMetadata *resultMetadata);\ndiff --git a/src/android/jpeg/encoder.h b/src/android/jpeg/encoder.h\nindex a28522f4..7b6140e7 100644\n--- a/src/android/jpeg/encoder.h\n+++ b/src/android/jpeg/encoder.h\n@@ -18,7 +18,7 @@ public:\n \tvirtual ~Encoder() = default;\n \n \tvirtual int configure(const libcamera::StreamConfiguration &cfg) = 0;\n-\tvirtual int encode(const libcamera::FrameBuffer &source,\n+\tvirtual int encode(const libcamera::FrameBuffer *source,\n \t\t\t   libcamera::Span<uint8_t> destination,\n \t\t\t   libcamera::Span<const uint8_t> exifData,\n \t\t\t   unsigned int quality) = 0;\ndiff --git a/src/android/jpeg/encoder_libjpeg.cpp b/src/android/jpeg/encoder_libjpeg.cpp\nindex a7a63601..1c5ec592 100644\n--- a/src/android/jpeg/encoder_libjpeg.cpp\n+++ b/src/android/jpeg/encoder_libjpeg.cpp\n@@ -178,10 +178,10 @@ void EncoderLibJpeg::compressNV(Span<const uint8_t> frame)\n \t}\n }\n \n-int EncoderLibJpeg::encode(const FrameBuffer &source, Span<uint8_t> dest,\n+int EncoderLibJpeg::encode(const FrameBuffer *source, Span<uint8_t> dest,\n \t\t\t   Span<const uint8_t> exifData, unsigned int quality)\n {\n-\tMappedFrameBuffer frame(&source, MappedFrameBuffer::MapFlag::Read);\n+\tMappedFrameBuffer frame(source, MappedFrameBuffer::MapFlag::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 61fbd1a6..92e57b75 100644\n--- a/src/android/jpeg/encoder_libjpeg.h\n+++ b/src/android/jpeg/encoder_libjpeg.h\n@@ -20,7 +20,7 @@ public:\n \t~EncoderLibJpeg();\n \n \tint configure(const libcamera::StreamConfiguration &cfg) override;\n-\tint encode(const libcamera::FrameBuffer &source,\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;\ndiff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp\nindex 3160a784..723e8d18 100644\n--- a/src/android/jpeg/post_processor_jpeg.cpp\n+++ b/src/android/jpeg/post_processor_jpeg.cpp\n@@ -50,7 +50,7 @@ int PostProcessorJpeg::configure(const StreamConfiguration &inCfg,\n \treturn encoder_->configure(inCfg);\n }\n \n-void PostProcessorJpeg::generateThumbnail(const FrameBuffer &source,\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@@ -82,7 +82,7 @@ void PostProcessorJpeg::generateThumbnail(const FrameBuffer &source,\n \t}\n }\n \n-int PostProcessorJpeg::process(const FrameBuffer &source,\n+int PostProcessorJpeg::process(const FrameBuffer *source,\n \t\t\t       CameraBuffer *destination,\n \t\t\t       const CameraMetadata &requestMetadata,\n \t\t\t       CameraMetadata *resultMetadata)\ndiff --git a/src/android/jpeg/post_processor_jpeg.h b/src/android/jpeg/post_processor_jpeg.h\nindex 6fd31022..c4b2e9ef 100644\n--- a/src/android/jpeg/post_processor_jpeg.h\n+++ b/src/android/jpeg/post_processor_jpeg.h\n@@ -22,13 +22,13 @@ 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+\tint process(const libcamera::FrameBuffer *source,\n \t\t    CameraBuffer *destination,\n \t\t    const CameraMetadata &requestMetadata,\n \t\t    CameraMetadata *resultMetadata) override;\n \n private:\n-\tvoid generateThumbnail(const libcamera::FrameBuffer &source,\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);\ndiff --git a/src/android/jpeg/thumbnailer.cpp b/src/android/jpeg/thumbnailer.cpp\nindex 79d83926..46575e4e 100644\n--- a/src/android/jpeg/thumbnailer.cpp\n+++ b/src/android/jpeg/thumbnailer.cpp\n@@ -37,11 +37,11 @@ void Thumbnailer::configure(const Size &sourceSize, PixelFormat pixelFormat)\n \tvalid_ = true;\n }\n \n-void Thumbnailer::createThumbnail(const FrameBuffer &source,\n+void Thumbnailer::createThumbnail(const FrameBuffer *source,\n \t\t\t\t  const Size &targetSize,\n \t\t\t\t  std::vector<unsigned char> *destination)\n {\n-\tMappedFrameBuffer frame(&source, MappedFrameBuffer::MapFlag::Read);\n+\tMappedFrameBuffer frame(source, MappedFrameBuffer::MapFlag::Read);\n \tif (!frame.isValid()) {\n \t\tLOG(Thumbnailer, Error)\n \t\t\t<< \"Failed to map FrameBuffer : \"\ndiff --git a/src/android/jpeg/thumbnailer.h b/src/android/jpeg/thumbnailer.h\nindex 4d086c49..0f3caf40 100644\n--- a/src/android/jpeg/thumbnailer.h\n+++ b/src/android/jpeg/thumbnailer.h\n@@ -19,7 +19,7 @@ public:\n \n \tvoid configure(const libcamera::Size &sourceSize,\n \t\t       libcamera::PixelFormat pixelFormat);\n-\tvoid createThumbnail(const libcamera::FrameBuffer &source,\n+\tvoid createThumbnail(const libcamera::FrameBuffer *source,\n \t\t\t     const libcamera::Size &targetSize,\n \t\t\t     std::vector<unsigned char> *dest);\n \tconst libcamera::PixelFormat &pixelFormat() const { return pixelFormat_; }\ndiff --git a/src/android/post_processor.h b/src/android/post_processor.h\nindex b2b5bd55..5b8f1ab8 100644\n--- a/src/android/post_processor.h\n+++ b/src/android/post_processor.h\n@@ -23,7 +23,7 @@ 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+\tvirtual int process(const libcamera::FrameBuffer *source,\n \t\t\t    CameraBuffer *destination,\n \t\t\t    const CameraMetadata &requestMetadata,\n \t\t\t    CameraMetadata *resultMetadata) = 0;\ndiff --git a/src/android/yuv/post_processor_yuv.cpp b/src/android/yuv/post_processor_yuv.cpp\nindex 3e793a58..4b507d33 100644\n--- a/src/android/yuv/post_processor_yuv.cpp\n+++ b/src/android/yuv/post_processor_yuv.cpp\n@@ -49,7 +49,7 @@ int PostProcessorYuv::configure(const StreamConfiguration &inCfg,\n \treturn 0;\n }\n \n-int PostProcessorYuv::process(const FrameBuffer &source,\n+int PostProcessorYuv::process(const FrameBuffer *source,\n \t\t\t      CameraBuffer *destination,\n \t\t\t      [[maybe_unused]] const CameraMetadata &requestMetadata,\n \t\t\t      [[maybe_unused]] CameraMetadata *metadata)\n@@ -57,7 +57,7 @@ int PostProcessorYuv::process(const FrameBuffer &source,\n \tif (!isValidBuffers(source, *destination))\n \t\treturn -EINVAL;\n \n-\tconst MappedFrameBuffer sourceMapped(&source, MappedFrameBuffer::MapFlag::Read);\n+\tconst MappedFrameBuffer sourceMapped(source, MappedFrameBuffer::MapFlag::Read);\n \tif (!sourceMapped.isValid()) {\n \t\tLOG(YUV, Error) << \"Failed to mmap camera frame buffer\";\n \t\treturn -EINVAL;\n@@ -83,12 +83,12 @@ int PostProcessorYuv::process(const FrameBuffer &source,\n \treturn 0;\n }\n \n-bool PostProcessorYuv::isValidBuffers(const FrameBuffer &source,\n+bool PostProcessorYuv::isValidBuffers(const FrameBuffer *source,\n \t\t\t\t      const CameraBuffer &destination) const\n {\n-\tif (source.planes().size() != 2) {\n+\tif (source->planes().size() != 2) {\n \t\tLOG(YUV, Error) << \"Invalid number of source planes: \"\n-\t\t\t\t<< source.planes().size();\n+\t\t\t\t<< source->planes().size();\n \t\treturn false;\n \t}\n \tif (destination.numPlanes() != 2) {\n@@ -97,12 +97,12 @@ bool PostProcessorYuv::isValidBuffers(const FrameBuffer &source,\n \t\treturn false;\n \t}\n \n-\tif (source.planes()[0].length < sourceLength_[0] ||\n-\t    source.planes()[1].length < sourceLength_[1]) {\n+\tif (source->planes()[0].length < sourceLength_[0] ||\n+\t    source->planes()[1].length < sourceLength_[1]) {\n \t\tLOG(YUV, Error)\n \t\t\t<< \"The source planes lengths are too small, actual size: {\"\n-\t\t\t<< source.planes()[0].length << \", \"\n-\t\t\t<< source.planes()[1].length\n+\t\t\t<< source->planes()[0].length << \", \"\n+\t\t\t<< source->planes()[1].length\n \t\t\t<< \"}, expected size: {\"\n \t\t\t<< sourceLength_[0] << \", \"\n \t\t\t<< sourceLength_[1] << \"}\";\ndiff --git a/src/android/yuv/post_processor_yuv.h b/src/android/yuv/post_processor_yuv.h\nindex f8b1ba23..44a04113 100644\n--- a/src/android/yuv/post_processor_yuv.h\n+++ b/src/android/yuv/post_processor_yuv.h\n@@ -20,13 +20,13 @@ 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+\tint process(const libcamera::FrameBuffer *source,\n \t\t    CameraBuffer *destination,\n \t\t    const CameraMetadata &requestMetadata,\n \t\t    CameraMetadata *metadata) override;\n \n private:\n-\tbool isValidBuffers(const libcamera::FrameBuffer &source,\n+\tbool isValidBuffers(const libcamera::FrameBuffer *source,\n \t\t\t    const CameraBuffer &destination) const;\n \tvoid calculateLengths(const libcamera::StreamConfiguration &inCfg,\n \t\t\t      const libcamera::StreamConfiguration &outCfg);\n",
    "prefixes": [
        "libcamera-devel",
        "RFC",
        "2/5"
    ]
}