From patchwork Mon Jan 23 15:49:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18186 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 CC68ABEFBE for ; Mon, 23 Jan 2023 15:50:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 862A96260C; Mon, 23 Jan 2023 16:50:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1674489001; bh=9ZG7A02w3xBIZWGiPWhbv2aDDQmxJ1BjGnnw5aKsFYw=; 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=jHLtUj0TPmy6+ntcVlgQ14OeB7x9Eek1dvnsJSqEX6DpvavvO4hM238Bu2J6vzGw4 xGFGXFusOvrIxiwVlW8Rshfze/za3IP93N2BO022g+u51a9kSzhRjXEe5LRZymvYPm YcXIxVx5+UR5uk+zR8ycBKtzqS4u6RdLf7rRK6AcBQRLUW0VnunWFRKPef+7BBcB+c GSQ2Y+pjGPzrJEf0Xf3F4O3wHILOzqt7LTMbGS9t7nP4hs7lyxVHJDNPFnDjA89AJ9 /wWN24Cxj7UA5aL2rKOi6fkUwNf3FffV3PIj8s7c9jHjLCua5qg4XkfiASuuEjktsC 2HqVSDdyQDnfA== Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BE0E8625F0 for ; Mon, 23 Jan 2023 16:49:55 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="WYZoV0Te"; dkim-atps=neutral Received: by mail-wm1-x329.google.com with SMTP id m5-20020a05600c4f4500b003db03b2559eso8890636wmq.5 for ; Mon, 23 Jan 2023 07:49:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; 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=6oRk+CQDW/U6TdVVYX9FHJVOlZ4Hp8UtCy5Yhpw/CYE=; b=WYZoV0Te39I1NJvAST15J3w/4/9Rb8p+lNDDgDT+AfE31tn1sqNm9NGwpcnFRnNtSW Lgu1ww6vZzXsNCqEyyIJYV9a5KmTVHSYAEqLVeftOwXasRGw3tDw1CcDvcBgfGhGd2bw YUyjAhnT/jxWuEhPRyE30IvibC/mFmJK1+TraiQqy2qxRC+T304HrPxbZrrxBNUMiMbU TRwAuWcozwu81vsF6jtMxsxLvXcWs+BZNc6sCZsnOY1sHwnxKZUQBNVmx0YJc8CO91En yPB662TLIyAJTTOXiyfgBJiBYSEEean1G+zzpQ8fceP5TR24TcQIZkYv3LNtcZeRdKaB vdQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=6oRk+CQDW/U6TdVVYX9FHJVOlZ4Hp8UtCy5Yhpw/CYE=; b=vNOukss93A2zsrrcsxg+9TVz1/I9nBKw7pBHIS4yS+EMcq5ljHHtUnEcANcAgAWwqO poUM/X9O+Qy6lWslVRyrMLOlHWIt1MLX+UPPFQuVgEBajHLpC9p12wAwyWATOLWWZqCF QrN+aDqIwT1tZsO08OBEuMeLXR4gck+wRXCOh3EwFk1sLw3RM5LoM1hos22mhcpOuk17 WEzCRDQA87X/JApP3IifGs+jI3ocwrOzbcJFwmSUSbqbudz4byXzHOYQVyHh7U/ReOUE pX5N9uyIwaDTQGJzkv2HHiuWkcCuASNDaNhseWQmRckt47X4ToIdLR3GodeYD3xTLtnt ORNw== X-Gm-Message-State: AFqh2kqAwawevStfn4sRRCQrrMZ/T8WFMyIDwRGW6w/2UVJQsx41T5Ox b9T9HVTjnXb7sThAyrl9UpYDmCsJKSdEOlTXUp4= X-Google-Smtp-Source: AMrXdXtVvqAzB/pMNKuGhswXgDiVm5uoX6tAhyJHCefa/tzGiXYaqzwqMpuTF8nvOrUi4M8eFD5FVw== X-Received: by 2002:a05:600c:35d5:b0:3db:fc4:d018 with SMTP id r21-20020a05600c35d500b003db0fc4d018mr21761591wmq.40.1674488995227; Mon, 23 Jan 2023 07:49:55 -0800 (PST) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id n16-20020a05600c181000b003d1de805de5sm10339689wmp.16.2023.01.23.07.49.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 07:49:54 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Mon, 23 Jan 2023 15:49:32 +0000 Message-Id: <20230123154934.27803-13-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123154934.27803-1-naush@raspberrypi.com> References: <20230123154934.27803-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 12/14] ipa: raspberrypi: Add lens position to DeviceStatus 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: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add the current frame's lens position (in dioptres) to the DeviceStatus structure. This value is obtained from the AfAlgorithm::getLensPosition() member function. Return this lens position back to the pipeline handler to store in the metadata field of the request. As a drive-by, fixup some inaccurate comments in the DeviceStatus structure. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Nick Hollinghurst nick.hollinghurst@raspberrypi.com --- src/ipa/raspberrypi/controller/device_status.h | 4 ++-- src/ipa/raspberrypi/raspberrypi.cpp | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ipa/raspberrypi/controller/device_status.h b/src/ipa/raspberrypi/controller/device_status.h index 4384c2149589..c45db7499f94 100644 --- a/src/ipa/raspberrypi/controller/device_status.h +++ b/src/ipa/raspberrypi/controller/device_status.h @@ -32,9 +32,9 @@ struct DeviceStatus { /* line length for the current frame */ libcamera::utils::Duration lineLength; double analogueGain; - /* 1.0/distance-in-metres, or 0 if unknown */ + /* 1.0/distance-in-metres */ std::optional lensPosition; - /* 1/f so that brightness quadruples when this doubles, or 0 if unknown */ + /* 1/f so that brightness quadruples when this doubles */ std::optional aperture; /* proportional to brightness with 0 = no flash, 1 = maximum flash */ std::optional flashIntensity; diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index fbace14b1afe..5f7397e2ab21 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -586,6 +586,8 @@ void IPARPi::reportMetadata(unsigned int ipaContext) helper_->exposure(deviceStatus->frameLength, deviceStatus->lineLength).get()); if (deviceStatus->sensorTemperature) libcameraMetadata_.set(controls::SensorTemperature, *deviceStatus->sensorTemperature); + if (deviceStatus->lensPosition) + libcameraMetadata_.set(controls::LensPosition, *deviceStatus->lensPosition); } AgcStatus *agcStatus = rpiMetadata.getLocked("agc.status"); @@ -1352,6 +1354,11 @@ void IPARPi::fillDeviceStatus(const ControlList &sensorControls, unsigned int ip deviceStatus.analogueGain = helper_->gain(gainCode); deviceStatus.frameLength = mode_.height + vblank; + RPiController::AfAlgorithm *af = dynamic_cast( + controller_.getAlgorithm("af")); + if (af) + deviceStatus.lensPosition = af->getLensPosition(); + LOG(IPARPI, Debug) << "Metadata - " << deviceStatus; rpiMetadata_[ipaContext].set("device.status", deviceStatus);