From patchwork Fri Dec 13 09:38:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 22306 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 3E048C32EA for ; Fri, 13 Dec 2024 09:46:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7E64667EEE; Fri, 13 Dec 2024 10:46:12 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="S5WwIcMZ"; dkim-atps=neutral Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5D16667EE0 for ; Fri, 13 Dec 2024 10:46:09 +0100 (CET) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-436203f1203so1621075e9.2 for ; Fri, 13 Dec 2024 01:46:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1734083169; x=1734687969; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=idQKCBHzbaC+BEg4JRAyp9O26UUUljmI2CnjLqe3ocU=; b=S5WwIcMZ/WvWBi0DlAXcXbO0DoXwYC/zjrYKEwfnp9kwRkgnGkIw+ZYSLcYVGt8BHa jK4AtyIulpaVxn7ba08u5dzb05cRptsygobwcDRX9Yzo0d8ttsc7gC7Q6BHmV+9McI1p iaKRTfSMLHDGZEA35AVIc7z5HOoQhfW/P2nUeuKG0tK3jL5rNH7Ua5oyx0dANoduEEV9 jFsihPOuN5CgKr6heAEC+4u9py0kGHSSQzdh6VsRBXgd0ZqPGeeJ+pgjCi6AKSsUaQ+K o//Dqi/uflApvXOagcSffp06lB/Qmg0j/F1lSkmd2Y0TZnEhUthj80L4B6CQlEGJl4Sr wTew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734083169; x=1734687969; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=idQKCBHzbaC+BEg4JRAyp9O26UUUljmI2CnjLqe3ocU=; b=d396kiqPVO9FUde1VkoZAAsLg1GLp5M5medeOfwkgd9QS1RGoW35WPjiY9axquCzwP Fc8+2FNwtaGetT2ZJp+YH3bhiRlwhe7DUtdjIS34XfgR9zRvDQ4P8RMzpslM7C4X9eWG WvWog15yvCSLvFLjSWcw+FK+oAWvRZr8ofzF3Scn8RlZoPPGNvCVkxMkz9uxWAK5UDhj NN8GQfVojgFdEbZzZbFxZ9Mwr9/T9gbzj2Sh7lYpTw5aihoUuwTx+fy1N/ebbEf65vY/ dqt9QvNKs+0c4AtL3GKQ1Xj7rumzuYcknJp09XZ7WVLLyUUm6dl9aK8Oiueen6LQ4P3x 78vw== X-Gm-Message-State: AOJu0YxJo6hiHo5y5eAGb/3iHc48QDnw0bCGEDKs1Px41e71gIRA9Aek XTSWHbmTWkDNrIC34NIyStDEScJN/0ham7I+v89t0hByaM9lAZGdktXYhR4ThVOCWoV1w41wF15 O X-Gm-Gg: ASbGnctnLCiYLw5kr9KtD+G3RHaF+KZNj/GCnHR6fOAUt+3eNmUQsetDQxCP4ONcEGi WDvUNN5fiUPKX1OAvMMosyMPFeIEHEmm/fbqS76tpQNkUCe3rA0xOFGUrdAITTMA9+kikqleySN i6ehrYNUdNM2W3Cogjj4+OqbR9PDVDhbATT/5EUISl+szyR0w4mJxjUYGwLPO8Z0xp9e40wil+g 0SHT9hTH2ATyXuudJgqHpMT/vrT/GMLr00xNMPPJiDc07S/S7/REghEjgOv5ZpkCuB74n6WZWxD X-Google-Smtp-Source: AGHT+IGZ2z8x2ufql5/63tDeg2CinB4a0Tr85AlsCnMvmlnYHu8EbMToaH4n6n1gTAC0piI10yFw5g== X-Received: by 2002:a05:600c:4ed3:b0:42c:c0d8:bf49 with SMTP id 5b1f17b1804b1-4362a9895eemr5579675e9.0.1734083168635; Fri, 13 Dec 2024 01:46:08 -0800 (PST) Received: from NAUSH-P-DELL.pitowers.org ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4362557c502sm43989105e9.11.2024.12.13.01.46.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 01:46:08 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck Subject: [PATCH 1/6] ipa: rpi: Use r-value references in the set()/setLocked() functions Date: Fri, 13 Dec 2024 09:38:24 +0000 Message-ID: <20241213094602.2083174-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241213094602.2083174-1-naush@raspberrypi.com> References: <20241213094602.2083174-1-naush@raspberrypi.com> MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Use an r-value reference in set() and setLocked(), allowing more efficient metadata handling with std::forward and std::move if needed. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Laurent Pinchart --- src/ipa/rpi/controller/metadata.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ipa/rpi/controller/metadata.h b/src/ipa/rpi/controller/metadata.h index b4650d25170f..eda4b59bca9a 100644 --- a/src/ipa/rpi/controller/metadata.h +++ b/src/ipa/rpi/controller/metadata.h @@ -36,10 +36,10 @@ public: } template - void set(std::string const &tag, T const &value) + void set(std::string const &tag, T &&value) { std::scoped_lock lock(mutex_); - data_[tag] = value; + data_[tag] = std::forward(value); } template @@ -104,10 +104,10 @@ public: } template - void setLocked(std::string const &tag, T const &value) + void setLocked(std::string const &tag, T &&value) { /* Use this only if you're holding the lock yourself. */ - data_[tag] = value; + data_[tag] = std::forward(value); } /* From patchwork Fri Dec 13 09:38:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 22307 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 67536C32F1 for ; Fri, 13 Dec 2024 09:46:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 61BD067EE5; Fri, 13 Dec 2024 10:46:13 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="YkIn3s2E"; dkim-atps=neutral Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EA33167EE0 for ; Fri, 13 Dec 2024 10:46:09 +0100 (CET) Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3862f11a13dso139003f8f.2 for ; Fri, 13 Dec 2024 01:46:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1734083169; x=1734687969; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aYx9VVm9lHIOifsTwg6GTaNC5W+9lzFaSpeOtlhfR2w=; b=YkIn3s2ElRODURtsrPkTv4uVDUQ1hkKZfS7+PjoyYrLc1IhmPwAbBD+RRN4ibMLnvr M+KL7VoOihIO9yQ95cbj6xf76/JOPRHGkxaUKCXCucoYdc5po38XQX1ip22/c05u+53e Aw48FL7mjQfqFthYVu9OUsJlEZm6upiigcmYZ4eiCgGrQKLNKYZTva8qJLFLLrIWho/k lpu8XF6v8/fgx+x+AGQ49P6ri6S+dKF3WWdGx9FcqJ5XQ49KfYRl+ZkxGvuioNlsquIM gxk7oCkSr/ywquVUCYkrUtsZKTeniCDwkTu+eILrGUXmHe8JhR1YPvgF5olxbpvMQLjI mG9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734083169; x=1734687969; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aYx9VVm9lHIOifsTwg6GTaNC5W+9lzFaSpeOtlhfR2w=; b=GTmsK5dK5swxi8ZnKEAbGUrGHrM+K20LpMNpDCnrhR0CkD7o4gWao49YgQ3edDLjPU RxxG6KTUdTWizpWJC9m8qhYBe2roh5/IPvLZFu0sWWUBSJYtVgdqmxs7SeaxhYChHH6r STZGqtbHA7IXJucoj/BOiDx+EodazecJ73lPOre0AvHVenwcE5ZxcGiavAocvAdFjOHC nDfEeI59F7ai0/J3dAayRfSE15tlb7v0cSkMpAUOfMKGT5U6v9ECkEZOo5E6gSZJEu44 io43w2Q0PlwasGroPhishqGWBFDdjx/gRD55G+ZFxG0EcTanNJAs8czmHnveCIefZmvV dxRQ== X-Gm-Message-State: AOJu0Yy98XrhNhQcPecljsbEI7sHBKJfsNTeslRaeaNFoyH5A4Wb8dv4 pre7uSl4nxvo3cDciUMo2qfD/P0TZ5oQvppbCikzWXZcrzKPhqt4z/PaYLw/t5Q9ZObFGL4Pgiv u X-Gm-Gg: ASbGnctNOXWcoe85GaR2qpaayMqPpBlMWADKb1wNPP1BufH6BEIYlcUUvG3H0XyhEiZ 4E3+4bZ4kiKeSJmwrlT2hqZSoVPg1eDZJ/tIptkHL9IOrLIqqS78tp9KZHaY1z5Igky8UhN6UgD zOU2I14U5nJD9pywJdYSOgcY/8X44PcXYdH5YihrIUEWgsaWPAaxPeIfyJngusgL+javfSzfPUe LFAYln8bRm7zUB/b6oeEbKtrc1XFXsBxHl7w5VnoF060YOOobpA6pdyXDQ/IX0Qa3+XLRyMujXM X-Google-Smtp-Source: AGHT+IEPzU2zUo1JcPv+W5s1fdtrNwUd+bWAyHLTS+wQkrekyW/XNjscNts29On9f7q39ZVIt63HyQ== X-Received: by 2002:a05:600c:1d1c:b0:434:f335:aa0d with SMTP id 5b1f17b1804b1-4362aa108d8mr5450065e9.2.1734083169206; Fri, 13 Dec 2024 01:46:09 -0800 (PST) Received: from NAUSH-P-DELL.pitowers.org ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4362557c502sm43989105e9.11.2024.12.13.01.46.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 01:46:08 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck Subject: [PATCH 2/6] ipa: rpi: Add erase()/eraseLocked() to RPiController::Metadata Date: Fri, 13 Dec 2024 09:38:25 +0000 Message-ID: <20241213094602.2083174-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241213094602.2083174-1-naush@raspberrypi.com> References: <20241213094602.2083174-1-naush@raspberrypi.com> MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" These function erases a key/value pair from the metadata object. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Laurent Pinchart --- src/ipa/rpi/controller/metadata.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/ipa/rpi/controller/metadata.h b/src/ipa/rpi/controller/metadata.h index eda4b59bca9a..62e54051f8f4 100644 --- a/src/ipa/rpi/controller/metadata.h +++ b/src/ipa/rpi/controller/metadata.h @@ -90,6 +90,12 @@ public: data_.insert(other.data_.begin(), other.data_.end()); } + void erase(std::string const &tag) + { + std::scoped_lock lock(mutex_); + eraseLocked(tag); + } + template T *getLocked(std::string const &tag) { @@ -110,6 +116,14 @@ public: data_[tag] = std::forward(value); } + void eraseLocked(std::string const &tag) + { + auto it = data_.find(tag); + if (it == data_.end()) + return; + data_.erase(it); + } + /* * Note: use of (lowercase) lock and unlock means you can create scoped * locks with the standard lock classes. From patchwork Fri Dec 13 09:38:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 22308 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 9D735C32EA for ; Fri, 13 Dec 2024 09:46:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A6D6267EF4; Fri, 13 Dec 2024 10:46:14 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="QWCCSakX"; dkim-atps=neutral Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 92A2567EE0 for ; Fri, 13 Dec 2024 10:46:10 +0100 (CET) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-436246b1f9bso1996515e9.1 for ; Fri, 13 Dec 2024 01:46:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1734083170; x=1734687970; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NhZXilb32109MmYRaMgOMB8Dlf9MNDOUyVd5nWppRWI=; b=QWCCSakXTu6iAePo4+NS6nE+t2VN1F5jNcqdVJJ8Ys4d7GwmO4eHZNL+7CnmQ+3wbY wCVnZgG5W30Gautq2VrMMQC8ta6sM5K4Ub9gJyst1UMO0lN2OWDctmpSriPNcoegwgCj yKMEFsy+/P8NkafZumCaRMeQiPEWAA17oAmUqIN5BFdA0/wh8W56CMfUGslkRg3gJNZM 0p3JV8ZFR+bOku4/acVHzFzYfCjxDsM4EXzthDfQ3ZCxfQU48d5tSpXD6kNniy9QkGe2 RSV2n8UEXf3QJAt1Gpg8yC0bzhqzAeADwm06dxX4ACgoDd0aNxvM+GMa07hoV7Qa6ltI /tPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734083170; x=1734687970; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NhZXilb32109MmYRaMgOMB8Dlf9MNDOUyVd5nWppRWI=; b=iJ5qULVumKTl2iKliOJoknYdQTcMub50qnbDY2arzoAWFJ8Q/CbFSx39U3Z5Yxk4Lj taxHiYLGK8CGrz1EuFTJ5evd2bSHpH1pakYRFSXx7B3YhX3mNn/C2K7y26ttmDnP+GY1 dVySG3Ikbki1SzNSjsablfTU4K1MTiprP9myFoRz90PjT0mmwxFBHOeSCJZxwecMf+96 Mf7oBupSh7BNozOVBsXgDpv/DWtVUj9yE9Y2fqoZ1GmdW+c/dqirN0g50h7UCPJTy9uS vnLuOsPegqLU07dsk3cCArV4wCLyWBrSCL9l7UxRYqyuM49lywt1fj83EQ+phKI1IxXj j5Ww== X-Gm-Message-State: AOJu0YzEGz3S7ivcVB7XJc51cz2d1PxnxEbDdx91Gc6Ij0pxcdT/nGx/ /sQnAFR/F3CvPp1oJATwJXC7zRhr6+lYse3o2l7irkMdTXtlfEqgpTn6KEJwwbIOrfRE53EcwPt 9 X-Gm-Gg: ASbGncueQ0T/hMKr6Xoc0Hk4wHycj5idoainq4RavGjrhho/kUKAw9WYyLUN45k/M+A LvBcCijxpXbqR35ikIeNwF06fEdOS34D6tinD0uaj18A1DQmXJqYws5Iw/zEeAIFot19+OPaqwp pZX/FUOiLrlfZkV4Z2qgw7Q9f3Z0DY3Qo8fzoJCrERXHKUFvM4vkIqRpolxnmSQtQOmJz0CGrPG 2VLaZ7jKTrGxlzkz8nboTwT1Y7hOtmIy8kHjK8YB5I5+VFdKx4JkvXpcEt6rWpkiuPbcU7rBEyh X-Google-Smtp-Source: AGHT+IFjcK+/PGuXECU6MqsSj1gItW/RWzcnAZjiluQ5w4DEz0CpPvAGInDB1jdg8wHu3IWAdwrfyA== X-Received: by 2002:a05:600c:6d96:b0:431:4983:e8fe with SMTP id 5b1f17b1804b1-4362aab9cafmr5239755e9.9.1734083169813; Fri, 13 Dec 2024 01:46:09 -0800 (PST) Received: from NAUSH-P-DELL.pitowers.org ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4362557c502sm43989105e9.11.2024.12.13.01.46.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 01:46:09 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck Subject: [PATCH 3/6] ipa: rpi: Add a HW property to determine if the data buffer is strided Date: Fri, 13 Dec 2024 09:38:26 +0000 Message-ID: <20241213094602.2083174-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241213094602.2083174-1-naush@raspberrypi.com> References: <20241213094602.2083174-1-naush@raspberrypi.com> MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This property (cfeDataBufferStrided) indicates if the CSI-2 hardware writes to the embedded/metadata buffer directly, or if it treats the buffer like an image buffer and strides the metadata lines. Unicam write this buffer strided, while the PiSP Frontend writes to it directly. This information will be relevant to data parsers in the helpers where the data is structured in lines. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Laurent Pinchart --- src/ipa/rpi/controller/controller.cpp | 2 ++ src/ipa/rpi/controller/controller.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/ipa/rpi/controller/controller.cpp b/src/ipa/rpi/controller/controller.cpp index e0131018e7b2..3bce88b9281e 100644 --- a/src/ipa/rpi/controller/controller.cpp +++ b/src/ipa/rpi/controller/controller.cpp @@ -39,6 +39,7 @@ static const std::map HardwareConfigMap .pipelineWidth = 13, .statsInline = false, .minPixelProcessingTime = 0s, + .cfeDataBufferStrided = true, } }, { @@ -71,6 +72,7 @@ static const std::map HardwareConfigMap * frames wider than ~16,000 pixels. */ .minPixelProcessingTime = 1.0us / 380, + .cfeDataBufferStrided = false, } }, }; diff --git a/src/ipa/rpi/controller/controller.h b/src/ipa/rpi/controller/controller.h index eff520bd61de..64f93f414524 100644 --- a/src/ipa/rpi/controller/controller.h +++ b/src/ipa/rpi/controller/controller.h @@ -49,6 +49,7 @@ public: unsigned int pipelineWidth; bool statsInline; libcamera::utils::Duration minPixelProcessingTime; + bool cfeDataBufferStrided; }; Controller(); From patchwork Fri Dec 13 09:38:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 22309 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 7DF0EC32F1 for ; Fri, 13 Dec 2024 09:46:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 608E367EF9; Fri, 13 Dec 2024 10:46:17 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="EgHoTKgr"; dkim-atps=neutral Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8A48567EEB for ; Fri, 13 Dec 2024 10:46:11 +0100 (CET) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-385db79aafbso98994f8f.1 for ; Fri, 13 Dec 2024 01:46:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1734083170; x=1734687970; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HSblzL9ARgj4fEX3/rzbo1k76l68wSLBOWWDbQdxmmA=; b=EgHoTKgrdvQ3b5HH3C3Qt5scVVaV6GrnQOPzkA+h+JLVYz4EgxK7ONzFaHtubr5tuk EHv/AYHWeJMrBpQLT1O6emjjMXfmH3FtwoXdT5LxOE74i2mkDY8IrWFuRgjQP+6RA+W+ UiUq4kUF3MtTOl6U+FGTMKrXAhQDLIlEHXHWYFATH4VN98MDutKTn+sHny+HSGGx2M6Y wjiWduFQAxEJhDMhtNV2U0rRqrHFbeSDd+gsjdacVGDLE0SjhiS0gyNg0BpctfsK1aCt JEvjdXBAxzv5dIx8HDA9wDscXYIM3a4yn1v5JOl6YcfOCwoGHIeiQ3ObUGorWRzzLsPo B1aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734083170; x=1734687970; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HSblzL9ARgj4fEX3/rzbo1k76l68wSLBOWWDbQdxmmA=; b=KFqtERW1lZOT2z4EwOUHHbtGIDngJEryAjAwCElfPVg3PNyqrfYBtDTpnIvyQUHePw Ez2053fC43le9c6IbSXFvEZfuV3eyGLo87Uh9GtIrIwFyZYPifnRVJaX2oGOqISA0jYW pVpFrsbSnH0TtS3/8O2pzWXSx8jZ3D+mGxS00yqR20ZQol5gbmKVOwRHJCj60azL4gl/ p8ntqtb6QMV8VVXGXN3vEWKr5rReSZAI7h5fdj+5QigtyLXt+VAs5YgGKpTswzmR2Pcv TuNBZfxILDyPpguxFS0JgMJ0cCTV3AjNebgOo9TjEvxygNizNy+bM3ZwfCh2J4RBYmGw dAyQ== X-Gm-Message-State: AOJu0YwxMefbH6Xqciknyxb2hnyeEyyPmP3UshMLMzc1O8BM5kGqIdfX Lsji40Scyv5XzksJgK1vkFpeOWPvaWZ88KMDhqY6nUph7uKMMEvsZH7tBI2P4AZ3Fpulwg7qZt1 c X-Gm-Gg: ASbGncvp/XmqBpmRYFeZ4euSg40GZ1Ymqyl6CVLpiAEn+63DlEDftSCrq15+4e308Sg 9k8hQQ3P5OYGVDibVTv1ElHnuLYntHCqed0dEVWYL0fBystSBqvNxis8pGLqd9AbEhuZjAU//T8 jIvC2VQDTRJKlwu7/VaxWTqNqSECgzXgu+CEd3bEsN9/s05cXiWICOl8LO+Siziw6QnQfEDzrlJ FXiZp2EzOri968J3JKueCS+ASRKSu7bA3ncOXO/twQ5qG5q4mabWjuhmUx0uARR0uyES14Vfj8n X-Google-Smtp-Source: AGHT+IEVoP/wxnIvLYkndk/DMifMcLQEK/lFq3FufDJGDHUqJFZnSFf/5VAyJlple0uHRclWvPGaQg== X-Received: by 2002:a5d:47a9:0:b0:385:fa20:6583 with SMTP id ffacd0b85a97d-38880ac637dmr416660f8f.2.1734083170462; Fri, 13 Dec 2024 01:46:10 -0800 (PST) Received: from NAUSH-P-DELL.pitowers.org ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4362557c502sm43989105e9.11.2024.12.13.01.46.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 01:46:10 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck Subject: [PATCH 4/6] controls: ipa: rpi: Add CNN controls Date: Fri, 13 Dec 2024 09:38:27 +0000 Message-ID: <20241213094602.2083174-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241213094602.2083174-1-naush@raspberrypi.com> References: <20241213094602.2083174-1-naush@raspberrypi.com> MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add the follwing RPi vendor controls to handle Convolutional Neural Network processing: CnnOutputTensor CnnOutputTensorInfo CnnEnableInputTensor CnnInputTensor CnnInputTensorInfo CnnKpiInfo These controls will be used to support the new Raspberry Pi AI Camera, using an IMX500 sensor with on-board neural network processing. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman --- src/ipa/rpi/controller/controller.h | 33 +++++++++ src/libcamera/control_ids_rpi.yaml | 108 ++++++++++++++++++++++++++++ 2 files changed, 141 insertions(+) diff --git a/src/ipa/rpi/controller/controller.h b/src/ipa/rpi/controller/controller.h index 64f93f414524..489188b44d9b 100644 --- a/src/ipa/rpi/controller/controller.h +++ b/src/ipa/rpi/controller/controller.h @@ -25,6 +25,39 @@ namespace RPiController { +/* + * The following structures are used to export the CNN input/output tensor information + * through the rpi::CnnOutputTensorInfo and rpi::CnnInputTensorInfo controls. + * Applications must cast the span to these structures exactly. + */ +static constexpr unsigned int NetworkNameLen = 64; +static constexpr unsigned int MaxNumTensors = 16; +static constexpr unsigned int MaxNumDimensions = 16; + +struct OutputTensorInfo { + uint32_t tensorDataNum; + uint32_t numDimensions; + uint16_t size[MaxNumDimensions]; +}; + +struct CnnOutputTensorInfo { + char networkName[NetworkNameLen]; + uint32_t numTensors; + OutputTensorInfo info[MaxNumTensors]; +}; + +struct CnnInputTensorInfo { + char networkName[NetworkNameLen]; + uint32_t width; + uint32_t height; + uint32_t numChannels; +}; + +struct CnnKpiInfo { + uint32_t dnnRuntime; + uint32_t dspRuntime; +}; + class Algorithm; typedef std::unique_ptr AlgorithmPtr; diff --git a/src/libcamera/control_ids_rpi.yaml b/src/libcamera/control_ids_rpi.yaml index 34bbdfc863c5..c0b5f63df525 100644 --- a/src/libcamera/control_ids_rpi.yaml +++ b/src/libcamera/control_ids_rpi.yaml @@ -55,4 +55,112 @@ controls: official libcamera API support for per-stream controls in the future. \sa ScalerCrop + + - CnnOutputTensor: + type: float + size: [n] + description: | + This control returns a span of floating point values that represent the + output tensors from a Convolutional Neural Network (CNN). The size and + format of this array of values is entirely dependent on the neural + network used, and further post-processing may need to be performed at + the application level to generate the final desired output. This control + is agnostic of the hardware or software used to generate the output + tensors. + + The structure of the span is described by the CnnOutputTensorInfo + control. + + \sa CnnOutputTensorInfo + + - CnnOutputTensorInfo: + type: uint8_t + size: [n] + description: | + This control returns the structure of the CnnOutputTensor. This structure + takes the following form: + + constexpr unsigned int NetworkNameLen = 64; + constexpr unsigned int MaxNumTensors = 16; + constexpr unsigned int MaxNumDimensions = 16; + + struct CnnOutputTensorInfo { + char networkName[NetworkNameLen]; + uint32_t numTensors; + OutputTensorInfo info[MaxNumTensors]; + }; + + with + + struct OutputTensorInfo { + uint32_t tensorDataNum; + uint32_t numDimensions; + uint16_t size[MaxNumDimensions]; + }; + + networkName is the name of the CNN used, + numTensors is the number of output tensors returned, + tensorDataNum gives the number of elements in each output tensor, + numDimensions gives the dimensionality of each output tensor, + size gives the size of each dimension in each output tensor. + + \sa CnnOutputTensor + + - CnnEnableInputTensor: + type: bool + description: | + Boolean to control if the IPA returns the input tensor used by the CNN + to generate the output tensors via the CnnInputTensor control. Because + the input tensor may be relatively large, for efficiency reason avoid + enabling input tensor output unless required for debugging purposes. + + \sa CnnInputTensor + + - CnnInputTensor: + type: uint8_t + size: [n] + description: | + This control returns a span of uint8_t pixel values that represent the + input tensor for a Convolutional Neural Network (CNN). The size and + format of this array of values is entirely dependent on the neural + network used, and further post-processing (e.g. pixel normalisations) may + need to be performed at the application level to generate the final input + image. + + The structure of the span is described by the CnnInputTensorInfo + control. + + \sa CnnInputTensorInfo + + - CnnInputTensorInfo: + type: uint8_t + size: [n] + description: | + This control returns the structure of the CnnInputTensor. This structure + takes the following form: + + constexpr unsigned int NetworkNameLen = 64; + + struct CnnInputTensorInfo { + char networkName[NetworkNameLen]; + uint32_t width; + uint32_t height; + uint32_t numChannels; + }; + + where + + networkName is the name of the CNN used, + width and height are the input tensor image width and height in pixels, + numChannels is the number of channels in the input tensor image. + + \sa CnnInputTensor + + - CnnKpiInfo: + type: int32_t + size: [2] + description: | + This control returns performance metrics for the CNN processing stage. + Two values are returned in this span, the runtime of the CNN/DNN stage + and the DSP stage in milliseconds. ... From patchwork Fri Dec 13 09:38:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 22310 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 35B99C32F2 for ; Fri, 13 Dec 2024 09:46:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C40B367EFB; Fri, 13 Dec 2024 10:46:18 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="dN5/vvac"; dkim-atps=neutral Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CCDFE67EE8 for ; Fri, 13 Dec 2024 10:46:11 +0100 (CET) Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-3862f11a13dso139015f8f.2 for ; Fri, 13 Dec 2024 01:46:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1734083171; x=1734687971; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ABhzmtZRvpmXxSShgjDOKB8Yq6zpZHSD4zqVCCPH2wI=; b=dN5/vvac5Vqv5/uLoA9LpQfz2AnieWcuVSvI9Q3hMUpiQ8KWlfn4+eHQ8y1Si79UR9 v2Traq3DHDklur9CQCk21ey6IvctE//srmdJBcSL7k7NifsZSt60zaq2+xW949pLQEkx fwvIQRIdC5zeH4ebHxX6Q2YZ1fXYUcXRe1OCL60YNZAwRP30sVN/dkNfzXyjXIEhvq4t 2rh0xO6j0gUP0Az8Z+e5skizhtG9Uc9WjNSPNMwePGh6WdK53O2Mox5zbyqNxqA0WVr5 Jss9VMrLGx6HalZhU92VrRUGxQq2denrmNc9KMnmy1UEP910cqQCclgJRZLEg5Qh6OCA DJCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734083171; x=1734687971; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ABhzmtZRvpmXxSShgjDOKB8Yq6zpZHSD4zqVCCPH2wI=; b=sqU/TjTVOZ0lvANeRLbHFdf7hswjlcVNABI06WJmnnezUtN9VCQEqxZGnR3WoNcvt/ 6H9i8zXntJzq9y4zn/8Yd6HVssjmnO3oNLGWf9KgaNqdOjWET5+4657YaVRiSZb48l0D 6/6wWozbCI+y2krnuSyFzMTlNS+b0W6CJqhRafpRoXrJOx8XQRiRFwGc7hmwO1XMMJF6 8cqObh53kAKK7QpFcm5S5deYFJzU6Ed1EhyjhE7d0m50NFChk6KuH9lxYAANMGK8o6j6 ZqyYdUAPpJMObkbrxTPFQ/qX0EVKUErHO85kvpJ8Pd2na59EEwxx07lRQSKu2eye9Wzh dFLQ== X-Gm-Message-State: AOJu0YwaxMdrfgvF7pRo4s4ACSu+/my8wScSfFL6VuvOdeyvl3G+O4qr zCCsDLMScDFggN6M2nM6GzVftXnJcEYuRCSTNfvW6/hjbrDPCuBZjLvMc6t3nUQph9Ez608Q1u0 g X-Gm-Gg: ASbGncvl7xawp3YbjtZ3/X+A1deYjyZ/8CCtyPCTBO9p1Eb/FdRqeLW20+3/Vi3gp3d Pv9YRA9Qu2PS8Vx7Sl6qRs92Clqkow8XpxCuce0f7i2i6BNkg79nBUPNGGbB7XTWftWf4qrH1OP DRYwJTqzbi0NncZcGWVqpNYQa6w8HI/eCoMBMHry2gct9XVBXpQsJewxrcNTVIQ3tfaS4KATZfp /U2/fdpNBEh7BzCFfMBc3g4WqGsKMpDNw0I/X1GsDmNV5FzTkHZun+MsvZB26TkIP90n5PV1XXP X-Google-Smtp-Source: AGHT+IEdjHRI0bMg3gh4pBka3rxvuJympF2JjHNdnTMcxGnEqJxvqbG0pp1zk4qL0pNU6cy2+/V2ow== X-Received: by 2002:a05:600c:3b02:b0:434:fecf:cb2f with SMTP id 5b1f17b1804b1-4362aa8faa0mr5396425e9.5.1734083171063; Fri, 13 Dec 2024 01:46:11 -0800 (PST) Received: from NAUSH-P-DELL.pitowers.org ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4362557c502sm43989105e9.11.2024.12.13.01.46.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 01:46:10 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck Subject: [PATCH 5/6] ipa: rpi: Handle the new CNN controls in the IPA Date: Fri, 13 Dec 2024 09:38:28 +0000 Message-ID: <20241213094602.2083174-6-naush@raspberrypi.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241213094602.2083174-1-naush@raspberrypi.com> References: <20241213094602.2083174-1-naush@raspberrypi.com> MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add code to handle the new CNN vendor controls in the Raspberry Pi IPA. The value of CnnInputTensorInfo is cached as it is the only stateful input control. All other controls are output controls, and the values are copied into directly from the rpiMetadata object if present. The camera helpers populate the rpiMetadata object if the sensor supports on-board CNN processing, such as the IMX500. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman --- src/ipa/rpi/common/ipa_base.cpp | 52 ++++++++++++++++++++++++++++++++- src/ipa/rpi/common/ipa_base.h | 2 ++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp index 5fce17e67bd6..b3656cbc730b 100644 --- a/src/ipa/rpi/common/ipa_base.cpp +++ b/src/ipa/rpi/common/ipa_base.cpp @@ -74,6 +74,7 @@ const ControlInfoMap::Map ipaControls{ { &controls::FrameDurationLimits, ControlInfo(INT64_C(33333), INT64_C(120000)) }, { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }, { &controls::rpi::StatsOutputEnable, ControlInfo(false, true, false) }, + { &controls::rpi::CnnEnableInputTensor, ControlInfo(false, true, false) }, }; /* IPA controls handled conditionally, if the sensor is not mono */ @@ -112,7 +113,7 @@ namespace ipa::RPi { IpaBase::IpaBase() : controller_(), frameLengths_(FrameLengthsQueueSize, 0s), statsMetadataOutput_(false), stitchSwapBuffers_(false), frameCount_(0), mistrustCount_(0), lastRunTimestamp_(0), - firstStart_(true), flickerState_({ 0, 0s }) + firstStart_(true), flickerState_({ 0, 0s }), cnnEnableInputTensor_(false) { } @@ -1263,6 +1264,10 @@ void IpaBase::applyControls(const ControlList &controls) statsMetadataOutput_ = ctrl.second.get(); break; + case controls::rpi::CNN_ENABLE_INPUT_TENSOR: + cnnEnableInputTensor_ = ctrl.second.get(); + break; + default: LOG(IPARPI, Warning) << "Ctrl " << controls::controls.at(ctrl.first)->name() @@ -1439,6 +1444,51 @@ void IpaBase::reportMetadata(unsigned int ipaContext) libcameraMetadata_.set(controls::HdrChannel, controls::HdrChannelNone); } + const std::shared_ptr *inputTensor = + rpiMetadata.getLocked>("cnn.input_tensor"); + if (cnnEnableInputTensor_ && inputTensor) { + unsigned int size = *rpiMetadata.getLocked("cnn.input_tensor_size"); + Span tensor{ inputTensor->get(), size }; + libcameraMetadata_.set(controls::rpi::CnnInputTensor, tensor); + /* No need to keep these big buffers any more. */ + rpiMetadata.eraseLocked("cnn.input_tensor"); + } + + const RPiController::CnnInputTensorInfo *inputTensorInfo = + rpiMetadata.getLocked("cnn.input_tensor_info"); + if (inputTensorInfo) { + Span tensorInfo{ reinterpret_cast(inputTensorInfo), + sizeof(*inputTensorInfo) }; + libcameraMetadata_.set(controls::rpi::CnnInputTensorInfo, tensorInfo); + } + + const std::shared_ptr *outputTensor = + rpiMetadata.getLocked>("cnn.output_tensor"); + if (outputTensor) { + unsigned int size = *rpiMetadata.getLocked("cnn.output_tensor_size"); + Span tensor{ reinterpret_cast(outputTensor->get()), + size }; + libcameraMetadata_.set(controls::rpi::CnnOutputTensor, tensor); + /* No need to keep these big buffers any more. */ + rpiMetadata.eraseLocked("cnn.output_tensor"); + } + + const RPiController::CnnOutputTensorInfo *outputTensorInfo = + rpiMetadata.getLocked("cnn.output_tensor_info"); + if (outputTensorInfo) { + Span tensorInfo{ reinterpret_cast(outputTensorInfo), + sizeof(*outputTensorInfo) }; + libcameraMetadata_.set(controls::rpi::CnnOutputTensorInfo, tensorInfo); + } + + const RPiController::CnnKpiInfo *kpiInfo = + rpiMetadata.getLocked("cnn.kpi_info"); + if (kpiInfo) { + libcameraMetadata_.set(controls::rpi::CnnKpiInfo, + { static_cast(kpiInfo->dnnRuntime), + static_cast(kpiInfo->dspRuntime) }); + } + metadataReady.emit(libcameraMetadata_); } diff --git a/src/ipa/rpi/common/ipa_base.h b/src/ipa/rpi/common/ipa_base.h index 1a811beb31f2..a55ce7ca9fa3 100644 --- a/src/ipa/rpi/common/ipa_base.h +++ b/src/ipa/rpi/common/ipa_base.h @@ -136,6 +136,8 @@ private: int32_t mode; utils::Duration manualPeriod; } flickerState_; + + bool cnnEnableInputTensor_; }; } /* namespace ipa::RPi */ From patchwork Fri Dec 13 09:38:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 22311 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 E0C9BC32EA for ; Fri, 13 Dec 2024 09:46:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 73CFB67EEB; Fri, 13 Dec 2024 10:46:19 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="RwrC66A6"; dkim-atps=neutral Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 649DB67EED for ; Fri, 13 Dec 2024 10:46:12 +0100 (CET) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4361aa6e517so1799315e9.2 for ; Fri, 13 Dec 2024 01:46:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1734083172; x=1734687972; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dMqIeHktniCC3ksS/cr/kuwcUfMRJ47Oehi3rhiipek=; b=RwrC66A698Fxt/oCp1Dxv+6qn8x8L9EGMuK1/8iqqDmQDpDYUZd0aU60zeOf5wfCHb eqAuSnoIZl5BS3sSivFZP69G2v7q1lXK01XUzn9bjsoAlJNt57Z40P+L+Cx9IMoBNLho vTYqZHhppMc19l33PZAAG7nwgBeq3hequcicD9BW1n7fvSZsu07J84vmFY6kT1m/h2D9 jGNWuYEPTsjojoMYE3eRAgemxlliy5kzi50aT6ej1nlUTAecJhrTjwui4tmMJpC2vuLk 8/P/SFNSzwsISdrSP/UB2bpa0PxGja7nglSbhNMIu/gMoCcCHlwcxIL7FENAPCYWrnka Higg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734083172; x=1734687972; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dMqIeHktniCC3ksS/cr/kuwcUfMRJ47Oehi3rhiipek=; b=TIH7/OWyo+5DapEZfBSKvl2WijVciva2p4PdiA4eLhjlf2yDItLaN+3uVDFVcX/H36 N3DUvvc5Phh1GL35GejvEt+WIYyi0/NacVxGVDfMxBlQESiG/470ArlepjeaF7MHCOio HtciLwOJ04xHdYUE+D8OTnihBIlh0i625LODnBzU7mDIufpxgMdM/U8HJ+E6DAEd3ShG HyF0GpvGVhrvqP8OtnYKy5ojyWGvdUszGA9PwMrECTi0RInqRP4jpWgey6EzDS1bprh0 gU6bnlQK11iJWld5poPuDoaanFObf+/TlOr849HIZkkJMH2QJjPchRaXqNs9H6bS8rHO H5dQ== X-Gm-Message-State: AOJu0YxDJJyZBc+k9iY2V/LBeFhEo+fn4n9NULoV+RdlU5YRG03fCn+t GvWH5WUWjoEKO5DW/62PMXj7XQZ0O5gjJx2jPvzhLAqEMMs0ApihUO6n+7UVeOQAoHyd8TrPfUn 8 X-Gm-Gg: ASbGnctjsw8sFN31RzmA5ZhuNFLVqba3AsQMXA3tnROJ8zlC24zWDRCpbOKoAIvzyAB TtiBiCUyzfft9PGEAw/tPxISWF33Z09y8o5adfILxWOX9YPXo2+YexyYX5hXZlD93T080RJjuCM 2dfp6WauFqoWV6PBmIrb9WHIjTMSp90raiPjgGgkQWEA3ic2LWCW/N+j6/hiERH8QOUWcy3UtfM sRL1Vqj5syi/d4OX885JocKcjRQWfsFWTOpzHQW9YHolq9KbKdrZkxeMQx2GifcGlXL9n0MUeP4 X-Google-Smtp-Source: AGHT+IHbxI9uKHgNhARwbk6XqNL9HGf/xOTOOAkFKuI6o61lV/O2/jHsjZeZwNMvuBP3IVCY41zmMg== X-Received: by 2002:a05:600c:4ed4:b0:436:1b94:2de5 with SMTP id 5b1f17b1804b1-4362aaa18damr5145315e9.5.1734083171674; Fri, 13 Dec 2024 01:46:11 -0800 (PST) Received: from NAUSH-P-DELL.pitowers.org ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4362557c502sm43989105e9.11.2024.12.13.01.46.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 01:46:11 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck Subject: [PATCH 6/6] ipa: rpi: Provide the camera helper with the hardware configuration Date: Fri, 13 Dec 2024 09:38:29 +0000 Message-ID: <20241213094602.2083174-7-naush@raspberrypi.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241213094602.2083174-1-naush@raspberrypi.com> References: <20241213094602.2083174-1-naush@raspberrypi.com> MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a CamHelper::setHwConfig() helper used by the IPA to set the hardware configuartion in use by the pipeline. This will be needed by the IMX500 camera helper in a future commit to determine if the metadata buffer is strided. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman --- src/ipa/rpi/cam_helper/cam_helper.cpp | 5 +++++ src/ipa/rpi/cam_helper/cam_helper.h | 2 ++ src/ipa/rpi/common/ipa_base.cpp | 1 + 3 files changed, 8 insertions(+) diff --git a/src/ipa/rpi/cam_helper/cam_helper.cpp b/src/ipa/rpi/cam_helper/cam_helper.cpp index 6493e88232a4..1422a02e9953 100644 --- a/src/ipa/rpi/cam_helper/cam_helper.cpp +++ b/src/ipa/rpi/cam_helper/cam_helper.cpp @@ -156,6 +156,11 @@ void CamHelper::setCameraMode(const CameraMode &mode) } } +void CamHelper::setHwConfig(const Controller::HardwareConfig &hwConfig) +{ + hwConfig_ = hwConfig; +} + void CamHelper::getDelays(int &exposureDelay, int &gainDelay, int &vblankDelay, int &hblankDelay) const { diff --git a/src/ipa/rpi/cam_helper/cam_helper.h b/src/ipa/rpi/cam_helper/cam_helper.h index 4a4ab5e68cba..fb7eb3202e79 100644 --- a/src/ipa/rpi/cam_helper/cam_helper.h +++ b/src/ipa/rpi/cam_helper/cam_helper.h @@ -76,6 +76,7 @@ public: CamHelper(std::unique_ptr parser, unsigned int frameIntegrationDiff); virtual ~CamHelper(); void setCameraMode(const CameraMode &mode); + void setHwConfig(const Controller::HardwareConfig &hwConfig); virtual void prepare(libcamera::Span buffer, Metadata &metadata); virtual void process(StatisticsPtr &stats, Metadata &metadata); @@ -108,6 +109,7 @@ protected: std::unique_ptr parser_; CameraMode mode_; + Controller::HardwareConfig hwConfig_; private: /* diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp index b3656cbc730b..a7d27ef66ec4 100644 --- a/src/ipa/rpi/common/ipa_base.cpp +++ b/src/ipa/rpi/common/ipa_base.cpp @@ -161,6 +161,7 @@ int32_t IpaBase::init(const IPASettings &settings, const InitParams ¶ms, Ini lensPresent_ = params.lensPresent; controller_.initialise(); + helper_->setHwConfig(controller_.getHardwareConfig()); /* Return the controls handled by the IPA */ ControlInfoMap::Map ctrlMap = ipaControls;