Files
salmanoff/stimBuffApis/livoxGen1/pcloudStimulusProducer.h
T
hayodea 280b6f7d1c OClCollMeshEngn: Produce ambience count; set postrin threshold
We modify the semantics/meaning of the ambience stim feature.
It now represents the number of frames whose average intensity
is below the ambienceLowVal.

We can now implement the postrin as the event wherein the number
of frames whose intensity <= ambienceLowVal exceeds
postrin-interest-threshold.
2025-11-28 02:55:24 -04:00

109 lines
3.1 KiB
C++

#ifndef _LIVOX_GEN1_PCLOUD_STIMULUS_PRODUCER_H
#define _LIVOX_GEN1_PCLOUD_STIMULUS_PRODUCER_H
#include <functional>
#include <atomic>
#include <user/stimulusProducer.h>
#include <user/stimulusFrame.h>
#include <livoxProto1/device.h>
#include <asynchronousContinuation.h>
#include <callback.h>
#include <user/stagingBuffer.h>
#include "ioUringAssemblyEngine.h"
#include "openClCollatingAndMeshingEngine.h"
#include "meshStimulusBuffer.h"
#include "pcloudIntensityStimulusBuffer.h"
#include "pcloudAmbienceStimulusBuffer.h"
namespace smo {
namespace stim_buff {
/**
* PcloudStimulusProducer is a specialized StimulusProducer for point cloud data.
*
* This class extends StimulusProducer to handle point cloud-specific stimulus
* frames, particularly those generated from LiDAR point cloud data. It
* provides additional functionality for managing point cloud frame metadata
* and processing.
*/
class PcloudStimulusProducer
: public StimulusProducer
{
public:
class PcloudFormatDesc
{
public:
enum class Format
{
XYZ,
XYZI,
};
public:
Format format;
};
public:
explicit PcloudStimulusProducer(
const std::shared_ptr<device::DeviceAttachmentSpec> &deviceAttachmentSpec,
std::shared_ptr<livoxProto1::Device> &device,
const PcloudFormatDesc& formatDesc,
size_t nDgramsPerStagingBufferFrame);
~PcloudStimulusProducer() = default;
// Non-copyable, movable
PcloudStimulusProducer(const PcloudStimulusProducer&) = delete;
PcloudStimulusProducer& operator=(const PcloudStimulusProducer&) = delete;
PcloudStimulusProducer(PcloudStimulusProducer&&) = default;
PcloudStimulusProducer& operator=(PcloudStimulusProducer&&) = default;
// Control methods
void start() override;
void stop() override;
std::shared_ptr<StimulusBuffer> getOrCreateAttachedStimulusBuffer(
const std::shared_ptr<device::DeviceAttachmentSpec>
&deviceAttachmentSpec) override;
std::shared_ptr<StimulusBuffer> getAttachedStimulusBuffer(
const std::shared_ptr<device::DeviceAttachmentSpec>& spec)
const override;
void destroyAttachedStimulusBuffer(
const std::shared_ptr<StimulusBuffer>& buffer) override;
protected:
void stimFrameProductionTimesliceInd() override;
// Callback function type for produceFrameReq
typedef std::function<void()> produceFrameReqCbFn;
public:
void produceFrameReq(smo::Callback<produceFrameReqCbFn> callback);
size_t nDgramsPerStagingBufferFrame;
std::shared_ptr<livoxProto1::Device> device;
PcloudFormatDesc formatDesc;
OpenClCollatingAndMeshingEngine openClCollatingAndMeshingEngine;
StagingBuffer assemblyBuffer;
IoUringAssemblyEngine ioUringAssemblyEngine;
StagingBuffer collationBuffer;
StagingBuffer averageIntensityBuffer;
size_t tempStimulusFrameMem;
StimulusFrame tempStimulusFrame;
std::atomic<std::shared_ptr<MeshStimulusBuffer>> meshStimulusBuffer;
std::atomic<std::shared_ptr<PcloudIntensityStimulusBuffer>>
intensityStimulusBuffer;
std::atomic<std::shared_ptr<PcloudAmbienceStimulusBuffer>>
ambienceStimulusBuffer;
private:
class ProduceFrameReq;
};
} // namespace stim_buff
} // namespace smo
#endif // _LIVOX_GEN1_PCLOUD_STIMULUS_PRODUCER_H