From patchwork Fri Jul 9 14:58:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 12886 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 01337C3225 for ; Fri, 9 Jul 2021 14:58:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9689168533; Fri, 9 Jul 2021 16:58:34 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="G05tTqeF"; dkim-atps=neutral Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 70D506851B for ; Fri, 9 Jul 2021 16:58:32 +0200 (CEST) Received: by mail-wm1-x330.google.com with SMTP id u8-20020a7bcb080000b02901e44e9caa2aso6483414wmj.4 for ; Fri, 09 Jul 2021 07:58: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=2MOHkI9d2JftDLF72AIP/Z1PbT5IJT/M0ZOVm45a6as=; b=G05tTqeFfQahWWCHmx76vZjNNueD6VVWKpIcs1DC3BIsMR8t48vkRrC01ecYzrsuDy i1EzPbx1WpNo5NrrZDbvkv5fF0pguAoYWqZkvAIXo20PMwr+skPgMn4CzHEAhyDCxnfr EokwAAKnVH3gvFdahXjO5SKjtSUBSg6WHyUP9rQ1+7Rwvfc2u0kB84KLkyV6BJJD3G8O 7jz7iSLJiJJklrLpGMNM0ERaRYH5X7Svo6Q7GPYRsN1cKWkK3IsuZ+YaHfFtpMpAOhY2 1xHHsbuq1ESTxF/7X+LVIRSjvdiIFHMIkzy2TUgUctrJoqm39ruTaQ+qXvGxhstCP+xE JiZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2MOHkI9d2JftDLF72AIP/Z1PbT5IJT/M0ZOVm45a6as=; b=rN8vzsmK+MLBchE8BAueniuk4JILAsPc+v3Xwop4u9hORDZjsaiomaE7djq4thq8B4 JxqpY6zu+oYtI7hp5H6P3UhUgB1SFNDwwoW9L5M/0C+5Mx/ezd5Vd7qESlk1K0LkRuM3 21c31I5b6j7WL4lBzDd8oKPrsfcxdOgfEVsD/9yhSE44zPXYDni87LISDyPOZTN1fTY5 E2Qq9I02SvigOon261RDNy8A2kGs1s8gauo75Dk7cyQ49dAWzS7FqoPwJJZ/6mgvbk2V wmdvpqzD6XhueDuG2F1wlS4b4abWCSIEHiAZwC4dqqHg/wtIqknlG9uMH6aYV7nCyz8Z coPw== X-Gm-Message-State: AOAM532XTKT5NFmF+9vnBBTTD8ZCg3f4VOnCI8sBcgq3oxHN4vneZuA+ 2kt/OEP/VV1UKg6006JgcJ2o2wRxiB9bPw== X-Google-Smtp-Source: ABdhPJxmwG97rw6pPRCoj+EYu41cL+Zyshoma6eJkH/xhk8bLKZzlP5Q4lpHp07mfq5wdP/c2uC93Q== X-Received: by 2002:a1c:771a:: with SMTP id t26mr39781166wmi.107.1625842711985; Fri, 09 Jul 2021 07:58:31 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:35c2:26d3:e217:4410]) by smtp.gmail.com with ESMTPSA id c2sm1480995wrn.28.2021.07.09.07.58.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jul 2021 07:58:31 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 9 Jul 2021 15:58:20 +0100 Message-Id: <20210709145825.2943443-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210709145825.2943443-1-naush@raspberrypi.com> References: <20210709145825.2943443-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 3/8] ipa: raspberrypi: Add an operator<< to struct 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add an operator<< overload to log all fields in DeviceStatus, and remove the manual logging statements in the IPA and CamHelper. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Jacopo Mondi --- src/ipa/raspberrypi/cam_helper.cpp | 5 +---- src/ipa/raspberrypi/controller/device_status.h | 15 +++++++++++++++ src/ipa/raspberrypi/raspberrypi.cpp | 5 +---- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp index e6d2258c66d7..1ec3f03e1aa3 100644 --- a/src/ipa/raspberrypi/cam_helper.cpp +++ b/src/ipa/raspberrypi/cam_helper.cpp @@ -188,10 +188,7 @@ void CamHelper::parseEmbeddedData(Span buffer, deviceStatus.shutter_speed = parsedDeviceStatus.shutter_speed; deviceStatus.analogue_gain = parsedDeviceStatus.analogue_gain; - LOG(IPARPI, Debug) << "Metadata updated - Exposure : " - << deviceStatus.shutter_speed - << " Gain : " - << deviceStatus.analogue_gain; + LOG(IPARPI, Debug) << "Metadata updated - " << deviceStatus; metadata.Set("device.status", deviceStatus); } diff --git a/src/ipa/raspberrypi/controller/device_status.h b/src/ipa/raspberrypi/controller/device_status.h index 73df7ce228dd..e2511d19b96d 100644 --- a/src/ipa/raspberrypi/controller/device_status.h +++ b/src/ipa/raspberrypi/controller/device_status.h @@ -6,6 +6,8 @@ */ #pragma once +#include + #include /* @@ -20,6 +22,19 @@ struct DeviceStatus { { } + friend std::ostream &operator<<(std::ostream &out, const DeviceStatus &d) + { + using namespace libcamera; /* for the Duration operator<< overload */ + + out << "Exposure: " << d.shutter_speed + << " Gain: " << d.analogue_gain + << " Aperture: " << d.aperture + << " Lens: " << d.lens_position + << " Flash: " << d.flash_intensity; + + return out; + } + /* time shutter is open */ libcamera::utils::Duration shutter_speed; double analogue_gain; diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 4d09a84f6532..f51c970befb5 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -1019,10 +1019,7 @@ void IPARPi::fillDeviceStatus(const ControlList &sensorControls) deviceStatus.shutter_speed = helper_->Exposure(exposureLines); deviceStatus.analogue_gain = helper_->Gain(gainCode); - LOG(IPARPI, Debug) << "Metadata - Exposure : " - << deviceStatus.shutter_speed - << " Gain : " - << deviceStatus.analogue_gain; + LOG(IPARPI, Debug) << "Metadata - " << deviceStatus; rpiMetadata_.Set("device.status", deviceStatus); }