From patchwork Mon Jul 12 10:02:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 12904 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 07557C3224 for ; Mon, 12 Jul 2021 10:02:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B01446852A; Mon, 12 Jul 2021 12:02:21 +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="shSnnXUA"; dkim-atps=neutral Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3AB4F6852A for ; Mon, 12 Jul 2021 12:02:18 +0200 (CEST) Received: by mail-wm1-x32d.google.com with SMTP id l4-20020a05600c4f04b0290220f8455631so3473715wmq.1 for ; Mon, 12 Jul 2021 03:02:18 -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=VHbiovgBa81RqZUmpEMLgj2ypP55uY9DSSVQxj3EZM4=; b=shSnnXUAELm87sM1eTiiTuLvGlK7B52c60NUQTm9W4SPSlgEupwtEstVvjQySe6WjA lbfjE/0KXLkqZj7mjhF+HJjBZ4gC9ww+pS/60kl33gBbVpkV8rpA4yzxuRGREsQTJx1/ tu8oHN9Vk99oX140Gl9hbFRIEF6xMR/DabKACyqQ2c77ZOozQvADlRtZQiSHjFKxMWxn 68mI4IAWr2OA6Dd+MmM/uMzvEa/AKSq6FY8g1zgUu01gjAzqzUQAfdvTCM+rp3kVmoht mleGFwS/08/j2b50gZrzN/CmnetJ1pN7YhKiqBScoj9Zzw8sLGGmV2cAlqDeoXHdzccs N92w== 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=VHbiovgBa81RqZUmpEMLgj2ypP55uY9DSSVQxj3EZM4=; b=BoCk31AzzFA+cBEUk9VXfQzhKfG1/FOgzwWI5MjXmfUZWOU1V8uEzBPWXgjFbj0vBF BdB7tzrkk2xoi0kQ8lUoePm3vRON6lJMhULzfXec1pxPzOZtZowXIoAVePe4vQJNjRrT rBFABfTIMqexOg49iUQnQLJv6jyzS8/eXHPMZjszh/1z4nXLZl20Sds8iL4IAqDlPvGh rcwgJ7Z26JO42wRVjDhjMF2e2kAskBpzib6h6zsfy4ZqSBHunrtqneYBrC7C6iPSpeFp LkyBoqX7GhRlap746/tbNFe94HSQN/CWVE6cA5FXKQDX8DzoPu9OJzxUwTr9zrZTswWr 1UUw== X-Gm-Message-State: AOAM5314mgAWUJQkAuHsw6HTw1ZHirBFZ3K/5vgLxSr+cYrmIO0GFkyt J97AyE/FD30oORwc3BafsSuqRJLEfLzAjA== X-Google-Smtp-Source: ABdhPJzfGhh2nG4dKJD1GzlMfzirYN6xlZx9Do+Jjj1ckEokneBZsnvkVcd0X3UHRT7UuWNP4pxQcQ== X-Received: by 2002:a1c:1bc3:: with SMTP id b186mr13655814wmb.27.1626084137707; Mon, 12 Jul 2021 03:02:17 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:3395:5e50:10bb:f8fd]) by smtp.gmail.com with ESMTPSA id b16sm14249941wrs.51.2021.07.12.03.02.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 03:02:17 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Mon, 12 Jul 2021 11:02:04 +0100 Message-Id: <20210712100209.447893-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210712100209.447893-1-naush@raspberrypi.com> References: <20210712100209.447893-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v7 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 Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/ipa/raspberrypi/cam_helper.cpp | 5 +---- .../raspberrypi/controller/device_status.cpp | 20 +++++++++++++++++++ .../raspberrypi/controller/device_status.h | 4 ++++ src/ipa/raspberrypi/meson.build | 1 + src/ipa/raspberrypi/raspberrypi.cpp | 5 +---- 5 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 src/ipa/raspberrypi/controller/device_status.cpp 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.cpp b/src/ipa/raspberrypi/controller/device_status.cpp new file mode 100644 index 000000000000..7b8218ca67d5 --- /dev/null +++ b/src/ipa/raspberrypi/controller/device_status.cpp @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ +/* + * Copyright (C) 2021, Raspberry Pi (Trading) Limited + * + * device_status.cpp - device (image sensor) status + */ +#include "device_status.h" + +using namespace libcamera; /* for the Duration operator<< overload */ + +std::ostream &operator<<(std::ostream &out, const DeviceStatus &d) +{ + out << "Exposure: " << d.shutter_speed + << " Gain: " << d.analogue_gain + << " Aperture: " << d.aperture + << " Lens: " << d.lens_position + << " Flash: " << d.flash_intensity; + + return out; +} diff --git a/src/ipa/raspberrypi/controller/device_status.h b/src/ipa/raspberrypi/controller/device_status.h index 73df7ce228dd..ec4bbe738b35 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,8 @@ struct DeviceStatus { { } + friend std::ostream &operator<<(std::ostream &out, const DeviceStatus &d); + /* time shutter is open */ libcamera::utils::Duration shutter_speed; double analogue_gain; diff --git a/src/ipa/raspberrypi/meson.build b/src/ipa/raspberrypi/meson.build index c98550180d7b..1af31e4aa021 100644 --- a/src/ipa/raspberrypi/meson.build +++ b/src/ipa/raspberrypi/meson.build @@ -40,6 +40,7 @@ rpi_ipa_sources = files([ 'controller/rpi/contrast.cpp', 'controller/rpi/sdn.cpp', 'controller/pwl.cpp', + 'controller/device_status.cpp', ]) mod = shared_module(ipa_name, 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); }