15 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 24 #include "vdt/vdtMath.h" 27 void sincosint(
float x,
float& sint,
float& cint);
31 int dzero(
float a,
float b,
float& x0,
float& rv,
float eps,
int mxf,
F func);
44 const float xp[9] = {9.29, 2.47, .89, .36, .15, .07, .03, .02, 0.0};
45 const float xq[7] = {.012, .03, .08, .26, .87, 3.83, 11.0};
47 float q, u, h4, h5, h6, q2,
d, ll, ul, rv;
61 float invKappa = 1.f /
kappa;
62 h_[4] = 1.f - beta2 * 0.42278433999999998f + (7.6f * invKappa);
65 h4 = -(7.6f * invKappa) - (beta2 * .57721566
f + 1.
f);
74 for (lp = 0; lp < 9; ++lp) {
78 ll = -
float(lp) - 1.5f;
79 for (lq = 0; lq < 7; ++lq) {
84 auto f2 = [h_](
float x) {
93 h_[0] =
kappa * (beta2 * .57721566f + 2.f) + 9.9166128600000008
f;
97 h_[1] = beta2 *
kappa;
99 h_[3] =
omega_ * 1.5707963250000001f;
106 a_[
n - 1] =
omega_ * .31830988654751274f;
131 for (
k = 1;
k <
n; ++
k) {
135 for (
k = 1;
k <
n; ++
k) {
138 for (
k = 1;
k <
n; ++
k) {
141 for (
k = 1;
k <
n; ++
k) {
142 vdt::fast_sincosf(
x1[
k], c3[
k], c4[
k]);
146 for (
k = 1;
k <
n; ++
k) {
147 vdt::fast_sincosf(xf2[
k],
s[
k],
c[
k]);
152 for (
k = 1;
k <
n; ++
k) {
156 for (
k = 1;
k <
n; ++
k) {
162 for (
k = 1;
k <
n; ++
k) {
166 for (
k = 1;
k <
n; ++
k) {
170 for (
k = 1;
k <
n; ++
k) {
174 for (
k = 1;
k <
n; ++
k) {
176 a_[
n - 1] += q2 *
a_[
l - 1];
190 const float xp[9] = {9.29, 2.47, .89, .36, .15, .07, .03, .02, 0.0};
191 const float xq[7] = {.012, .03, .08, .26, .87, 3.83, 11.0};
193 float q, u, h4, h5, h6, q2,
d, ll, ul, rv;
203 float invKappa = 1.f /
kappa;
204 h_[4] = 0.57721566f + (7.6f * invKappa);
205 h4 = -(7.6f * invKappa) - 1.57721566
f;
214 for (lp = 0; lp < 9; ++lp) {
218 ll = -
float(lp) - 1.5f;
219 for (lq = 0; lq < 7; ++lq) {
230 h_[0] =
kappa * 2.57721566f + 9.9166128600000008f;
232 h_[0] += 6.90775527f;
236 h_[3] =
omega_ * 1.5707963250000001f;
265 for (
k = 1;
k <
n; ++
k) {
269 for (
k = 1;
k <
n; ++
k) {
272 for (
k = 1;
k <
n; ++
k) {
275 for (
k = 1;
k <
n; ++
k) {
276 vdt::fast_sincosf(
x1[
k], c3[
k], c4[
k]);
280 for (
k = 1;
k <
n; ++
k) {
281 vdt::fast_sincosf(xf2[
k],
s[
k],
c[
k]);
285 for (
k = 1;
k <
n; ++
k) {
289 for (
k = 1;
k <
n; ++
k) {
293 for (
k = 1;
k <
n; ++
k) {
297 for (
k = 1;
k <
n; ++
k) {
299 a_[
n - 1] += q2 *
a_[
l - 1];
314 float f, u,
y,
a0, a1;
322 }
else if (
x <=
t1_) {
324 u =
omega_ *
y - 3.141592653589793f;
326 vdt::fast_sincosf(u, su, cu);
331 for (
k = 2;
k <= n1; ++
k) {
334 a0 =
a_[
k - 1] + cof * a1 -
a2;
338 for (
k = 2;
k <=
n; ++
k) {
375 const float zero = 0.;
376 const float q2[7] = {
377 .10340013040487, 3.319092135933, 20.449478501379, 41.280784189142, 32.426421069514, 10.041164382905, 1.};
378 const float p3[6] = {
379 -2.3909964453136, -147.98219500504, -254.3763397689, -119.55761038372, -19.630408535939, -.9999999999036};
380 const float q3[6] = {177.60070940351, 530.68509610812, 462.23027156148, 156.81843364539, 21.630408494238, 1.};
381 const float p4[8] = {-8.6693733995107,
389 const float q4[8] = {34.171875,
397 const float a1[8] = {-2.1808638152072,
405 const float b1[8] = {0.,
413 const float a2[8] = {-3.4833465360285,
421 const float b2[8] = {0.,
429 const float a3[6] = {
430 -27.780928934438, -10.10479081576, -9.1483008216736, -5.0223317461851, -3.0000077799358, 1.0000000000704};
431 const float one = 1.;
432 const float b3[6] = {0., 122.39993926823, 2.7276100778779, -7.1897518395045, -2.9990118065262, 1.999999942826};
433 const float two = 2.;
434 const float three = 3.;
435 const float x0 = .37250741078137;
436 const float xl[6] = {-24., -12., -6., 0., 1., 4.};
437 const float p1[5] = {4.293125234321, 39.894153870321, 292.52518866921, 425.69682638592, -434.98143832952};
438 const float q1[5] = {1., 18.899288395003, 150.95038744251, 568.05252718987, 753.58564359843};
439 const float p2[7] = {.43096783946939,
448 float v, y, ap, bp, aq,
dp, bq, dq;
452 for (
int i__ = 2; i__ <= 5; ++i__) {
453 ap = a3[i__ - 1] -
x +
b3[i__ - 1] / ap;
456 }
else if (
x <= xl[1]) {
458 for (
int i__ = 2; i__ <= 7; ++i__) {
459 ap =
a2[i__ - 1] -
x +
b2[i__ - 1] / ap;
462 }
else if (
x <= xl[2]) {
464 for (
int i__ = 2; i__ <= 7; ++i__) {
465 ap = a1[i__ - 1] -
x +
b1[i__ - 1] / ap;
468 }
else if (
x < xl[3]) {
472 for (
int i__ = 2; i__ <= 8; ++i__) {
475 dp = p4[i__ - 1] - ap +
v * bp;
479 for (
int i__ = 2; i__ <= 8; ++i__) {
482 dq = q4[i__ - 1] - aq +
v * bq;
485 }
else if (
x == xl[3]) {
487 }
else if (
x < xl[4]) {
490 for (
int i__ = 2; i__ <= 5; ++i__) {
491 ap =
p1[i__ - 1] +
x * ap;
492 aq = q1[i__ - 1] +
x * aq;
495 }
else if (
x <= xl[5]) {
499 for (
int i__ = 2; i__ <= 7; ++i__) {
500 ap =
p2[i__ - 1] + y * ap;
501 aq = q2[i__ - 1] + y * aq;
508 for (
int i__ = 2; i__ <= 6; ++i__) {
509 ap =
p3[i__ - 1] + y * ap;
510 aq = q3[i__ - 1] + y * aq;
517 template <
typename F>
520 float d__1, d__2, d__3, d__4;
523 float f1,
f2, f3,
u1,
u2, x1, x2,
u3, u4, x3, ca, cb, cc, fa, fb, ee,
ff;
525 float xa, xb,
fx,
xx, su4;
532 rv = (xb - xa) * -2.
f;
538 x0 = (xa + xb) * 0.5
f;
554 rv = (d__1 = xb - xa, fabs(d__1)) * -0.5
f;
570 if (
u2 == 0.
f || u4 == 0.
f) {
578 cb = (x1 + x2) *
u2 - (x2 + x0) *
u1;
579 cc = (x1 - x0) *
f1 - x1 * (ca * x1 + cb);
586 u3 = cb / (ca * 2.f);
587 u4 =
u3 *
u3 - cc / ca;
597 if (x0 < xa || x0 > xb) {
601 d__3 = (d__1 = x0 - x3,
std::abs(d__1));
602 d__4 = (d__2 = x0 - x2,
std::abs(d__2));
642 rv = (d__1 = xb - xa,
std::abs(d__1)) * -0.5
f;
const int mode_
returns the limits on the non-zero (mode=0) or normalized region (mode=1)
void sincosint(float x, float &sint, float &cint)
void limits(float &xl, float &xu) const
density (mode=0) or distribution (mode=1) function
Abs< T >::type abs(const T &t)
int dzero(float a, float b, float &x0, float &rv, float eps, int mxf, F func)
Private version of the exponential integral.
float expint(float x)
Private version of the cosine and sine integral.
static constexpr float a0
VVIObjF(float kappa, float beta2, int mode)
Constructor.
static constexpr float b0
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
static constexpr float d1
int sicif(float xx, float &si, float &ci)