From patchwork Fri Jul 2 15:09:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 12794 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 8601AC0100 for ; Fri, 2 Jul 2021 15:09:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3C5C468510; Fri, 2 Jul 2021 17:09:55 +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="nBxzcD6h"; dkim-atps=neutral Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CE87068501 for ; Fri, 2 Jul 2021 17:09:52 +0200 (CEST) Received: by mail-wr1-x436.google.com with SMTP id a13so12832924wrf.10 for ; Fri, 02 Jul 2021 08:09:52 -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=O7H1hFZyFkxaWCJ77Wzb3PdS3XbH9S/vOwpeZxUZzf4=; b=nBxzcD6h8lmYCahsnYL4YfhoGJT5S795pHeMd3styf1xaVyCJf8F/HETstJ3FuyYvu FvHS2TGnFVVF7Wu6EbdMCVRFMuWQaGt6va9hBmducZG4Y9JyLeg3KbWSKjDSRMa2EgC7 QgAi/hitr3st1dyAvTpQod7TNn6Um/wtR2JuoxZPswCdpBXcxl/s8v6sWPH2ADy2bEbI h/A9lj3rDqt56oso7q1jHf0UuFNvXFLkdh3m5AV/XhunG4rWZYS0Toxwxs6AE9YdUh3z a9nNuNuBsivAn290xI1f+En9tcOHx8zF3ixc7qUeu6TA+2asYCfTq+vMeAYeQG+VYo2g R3/A== 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=O7H1hFZyFkxaWCJ77Wzb3PdS3XbH9S/vOwpeZxUZzf4=; b=uk+SByHdeEsvq+FOKPccnTgUdzk07XeqSu8jXiQrRuaT5iEFdtTmgaYmWTlM2GaZYj p6KQM67hIYl3xhbc1WqmRX4DbmjXjz5uf5aerwUweJhzJKm2MaDY8tu7GIYh6bYFrW+4 WF2+ag6zFAhkJKQE8n9IB2PwBwyl7x/FLyCQZY3a/Y9zuINWMglAYROjmPm9DU5S9lGY Jn0TWT395g8W7sTe4fhCFSHOXpZ7Aa/nLZTRLQYnSAzQZM6hs8mG3CuDrLO22jxVQbSV CY8mACLGCJUqZPdaKWuLzRmm2fa0fjhsGImtRm02cKmv0aM/R9OqCIiWLKR+Kix1vzgi bSYQ== X-Gm-Message-State: AOAM533IfI8O99OBbhdRSwATAThHuteVLqGM7wDe5TOGBeLBzPqWPq/I m3rnVLisF13a2gG2h9Tt496VyX2pt5Z9jA== X-Google-Smtp-Source: ABdhPJws4avxQLBpaB121JYLthki1EVVhGFv68znmD6vxaY55xv95qTWz2DZeHKS2w/lztlzg8tvGQ== X-Received: by 2002:a5d:668e:: with SMTP id l14mr93955wru.227.1625238592298; Fri, 02 Jul 2021 08:09:52 -0700 (PDT) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id n4sm3619335wrw.21.2021.07.02.08.09.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 08:09:51 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 2 Jul 2021 16:09:35 +0100 Message-Id: <20210702150940.226941-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210702150940.226941-1-naush@raspberrypi.com> References: <20210702150940.226941-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 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 --- 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); }