diff options
author | Umang Jain <umang.jain@ideasonboard.com> | 2022-03-31 21:22:09 +0530 |
---|---|---|
committer | Umang Jain <umang.jain@ideasonboard.com> | 2022-04-08 15:15:43 +0530 |
commit | bc7ff6e2897f6b80368fb21bd08414125a946c8f (patch) | |
tree | 047e0e912a1bbc2f1bc539971d1888d7563efa77 | |
parent | 5647f50d30a069332ad460179e1aae9ecf103fa6 (diff) |
ipa: ipu3: Inline parseStatistics() into processStatsBuffer()
Since we have moved away from switch/case on the operation ID,
there's little reason to split the operation in two functions.
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
-rw-r--r-- | ipu3.cpp | 74 |
1 files changed, 31 insertions, 43 deletions
@@ -60,10 +60,6 @@ private: const ControlInfoMap &sensorControls, ControlInfoMap *ipaControls); void runAiq(unsigned int frame); - void parseStatistics(unsigned int frame, - int64_t frameTimestamp, - const ipu3_uapi_stats_3a *stats, - const ControlList& sensorCtrls); void setControls(unsigned int frame); @@ -379,43 +375,6 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame, const int64_t frameTimest const ipu3_uapi_stats_3a *stats = reinterpret_cast<ipu3_uapi_stats_3a *>(mem.data()); - parseStatistics(frame, frameTimestamp, stats, sensorControls); -} - -void IPAIPU3::runAiq([[maybe_unused]] unsigned int frame) -{ - /* Run algorithms into/using this context structure */ - resultsHistory_.extendOne(); - aiq::AiqResults& latestResults = resultsHistory_.latest(); - - /* Todo: Refactor AiqInputParameters interface to set following parameters. */ - aiqInputParams_.afParams.lens_position = lensPosition_; - aiqInputParams_.afParams.lens_movement_start_timestamp = lensMovementStartTime_; - - aiq_.run2a(frame, aiqInputParams_, latestResults); - - exposure_ = latestResults.ae()->exposures[0].sensor_exposure->coarse_integration_time; - gain_ = latestResults.ae()->exposures[0].sensor_exposure->analog_gain_code_global; - - /* - * Af algorithm compares the timestamp of start of the lens movement and - * that of the statistics generated to estimate whether next lens - * position should be produced. - * \todo use the lens movement start time reported by the pipeline handler. - */ - if (lensPosition_ != latestResults.af()->next_lens_position) { - utils::time_point time = utils::clock::now(); - uint64_t usecs = std::chrono::duration_cast<std::chrono::microseconds>(time.time_since_epoch()).count(); - lensMovementStartTime_ = usecs; - } - lensPosition_ = latestResults.af()->next_lens_position; -} - -void IPAIPU3::parseStatistics(unsigned int frame, - int64_t frameTimestamp, - const ipu3_uapi_stats_3a *stats, - const ControlList& sensorCtrls) -{ ControlList ctrls(controls::controls); /* \todo React to statistics and update internal state machine. */ @@ -438,11 +397,11 @@ void IPAIPU3::parseStatistics(unsigned int frame, int32_t effectiveGain = 0; ControlValue ctrlValue; - ctrlValue = sensorCtrls.get(V4L2_CID_EXPOSURE); + ctrlValue = sensorControls.get(V4L2_CID_EXPOSURE); if (!ctrlValue.isNone()) effectiveExpo = ctrlValue.get<int32_t>(); - ctrlValue = sensorCtrls.get(V4L2_CID_ANALOGUE_GAIN); + ctrlValue = sensorControls.get(V4L2_CID_ANALOGUE_GAIN); if (!ctrlValue.isNone()) effectiveGain = ctrlValue.get<int32_t>(); @@ -472,6 +431,35 @@ void IPAIPU3::parseStatistics(unsigned int frame, metadataReady.emit(frame, ctrls); } +void IPAIPU3::runAiq([[maybe_unused]] unsigned int frame) +{ + /* Run algorithms into/using this context structure */ + resultsHistory_.extendOne(); + aiq::AiqResults& latestResults = resultsHistory_.latest(); + + /* Todo: Refactor AiqInputParameters interface to set following parameters. */ + aiqInputParams_.afParams.lens_position = lensPosition_; + aiqInputParams_.afParams.lens_movement_start_timestamp = lensMovementStartTime_; + + aiq_.run2a(frame, aiqInputParams_, latestResults); + + exposure_ = latestResults.ae()->exposures[0].sensor_exposure->coarse_integration_time; + gain_ = latestResults.ae()->exposures[0].sensor_exposure->analog_gain_code_global; + + /* + * Af algorithm compares the timestamp of start of the lens movement and + * that of the statistics generated to estimate whether next lens + * position should be produced. + * \todo use the lens movement start time reported by the pipeline handler. + */ + if (lensPosition_ != latestResults.af()->next_lens_position) { + utils::time_point time = utils::clock::now(); + uint64_t usecs = std::chrono::duration_cast<std::chrono::microseconds>(time.time_since_epoch()).count(); + lensMovementStartTime_ = usecs; + } + lensPosition_ = latestResults.af()->next_lens_position; +} + void IPAIPU3::setControls(unsigned int frame) { ControlList sensorCtrls(ctrls_); |