14 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
23 #include "vdt/vdtMath.h"
26 void sincosint(
float x,
float& sint,
float& cint);
30 int dzero(
float a,
float b,
float& x0,
float& rv,
float eps,
int mxf,
F func);
42 const float xp[9] = {9.29, 2.47, .89, .36, .15, .07, .03, .02, 0.0};
43 const float xq[7] = {.012, .03, .08, .26, .87, 3.83, 11.0};
45 float q, u,
x,
c1, c2, c3, c4,
d1, h4, h5, h6,
q2,
x1,
d, ll, ul, xf1, xf2, rv;
59 float invKappa = 1.f /
kappa;
60 h_[4] = 1.f - beta2 * 0.42278433999999998f + (7.6f * invKappa);
63 h4 = -(7.6f * invKappa) - (beta2 * .57721566
f + 1.
f);
72 for (lp = 0; lp < 9; ++lp) {
76 ll = -
float(lp) - 1.5f;
77 for (lq = 0; lq < 7; ++lq) {
82 auto f2 = [h_](
float x) {
91 h_[0] =
kappa * (beta2 * .57721566f + 2.f) + 9.9166128600000008
f;
95 h_[1] = beta2 *
kappa;
97 h_[3] =
omega_ * 1.5707963250000001f;
104 a_[
n - 1] =
omega_ * .31830988654751274f;
108 for (
k = 1;
k <
n; ++
k) {
114 vdt::fast_sincosf(
x1, c3, c4);
115 xf1 =
kappa * (beta2 *
c1 - c4) -
x * c2;
118 vdt::fast_sincosf(xf2,
s,
c);
144 float f, u,
y,
a0, a1;
152 }
else if (
x <=
t1_) {
154 u =
omega_ *
y - 3.141592653589793f;
156 vdt::fast_sincosf(u, su, cu);
161 for (
k = 2;
k <= n1; ++
k) {
164 a0 =
a_[
k - 1] + cof * a1 -
a2;
168 for (
k = 2;
k <=
n; ++
k) {
205 const float zero = 0.;
206 const float q2[7] = {
207 .10340013040487, 3.319092135933, 20.449478501379, 41.280784189142, 32.426421069514, 10.041164382905, 1.};
208 const float p3[6] = {
209 -2.3909964453136, -147.98219500504, -254.3763397689, -119.55761038372, -19.630408535939, -.9999999999036};
210 const float q3[6] = {177.60070940351, 530.68509610812, 462.23027156148, 156.81843364539, 21.630408494238, 1.};
211 const float p4[8] = {-8.6693733995107,
219 const float q4[8] = {34.171875,
227 const float a1[8] = {-2.1808638152072,
235 const float b1[8] = {0.,
243 const float a2[8] = {-3.4833465360285,
251 const float b2[8] = {0.,
259 const float a3[6] = {
260 -27.780928934438, -10.10479081576, -9.1483008216736, -5.0223317461851, -3.0000077799358, 1.0000000000704};
261 const float one = 1.;
262 const float b3[6] = {0., 122.39993926823, 2.7276100778779, -7.1897518395045, -2.9990118065262, 1.999999942826};
263 const float two = 2.;
264 const float three = 3.;
265 const float x0 = .37250741078137;
266 const float xl[6] = {-24., -12., -6., 0., 1., 4.};
267 const float p1[5] = {4.293125234321, 39.894153870321, 292.52518866921, 425.69682638592, -434.98143832952};
268 const float q1[5] = {1., 18.899288395003, 150.95038744251, 568.05252718987, 753.58564359843};
269 const float p2[7] = {.43096783946939,
278 float v, y, ap, bp, aq,
dp, bq, dq;
282 for (
int i__ = 2; i__ <= 5; ++i__) {
283 ap = a3[i__ - 1] - x +
b3[i__ - 1] / ap;
286 }
else if (x <= xl[1]) {
288 for (
int i__ = 2; i__ <= 7; ++i__) {
289 ap =
a2[i__ - 1] - x +
b2[i__ - 1] / ap;
292 }
else if (x <= xl[2]) {
294 for (
int i__ = 2; i__ <= 7; ++i__) {
295 ap = a1[i__ - 1] - x +
b1[i__ - 1] / ap;
298 }
else if (x < xl[3]) {
302 for (
int i__ = 2; i__ <= 8; ++i__) {
305 dp =
p4[i__ - 1] - ap +
v * bp;
309 for (
int i__ = 2; i__ <= 8; ++i__) {
312 dq = q4[i__ - 1] - aq +
v * bq;
315 }
else if (x == xl[3]) {
317 }
else if (x < xl[4]) {
320 for (
int i__ = 2; i__ <= 5; ++i__) {
321 ap =
p1[i__ - 1] + x * ap;
322 aq =
q1[i__ - 1] + x * aq;
325 }
else if (x <= xl[5]) {
329 for (
int i__ = 2; i__ <= 7; ++i__) {
330 ap =
p2[i__ - 1] + y * ap;
331 aq =
q2[i__ - 1] + y * aq;
338 for (
int i__ = 2; i__ <= 6; ++i__) {
339 ap =
p3[i__ - 1] + y * ap;
340 aq = q3[i__ - 1] + y * aq;
347 template <
typename F>
348 int dzero(
float a,
float b,
float& x0,
float& rv,
float eps,
int mxf,
F func) {
350 float d__1, d__2, d__3, d__4;
353 float f1,
f2, f3,
u1,
u2,
x1,
x2,
u3, u4, x3, ca, cb,
cc,
fa,
fb, ee,
ff;
355 float xa, xb,
fx,
xx, su4;
362 rv = (xb - xa) * -2.
f;
368 x0 = (xa + xb) * 0.5
f;
384 rv = (d__1 = xb - xa, fabs(d__1)) * -0.5
f;
400 if (
u2 == 0.
f || u4 == 0.
f) {
416 u3 = cb / (ca * 2.f);
427 if (x0 < xa || x0 > xb) {
431 d__3 = (d__1 = x0 - x3,
std::abs(d__1));
472 rv = (d__1 = xb - xa,
std::abs(d__1)) * -0.5
f;