32 bool sclamp =
false,
bool aclamp =
false,
35 bool use_value_method =
false);
40 template <
class F,
class FR,
class FP>
42 bool sclamp,
bool aclamp,
48 template <
class F,
class FP>
50 bool sclamp,
bool aclamp,
53 bool use_value_method =
false);
57 static constexpr
fpreal LN_PNT_ONE = -2.3025851;
58 static constexpr
fpreal MAX_STEADY_DELTA = 0.001;
66 bool sclamp,
bool aclamp,
74 p1.addScaledVec(1.0 - lag_up, p0);
81 v1.addScaledVec(1.0 - over_up, v0);
88 v1 *= (sclamp_up / len);
101 a1 *= (aclamp_up / len);
117 bool sclamp,
bool aclamp,
128 if (use_value_method)
134 p1 = (1.0 - lag_up)*p0 + lag_up*p1;
136 p1 = (1.0 - lag_down)*p0 + lag_down*p1;
142 v1 = (1.0 - over_up)*v0 + over_up*v1;
144 v1 = (1.0 - over_down)*v0 + over_down*v1;
156 if (v1 < - sclamp_down)
176 if (a1 < -aclamp_down)
192 bool sclamp,
bool aclamp,
195 bool use_value_method)
208 fpreal lag0 = (lag_up > 0.0) ? 1.0 -
exp(LN_PNT_ONE / lag_up) : 1.0;
209 fpreal lag1 = (lag_down > 0.0) ? 1.0 -
exp(LN_PNT_ONE / lag_down) : 1.0;
210 fpreal over0 = (overshoot_up > 0.0) ? 1.0 -
exp(LN_PNT_ONE / overshoot_up) : 1.0;
211 fpreal over1 = (overshoot_down > 0.0) ? 1.0 -
exp(LN_PNT_ONE / overshoot_down) : 1.0;
217 p1 = calculateLag(use_value_method, v, p, p1,
219 lag0, lag1, over0, over1,
220 sclamp_up, sclamp_down, aclamp_up, aclamp_down);
226 template <
class F,
class FP>
229 bool sclamp,
bool aclamp,
230 const FP& get_params,
232 bool use_value_method)
246 for (
exint i = start; i <=
end; i++)
250 if (!get_params(lag_up, lag_down, over_up, over_down,
251 sclamp_up, sclamp_down, aclamp_up, aclamp_down))
256 fpreal res = calculateLag(use_value_method, v0, p0, p1, sclamp, aclamp,
257 lag_up, lag_down, over_up, over_down,
258 sclamp_up, sclamp_down, aclamp_up, aclamp_down);
261 if (delta > MAX_STEADY_DELTA)
270 template <
class F,
class FR,
class FP>
273 bool sclamp,
bool aclamp,
274 const FP& get_params,
292 for (
exint i = start; i <=
end; i++)
296 if (!get_params(lag_up, over_up, sclamp_up, aclamp_up))
301 calculateLagVector(v0, v1, p0, p1, a0, a1,
304 sclamp_up, aclamp_up);
static bool solveRealtime(const F &get_data, fpreal *result, int start, int end, bool sclamp, bool aclamp, const FP &get_params, fpreal &v0, fpreal &p0, bool use_value_method=false)
void init(exint nl, exint nh)
Initialize nl, nh and allocate space.
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
exint getNH() const
Get the high index.
**But if you need a result
IMATH_HOSTDEVICE constexpr int cmp(T a, T b) IMATH_NOEXCEPT
static void solveRealtimeMagnitude(const F &get_data, const FR &set_results, int start, int end, bool sclamp, bool aclamp, const FP &get_params, UT_VectorR &v0, UT_VectorR &p0)
auto get_data(std::basic_string< Char > &s) -> Char *
static void solve(const fpreal *data, fpreal *result, int size, fpreal lag_up, fpreal lag_down, fpreal overshoot_up, fpreal overshoot_down, bool sclamp=false, bool aclamp=false, fpreal sclamp_up=0.0, fpreal sclamp_down=0.0, fpreal aclamp_up=0.0, fpreal aclamp_down=0.0, bool use_value_method=false)
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER IMATH_HOSTDEVICE constexpr T abs(T a) IMATH_NOEXCEPT
exint getNL() const
Get the low index.