summaryrefslogtreecommitdiff
path: root/src/ipa/simple/soft_simple.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipa/simple/soft_simple.cpp')
-rw-r--r--src/ipa/simple/soft_simple.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp
index b26e4e15..c94c4cd5 100644
--- a/src/ipa/simple/soft_simple.cpp
+++ b/src/ipa/simple/soft_simple.cpp
@@ -5,6 +5,7 @@
* Simple Software Image Processing Algorithm module
*/
+#include <chrono>
#include <stdint.h>
#include <sys/mman.h>
@@ -32,6 +33,8 @@
namespace libcamera {
LOG_DEFINE_CATEGORY(IPASoft)
+using namespace std::literals::chrono_literals;
+
namespace ipa::soft {
/* Maximum number of frame contexts to be held */
@@ -50,8 +53,10 @@ public:
int init(const IPASettings &settings,
const SharedFD &fdStats,
const SharedFD &fdParams,
- const ControlInfoMap &sensorInfoMap,
- ControlInfoMap *ipaControls) override;
+ const IPACameraSensorInfo &sensorInfo,
+ const ControlInfoMap &sensorControls,
+ ControlInfoMap *ipaControls,
+ bool *ccmEnabled) override;
int configure(const IPAConfigInfo &configInfo) override;
int start() override;
@@ -88,8 +93,10 @@ IPASoftSimple::~IPASoftSimple()
int IPASoftSimple::init(const IPASettings &settings,
const SharedFD &fdStats,
const SharedFD &fdParams,
- const ControlInfoMap &sensorInfoMap,
- ControlInfoMap *ipaControls)
+ const IPACameraSensorInfo &sensorInfo,
+ const ControlInfoMap &sensorControls,
+ ControlInfoMap *ipaControls,
+ bool *ccmEnabled)
{
camHelper_ = CameraSensorHelperFactoryBase::create(settings.sensorModel);
if (!camHelper_) {
@@ -98,6 +105,8 @@ int IPASoftSimple::init(const IPASettings &settings,
<< settings.sensorModel;
}
+ context_.sensorInfo = sensorInfo;
+
/* Load the tuning data file */
File file(settings.configurationFile);
if (!file.open(File::OpenModeFlag::ReadOnly)) {
@@ -125,6 +134,8 @@ int IPASoftSimple::init(const IPASettings &settings,
if (ret)
return ret;
+ *ccmEnabled = context_.ccmEnabled;
+
params_ = nullptr;
stats_ = nullptr;
@@ -169,12 +180,12 @@ int IPASoftSimple::init(const IPASettings &settings,
* Don't save the min and max control values yet, as e.g. the limits
* for V4L2_CID_EXPOSURE depend on the configured sensor resolution.
*/
- if (sensorInfoMap.find(V4L2_CID_EXPOSURE) == sensorInfoMap.end()) {
+ if (sensorControls.find(V4L2_CID_EXPOSURE) == sensorControls.end()) {
LOG(IPASoft, Error) << "Don't have exposure control";
return -EINVAL;
}
- if (sensorInfoMap.find(V4L2_CID_ANALOGUE_GAIN) == sensorInfoMap.end()) {
+ if (sensorControls.find(V4L2_CID_ANALOGUE_GAIN) == sensorControls.end()) {
LOG(IPASoft, Error) << "Don't have gain control";
return -EINVAL;
}
@@ -194,6 +205,8 @@ int IPASoftSimple::configure(const IPAConfigInfo &configInfo)
context_.activeState = {};
context_.frameContexts.clear();
+ context_.configuration.agc.lineDuration =
+ context_.sensorInfo.minLineLength * 1.0s / context_.sensorInfo.pixelRate;
context_.configuration.agc.exposureMin = exposureInfo.min().get<int32_t>();
context_.configuration.agc.exposureMax = exposureInfo.max().get<int32_t>();
if (!context_.configuration.agc.exposureMin) {
@@ -295,15 +308,10 @@ void IPASoftSimple::processStats(const uint32_t frame,
int32_t again = sensorControls.get(V4L2_CID_ANALOGUE_GAIN).get<int32_t>();
frameContext.sensor.gain = camHelper_ ? camHelper_->gain(again) : again;
- /*
- * Software ISP currently does not produce any metadata. Use an empty
- * ControlList for now.
- *
- * \todo Implement proper metadata handling
- */
ControlList metadata(controls::controls);
for (auto const &algo : algorithms())
algo->process(context_, frame, frameContext, stats_, metadata);
+ metadataReady.emit(frame, metadata);
/* Sanity check */
if (!sensorControls.contains(V4L2_CID_EXPOSURE) ||