Show a patch.

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

{
    "id": 18771,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/18771/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18771/",
    "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": "<20230630120303.33023-3-umang.jain@ideasonboard.com>",
    "date": "2023-06-30T12:03:00",
    "name": "[libcamera-devel,RFC,2/5] ipa: rpi: Make parsePdafData() available in the CamHelper class",
    "commit_ref": null,
    "pull_url": null,
    "state": "deferred",
    "archived": false,
    "hash": "273ad2a6b317c950d8fd473711701e65179de716",
    "submitter": {
        "id": 86,
        "url": "https://patchwork.libcamera.org/api/1.1/people/86/?format=api",
        "name": "Umang Jain",
        "email": "umang.jain@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18771/mbox/",
    "series": [
        {
            "id": 3945,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3945/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3945",
            "date": "2023-06-30T12:02:58",
            "name": "ipa: rpi: CamHelper improvements",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3945/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18771/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18771/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 4B95ABE175\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 30 Jun 2023 12:03:14 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0F294628C5;\n\tFri, 30 Jun 2023 14:03:13 +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 00DEB628BE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 30 Jun 2023 14:03:09 +0200 (CEST)",
            "from umang.jainideasonboard.com.praguecc.cz (unknown\n\t[193.85.242.128])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 79CF4DE2;\n\tFri, 30 Jun 2023 14:02:27 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1688126593;\n\tbh=vQpye2Y9OwiLOppoOXQEwyz1zqAHufpJ5KTWofakVN0=;\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:\n\tFrom;\n\tb=p5AsvjIPFEAoXECJLb0ySAof9lUp0rLi4ySAB/6PZQR6ovNUj1qCw18SyEHjuVrz+\n\tqc+NZjanE+rvv5ZiwlfZO3fteQSxmjecawj6A5Uc/CmA8iwr+y2QKAaaNtM5dVd1op\n\tjsHsHYauYzoUI3Z7O531c3l0pPKIEfv17XuPQimznL8Qa7l/oE8p2qe7nUoWtozOlm\n\tOySbWiGa7eiW3/eRZ/NJfQs3xA8GLh7v7HMpUZHujdSgHzvQ89nXpwm17R+TtVEROr\n\tXZla3Ovz42dwoHb3VixCU2Wy8Gemx6h8QVq0nMlny7JfhFc03Ni8+h46JZTR0zIQnv\n\tIp8jstAPQ9gMw==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1688126547;\n\tbh=vQpye2Y9OwiLOppoOXQEwyz1zqAHufpJ5KTWofakVN0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Go/HsFXz31Z5mrr/cXLPGh/0JQIVRX8TGE2Xb+t8o9T1P+/W6mCF/DUjuBgxtyrVc\n\tsHu9WmoLb9XLhK9PVQ/hPSbVuOaKG1h2VahwMLn9u2Oyq4HaBjkI97PAYMEkpHcscN\n\tVhcFKhCFX92eBqmpmBZeL33iAbeHlfmadWtWVZD0="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Go/HsFXz\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 30 Jun 2023 14:03:00 +0200",
        "Message-Id": "<20230630120303.33023-3-umang.jain@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.39.1",
        "In-Reply-To": "<20230630120303.33023-1-umang.jain@ideasonboard.com>",
        "References": "<20230630120303.33023-1-umang.jain@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [RFC PATCH 2/5] ipa: rpi: Make parsePdafData()\n\tavailable in the CamHelper class",
        "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": "Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Umang Jain <umang.jain@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "parsePdafData() parses the PDAF section of the sensor's embedded data\nand the parsing logic is generic to all PDAF-supported sensors.\nOnce the PDAF-specific buffer section is identified correctly, any\nsensor should be able to use this helper in order parse its PDAF data.\n\nNo functional changes intended in this patch.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/ipa/rpi/cam_helper/cam_helper.cpp        | 29 +++++++++++++++\n src/ipa/rpi/cam_helper/cam_helper.h          |  6 ++++\n src/ipa/rpi/cam_helper/cam_helper_imx708.cpp | 37 --------------------\n 3 files changed, 35 insertions(+), 37 deletions(-)",
    "diff": "diff --git a/src/ipa/rpi/cam_helper/cam_helper.cpp b/src/ipa/rpi/cam_helper/cam_helper.cpp\nindex ddd5e9a4..e9e0c496 100644\n--- a/src/ipa/rpi/cam_helper/cam_helper.cpp\n+++ b/src/ipa/rpi/cam_helper/cam_helper.cpp\n@@ -253,6 +253,35 @@ void CamHelper::parseEmbeddedData(Span<const uint8_t> buffer,\n \tmetadata.set(\"device.status\", deviceStatus);\n }\n \n+bool CamHelper::parsePdafData(Span<const uint8_t> &data, unsigned bpp, PdafRegions &pdaf)\n+{\n+\tconst uint8_t *ptr = data.data();\n+\tunsigned int len = data.size();\n+\tsize_t step = bpp >> 1; /* bytes per PDAF grid entry */\n+\n+\tif (bpp < 10 || bpp > 12 || len < 194 * step || ptr[0] != 0 || ptr[1] >= 0x40) {\n+\t\tLOG(IPARPI, Error) << \"PDAF data in unsupported format\";\n+\t\treturn false;\n+\t}\n+\n+\tpdaf.init({ pdafStatsCols, pdafStatsRows });\n+\n+\tptr += 2 * step;\n+\tfor (unsigned i = 0; i < pdafStatsRows; ++i) {\n+\t\tfor (unsigned j = 0; j < pdafStatsCols; ++j) {\n+\t\t\tunsigned c = (ptr[0] << 3) | (ptr[1] >> 5);\n+\t\t\tint p = (((ptr[1] & 0x0f) - (ptr[1] & 0x10)) << 6) | (ptr[2] >> 2);\n+\t\t\tPdafData pdafData;\n+\t\t\tpdafData.conf = c;\n+\t\t\tpdafData.phase = c ? p : 0;\n+\t\t\tpdaf.set(libcamera::Point(j, i), { pdafData, 1, 0 });\n+\t\t\tptr += step;\n+\t\t}\n+\t}\n+\n+\treturn true;\n+}\n+\n void CamHelper::populateMetadata([[maybe_unused]] const MdParser::RegisterMap &registers,\n \t\t\t\t [[maybe_unused]] Metadata &metadata) const\n {\ndiff --git a/src/ipa/rpi/cam_helper/cam_helper.h b/src/ipa/rpi/cam_helper/cam_helper.h\nindex 58a4b202..705796a2 100644\n--- a/src/ipa/rpi/cam_helper/cam_helper.h\n+++ b/src/ipa/rpi/cam_helper/cam_helper.h\n@@ -16,6 +16,7 @@\n #include \"controller/camera_mode.h\"\n #include \"controller/controller.h\"\n #include \"controller/metadata.h\"\n+#include \"controller/pdaf_data.h\"\n #include \"md_parser.h\"\n \n #include \"libcamera/internal/v4l2_videodevice.h\"\n@@ -101,11 +102,16 @@ public:\n \tvirtual unsigned int mistrustFramesModeSwitch() const;\n \n protected:\n+\tstatic bool parsePdafData(libcamera::Span<const uint8_t> &pdafData, unsigned bpp,\n+\t\t\t\t  PdafRegions &pdaf);\n \tvoid parseEmbeddedData(libcamera::Span<const uint8_t> buffer,\n \t\t\t       Metadata &metadata);\n \tvirtual void populateMetadata(const MdParser::RegisterMap &registers,\n \t\t\t\t      Metadata &metadata) const;\n \n+\tstatic constexpr int pdafStatsRows = 12;\n+\tstatic constexpr int pdafStatsCols = 16;\n+\n \tstd::unique_ptr<MdParser> parser_;\n \tCameraMode mode_;\n \ndiff --git a/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp b/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp\nindex b24ee643..d0382d63 100644\n--- a/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp\n+++ b/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp\n@@ -12,8 +12,6 @@\n \n #include <libcamera/base/log.h>\n \n-#include \"controller/pdaf_data.h\"\n-\n #include \"cam_helper.h\"\n #include \"md_parser.h\"\n \n@@ -72,15 +70,9 @@ private:\n \t/* Largest long exposure scale factor given as a left shift on the frame length. */\n \tstatic constexpr int longExposureShiftMax = 7;\n \n-\tstatic constexpr int pdafStatsRows = 12;\n-\tstatic constexpr int pdafStatsCols = 16;\n-\n \tvoid populateMetadata(const MdParser::RegisterMap &registers,\n \t\t\t      Metadata &metadata) const override;\n \n-\tstatic bool parsePdafData(libcamera::Span<const uint8_t> &pdafData, unsigned bpp,\n-\t\t\t\t  PdafRegions &pdaf);\n-\n \tbool parseAEHist(const uint8_t *ptr, size_t len, unsigned bpp);\n \tvoid putAGCStatistics(StatisticsPtr stats);\n \n@@ -243,35 +235,6 @@ void CamHelperImx708::populateMetadata(const MdParser::RegisterMap &registers,\n \tmetadata.set(\"device.status\", deviceStatus);\n }\n \n-bool CamHelperImx708::parsePdafData(Span<const uint8_t> &data, unsigned bpp, PdafRegions &pdaf)\n-{\n-\tconst uint8_t *ptr = data.data();\n-\tunsigned int len = data.size();\n-\tsize_t step = bpp >> 1; /* bytes per PDAF grid entry */\n-\n-\tif (bpp < 10 || bpp > 12 || len < 194 * step || ptr[0] != 0 || ptr[1] >= 0x40) {\n-\t\tLOG(IPARPI, Error) << \"PDAF data in unsupported format\";\n-\t\treturn false;\n-\t}\n-\n-\tpdaf.init({ pdafStatsCols, pdafStatsRows });\n-\n-\tptr += 2 * step;\n-\tfor (unsigned i = 0; i < pdafStatsRows; ++i) {\n-\t\tfor (unsigned j = 0; j < pdafStatsCols; ++j) {\n-\t\t\tunsigned c = (ptr[0] << 3) | (ptr[1] >> 5);\n-\t\t\tint p = (((ptr[1] & 0x0F) - (ptr[1] & 0x10)) << 6) | (ptr[2] >> 2);\n-\t\t\tPdafData pdafData;\n-\t\t\tpdafData.conf = c;\n-\t\t\tpdafData.phase = c ? p : 0;\n-\t\t\tpdaf.set(libcamera::Point(j, i), { pdafData, 1, 0 });\n-\t\t\tptr += step;\n-\t\t}\n-\t}\n-\n-\treturn true;\n-}\n-\n bool CamHelperImx708::parseAEHist(const uint8_t *ptr, size_t len, unsigned bpp)\n {\n \tstatic constexpr unsigned int PipelineBits = Statistics::NormalisationFactorPow2;\n",
    "prefixes": [
        "libcamera-devel",
        "RFC",
        "2/5"
    ]
}