From patchwork Wed Jun 29 08:57:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 16423 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 45FAEBD808 for ; Wed, 29 Jun 2022 08:57:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0771865640; Wed, 29 Jun 2022 10:57:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656493053; bh=cTDyvnhIURTW0R4V5fGA65Hb3TQoxTJ7BxIYsVxB5/k=; 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=E5zTKZWeD1BVGHhNvQuSsceapeG6Tu6+2hPE5mLHMl13kPMmSJykjlvMq8Vx2a6mB fToYGCC+vLSZC8QeqcN4TnFjXxNiHEXhifNMgEtfYE8+kO8my7qSLcFnHo2s8YDLkF nwzSobn1MqEVOwTxQpLLwD/++mxvuifxBFqp3YCEv80EbRsIEjjpKDm3zM6nLJPosJ vCPqRAMCOot8asTFx5oUWuFgAjS2A93k35GgcNifGJEQxdql4gKOvka5e1bMxYDkCT Efu+rzWYkD2lQ/r7sCy8ksk1fJ55cWQo9uP3zRPOqLA/85BQ9Mz8iuZF/j/LILSIK4 sTocnXNZET+CQ== Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1B8C565632 for ; Wed, 29 Jun 2022 10:57:29 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="G25mraLt"; dkim-atps=neutral Received: by mail-wr1-x432.google.com with SMTP id d17so15718855wrc.10 for ; Wed, 29 Jun 2022 01:57:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=weQED+1mys2mhgHP4iQlmcHoTRJvWho5Ugz62KPfY20=; b=G25mraLtkeEEktCfQjyUp5t7uY3DDCdg9knRZkE7l1zpyJ3+9lLI8aW6ALJ9phGOwJ K4v+ZNbk89uDRCuPs0T0VxCvpYqV02Umh1OgoYBJE4sNjvnJxK3Wfb5o7dm9YDqN9nDl z/WWNrijfwrxqZt9g9usAV1gAyL0EFgJ7elFeoARJS56qsFmQmsaK8Ita5UrgdxAQTnw +Zax3sLtOpYaV7ONJPk1C2o2uSmvhQ7WlH+DkmffmbvKnGPPWNxRiDeUrVBQJs9UP/rD 8hHB6bC4De6VEcUk0qPfYbeycdg6BhqGqSm6Qq7kchr7viTf/GMpVk5k4ugWQ0tgYfmT 3VQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=weQED+1mys2mhgHP4iQlmcHoTRJvWho5Ugz62KPfY20=; b=kc9VFdZzW5Ebp95GAnYmSDMJmcgnrRpw8yr4TfOpeM4lqCZKEyHWYlwxHEar8/w/LE RPIJ426LaTHty9iEI2STiHRMkminZOXzCmo5vXE2cuazAkwJ83bg/zz9p64hyRL5kToS djTJImHZP5NrDgnCzEo1vF26Xl5zxGDITNMu+qOnSgZX0RCljVMr1lbt3yWlG2Mqw8is CF2a7a8JG63gSX6D937WG1ga11kLdtGrPJLitugrwDM5v1d7OHTjJq4fRZX9TtnN91te dw945cnDAWQm1Opez5cMcu6jtrH/iC5K8BsN6KFHqsghZTZb4NwkzjWuao571F3/qcDq bEtA== X-Gm-Message-State: AJIora9aj6kPLdZIBrUJ8/6HLdm3qGMt2xZ4EzPaZJXXYOrcVCnBhnqI xq+gb9zegQT4GRGQiRz1yvkY7S+5r9GJgzB/ X-Google-Smtp-Source: AGRyM1sVMXQ37PcpZ3gSYSbHo9c23Cfn3hyLpLmcAGF7jg/P1R/7MfqcXw1fMifowayflAP3StxUWA== X-Received: by 2002:adf:e5d2:0:b0:21b:bfd5:cacd with SMTP id a18-20020adfe5d2000000b0021bbfd5cacdmr1955877wrn.474.1656493048482; Wed, 29 Jun 2022 01:57:28 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id f15-20020a05600c154f00b003a032c88877sm2897102wmg.15.2022.06.29.01.57.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 01:57:27 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 29 Jun 2022 09:57:20 +0100 Message-Id: <20220629085722.11786-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220629085722.11786-1-naush@raspberrypi.com> References: <20220629085722.11786-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 2/4] ipa: raspberrypi: Add sensor temperature 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 an optional sensor_temperature field to the DeviceStatus structure. If a temperature measurement is available for a frame, the value is returned out through the SensorTemperature control in the Request metadata. Additionally, provide the sensor temperature value from the std::ostream &operator<< overload. Signed-off-by: Naushir Patuck Reviewed-by: Kieran Bingham Reviewed-by: David Plowman --- src/ipa/raspberrypi/cam_helper.cpp | 8 +++++--- src/ipa/raspberrypi/controller/device_status.cpp | 3 +++ src/ipa/raspberrypi/controller/device_status.h | 3 +++ src/ipa/raspberrypi/raspberrypi.cpp | 2 ++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp index 74179399e86a..3f81d4187d4d 100644 --- a/src/ipa/raspberrypi/cam_helper.cpp +++ b/src/ipa/raspberrypi/cam_helper.cpp @@ -185,9 +185,9 @@ void CamHelper::parseEmbeddedData(Span buffer, metadata.Merge(parsedMetadata); /* - * Overwrite the exposure/gain values in the existing DeviceStatus with - * values from the parsed embedded buffer. Fetch it first in case any - * other fields were set meaningfully. + * Overwrite the exposure/gain, frame length and sensor temperature values + * in the existing DeviceStatus with values from the parsed embedded buffer. + * Fetch it first in case any other fields were set meaningfully. */ DeviceStatus deviceStatus, parsedDeviceStatus; if (metadata.Get("device.status", deviceStatus) || @@ -199,6 +199,8 @@ void CamHelper::parseEmbeddedData(Span buffer, deviceStatus.shutter_speed = parsedDeviceStatus.shutter_speed; deviceStatus.analogue_gain = parsedDeviceStatus.analogue_gain; deviceStatus.frame_length = parsedDeviceStatus.frame_length; + if (parsedDeviceStatus.sensor_temperature) + deviceStatus.sensor_temperature = parsedDeviceStatus.sensor_temperature; LOG(IPARPI, Debug) << "Metadata updated - " << deviceStatus; diff --git a/src/ipa/raspberrypi/controller/device_status.cpp b/src/ipa/raspberrypi/controller/device_status.cpp index f052ea8b7bed..05897fc15b50 100644 --- a/src/ipa/raspberrypi/controller/device_status.cpp +++ b/src/ipa/raspberrypi/controller/device_status.cpp @@ -17,5 +17,8 @@ std::ostream &operator<<(std::ostream &out, const DeviceStatus &d) << " Lens: " << d.lens_position << " Flash: " << d.flash_intensity; + if (d.sensor_temperature) + out << " Temperature: " << *d.sensor_temperature; + return out; } diff --git a/src/ipa/raspberrypi/controller/device_status.h b/src/ipa/raspberrypi/controller/device_status.h index c4a5d9c8e8c7..eca3bf4b042e 100644 --- a/src/ipa/raspberrypi/controller/device_status.h +++ b/src/ipa/raspberrypi/controller/device_status.h @@ -7,6 +7,7 @@ #pragma once #include +#include #include @@ -36,4 +37,6 @@ struct DeviceStatus { double aperture; /* proportional to brightness with 0 = no flash, 1 = maximum flash */ double flash_intensity; + /* Sensor reported temperature value (in degrees) */ + std::optional sensor_temperature; }; diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 3b126bb5175e..cb0025a17aff 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -491,6 +491,8 @@ void IPARPi::reportMetadata() libcameraMetadata_.set(controls::AnalogueGain, deviceStatus->analogue_gain); libcameraMetadata_.set(controls::FrameDuration, helper_->Exposure(deviceStatus->frame_length).get()); + if (deviceStatus->sensor_temperature) + libcameraMetadata_.set(controls::SensorTemperature, *deviceStatus->sensor_temperature); } AgcStatus *agcStatus = rpiMetadata_.GetLocked("agc.status");