diff options
-rw-r--r-- | src/ipa/rkisp1/rkisp1.cpp | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index 01bb54fb..53b53f12 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -28,6 +28,7 @@ #include "libcamera/internal/mapped_framebuffer.h" #include "libcamera/internal/yaml_parser.h" +#include "algorithms/af.h" #include "algorithms/agc.h" #include "algorithms/algorithm.h" #include "algorithms/awb.h" @@ -295,9 +296,56 @@ void IPARkISP1::unmapBuffers(const std::vector<unsigned int> &ids) } void IPARkISP1::queueRequest([[maybe_unused]] const uint32_t frame, - [[maybe_unused]] const ControlList &controls) + const ControlList &controls) { - /* \todo Start processing for 'frame' based on 'controls'. */ + using namespace algorithms; + + for (auto const &ctrl : controls) { + unsigned int ctrlEnum = ctrl.first; + const ControlValue &ctrlValue = ctrl.second; + + LOG(IPARkISP1, Debug) << "Request ctrl: " + << controls::controls.at(ctrlEnum)->name() + << " = " << ctrlValue.toString(); + + switch (ctrlEnum) { + case controls::AF_MODE: { + Af *af = getAlgorithm<Af>(); + if (!af) { + LOG(IPARkISP1, Warning) << "Could not set AF_MODE - no AF algorithm"; + break; + } + + af->setMode(static_cast<controls::AfModeEnum>(ctrlValue.get<int32_t>())); + break; + } + case controls::AF_TRIGGER: { + Af *af = getAlgorithm<Af>(); + if (!af) { + LOG(IPARkISP1, Warning) << "Could not set AF_TRIGGER - no AF algorithm"; + break; + } + + af->setTrigger(static_cast<controls::AfTriggerEnum>(ctrlValue.get<int32_t>())); + break; + } + case controls::AF_PAUSE: { + Af *af = getAlgorithm<Af>(); + if (!af) { + LOG(IPARkISP1, Warning) << "Could not set AF_TRIGGER - no AF algorithm"; + break; + } + + af->setPause(static_cast<controls::AfPauseEnum>(ctrlValue.get<int32_t>())); + break; + } + default: + LOG(IPARkISP1, Warning) + << "Ctrl " << controls::controls.at(ctrlEnum)->name() + << " is not handled."; + break; + } + } } void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId) |