Implement new intrin params; fix parseSynonyms
Previously parseSynonyms didn't properly return the last provided synonym of the param in question, so fix it here to do that.
This commit is contained in:
@@ -10,11 +10,23 @@
|
||||
#include <user/stimulusBuffer.h>
|
||||
#include <user/stagingBuffer.h>
|
||||
#include <user/deviceAttachmentSpec.h>
|
||||
#include <user/intrinThresholdParams.h>
|
||||
#include "lg1PcloudAmbienceStencil.h"
|
||||
|
||||
namespace smo {
|
||||
namespace stim_buff {
|
||||
|
||||
inline intrin::ParsedThresholdParam parsePostrinInterestParam(
|
||||
const std::shared_ptr<device::DeviceAttachmentSpec>& deviceAttachmentSpec)
|
||||
{
|
||||
return intrin::parseOptionalThresholdParam(
|
||||
deviceAttachmentSpec->qualeIfaceApiParams,
|
||||
intrin::kPosIntPcParamNames,
|
||||
intrin::kPosIntThrParamNames,
|
||||
90,
|
||||
intrin::ThresholdUnit::Percentage);
|
||||
}
|
||||
|
||||
// Forward declaration
|
||||
class StimulusProducer;
|
||||
|
||||
@@ -40,22 +52,18 @@ public:
|
||||
callbacks, flags),
|
||||
nStencils(nStencils_)
|
||||
{
|
||||
// Parse postrinInterestPercentage (interpreted as percentage 0-100)
|
||||
const std::vector<std::string> postrinInterestThresholdParamNames = {
|
||||
"postrin-interest-percentage",
|
||||
"postrin-interest-pc",
|
||||
"postrin-interest"
|
||||
};
|
||||
intrin::validateNoForbiddenUnitlessIntrinParams(
|
||||
deviceAttachmentSpec->qualeIfaceApiParams);
|
||||
|
||||
postrinInterestPercentage = static_cast<uint32_t>(
|
||||
device::DeviceAttachmentSpec::parseOptionalParamAsIntWithSynonyms(
|
||||
deviceAttachmentSpec->qualeIfaceApiParams,
|
||||
postrinInterestThresholdParamNames,
|
||||
90));
|
||||
const auto postrinInterestParam =
|
||||
parsePostrinInterestParam(deviceAttachmentSpec);
|
||||
postrinInterestPercentage =
|
||||
postrinInterestParam.unit == intrin::ThresholdUnit::Percentage
|
||||
? static_cast<uint32_t>(postrinInterestParam.value)
|
||||
: 0U;
|
||||
postrinInterestThreshold = intrin::resolveThresholdValue(
|
||||
postrinInterestParam, nDgramsPerFrame_);
|
||||
|
||||
// Convert percentage to absolute frame count
|
||||
postrinInterestThreshold = static_cast<uint32_t>(
|
||||
(nDgramsPerFrame_ * postrinInterestPercentage) / 100);
|
||||
// Parse ambienceIntensityLowVal from qualeIfaceApiParams
|
||||
const std::vector<std::string> ambienceIntensityLowValParamNames = {
|
||||
"ambience-intensity-low-val"
|
||||
|
||||
Reference in New Issue
Block a user