From patchwork Thu Jan 19 10:45:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18160 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 57C45C3299 for ; Thu, 19 Jan 2023 10:46:08 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 05FBC6260D; Thu, 19 Jan 2023 11:46:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1674125168; 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=2jrHCR2os3K8V5JHlpP1LBIX+eUVB2bLJqdMsyz49qMvc4hTAKSwZOInR6rbvr/CG Zf2qPeN9w+HFIQzLz5kfMtaUyF3qNhKnWkhhViRYdrBClXZn0z8ZFW/FOfNzRe8MpX imSCsx2asflnYegAzQTF3Y8Zds75f3xGzJIt1ZvRYoICC+3AsSQDh99QcdqUMo1gkK 8Az/Sc8hpx/dAx/Qkk+EOAO9IoRZDvRjRY+EJ242zGd1AHrXcwdMG5QgAeuS/4Cz5E Mz7frcdg5GkthVWFAxiUGXo8k+WFdEEAMPGmS/Wn9OfCIY6IEGNfEiXZ0weYyoGLkt qqIKUvilaprLg== 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 71E64625FF for ; Thu, 19 Jan 2023 11:46:01 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="dWv3o0pA"; dkim-atps=neutral Received: by mail-wm1-x333.google.com with SMTP id l41-20020a05600c1d2900b003daf986faaeso923704wms.3 for ; Thu, 19 Jan 2023 02:46:01 -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=dWv3o0pA6bn4y9mAODxSjSMMTPigSVDl+rrHSMn4jjWEbAwoRQFD/e6BcUiQMXkoSu 6CDHMDWN4yMOmwfGYU7zqh/Mc8fqeQPH0a/ThSEkIoDrpu64tkG99YYWyj5zHbVOIpFt 7J8nv/SWQVdGfRG8tfOyaCbIIaJ4bL4gNLJhT8+jGm72wY5TTunGHV+rZ7gyhIDTJPzQ uM9ME4SCOkVg+jz2rMHS0iHJVlhdKKI5ke3NGLYaHVzhyQXPGqhlXAXgc7YpBRhEXHNs wjb6OUFja+ePQ+k7WB+hBV2iKfmZDHeS8VlQ9Q770LkaLcgu8N0HoX50D28ZT4yt5vxn l2PQ== 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=5IpuhlG0gTXdU4bkRkul8QBgnuFYS5cfRNlTMhcmkOIVpW/h1LONoyMK0/AFQA69mn LLVQC+3GovbysqYJgYvIAFHQnRKUjHjNcABX9W8/0EiZ+eh7xxbxiRUFLMK1+sIMsyMy FmIk47wJU13y8UiimnZMh3dUmytVoXP/etrb2BXnvQ8YDV3fHZTQeRQaWzLXd6ivCfq+ r6jeuOkWuaF2jI/q7k9KUsaIBRrTqW1dq8RV4KhqObj914QR17DwEIEpVt4dle2Ykwmc iI+vEm/+rGzPMq4lJyQ9MgXQ2qxmRbvA+B9ihfXPWH06t26nO4NSXqXgsQCgvhBL+aP6 DNAQ== X-Gm-Message-State: AFqh2kpqA05sEtOQxjzqsnb0VkYs6wiBpttCotujUY/dpM0NW230M+Z8 PjbifSL+bi4VZecjW57YzVUzZ1g066HXw5Pwpbk= X-Google-Smtp-Source: AMrXdXv6FdimLMkCXtDmVXXxXPcy9W3VBah8SNz1zQ9fe0G5/7xRuEB16akq5sY1l/LQGD04IR0jhA== X-Received: by 2002:a05:600c:1d8e:b0:3d1:ebdf:d586 with SMTP id p14-20020a05600c1d8e00b003d1ebdfd586mr9670680wms.29.1674125160748; Thu, 19 Jan 2023 02:46:00 -0800 (PST) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id be12-20020a05600c1e8c00b003db06224953sm5332029wmb.41.2023.01.19.02.46.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jan 2023 02:46:00 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Thu, 19 Jan 2023 10:45:42 +0000 Message-Id: <20230119104544.9456-13-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230119104544.9456-1-naush@raspberrypi.com> References: <20230119104544.9456-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 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);