Patch Detail
Show a patch.
GET /api/1.1/patches/18770/?format=api
{ "id": 18770, "url": "https://patchwork.libcamera.org/api/1.1/patches/18770/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18770/", "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-2-umang.jain@ideasonboard.com>", "date": "2023-06-30T12:02:59", "name": "[libcamera-devel,RFC,1/5] rpi: cam_helper_imx708: Use Span<> to pass PDAF data", "commit_ref": null, "pull_url": null, "state": "deferred", "archived": false, "hash": "43750da2e3eca6b3e59e63ce1db6a69a95e0e298", "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/18770/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/18770/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18770/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 6DBF4C3295\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 30 Jun 2023 12:03:13 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2495A628C4;\n\tFri, 30 Jun 2023 14:03:12 +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 B71EF628BD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 30 Jun 2023 14:03:08 +0200 (CEST)", "from umang.jainideasonboard.com.praguecc.cz (unknown\n\t[193.85.242.128])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 253429B9;\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=1688126592;\n\tbh=rbKBOeF5sQpJW6EhEmh/kYUereAH3ZtKZdLQnrBJgss=;\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=FFpcHXNwKoG+nAVIDEEHu/cqRBqMOTs7b+bTxqKTWQbKyHXjfA6S5k7KQd67149Pz\n\tkIejk+yXpUiz1diRw4NJPTYfVBb0+cnOaYevhC1MDaCgb2lPqBU+SRZ4l5+vl+3hxQ\n\tH3PjNK7mcQ5t7SnKBiMHQi+iIT/mmbIqx6FQtwavJOkpzESCat36em+YhM5WFkcasE\n\ti5SmcvZZQi2IiIFF3LJFG5xJmMG7c+IJwKyQR4CgzevvEoDtviCFzri1QHkW4n+FCJ\n\torhGh2402jm3cbzP/7CqOV8KNOYYL6IN4WlHbfsalGHFHnPVD6dLbJUns/isMEZVUU\n\tZt54asrWUfLuA==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1688126547;\n\tbh=rbKBOeF5sQpJW6EhEmh/kYUereAH3ZtKZdLQnrBJgss=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=LrQRmkbmicJaF0tFaVwYhPNeMOUnErEig+lIpdYLsgrRAFkuXvX7kTZpEP7CKI+nI\n\t82C7GoY6sM1xuDOrFBj+eXXidnfyS8wLPsuYLnMedL2mHeK+MBSGlt1A40XtxnvbJC\n\tv74YOUujuwbXYsNJLAPdYF4u9kLNxHjFGXyViC2k=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"LrQRmkbm\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 30 Jun 2023 14:02:59 +0200", "Message-Id": "<20230630120303.33023-2-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 1/5] rpi: cam_helper_imx708: Use\n\tSpan<> to pass PDAF data", "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": "Instead of passing raw buffer pointer and length, construct a Span<>\nand pass it in parsePdafData().\n\nWhile at it, introduce a constexpr which denotes the scanline of the\nPDAF data in the embedded data. Use that constexpr to compute the\noffset of PDAF buffer in the embedded data.\n\nNp 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_imx708.cpp | 25 +++++++++++---------\n 1 file changed, 14 insertions(+), 11 deletions(-)", "diff": "diff --git a/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp b/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp\nindex 641ba18f..b24ee643 100644\n--- a/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp\n+++ b/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp\n@@ -42,6 +42,9 @@ constexpr std::initializer_list<uint32_t> registerList =\n \t{ expHiReg, expLoReg, gainHiReg, gainLoReg, lineLengthHiReg,\n \t lineLengthLoReg, frameLengthHiReg, frameLengthLoReg, temperatureReg };\n \n+/* PDAF data is expect to occupy the third scanline of embedded data. */\n+constexpr uint32_t pdafLineOffsetImx708 = 2;\n+\n class CamHelperImx708 : public CamHelper\n {\n public:\n@@ -75,7 +78,7 @@ private:\n \tvoid populateMetadata(const MdParser::RegisterMap ®isters,\n \t\t\t Metadata &metadata) const override;\n \n-\tstatic bool parsePdafData(const uint8_t *ptr, size_t len, unsigned bpp,\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@@ -116,17 +119,16 @@ void CamHelperImx708::prepare(libcamera::Span<const uint8_t> buffer, Metadata &m\n \n \tparseEmbeddedData(buffer, metadata);\n \n-\t/*\n-\t * Parse PDAF data, which we expect to occupy the third scanline\n-\t * of embedded data. As PDAF is quite sensor-specific, it's parsed here.\n-\t */\n+\t/* Parse sensor-specific PDAF data. */\n \tsize_t bytesPerLine = (mode_.width * mode_.bitdepth) >> 3;\n+\tsize_t pdafDataOffset = pdafLineOffsetImx708 * bytesPerLine;\n \n-\tif (buffer.size() > 2 * bytesPerLine) {\n+\tif (buffer.size() > pdafDataOffset) {\n \t\tPdafRegions pdaf;\n-\t\tif (parsePdafData(&buffer[2 * bytesPerLine],\n-\t\t\t\t buffer.size() - 2 * bytesPerLine,\n-\t\t\t\t mode_.bitdepth, pdaf))\n+\t\tlibcamera::Span<const uint8_t> pdafData{ &buffer[pdafDataOffset],\n+\t\t\t\t\t\t\t buffer.size() - pdafDataOffset };\n+\n+\t\tif (parsePdafData(pdafData, mode_.bitdepth, pdaf))\n \t\t\tmetadata.set(\"pdaf.regions\", pdaf);\n \t}\n \n@@ -241,9 +243,10 @@ void CamHelperImx708::populateMetadata(const MdParser::RegisterMap ®isters,\n \tmetadata.set(\"device.status\", deviceStatus);\n }\n \n-bool CamHelperImx708::parsePdafData(const uint8_t *ptr, size_t len,\n-\t\t\t\t unsigned bpp, PdafRegions &pdaf)\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", "prefixes": [ "libcamera-devel", "RFC", "1/5" ] }