LG1PCloudAmbStncl: Use RangeDescriptor obj instead of StagingBuffer
We directly use an instance of RangeDescriptor to avoid incurring the memory cost of using a StagingBuffer here. It's unnecessary since these stencils will always be 32bits large.
This commit is contained in:
@@ -18,16 +18,6 @@ class PcloudAmbienceStencil
|
||||
public:
|
||||
typedef uint32_t PcloudAmbienceStimulusValue;
|
||||
|
||||
/**
|
||||
* RangeDescriptor describes a contiguous range of body spots for
|
||||
* point cloud ambience stencils.
|
||||
*/
|
||||
struct RangeDescriptor : public Stencil::RangeDescriptor
|
||||
{
|
||||
uint32_t bodySpot;
|
||||
size_t nContiguousSpots;
|
||||
};
|
||||
|
||||
PcloudAmbienceStencil() = default;
|
||||
virtual ~PcloudAmbienceStencil() = default;
|
||||
};
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define _STENCIL_H
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <mentalEntity.h>
|
||||
|
||||
namespace smo {
|
||||
@@ -40,6 +41,8 @@ public:
|
||||
*/
|
||||
struct RangeDescriptor
|
||||
{
|
||||
uint32_t bodySpot;
|
||||
size_t nContiguousSpots;
|
||||
};
|
||||
|
||||
Stencil() = default;
|
||||
|
||||
@@ -15,7 +15,6 @@ if(ENABLE_STIMBUFFAPI_livoxGen1)
|
||||
add_library(livoxGen1 SHARED
|
||||
livoxGen1.cpp
|
||||
pcloudStimulusProducer.cpp
|
||||
lg1PcloudAmbienceStencil.cpp
|
||||
ioUringAssemblyEngine.cpp
|
||||
openClCollatingAndMeshingEngine.cpp
|
||||
openClKernels.cl.S
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
#include "lg1PcloudAmbienceStencil.h"
|
||||
#include <unistd.h>
|
||||
|
||||
namespace smo {
|
||||
namespace stim_buff {
|
||||
|
||||
// Common IOEngineConstraints for LG1 ambience stencil StagingBuffer
|
||||
// (used for both input and output constraints)
|
||||
const StagingBuffer::IOEngineConstraints
|
||||
LG1PcloudAmbienceStencil::stencilBufferConstraints(
|
||||
// slotStartAlignmentByteVal, slotPadToNBytes.
|
||||
sizeof(void*),
|
||||
sizeof(PcloudAmbienceStencil::RangeDescriptor),
|
||||
// frameStartAlignmentByteVal, framePadToNBytes.
|
||||
static_cast<size_t>(sysconf(_SC_PAGE_SIZE)),
|
||||
static_cast<size_t>(sysconf(_SC_PAGE_SIZE)));
|
||||
|
||||
} // namespace stim_buff
|
||||
} // namespace smo
|
||||
@@ -3,37 +3,23 @@
|
||||
|
||||
#include "livoxGen1.h"
|
||||
#include <user/pcloudAmbienceStencil.h>
|
||||
#include <user/stagingBuffer.h>
|
||||
#include <unistd.h>
|
||||
#include <user/stencil.h>
|
||||
|
||||
namespace smo {
|
||||
namespace stim_buff {
|
||||
|
||||
/**
|
||||
* LG1PcloudAmbienceStencil represents Livox Gen1-specific stencils for
|
||||
* ambience data. The StagingBuffer is sized to handle the worst-case scenario
|
||||
* where every ambience body spot requires its own descriptor
|
||||
* (nDgramsPerFrame slots).
|
||||
* ambience data. It holds a single RangeDescriptor with bodySpot=0 and
|
||||
* nContiguousSpots=1.
|
||||
*/
|
||||
class LG1PcloudAmbienceStencil
|
||||
: public PcloudAmbienceStencil
|
||||
{
|
||||
public:
|
||||
// Common IOEngineConstraints for stencil buffer (used for both input and output)
|
||||
static const StagingBuffer::IOEngineConstraints stencilBufferConstraints;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param nDgramsPerFrame Number of datagrams per frame, used to size the
|
||||
* stencil buffer for worst-case scenario (one descriptor per dgram)
|
||||
*/
|
||||
explicit LG1PcloudAmbienceStencil(size_t nDgramsPerFrame)
|
||||
explicit LG1PcloudAmbienceStencil()
|
||||
: PcloudAmbienceStencil(),
|
||||
stencilBuffer(
|
||||
stencilBufferConstraints, // Input constraints
|
||||
stencilBufferConstraints, // Output constraints (same as input)
|
||||
nDgramsPerFrame),
|
||||
nRangeDescriptors(0)
|
||||
rangeDescriptor{0, 1}
|
||||
{}
|
||||
|
||||
~LG1PcloudAmbienceStencil() = default;
|
||||
@@ -41,36 +27,33 @@ public:
|
||||
// Implement pure virtual functions from Stencil
|
||||
bool hasData() const override
|
||||
{
|
||||
return nRangeDescriptors > 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t getRelevantCount() const override
|
||||
{
|
||||
// TODO: Implement based on range descriptors
|
||||
return 0;
|
||||
return rangeDescriptor.nContiguousSpots;
|
||||
}
|
||||
|
||||
bool isRelevant(size_t offset) const override
|
||||
{
|
||||
// TODO: Implement based on range descriptors
|
||||
(void)offset;
|
||||
return false;
|
||||
return (offset >= rangeDescriptor.bodySpot &&
|
||||
offset < rangeDescriptor.bodySpot + rangeDescriptor.nContiguousSpots);
|
||||
}
|
||||
|
||||
size_t getNRangeDescriptors() const override
|
||||
{
|
||||
return nRangeDescriptors;
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool buildStencilMetadata() override
|
||||
{
|
||||
// TODO: Implement stencil metadata building
|
||||
// Metadata is already built (single fixed descriptor)
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
StagingBuffer stencilBuffer;
|
||||
size_t nRangeDescriptors;
|
||||
smo::cologex::Stencil::RangeDescriptor rangeDescriptor;
|
||||
};
|
||||
|
||||
} // namespace stim_buff
|
||||
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
|
||||
// Construct stencils and add to list (FIFO behavior)
|
||||
for (size_t i = 0; i < nStencils; ++i) {
|
||||
stencils.emplace_back(nDgramsPerFrame_);
|
||||
stencils.emplace_back();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user