{"id":17551,"url":"https://patchwork.libcamera.org/api/1.1/patches/17551/?format=json","web_url":"https://patchwork.libcamera.org/patch/17551/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20221006131744.5179-11-naush@raspberrypi.com>","date":"2022-10-06T13:17:44","name":"[libcamera-devel,v2,10/10] ipa: raspberrypi: Extract line length from the embedded data parser","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"aeedbe47fe94b6416bfed5c9c1a3f9bc0904f73b","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17551/mbox/","series":[{"id":3537,"url":"https://patchwork.libcamera.org/api/1.1/series/3537/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3537","date":"2022-10-06T13:17:34","name":"Raspberry Pi: Horizontal blanking control","version":2,"mbox":"https://patchwork.libcamera.org/series/3537/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17551/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17551/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 AF71BC3287\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  6 Oct 2022 13:18:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3BED962D18;\n\tThu,  6 Oct 2022 15:18:05 +0200 (CEST)","from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com\n\t[IPv6:2a00:1450:4864:20::42b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 60C3962D0B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  6 Oct 2022 15:18:02 +0200 (CEST)","by mail-wr1-x42b.google.com with SMTP id b4so2706728wrs.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 06 Oct 2022 06:18:02 -0700 (PDT)","from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tq18-20020a056000137200b0022cc7c32309sm17986049wrz.115.2022.10.06.06.18.00\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 06 Oct 2022 06:18:00 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1665062285;\n\tbh=hV19k6+5ZyQUG7rvYzMq3gDrTHgp05W10hHjsFaKaPk=;\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=PceIWNvQp01vKF51ufM+9x9KncaYm6a6GdW2iYFZeKuPOrpEHWYlxqEH50ynCMmnr\n\t/bdSJU6+99LgKWYnd/zkDWxdJjeE4NC4uYuDQb4UjHl17dje74GxZL3rM5A3DzRkrz\n\t0F/am0rv9OR/w/bIKnS5mY/EM9Jx2yQ8UnjrfevTPdg/ul703RI3eYfpKapVb/3mGw\n\tStrqfDNC10H3Y1uHjQONcIk/nRtqjNIFK6+qfN01Kzdt7Qqiavza2n601UUa141AU0\n\tPDiJYJm2VihvU1bk0U+Vv3zezCcvHdk87wFxAl1wmYvc4jARj0SaF4F9it4wuLUSnO\n\tXrJxv/lKRJmZw==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date;\n\tbh=/spMsGEdXBbA5Mp/XA3rOFmIjFUaZnuuSdKv/kJBWeQ=;\n\tb=Az05FNQwwnuD9doSxwBNp3eREGiHlkHLohaeLzt+5J3joWv+CKomaYSDM86BP5HRYx\n\tA7PlDGCgv6rUjqrmnl6gK+e4C27mfnKzzEbMd9SV/DZBDxwhqF1nIdNjQnKmuSz9tCVt\n\tU15wbogC9Sbse86lXaA3cxybv/OfAwXtXAkdXJo8/l4SP3U2NiZ5SPtcb9vlF0Ky0kCz\n\t076OGSe6cacbG82kYnOxhnj5rYskk4KAGO50ts9BHXLGzSx5tVkFHwlvP60qKL1EObRd\n\tDaS6d8ywv7/+uvPGFy/EsKmJsOFYGrduMu/J+V3NafMKPf956qV6zvs1yxZX7zuLx5Fb\n\tI/kA=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"Az05FNQw\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date;\n\tbh=/spMsGEdXBbA5Mp/XA3rOFmIjFUaZnuuSdKv/kJBWeQ=;\n\tb=dkPkPaLSkpVKf3kCL9GuPAv0yGPXq9O9PqYz2YxFHH57TZp5jichhPkGzGdXresW6H\n\t9nXIdUc+EsSNiGQ9J+1hmwVqwP0ZYGrl1ynHrY/19pOFRTqYP1oJdfgtOMkPn+2qG0gS\n\t+lWYtEy7XsFKAl0EnqoLv7F61L3g55JTryXG3H9qATrRhKM+T521yK88Zqr6/2ueofOs\n\trP1JoTGkmWNEAenGJK+S/hAal1cfvFlL2IeYax7tFdWPOqIyKTFWUx5YVKeKJBGyGKdV\n\tw2V3ortB9btZi+8HnjzkEoW/o9LPYwDAVcnINvKJJl5WYC0inoMkrtw3f2X7XnYwHLIa\n\tA7WQ==","X-Gm-Message-State":"ACrzQf1g2NgzpUmH6gZKggoC/hxjyCvvvJ9igtfjltiNCvSrkfuG3cmQ\n\ts2vMeDvI1OZCpSWDPT0pkvatpYgmf28BLg==","X-Google-Smtp-Source":"AMsMyM5BbKtFj+3FVEyJAkL5BdIq6SMt3UWWOaf7iHg2yi0kSbhhFSfADdLNndaSnO4aiXei2T59UA==","X-Received":"by 2002:a5d:6c6b:0:b0:225:dde:ab40 with SMTP id\n\tr11-20020a5d6c6b000000b002250ddeab40mr3230686wrz.690.1665062281943; \n\tThu, 06 Oct 2022 06:18:01 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  6 Oct 2022 14:17:44 +0100","Message-Id":"<20221006131744.5179-11-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20221006131744.5179-1-naush@raspberrypi.com>","References":"<20221006131744.5179-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 10/10] ipa: raspberrypi: Extract line\n\tlength from the embedded data parser","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":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Update the imx219, imx477 and imx519 parsers to extract the line length values\nfrom the embedded data stream and use these values in the deviceStatus metadata,\nreplacing the DelayedControls provided values.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nTested-by: Dave Stevenson <dave.stevenson@raspberrypi.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/raspberrypi/cam_helper.cpp        | 3 ++-\n src/ipa/raspberrypi/cam_helper_imx219.cpp | 9 +++++++--\n src/ipa/raspberrypi/cam_helper_imx477.cpp | 9 +++++++--\n src/ipa/raspberrypi/cam_helper_imx519.cpp | 9 +++++++--\n 4 files changed, 23 insertions(+), 7 deletions(-)","diff":"diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp\nindex afbc03d36b02..d90ac1deda47 100644\n--- a/src/ipa/raspberrypi/cam_helper.cpp\n+++ b/src/ipa/raspberrypi/cam_helper.cpp\n@@ -222,7 +222,7 @@ void CamHelper::parseEmbeddedData(Span<const uint8_t> buffer,\n \tmetadata.merge(parsedMetadata);\n \n \t/*\n-\t * Overwrite the exposure/gain, frame length and sensor temperature values\n+\t * Overwrite the exposure/gain, line/frame length and sensor temperature values\n \t * in the existing DeviceStatus with values from the parsed embedded buffer.\n \t * Fetch it first in case any other fields were set meaningfully.\n \t */\n@@ -236,6 +236,7 @@ void CamHelper::parseEmbeddedData(Span<const uint8_t> buffer,\n \tdeviceStatus.shutterSpeed = parsedDeviceStatus.shutterSpeed;\n \tdeviceStatus.analogueGain = parsedDeviceStatus.analogueGain;\n \tdeviceStatus.frameLength = parsedDeviceStatus.frameLength;\n+\tdeviceStatus.lineLength = parsedDeviceStatus.lineLength;\n \tif (parsedDeviceStatus.sensorTemperature)\n \t\tdeviceStatus.sensorTemperature = parsedDeviceStatus.sensorTemperature;\n \ndiff --git a/src/ipa/raspberrypi/cam_helper_imx219.cpp b/src/ipa/raspberrypi/cam_helper_imx219.cpp\nindex 98a3b31956ec..c3337ed08466 100644\n--- a/src/ipa/raspberrypi/cam_helper_imx219.cpp\n+++ b/src/ipa/raspberrypi/cam_helper_imx219.cpp\n@@ -32,8 +32,11 @@ constexpr uint32_t expHiReg = 0x15a;\n constexpr uint32_t expLoReg = 0x15b;\n constexpr uint32_t frameLengthHiReg = 0x160;\n constexpr uint32_t frameLengthLoReg = 0x161;\n+constexpr uint32_t lineLengthHiReg = 0x162;\n+constexpr uint32_t lineLengthLoReg = 0x163;\n constexpr std::initializer_list<uint32_t> registerList [[maybe_unused]]\n-\t= { expHiReg, expLoReg, gainReg, frameLengthHiReg, frameLengthLoReg };\n+\t= { expHiReg, expLoReg, gainReg, frameLengthHiReg, frameLengthLoReg,\n+\t    lineLengthHiReg, lineLengthLoReg };\n \n class CamHelperImx219 : public CamHelper\n {\n@@ -94,8 +97,10 @@ void CamHelperImx219::populateMetadata(const MdParser::RegisterMap &registers,\n {\n \tDeviceStatus deviceStatus;\n \n+\tdeviceStatus.lineLength = lineLengthPckToDuration(registers.at(lineLengthHiReg) * 256 +\n+\t\t\t\t\t\t\t  registers.at(lineLengthLoReg));\n \tdeviceStatus.shutterSpeed = exposure(registers.at(expHiReg) * 256 + registers.at(expLoReg),\n-\t\t\t\t\t     mode_.minLineLength);\n+\t\t\t\t\t     deviceStatus.lineLength);\n \tdeviceStatus.analogueGain = gain(registers.at(gainReg));\n \tdeviceStatus.frameLength = registers.at(frameLengthHiReg) * 256 + registers.at(frameLengthLoReg);\n \ndiff --git a/src/ipa/raspberrypi/cam_helper_imx477.cpp b/src/ipa/raspberrypi/cam_helper_imx477.cpp\nindex 19a5e471c27e..bc769ca75baa 100644\n--- a/src/ipa/raspberrypi/cam_helper_imx477.cpp\n+++ b/src/ipa/raspberrypi/cam_helper_imx477.cpp\n@@ -35,9 +35,12 @@ constexpr uint32_t gainHiReg = 0x0204;\n constexpr uint32_t gainLoReg = 0x0205;\n constexpr uint32_t frameLengthHiReg = 0x0340;\n constexpr uint32_t frameLengthLoReg = 0x0341;\n+constexpr uint32_t lineLengthHiReg = 0x0342;\n+constexpr uint32_t lineLengthLoReg = 0x0343;\n constexpr uint32_t temperatureReg = 0x013a;\n constexpr std::initializer_list<uint32_t> registerList =\n-\t{ expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg, frameLengthLoReg, temperatureReg  };\n+\t{ expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg, frameLengthLoReg,\n+\t  lineLengthHiReg, lineLengthLoReg, temperatureReg };\n \n class CamHelperImx477 : public CamHelper\n {\n@@ -175,8 +178,10 @@ void CamHelperImx477::populateMetadata(const MdParser::RegisterMap &registers,\n {\n \tDeviceStatus deviceStatus;\n \n+\tdeviceStatus.lineLength = lineLengthPckToDuration(registers.at(lineLengthHiReg) * 256 +\n+\t\t\t\t\t\t\t  registers.at(lineLengthLoReg));\n \tdeviceStatus.shutterSpeed = exposure(registers.at(expHiReg) * 256 + registers.at(expLoReg),\n-\t\t\t\t\t     mode_.minLineLength);\n+\t\t\t\t\t     deviceStatus.lineLength);\n \tdeviceStatus.analogueGain = gain(registers.at(gainHiReg) * 256 + registers.at(gainLoReg));\n \tdeviceStatus.frameLength = registers.at(frameLengthHiReg) * 256 + registers.at(frameLengthLoReg);\n \tdeviceStatus.sensorTemperature = std::clamp<int8_t>(registers.at(temperatureReg), -20, 80);\ndiff --git a/src/ipa/raspberrypi/cam_helper_imx519.cpp b/src/ipa/raspberrypi/cam_helper_imx519.cpp\nindex d2eb171912da..c7262aa0b6e6 100644\n--- a/src/ipa/raspberrypi/cam_helper_imx519.cpp\n+++ b/src/ipa/raspberrypi/cam_helper_imx519.cpp\n@@ -36,8 +36,11 @@ constexpr uint32_t gainHiReg = 0x0204;\n constexpr uint32_t gainLoReg = 0x0205;\n constexpr uint32_t frameLengthHiReg = 0x0340;\n constexpr uint32_t frameLengthLoReg = 0x0341;\n+constexpr uint32_t lineLengthHiReg = 0x0342;\n+constexpr uint32_t lineLengthLoReg = 0x0343;\n constexpr std::initializer_list<uint32_t> registerList =\n-\t{ expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg, frameLengthLoReg  };\n+\t{ expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg, frameLengthLoReg,\n+\t  lineLengthHiReg, lineLengthLoReg };\n \n class CamHelperImx519 : public CamHelper\n {\n@@ -175,8 +178,10 @@ void CamHelperImx519::populateMetadata(const MdParser::RegisterMap &registers,\n {\n \tDeviceStatus deviceStatus;\n \n+\tdeviceStatus.lineLength = lineLengthPckToDuration(registers.at(lineLengthHiReg) * 256 +\n+\t\t\t\t\t\t\t  registers.at(lineLengthLoReg));\n \tdeviceStatus.shutterSpeed = exposure(registers.at(expHiReg) * 256 + registers.at(expLoReg),\n-\t\t\t\t\t     mode_.minLineLength);\n+\t\t\t\t\t     deviceStatus.lineLength);\n \tdeviceStatus.analogueGain = gain(registers.at(gainHiReg) * 256 + registers.at(gainLoReg));\n \tdeviceStatus.frameLength = registers.at(frameLengthHiReg) * 256 + registers.at(frameLengthLoReg);\n \n","prefixes":["libcamera-devel","v2","10/10"]}