Pair APS frames with completed DVS synchronization groups in FIFO order.
More...
#include <DvsApsFusionProccessor.hpp>
Pair APS frames with completed DVS synchronization groups in FIFO order.
Callers must serialize DVS accumulation and callback registration. Fusion callbacks run synchronously under the queue mutex: do not reenter clear(), addApsData(), addSharedApsData(), or addSyncSignal() from them. Latest-only mode and positive event limits can discard input.
◆ DvsApsFusionProccessor()
| dvsense::DvsApsFusionProccessor::DvsApsFusionProccessor |
( |
size_t | max_events_per_frame = 0, |
|
|
bool | latest_only = false ) |
|
inlineexplicit |
Construct a DVS/APS fusion processor.
Initializes an empty event buffer and an event-frame object pool. When latest-only mode is enabled, queued APS and DVS groups may be discarded in favor of newer input to bound preview latency.
- Parameters
-
| max_events_per_frame | Maximum number of DVS events retained for one synchronization group. Set to 0 to retain all events. |
| latest_only | Whether to discard queued older groups when newer input arrives. |
◆ clear()
| void dvsense::DvsApsFusionProccessor::clear |
( |
| ) |
|
|
inline |
Clear all queued APS frames, completed DVS groups, and the current DVS event buffer.
Registered callbacks and processor configuration are preserved.
◆ addFusionDataCallback()
Register a non-owning callback for fused APS and DVS data.
The DVS pointer range is valid only for the duration of the callback. Registering a new callback replaces the previously registered non-owning callback. If a shared callback is also registered, this callback is invoked first.
- Parameters
-
| cb | Callback receiving the matched APS frame and the half-open DVS range [begin, end). |
◆ addSharedFusionDataCallback()
Register a callback that shares the fused DVS event buffer.
The callback may retain the shared event buffer for asynchronous processing. Registering a new callback replaces the previously registered shared callback. If a non-owning callback is also registered, the shared callback is invoked after it.
- Parameters
-
| cb | Callback receiving the matched APS frame and a shared DVS event buffer. |
◆ removeFusionDataCallback()
| void dvsense::DvsApsFusionProccessor::removeFusionDataCallback |
( |
| ) |
|
|
inline |
Remove both the non-owning and shared fusion-data callbacks.
◆ addDvsData()
| void dvsense::DvsApsFusionProccessor::addDvsData |
( |
const Event2D * | begin, |
|
|
const Event2D * | end ) |
|
inline |
Append DVS events to the current synchronization group.
If a per-frame event limit was configured, only the events that fit within the remaining capacity are retained; excess events are ignored by this fusion processor.
- Parameters
-
| begin | Pointer to the first input event. |
| end | Pointer one past the last input event. |
◆ addApsData()
| void dvsense::DvsApsFusionProccessor::addApsData |
( |
const ApsFrame | frame | ) |
|
|
inline |
Add an APS frame by making a deep copy of its pixel data.
The queued frame is independent of the input frame lifetime. In latest-only mode, queued older APS frames are discarded before this frame is added. Matching callbacks may run synchronously before this function returns.
- Parameters
-
| frame | APS frame to copy and enqueue. |
◆ addSharedApsData()
| void dvsense::DvsApsFusionProccessor::addSharedApsData |
( |
const ApsFrame & | frame | ) |
|
|
inline |
Add an APS frame by sharing its pixel storage without a deep copy.
Use this overload only when copies of the frame keep its pixel storage alive for the entire queued lifetime. Matching callbacks may run synchronously before this function returns.
- Parameters
-
| frame | APS frame whose pixel storage will be shared with the queue. |
- Warning
- Passing a frame backed only by borrowed external memory can leave queued data dangling.
◆ addSyncSignal()
| void dvsense::DvsApsFusionProccessor::addSyncSignal |
( |
const EventTriggerIn & | trigger_in | ) |
|
|
inline |
Add a synchronization signal and close the current DVS event group on a rising edge.
Signals whose polarity is not 1 are ignored. In latest-only mode, completed older DVS groups are discarded before the current group is queued. Matching callbacks may run synchronously before this function returns.
- Parameters
-
| trigger_in | Synchronization signal associated with the DVS stream. |
◆ fusionData()
| void dvsense::DvsApsFusionProccessor::fusionData |
( |
| ) |
|
|
inline |
Match queued APS frames and DVS groups in FIFO order and invoke registered callbacks.
Each iteration consumes one APS frame and one completed DVS group. The non-owning callback is invoked first, followed by the owning callback. This function is called while the fusion queue mutex is held and normally should not be called directly by users.