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>
This commit is contained in:
parent
df8cafaf87
commit
f24d83720f
5 changed files with 27 additions and 8 deletions
|
@ -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);
|
||||
}
|
||||
|
|
20
src/ipa/raspberrypi/controller/device_status.cpp
Normal file
20
src/ipa/raspberrypi/controller/device_status.cpp
Normal file
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue