[{"id":25272,"web_url":"https://patchwork.libcamera.org/comment/25272/","msgid":"<YzxpwarRv8K98K/D@pendragon.ideasonboard.com>","date":"2022-10-04T17:13:37","subject":"Re: [libcamera-devel] [PATCH v1 9/9] ipa: raspberrypi: Extract line\n\tlength from the embedded data parser","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nThank you for the patch.\n\nOn Mon, Oct 03, 2022 at 09:39:35AM +0100, Naushir Patuck via libcamera-devel wrote:\n> Update the imx219, imx477 and imx519 parsers to extract the line length values\n> from the embedded data stream and use these values in the deviceStatus metadata,\n> replacing the DelayedControls provided values.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\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(-)\n> \n> diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp\n> index f5f034ece711..1811d231ad40 100644\n> --- a/src/ipa/raspberrypi/cam_helper.cpp\n> +++ b/src/ipa/raspberrypi/cam_helper.cpp\n> @@ -228,7 +228,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> @@ -242,6 +242,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>  \n> diff --git a/src/ipa/raspberrypi/cam_helper_imx219.cpp b/src/ipa/raspberrypi/cam_helper_imx219.cpp\n> index 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>  \n> diff --git a/src/ipa/raspberrypi/cam_helper_imx477.cpp b/src/ipa/raspberrypi/cam_helper_imx477.cpp\n> index 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);\n> diff --git a/src/ipa/raspberrypi/cam_helper_imx519.cpp b/src/ipa/raspberrypi/cam_helper_imx519.cpp\n> index 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>","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 702B3C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  4 Oct 2022 17:13:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CB53C60AB3;\n\tTue,  4 Oct 2022 19:13:42 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 37A4E601C7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  4 Oct 2022 19:13:41 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 921AD2D9;\n\tTue,  4 Oct 2022 19:13:40 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664903622;\n\tbh=5gr+iPe0KN/y89eovzX15Tc5kvomEBZQFttyydTPbB8=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=b7BXbrnm7jE5YGjBJFZB/5JDXadJ0i5s99l/hqDZTpA/qkhRxf6DHhPX7BpD7RTPB\n\tVQz1Ivdb84NxaMPvhlijAsTVqa6J+16dUH3xgCPk02bBh/wfowd+X7H7ejRsazPBNm\n\tqsHU6O9JHsnj8ee58o131tFGfbN6UT5d4MSfFTrDkAThTj3no1PtDCFsYKUybmBcRy\n\tyKPws9KCd7pmIASZ6NFXFUjLaq2C0LxV9inM4J2Pya04H/yu5sloYTkcls9eQZz1xW\n\tRsaspM9lgo+Bw5VkDcdScEiwqu3aAB/v+jN125xEgIZDpbOPpMSOhpdc/CW1GI28iA\n\tsIpIKFgxv5FAw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1664903620;\n\tbh=5gr+iPe0KN/y89eovzX15Tc5kvomEBZQFttyydTPbB8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=wjf866afjqKAev0nS6DwrdDPuk3spdRb2WfC4YqOkejolwMpTNrvayjErxiPZ4F2N\n\tCdWBtIdWX/Y/XaA4X4LbiFi8pZF3giqQrrJ73I8zidtoXqsVRWNbpNUof7Od84BxAn\n\tmq7vE2kjZLCR0WIbGcmFU8OVH603N4wlkpNuRWmI="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"wjf866af\"; dkim-atps=neutral","Date":"Tue, 4 Oct 2022 20:13:37 +0300","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<YzxpwarRv8K98K/D@pendragon.ideasonboard.com>","References":"<20221003083934.31629-1-naush@raspberrypi.com>\n\t<20221003083934.31629-10-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20221003083934.31629-10-naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH v1 9/9] 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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]