diff options
Diffstat (limited to 'src/ipa/rkisp1/rkisp1.cpp')
-rw-r--r-- | src/ipa/rkisp1/rkisp1.cpp | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index e6aadb56..04956b2e 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -40,13 +40,18 @@ using namespace std::literals::chrono_literals; namespace ipa::rkisp1 { +/* Maximum number of frame contexts to be held */ +static constexpr uint32_t kMaxFrameContexts = 16; + class IPARkISP1 : public IPARkISP1Interface, public Module { public: + IPARkISP1(); + int init(const IPASettings &settings, unsigned int hwRevision, ControlInfoMap *ipaControls) override; int start() override; - void stop() override {} + void stop() override; int configure(const IPACameraSensorInfo &info, const std::map<uint32_t, IPAStream> &streamConfig, @@ -100,6 +105,11 @@ const ControlInfoMap::Map rkisp1Controls{ } /* namespace */ +IPARkISP1::IPARkISP1() + : context_({ {}, {}, { kMaxFrameContexts } }) +{ +} + std::string IPARkISP1::logPrefix() const { return "rkisp1"; @@ -185,6 +195,11 @@ int IPARkISP1::start() return 0; } +void IPARkISP1::stop() +{ + context_.frameContexts.clear(); +} + /** * \todo The RkISP1 pipeline currently provides an empty IPACameraSensorInfo * if the connected sensor does not provide enough information to properly @@ -222,8 +237,10 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info, << "Exposure: " << minExposure << "-" << maxExposure << " Gain: " << minGain << "-" << maxGain; - /* Clean context at configuration */ - context_ = {}; + /* Clear the IPA context before the streaming session. */ + context_.configuration = {}; + context_.activeState = {}; + context_.frameContexts.clear(); /* Set the hardware revision for the algorithms. */ context_.configuration.hw.revision = hwRevision_; @@ -286,8 +303,7 @@ void IPARkISP1::unmapBuffers(const std::vector<unsigned int> &ids) void IPARkISP1::queueRequest(const uint32_t frame, const ControlList &controls) { - /* \todo Obtain the frame context to pass to process from the FCQueue */ - IPAFrameContext frameContext; + IPAFrameContext &frameContext = context_.frameContexts.alloc(frame); for (auto const &algo : algorithms()) algo->queueRequest(context_, frame, frameContext, controls); @@ -295,8 +311,7 @@ void IPARkISP1::queueRequest(const uint32_t frame, const ControlList &controls) void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId) { - /* \todo Obtain the frame context to pass to process from the FCQueue */ - IPAFrameContext frameContext; + IPAFrameContext &frameContext = context_.frameContexts.get(frame); rkisp1_params_cfg *params = reinterpret_cast<rkisp1_params_cfg *>( @@ -315,6 +330,8 @@ void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId) void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId, const ControlList &sensorControls) { + IPAFrameContext &frameContext = context_.frameContexts.get(frame); + const rkisp1_stat_buffer *stats = reinterpret_cast<rkisp1_stat_buffer *>( mappedBuffers_.at(bufferId).planes()[0].data()); @@ -326,9 +343,6 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId unsigned int aeState = 0; - /* \todo Obtain the frame context to pass to process from the FCQueue */ - IPAFrameContext frameContext; - for (auto const &algo : algorithms()) algo->process(context_, frame, frameContext, stats); |