@@ -50,6 +50,7 @@ static const ControlInfoMap Controls({
{ &controls::AfState, ControlInfo(controls::AfStateValues) },
{ &controls::AfPause, ControlInfo(controls::AfPauseValues) },
{ &controls::AfPauseState, ControlInfo(controls::AfPauseStateValues) },
+ { &controls::AfTrigger, ControlInfo(controls::AfTriggerValues) },
}, controls::controls);
} /* namespace RPi */
@@ -19,7 +19,7 @@ public:
// An af algorithm must provide the following:
virtual void SetMode(const uint32_t &mode) = 0;
// start a cycle (in auto mode)
- virtual void Trigger() = 0;
+ virtual void Trigger(const uint32_t &trigger) = 0;
// cancel a cycle (in auto mode)
virtual void Cancel() = 0;
// pause the continuous mode
@@ -59,8 +59,16 @@ void Af::SetMode(const uint32_t &mode)
}
}
-void Af::Trigger()
-{
+void Af::Trigger(const uint32_t &trigger)
+{
+ LOG(IoBAf, Debug) << "Trigger called in mode " << mode_
+ << " with " << trigger;
+ if (mode_ == libcamera::controls::AfModeAuto) {
+ if (trigger == libcamera::controls::AfTriggerStart)
+ afReset();
+ else
+ status_.state = libcamera::controls::AfStateIdle;
+ }
}
void Af::Pause(const uint32_t &pause)
@@ -24,7 +24,7 @@ public:
void Prepare(Metadata *image_metadata) override;
void Process(StatisticsPtr &stats, Metadata *image_metadata) override;
void SetMode(const uint32_t &mode) override;
- void Trigger() override;
+ void Trigger(const uint32_t &trigger) override;
void Cancel() override;
void Pause(const uint32_t &pause) override;
void SetWindows(const libcamera::Rectangle &afWindows) override;
@@ -986,6 +986,20 @@ void IPARPi::queueRequest(const ControlList &controls)
break;
}
+ case controls::AF_TRIGGER: {
+ RPiController::AfAlgorithm *af = dynamic_cast<RPiController::AfAlgorithm *>(
+ controller_.GetAlgorithm("iob.af"));
+ if (!af) {
+ LOG(IPARPI, Warning)
+ << "Could not set AF_MODE - no AF algorithm";
+ break;
+ }
+
+ af->Trigger(ctrl.second.get<int32_t>());
+
+ break;
+ }
+
default:
LOG(IPARPI, Warning)
<< "Ctrl " << controls::controls.at(ctrl.first)->name()
When the algorithm is in auto mode, it will start a new scan, and either end in the AfStateFocused ot AfStateFailed state. The user may decide to trigger a new scan, passing the AfTrigger control down to the pipeline handler. Implement a simple trigger operation in the IPA and call it from the pipeline handler when the control is passed. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> --- include/libcamera/ipa/raspberrypi.h | 1 + src/ipa/raspberrypi/controller/af_algorithm.hpp | 2 +- src/ipa/raspberrypi/controller/iob/af.cpp | 12 ++++++++++-- src/ipa/raspberrypi/controller/iob/af.h | 2 +- src/ipa/raspberrypi/raspberrypi.cpp | 14 ++++++++++++++ 5 files changed, 27 insertions(+), 4 deletions(-)