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.
This commit is contained in:
@@ -5,8 +5,11 @@
|
||||
#include <cstdint>
|
||||
#include <list>
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <user/stimulusBuffer.h>
|
||||
#include <user/stagingBuffer.h>
|
||||
#include <user/deviceAttachmentSpec.h>
|
||||
#include "lg1PcloudAmbienceStencil.h"
|
||||
|
||||
namespace smo {
|
||||
@@ -30,15 +33,52 @@ public:
|
||||
const StagingBuffer::IOEngineConstraints& outputEngineConstraints,
|
||||
const SmoCallbacks& callbacks,
|
||||
cl_mem_flags flags,
|
||||
uint32_t ambienceHighVal_,
|
||||
size_t nStencils_, size_t nDgramsPerFrame_)
|
||||
: StimulusBuffer(
|
||||
parent, deviceAttachmentSpec, histbuffMs,
|
||||
inputEngineConstraints, outputEngineConstraints,
|
||||
callbacks, flags),
|
||||
ambienceHighVal(ambienceHighVal_),
|
||||
nStencils(nStencils_)
|
||||
{
|
||||
// Parse postrinInterestThreshold from qualeIfaceApiParams
|
||||
const std::vector<std::string> postrinInterestThresholdParamNames = {
|
||||
"postrin-interest-threshold",
|
||||
"postrin-interest"
|
||||
};
|
||||
|
||||
/** EXPLANATION:
|
||||
* The default postrin threshold is determined as follows:
|
||||
* We want 90% of the scanned points to have intensity under the
|
||||
* lowVal to consider the ambience criterion met.
|
||||
*
|
||||
* If nDgramsPerFrame_ (the number of datagrams per frame) is less
|
||||
* than 10, we require that all frames (100%) be under the lowVal.
|
||||
* This is because, for such small sample sizes, calculating 90%
|
||||
* does not yield a meaningful integer; for example, 90% of 7 is
|
||||
* 6.3, but we must count whole frames that meet the threshold. By
|
||||
* using nDgramsPerFrame_ as the threshold in this case, we ensure
|
||||
* logical, all-or-nothing evaluation at low sample counts while
|
||||
* maintaining an approximate 90% requirement for larger frame
|
||||
* sizes.
|
||||
*/
|
||||
uint32_t defaultPostrinThreshold = (nDgramsPerFrame_ < 10)
|
||||
? static_cast<uint32_t>(nDgramsPerFrame_)
|
||||
: static_cast<uint32_t>(nDgramsPerFrame_ * 9 / 10);
|
||||
|
||||
postrinInterestThreshold = static_cast<uint32_t>(
|
||||
device::DeviceAttachmentSpec::parseOptionalParamAsIntWithSynonyms(
|
||||
deviceAttachmentSpec->qualeIfaceApiParams,
|
||||
postrinInterestThresholdParamNames,
|
||||
defaultPostrinThreshold));
|
||||
// Parse ambienceIntensityLowVal from qualeIfaceApiParams
|
||||
const std::vector<std::string> ambienceIntensityLowValParamNames = {
|
||||
"ambience-intensity-low-val"
|
||||
};
|
||||
ambienceIntensityLowVal = static_cast<uint32_t>(
|
||||
device::DeviceAttachmentSpec::parseOptionalParamAsIntWithSynonyms(
|
||||
deviceAttachmentSpec->qualeIfaceApiParams,
|
||||
ambienceIntensityLowValParamNames, 8));
|
||||
|
||||
// Construct stencils and add to list (FIFO behavior)
|
||||
for (size_t i = 0; i < nStencils; ++i) {
|
||||
stencils.emplace_back(nDgramsPerFrame_);
|
||||
@@ -54,7 +94,8 @@ public:
|
||||
PcloudAmbienceStimulusBuffer& operator=(PcloudAmbienceStimulusBuffer&&) = default;
|
||||
|
||||
public:
|
||||
uint32_t ambienceHighVal;
|
||||
uint32_t postrinInterestThreshold;
|
||||
uint32_t ambienceIntensityLowVal;
|
||||
size_t nStencils;
|
||||
std::list<LG1PcloudAmbienceStencil> stencils;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user