From patchwork Fri Jun 30 12:02:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 18770 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 6DBF4C3295 for ; Fri, 30 Jun 2023 12:03:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2495A628C4; Fri, 30 Jun 2023 14:03:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1688126592; bh=rbKBOeF5sQpJW6EhEmh/kYUereAH3ZtKZdLQnrBJgss=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=FFpcHXNwKoG+nAVIDEEHu/cqRBqMOTs7b+bTxqKTWQbKyHXjfA6S5k7KQd67149Pz kIejk+yXpUiz1diRw4NJPTYfVBb0+cnOaYevhC1MDaCgb2lPqBU+SRZ4l5+vl+3hxQ H3PjNK7mcQ5t7SnKBiMHQi+iIT/mmbIqx6FQtwavJOkpzESCat36em+YhM5WFkcasE i5SmcvZZQi2IiIFF3LJFG5xJmMG7c+IJwKyQR4CgzevvEoDtviCFzri1QHkW4n+FCJ orhGh2402jm3cbzP/7CqOV8KNOYYL6IN4WlHbfsalGHFHnPVD6dLbJUns/isMEZVUU Zt54asrWUfLuA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B71EF628BD for ; Fri, 30 Jun 2023 14:03:08 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="LrQRmkbm"; dkim-atps=neutral Received: from umang.jainideasonboard.com.praguecc.cz (unknown [193.85.242.128]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 253429B9; Fri, 30 Jun 2023 14:02:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1688126547; bh=rbKBOeF5sQpJW6EhEmh/kYUereAH3ZtKZdLQnrBJgss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LrQRmkbmicJaF0tFaVwYhPNeMOUnErEig+lIpdYLsgrRAFkuXvX7kTZpEP7CKI+nI 82C7GoY6sM1xuDOrFBj+eXXidnfyS8wLPsuYLnMedL2mHeK+MBSGlt1A40XtxnvbJC v74YOUujuwbXYsNJLAPdYF4u9kLNxHjFGXyViC2k= 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 Subject: [libcamera-devel] [RFC PATCH 1/5] rpi: cam_helper_imx708: Use Span<> to pass PDAF data X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Umang Jain via libcamera-devel From: Umang Jain Reply-To: Umang Jain Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Instead of passing raw buffer pointer and length, construct a Span<> and pass it in parsePdafData(). While at it, introduce a constexpr which denotes the scanline of the PDAF data in the embedded data. Use that constexpr to compute the offset of PDAF buffer in the embedded data. Np functional changes intended in this patch. Signed-off-by: Umang Jain --- src/ipa/rpi/cam_helper/cam_helper_imx708.cpp | 25 +++++++++++--------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp b/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp index 641ba18f..b24ee643 100644 --- a/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp +++ b/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp @@ -42,6 +42,9 @@ constexpr std::initializer_list registerList = { expHiReg, expLoReg, gainHiReg, gainLoReg, lineLengthHiReg, lineLengthLoReg, frameLengthHiReg, frameLengthLoReg, temperatureReg }; +/* PDAF data is expect to occupy the third scanline of embedded data. */ +constexpr uint32_t pdafLineOffsetImx708 = 2; + class CamHelperImx708 : public CamHelper { public: @@ -75,7 +78,7 @@ private: void populateMetadata(const MdParser::RegisterMap ®isters, Metadata &metadata) const override; - static bool parsePdafData(const uint8_t *ptr, size_t len, unsigned bpp, + static bool parsePdafData(libcamera::Span &pdafData, unsigned bpp, PdafRegions &pdaf); bool parseAEHist(const uint8_t *ptr, size_t len, unsigned bpp); @@ -116,17 +119,16 @@ void CamHelperImx708::prepare(libcamera::Span buffer, Metadata &m parseEmbeddedData(buffer, metadata); - /* - * Parse PDAF data, which we expect to occupy the third scanline - * of embedded data. As PDAF is quite sensor-specific, it's parsed here. - */ + /* Parse sensor-specific PDAF data. */ size_t bytesPerLine = (mode_.width * mode_.bitdepth) >> 3; + size_t pdafDataOffset = pdafLineOffsetImx708 * bytesPerLine; - if (buffer.size() > 2 * bytesPerLine) { + if (buffer.size() > pdafDataOffset) { PdafRegions pdaf; - if (parsePdafData(&buffer[2 * bytesPerLine], - buffer.size() - 2 * bytesPerLine, - mode_.bitdepth, pdaf)) + libcamera::Span pdafData{ &buffer[pdafDataOffset], + buffer.size() - pdafDataOffset }; + + if (parsePdafData(pdafData, mode_.bitdepth, pdaf)) metadata.set("pdaf.regions", pdaf); } @@ -241,9 +243,10 @@ void CamHelperImx708::populateMetadata(const MdParser::RegisterMap ®isters, metadata.set("device.status", deviceStatus); } -bool CamHelperImx708::parsePdafData(const uint8_t *ptr, size_t len, - unsigned bpp, PdafRegions &pdaf) +bool CamHelperImx708::parsePdafData(Span &data, unsigned bpp, PdafRegions &pdaf) { + const uint8_t *ptr = data.data(); + unsigned int len = data.size(); size_t step = bpp >> 1; /* bytes per PDAF grid entry */ if (bpp < 10 || bpp > 12 || len < 194 * step || ptr[0] != 0 || ptr[1] >= 0x40) { From patchwork Fri Jun 30 12:03:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 18771 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 4B95ABE175 for ; Fri, 30 Jun 2023 12:03:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0F294628C5; Fri, 30 Jun 2023 14:03:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1688126593; bh=vQpye2Y9OwiLOppoOXQEwyz1zqAHufpJ5KTWofakVN0=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=p5AsvjIPFEAoXECJLb0ySAof9lUp0rLi4ySAB/6PZQR6ovNUj1qCw18SyEHjuVrz+ qc+NZjanE+rvv5ZiwlfZO3fteQSxmjecawj6A5Uc/CmA8iwr+y2QKAaaNtM5dVd1op jsHsHYauYzoUI3Z7O531c3l0pPKIEfv17XuPQimznL8Qa7l/oE8p2qe7nUoWtozOlm OySbWiGa7eiW3/eRZ/NJfQs3xA8GLh7v7HMpUZHujdSgHzvQ89nXpwm17R+TtVEROr XZla3Ovz42dwoHb3VixCU2Wy8Gemx6h8QVq0nMlny7JfhFc03Ni8+h46JZTR0zIQnv Ip8jstAPQ9gMw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 00DEB628BE for ; Fri, 30 Jun 2023 14:03:09 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Go/HsFXz"; dkim-atps=neutral Received: from umang.jainideasonboard.com.praguecc.cz (unknown [193.85.242.128]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 79CF4DE2; Fri, 30 Jun 2023 14:02:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1688126547; bh=vQpye2Y9OwiLOppoOXQEwyz1zqAHufpJ5KTWofakVN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Go/HsFXz31Z5mrr/cXLPGh/0JQIVRX8TGE2Xb+t8o9T1P+/W6mCF/DUjuBgxtyrVc sHu9WmoLb9XLhK9PVQ/hPSbVuOaKG1h2VahwMLn9u2Oyq4HaBjkI97PAYMEkpHcscN VhcFKhCFX92eBqmpmBZeL33iAbeHlfmadWtWVZD0= 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 Subject: [libcamera-devel] [RFC PATCH 2/5] ipa: rpi: Make parsePdafData() available in the CamHelper class X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Umang Jain via libcamera-devel From: Umang Jain Reply-To: Umang Jain Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" parsePdafData() parses the PDAF section of the sensor's embedded data and the parsing logic is generic to all PDAF-supported sensors. Once the PDAF-specific buffer section is identified correctly, any sensor should be able to use this helper in order parse its PDAF data. No functional changes intended in this patch. Signed-off-by: Umang Jain --- src/ipa/rpi/cam_helper/cam_helper.cpp | 29 +++++++++++++++ src/ipa/rpi/cam_helper/cam_helper.h | 6 ++++ src/ipa/rpi/cam_helper/cam_helper_imx708.cpp | 37 -------------------- 3 files changed, 35 insertions(+), 37 deletions(-) diff --git a/src/ipa/rpi/cam_helper/cam_helper.cpp b/src/ipa/rpi/cam_helper/cam_helper.cpp index ddd5e9a4..e9e0c496 100644 --- a/src/ipa/rpi/cam_helper/cam_helper.cpp +++ b/src/ipa/rpi/cam_helper/cam_helper.cpp @@ -253,6 +253,35 @@ void CamHelper::parseEmbeddedData(Span buffer, metadata.set("device.status", deviceStatus); } +bool CamHelper::parsePdafData(Span &data, unsigned bpp, PdafRegions &pdaf) +{ + const uint8_t *ptr = data.data(); + unsigned int len = data.size(); + size_t step = bpp >> 1; /* bytes per PDAF grid entry */ + + if (bpp < 10 || bpp > 12 || len < 194 * step || ptr[0] != 0 || ptr[1] >= 0x40) { + LOG(IPARPI, Error) << "PDAF data in unsupported format"; + return false; + } + + pdaf.init({ pdafStatsCols, pdafStatsRows }); + + ptr += 2 * step; + for (unsigned i = 0; i < pdafStatsRows; ++i) { + for (unsigned j = 0; j < pdafStatsCols; ++j) { + unsigned c = (ptr[0] << 3) | (ptr[1] >> 5); + int p = (((ptr[1] & 0x0f) - (ptr[1] & 0x10)) << 6) | (ptr[2] >> 2); + PdafData pdafData; + pdafData.conf = c; + pdafData.phase = c ? p : 0; + pdaf.set(libcamera::Point(j, i), { pdafData, 1, 0 }); + ptr += step; + } + } + + return true; +} + void CamHelper::populateMetadata([[maybe_unused]] const MdParser::RegisterMap ®isters, [[maybe_unused]] Metadata &metadata) const { diff --git a/src/ipa/rpi/cam_helper/cam_helper.h b/src/ipa/rpi/cam_helper/cam_helper.h index 58a4b202..705796a2 100644 --- a/src/ipa/rpi/cam_helper/cam_helper.h +++ b/src/ipa/rpi/cam_helper/cam_helper.h @@ -16,6 +16,7 @@ #include "controller/camera_mode.h" #include "controller/controller.h" #include "controller/metadata.h" +#include "controller/pdaf_data.h" #include "md_parser.h" #include "libcamera/internal/v4l2_videodevice.h" @@ -101,11 +102,16 @@ public: virtual unsigned int mistrustFramesModeSwitch() const; protected: + static bool parsePdafData(libcamera::Span &pdafData, unsigned bpp, + PdafRegions &pdaf); void parseEmbeddedData(libcamera::Span buffer, Metadata &metadata); virtual void populateMetadata(const MdParser::RegisterMap ®isters, Metadata &metadata) const; + static constexpr int pdafStatsRows = 12; + static constexpr int pdafStatsCols = 16; + std::unique_ptr parser_; CameraMode mode_; diff --git a/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp b/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp index b24ee643..d0382d63 100644 --- a/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp +++ b/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp @@ -12,8 +12,6 @@ #include -#include "controller/pdaf_data.h" - #include "cam_helper.h" #include "md_parser.h" @@ -72,15 +70,9 @@ private: /* Largest long exposure scale factor given as a left shift on the frame length. */ static constexpr int longExposureShiftMax = 7; - static constexpr int pdafStatsRows = 12; - static constexpr int pdafStatsCols = 16; - void populateMetadata(const MdParser::RegisterMap ®isters, Metadata &metadata) const override; - static bool parsePdafData(libcamera::Span &pdafData, unsigned bpp, - PdafRegions &pdaf); - bool parseAEHist(const uint8_t *ptr, size_t len, unsigned bpp); void putAGCStatistics(StatisticsPtr stats); @@ -243,35 +235,6 @@ void CamHelperImx708::populateMetadata(const MdParser::RegisterMap ®isters, metadata.set("device.status", deviceStatus); } -bool CamHelperImx708::parsePdafData(Span &data, unsigned bpp, PdafRegions &pdaf) -{ - const uint8_t *ptr = data.data(); - unsigned int len = data.size(); - size_t step = bpp >> 1; /* bytes per PDAF grid entry */ - - if (bpp < 10 || bpp > 12 || len < 194 * step || ptr[0] != 0 || ptr[1] >= 0x40) { - LOG(IPARPI, Error) << "PDAF data in unsupported format"; - return false; - } - - pdaf.init({ pdafStatsCols, pdafStatsRows }); - - ptr += 2 * step; - for (unsigned i = 0; i < pdafStatsRows; ++i) { - for (unsigned j = 0; j < pdafStatsCols; ++j) { - unsigned c = (ptr[0] << 3) | (ptr[1] >> 5); - int p = (((ptr[1] & 0x0F) - (ptr[1] & 0x10)) << 6) | (ptr[2] >> 2); - PdafData pdafData; - pdafData.conf = c; - pdafData.phase = c ? p : 0; - pdaf.set(libcamera::Point(j, i), { pdafData, 1, 0 }); - ptr += step; - } - } - - return true; -} - bool CamHelperImx708::parseAEHist(const uint8_t *ptr, size_t len, unsigned bpp) { static constexpr unsigned int PipelineBits = Statistics::NormalisationFactorPow2; From patchwork Fri Jun 30 12:03:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 18772 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 18451C32AA for ; Fri, 30 Jun 2023 12:03:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 82407628CC; Fri, 30 Jun 2023 14:03:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1688126593; bh=kt9qEOgLDzU0HrWp4M2ICglT7zLFIrNI6z7PVRwL/64=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=MRiBE9LG0EjEKzKgj2RsznCoLkFX0Ht9SYwQP7Q+ocK0aKu0NdmJehFL3NLscQ0I9 qg3PbiAr3hqsropyk4Rb6A2LITqPRPClX1ObA4Gc+MYuUVfIZm+Wt+n3DcUDpY9nXt TJa9T0XEDetvaj+bgCfFNS3tM3wJ4shShHvFSz8Vh8BMesXkNaQQeSFbmhG4VvWzMt QGdusc+3PnZyN4l64kFE3ZBASIWxqyD/DhA3eWMstBc8gBUfZxastf5SiX7MF6vEzx f2fdCsXj0D9DjjjjPG+resffdm94ojc7JoyRWrW0aTPCVElzMsKO2H3UPTZSANIZnI NSq6QKrEKQvGw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 503DC628C1 for ; Fri, 30 Jun 2023 14:03:09 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="NXXiKEOv"; dkim-atps=neutral Received: from umang.jainideasonboard.com.praguecc.cz (unknown [193.85.242.128]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CD54931FA; Fri, 30 Jun 2023 14:02:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1688126548; bh=kt9qEOgLDzU0HrWp4M2ICglT7zLFIrNI6z7PVRwL/64=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NXXiKEOv601tP9ADy+oGDnuaVBFRyYG5NaFdYQ4Ks0df80B0dXEvXxxYY52nOsZVY UtXhloRthDtHLJpp0iAB72K3Yg7bjS2OJ08sJQg/DF62zkKbOEwT5UJ7W+zXBmsJ4x 7jQIUYej3sKcAp9+5tVS7U4KZLZazf4vJEqGgIRQ= To: libcamera-devel@lists.libcamera.org Date: Fri, 30 Jun 2023 14:03:01 +0200 Message-Id: <20230630120303.33023-4-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 Subject: [libcamera-devel] [RFC PATCH 3/5] ipa: rpi: cam_helper_imx708: Only pass embedded buffer in parseEmbeddedData() X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Umang Jain via libcamera-devel From: Umang Jain Reply-To: Umang Jain Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Only the embedded data section should be passed while parsing the embedded data through parseEmbeddedData(). Signed-off-by: Umang Jain --- src/ipa/rpi/cam_helper/cam_helper_imx708.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp b/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp index d0382d63..6c3b54ed 100644 --- a/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp +++ b/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp @@ -40,6 +40,8 @@ constexpr std::initializer_list registerList = { expHiReg, expLoReg, gainHiReg, gainLoReg, lineLengthHiReg, lineLengthLoReg, frameLengthHiReg, frameLengthLoReg, temperatureReg }; +/* No. of lines of embedded data on IMX708. */ +constexpr uint32_t embeddedDataLinesImx708 = 2; /* PDAF data is expect to occupy the third scanline of embedded data. */ constexpr uint32_t pdafLineOffsetImx708 = 2; @@ -109,10 +111,13 @@ void CamHelperImx708::prepare(libcamera::Span buffer, Metadata &m return; } - parseEmbeddedData(buffer, metadata); + size_t bytesPerLine = (mode_.width * mode_.bitdepth) >> 3; + + libcamera::Span embeddedData{ buffer.data(), + embeddedDataLinesImx708 * bytesPerLine }; + parseEmbeddedData(embeddedData, metadata); /* Parse sensor-specific PDAF data. */ - size_t bytesPerLine = (mode_.width * mode_.bitdepth) >> 3; size_t pdafDataOffset = pdafLineOffsetImx708 * bytesPerLine; if (buffer.size() > pdafDataOffset) { From patchwork Fri Jun 30 12:03:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 18773 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id C312FC32AB for ; Fri, 30 Jun 2023 12:03:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0F474628C6; Fri, 30 Jun 2023 14:03:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1688126594; bh=4ChzfexEBo0QACUM7f3MjOT0KuOpKExpyR6ioq9zevU=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=XLO/vbDEVjLzOsOga0966OO+Zqd0VjZ9xC8RfjCgfPlmfeEp/e1vAWNUdNvuVmGNX 2e2Dt9/eEoWVPxBSYy4p8atKRhgjuTCrvSJXyVGVd4rY6Nz+JKAc8cI07BqjwNHxNy F++GJTPG5r1QHkYE5NOOZ3nAd4wRxlAjbx5a0w/MQxSbHNtrE9Ij21Na1ULBvfXy/N /C8IrO7lGupm2IO2HjH7b8XyCg264kOgFez6fRKIBPCCn2+//lIJzzzO566qC0KpAP u7DughFghcfg84AMhjPssFwcTvdoIvXklgbf7LN7q21b1cKCDbUY9uI5Yg1xqG0BJW ofBoux1YDxLDQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A45C6628C1 for ; Fri, 30 Jun 2023 14:03:09 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="YCDXXlo+"; dkim-atps=neutral Received: from umang.jainideasonboard.com.praguecc.cz (unknown [193.85.242.128]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2DB7832D2; Fri, 30 Jun 2023 14:02:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1688126548; bh=4ChzfexEBo0QACUM7f3MjOT0KuOpKExpyR6ioq9zevU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YCDXXlo+RCTnFzTjHmi2pJ715oeZIUR8jnUFzGMHCzoLAMeIZyXgTczfClO4tj+LZ be82GTpKbdNoXoIdMMB1EKUJv49H6FQXZdb6XA5LyJYnB6ryKMoGg4YIeGgROJ7U6a enKKQ0oaPb0xwC3itAnNSokHtaTgWi9uO1ZI9YeU= To: libcamera-devel@lists.libcamera.org Date: Fri, 30 Jun 2023 14:03:02 +0200 Message-Id: <20230630120303.33023-5-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 Subject: [libcamera-devel] [RFC PATCH 4/5] ipa: rpi: cam_helper_imx477: Only pass embedded buffer in parseEmbeddedData() X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Umang Jain via libcamera-devel From: Umang Jain Reply-To: Umang Jain Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Only the embedded data section should be passed while parsing the embedded data through parseEmbeddedData(). Signed-off-by: Umang Jain --- src/ipa/rpi/cam_helper/cam_helper_imx477.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ipa/rpi/cam_helper/cam_helper_imx477.cpp b/src/ipa/rpi/cam_helper/cam_helper_imx477.cpp index bc769ca7..3753fd0b 100644 --- a/src/ipa/rpi/cam_helper/cam_helper_imx477.cpp +++ b/src/ipa/rpi/cam_helper/cam_helper_imx477.cpp @@ -42,6 +42,9 @@ constexpr std::initializer_list registerList = { expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg, frameLengthLoReg, lineLengthHiReg, lineLengthLoReg, temperatureReg }; +/* No. of lines of embedded data on IMX477. */ +constexpr uint32_t embeddedDataLinesImx477 = 2; + class CamHelperImx477 : public CamHelper { public: @@ -95,7 +98,11 @@ void CamHelperImx477::prepare(libcamera::Span buffer, Metadata &m return; } - parseEmbeddedData(buffer, metadata); + size_t bytesPerLine = (mode_.width * mode_.bitdepth) >> 3; + libcamera::Span embeddedData{ buffer.data(), + embeddedDataLinesImx477 * bytesPerLine }; + + parseEmbeddedData(embeddedData, metadata); /* * The DeviceStatus struct is first populated with values obtained from From patchwork Fri Jun 30 12:03:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 18774 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 0E162C3295 for ; Fri, 30 Jun 2023 12:03:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 94216628C8; Fri, 30 Jun 2023 14:03:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1688126594; bh=v1XEwTx8XIC3TLzFQZnBpaCqyNfZFOmH3b6GltBv8QA=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Foit8WsoRNivigYFE4gYIUcoFoGj30ebjlazQNw6OyjM5JIaxjyzi7eAJeSu3S0L5 hvKRyD2JnMhqW6O+O0FPPqes3o+NZuoQq0C061lmtKydtpAmPITMkt3rAmrqxuv5dI Y/rCRoTdh9d/K8XsLnzUJvE1ch+CmVOPFbfE2EgRz0emurNTQDz2W2mlPUsOvdZMco wbGQM1sLMS4+CiqVdZD/ZWoJ1zGhKznX0nIr6LlTp79OJx1GoLDSIwmlx1eC8iZXfT c20T9hpv34MkjS402GvwK2JgaZcIb/ADTmDjJTHPYHOfbyDWyD1OxiPMbNIvbopuq1 LF/d+p0QVPB/g== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 04452628C1 for ; Fri, 30 Jun 2023 14:03:10 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="hyqn+PmB"; dkim-atps=neutral Received: from umang.jainideasonboard.com.praguecc.cz (unknown [193.85.242.128]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 81CB73320; Fri, 30 Jun 2023 14:02:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1688126548; bh=v1XEwTx8XIC3TLzFQZnBpaCqyNfZFOmH3b6GltBv8QA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hyqn+PmBxyBKzf6+DB8bTI1HLbRSQUorw/pB5UFfTmH4sD0h/kzvD2Nb9y7lKHHLK SU6imDX7xnjYWzcOcVHlKK+kyI4YahHuY7/IKRmhf7gdYJ1hyH83rqBFpfD4iQkJQ5 79UuHfT9eTMl/LK/TktSp8L+PHbnbZ6rYzgpIl/c= To: libcamera-devel@lists.libcamera.org Date: Fri, 30 Jun 2023 14:03:03 +0200 Message-Id: <20230630120303.33023-6-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 Subject: [libcamera-devel] [RFC PATCH 5/5] ipa: rpi: cam_helper_imx519: Only pass embedded buffer in parseEmbeddedData() X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Umang Jain via libcamera-devel From: Umang Jain Reply-To: Umang Jain Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Only the embedded data section should be passed while parsing the embedded data through parseEmbeddedData(). Signed-off-by: Umang Jain --- src/ipa/rpi/cam_helper/cam_helper_imx519.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ipa/rpi/cam_helper/cam_helper_imx519.cpp b/src/ipa/rpi/cam_helper/cam_helper_imx519.cpp index c7262aa0..77fb1f03 100644 --- a/src/ipa/rpi/cam_helper/cam_helper_imx519.cpp +++ b/src/ipa/rpi/cam_helper/cam_helper_imx519.cpp @@ -42,6 +42,9 @@ constexpr std::initializer_list registerList = { expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg, frameLengthLoReg, lineLengthHiReg, lineLengthLoReg }; +/* No. of lines of embedded data on IMX519. */ +constexpr uint32_t embeddedDataLinesImx519 = 2; + class CamHelperImx519 : public CamHelper { public: @@ -95,7 +98,10 @@ void CamHelperImx519::prepare(libcamera::Span buffer, Metadata &m return; } - parseEmbeddedData(buffer, metadata); + size_t bytesPerLine = (mode_.width * mode_.bitdepth) >> 3; + libcamera::Span embeddedData{ buffer.data(), + embeddedDataLinesImx519 * bytesPerLine }; + parseEmbeddedData(embeddedData, metadata); /* * The DeviceStatus struct is first populated with values obtained from