summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2021-07-12 11:02:04 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-07-12 15:57:05 +0300
commitf24d83720f0ecd5656699f5013d7b5532e6e72c2 (patch)
tree74c3be8fc9897efe6c03a0ee78575c7c40e1c721
parentdf8cafaf8788eb27c25576ce94ca605f8a50527d (diff)
ipa: raspberrypi: Add an operator<< to struct DeviceStatus
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 <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/ipa/raspberrypi/cam_helper.cpp5
-rw-r--r--src/ipa/raspberrypi/controller/device_status.cpp20
-rw-r--r--src/ipa/raspberrypi/controller/device_status.h4
-rw-r--r--src/ipa/raspberrypi/meson.build1
-rw-r--r--src/ipa/raspberrypi/raspberrypi.cpp5
5 files changed, 27 insertions, 8 deletions
diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp
index e6d2258c..1ec3f03e 100644
--- a/src/ipa/raspberrypi/cam_helper.cpp
+++ b/src/ipa/raspberrypi/cam_helper.cpp
@@ -188,10 +188,7 @@ void CamHelper::parseEmbeddedData(Span<const uint8_t> 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 00000000..7b8218ca
--- /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 73df7ce2..ec4bbe73 100644
--- a/src/ipa/raspberrypi/controller/device_status.h
+++ b/src/ipa/raspberrypi/controller/device_status.h
@@ -6,6 +6,8 @@
*/
#pragma once
+#include <iostream>
+
#include <libcamera/base/utils.h>
/*
@@ -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 c9855018..1af31e4a 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 4ae81f35..ebae2c55 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);
}