ipa: vc4: Implement the StatsOutputEnable vendor control
Implement the StatsOutputEnable control for the VC4 IPA. When set, this outputs the ISP statistics as a uint8_t span through the Bcm2835StatsOutput metadata control. To get this working, IpaBase::libcameraMetadata_ is moved from a private to a protected member variable. This makes it accessable to the VC4 derived IPA class. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
12ffe28e1c
commit
0110d9915e
3 changed files with 18 additions and 4 deletions
|
@ -70,7 +70,8 @@ const ControlInfoMap::Map ipaControls{
|
||||||
{ &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) },
|
{ &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) },
|
||||||
{ &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },
|
{ &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },
|
||||||
{ &controls::FrameDurationLimits, ControlInfo(INT64_C(33333), INT64_C(120000)) },
|
{ &controls::FrameDurationLimits, ControlInfo(INT64_C(33333), INT64_C(120000)) },
|
||||||
{ &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }
|
{ &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) },
|
||||||
|
{ &controls::rpi::StatsOutputEnable, ControlInfo(false, true) },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* IPA controls handled conditionally, if the sensor is not mono */
|
/* IPA controls handled conditionally, if the sensor is not mono */
|
||||||
|
@ -100,8 +101,9 @@ LOG_DEFINE_CATEGORY(IPARPI)
|
||||||
namespace ipa::RPi {
|
namespace ipa::RPi {
|
||||||
|
|
||||||
IpaBase::IpaBase()
|
IpaBase::IpaBase()
|
||||||
: controller_(), frameLengths_(FrameLengthsQueueSize, 0s), frameCount_(0),
|
: controller_(), frameLengths_(FrameLengthsQueueSize, 0s), statsMetadataOutput_(false),
|
||||||
mistrustCount_(0), lastRunTimestamp_(0), firstStart_(true), flickerState_({ 0, 0s })
|
frameCount_(0), mistrustCount_(0), lastRunTimestamp_(0), firstStart_(true),
|
||||||
|
flickerState_({ 0, 0s })
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1162,6 +1164,10 @@ void IpaBase::applyControls(const ControlList &controls)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case controls::rpi::STATS_OUTPUT_ENABLE:
|
||||||
|
statsMetadataOutput_ = ctrl.second.get<bool>();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOG(IPARPI, Warning)
|
LOG(IPARPI, Warning)
|
||||||
<< "Ctrl " << controls::controls.at(ctrl.first)->name()
|
<< "Ctrl " << controls::controls.at(ctrl.first)->name()
|
||||||
|
|
|
@ -61,6 +61,8 @@ protected:
|
||||||
/* Track the frame length times over FrameLengthsQueueSize frames. */
|
/* Track the frame length times over FrameLengthsQueueSize frames. */
|
||||||
std::deque<utils::Duration> frameLengths_;
|
std::deque<utils::Duration> frameLengths_;
|
||||||
utils::Duration lastTimeout_;
|
utils::Duration lastTimeout_;
|
||||||
|
ControlList libcameraMetadata_;
|
||||||
|
bool statsMetadataOutput_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* Number of metadata objects available in the context list. */
|
/* Number of metadata objects available in the context list. */
|
||||||
|
@ -89,7 +91,6 @@ private:
|
||||||
|
|
||||||
bool lensPresent_;
|
bool lensPresent_;
|
||||||
bool monoSensor_;
|
bool monoSensor_;
|
||||||
ControlList libcameraMetadata_;
|
|
||||||
|
|
||||||
std::array<RPiController::Metadata, numMetadataContexts> rpiMetadata_;
|
std::array<RPiController::Metadata, numMetadataContexts> rpiMetadata_;
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <linux/bcm2835-isp.h>
|
#include <linux/bcm2835-isp.h>
|
||||||
|
|
||||||
#include <libcamera/base/log.h>
|
#include <libcamera/base/log.h>
|
||||||
|
#include <libcamera/base/span.h>
|
||||||
#include <libcamera/control_ids.h>
|
#include <libcamera/control_ids.h>
|
||||||
#include <libcamera/ipa/ipa_module_info.h>
|
#include <libcamera/ipa/ipa_module_info.h>
|
||||||
|
|
||||||
|
@ -245,6 +246,12 @@ RPiController::StatisticsPtr IpaVc4::platformProcessStats(Span<uint8_t> mem)
|
||||||
stats->focus_stats[i].contrast_val_num[1][1],
|
stats->focus_stats[i].contrast_val_num[1][1],
|
||||||
stats->focus_stats[i].contrast_val_num[1][0] });
|
stats->focus_stats[i].contrast_val_num[1][0] });
|
||||||
|
|
||||||
|
if (statsMetadataOutput_) {
|
||||||
|
Span<const uint8_t> statsSpan(reinterpret_cast<const uint8_t *>(stats),
|
||||||
|
sizeof(bcm2835_isp_stats));
|
||||||
|
libcameraMetadata_.set(controls::rpi::Bcm2835StatsOutput, statsSpan);
|
||||||
|
}
|
||||||
|
|
||||||
return statistics;
|
return statistics;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue