From patchwork Fri Jun 24 07:35:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 16364 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 E6002BD808 for ; Fri, 24 Jun 2022 07:35:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8DE0165642; Fri, 24 Jun 2022 09:35:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656056136; bh=JnEWMYEe4ljQSpx/EsezHbYzmULN6aQP59WhNtfitPs=; 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=uy65H+0EX4dyIVkXTK2nIGwhTJQyXgG+b/0O6S/GI40JJHVZStXh8gccK54UZyJA1 FRtvPVlt1MwQo3YH4fXdWNNjDCjP70RmtZBBnv3ikIQUaYx8UT/rYdOj0TL0J/71SM J71lD9vy6LNzaMnze0sloL5XvqCbzFbCgSjeeIWl4Tgq7baOteG5rB/CqJ1pm/QCTO eC+f/5OC4i7ENFgNZWsKw1JnBCI9ZlHCWDaJLznvQcqkySunu8MyH6Ddbyf+OHznbm KsnAHjbFKRpHXiD5oKJRr8YalxHv0jk2MA4B5JfEaUt51GWeuHUDgVfXp9Mw19DhBo TRO2cEhE4wEOg== Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A1C2665631 for ; Fri, 24 Jun 2022 09:35:32 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="en4gQ38i"; dkim-atps=neutral Received: by mail-wm1-x334.google.com with SMTP id e5so804335wma.0 for ; Fri, 24 Jun 2022 00:35:32 -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=TKXSDlXgMKHxKCr92d20eztm199M5cveMVtTrE2BYsA=; b=en4gQ38iGiQb9sIZ0/u9rXAidC5wPC3ivyxwMapzKkyPk2SIombamJSyclXE6fV2H2 q7D5lKAxw/zLXgD4/Pmlw32F5XggDBK47t2HXHAdwLLwh5AmZqCvbxNYvIV2xz2jOTm9 ARCiualzja16apyaB9hqbQeG7zZSxIKF/E4gAGusnZ+RVXfKhLMEIOZvxXxvi9THk189 aZtTYC8LIBmN6lOEpmiPENBpX5wRhm5t9KfAfpuDEa6W10qC9nVsjhHtQD8ajKYMpXWW njA0qP+R6xUalNfOkB9Vzd8CNJo0UCR9XVsZAQF6YbKZ7qif33J2n5++u1Qv79jV6UV+ 6dVQ== 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=TKXSDlXgMKHxKCr92d20eztm199M5cveMVtTrE2BYsA=; b=vytZontXCNEd0mS0aJ3D2qKgjMHMdFwXRhNJckYTjW9RxjbcipE4rmJeYgNEPXvdlY 4pMFYUwKoOm7VWaCUdUwbuGUCjjTRILJaDZPLi5DHKU+OhN7aVi/harHcdEbJKi7lnS3 abrneyg+NMMEuClnQzCY5TGK2rDNpAo3ke6tmVAZ3Ba/OIDwWt7oxk7m3pieVmzfDNmj uXhfA9o2DSg5pB3Om8IghGAaOhPL7BL2MZ4IlOXO1dyTXZh6oODdWj7YC9HG5wdlsa0J aXvHmx70fZkbhCQ7IE5NpOUhuVNtZjeGKheRwyiwRypfdbkOY86JAzZXuiLonkXFcxo2 Y2zA== X-Gm-Message-State: AJIora/k+0uaFhNJGXSuQABZASYqpXTtAZ45L6Z0jIfDR1PvTtRBw32t q+NJZZfUrAAsh2I+YRwcFJTtnFbZZOQ9PIL6 X-Google-Smtp-Source: AGRyM1tUlDX64Qypgw3i7IzH2JEPPHN74KIKWK7YzyiGbmkBiOMdzVGbY3xGnZ/k5/74EtY6S4UXJA== X-Received: by 2002:a05:600c:354c:b0:39c:7e86:6ff5 with SMTP id i12-20020a05600c354c00b0039c7e866ff5mr2037678wmq.145.1656056131731; Fri, 24 Jun 2022 00:35:31 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c154d00b0039ee391a024sm6695195wmg.14.2022.06.24.00.35.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 00:35:31 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 24 Jun 2022 08:35:26 +0100 Message-Id: <20220624073528.26670-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220624073528.26670-1-naush@raspberrypi.com> References: <20220624073528.26670-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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");