Changeset View
Changeset View
Standalone View
Standalone View
libs/image/kis_gauss_circle_mask_generator_p.h
Context not available. | |||||
50 | 50 | | |||
---|---|---|---|---|---|
51 | inline quint8 value(qreal dist) const; | 51 | inline quint8 value(qreal dist) const; | ||
52 | 52 | | |||
53 | #if defined HAVE_VC | | |||
54 | // vectorized erf function, precision 1e-5 | | |||
55 | Vc::float_v vErf(Vc::float_v x) { | | |||
56 | Vc::float_v xa = abs(x); | | |||
57 | Vc::float_m precisionLimit(xa >= 9.3f); // wrong result for any number beyond this | | |||
58 | xa(precisionLimit) = 0; | | |||
59 | Vc::float_v sign(Vc::One); | | |||
60 | Vc::float_m invertMask = x < 0.f; | | |||
61 | sign(invertMask) = -1.f; | | |||
62 | | ||||
63 | // CONSTANTS | | |||
64 | float a1 = 0.254829592; | | |||
65 | float a2 = -0.284496736; | | |||
66 | float a3 = 1.421413741; | | |||
67 | float a4 = -1.453152027; | | |||
68 | float a5 = 1.061405429; | | |||
69 | float p = 0.3275911; | | |||
70 | | ||||
71 | Vc::float_v t = 1.0f / (1.0f + p * xa); | | |||
72 | Vc::float_v y = 1.0f - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * exp(-xa * xa); | | |||
73 | y(precisionLimit) = 1.0f; | | |||
74 | return sign * y; | | |||
75 | } | | |||
76 | #endif /* defined HAVE_VC */ | | |||
77 | }; | 53 | }; | ||
78 | 54 | | |||
79 | #endif /* _KIS_GAUSS_MASK_GENERATOR_P_H_ */ | 55 | #endif /* _KIS_GAUSS_MASK_GENERATOR_P_H_ */ | ||
Context not available. |