MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / cubicInterpFunc

Function cubicInterpFunc

src/backend/cuda/kernel/interp.hpp:53–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51
52template<typename Ty, typename Tp>
53__device__ inline static Ty cubicInterpFunc(Ty val[4], Tp xratio, bool spline) {
54 Ty a0, a1, a2, a3;
55 if (spline) {
56 a0 = scalar<Ty>(-0.5) * val[0] + scalar<Ty>(1.5) * val[1] +
57 scalar<Ty>(-1.5) * val[2] + scalar<Ty>(0.5) * val[3];
58
59 a1 = scalar<Ty>(1.0) * val[0] + scalar<Ty>(-2.5) * val[1] +
60 scalar<Ty>(2.0) * val[2] + scalar<Ty>(-0.5) * val[3];
61
62 a2 = scalar<Ty>(-0.5) * val[0] + scalar<Ty>(0.5) * val[2];
63
64 a3 = val[1];
65 } else {
66 a0 = val[3] - val[2] - val[0] + val[1];
67 a1 = val[0] - val[1] - a0;
68 a2 = val[2] - val[0];
69 a3 = val[1];
70 }
71
72 Tp xratio2 = xratio * xratio;
73 Tp xratio3 = xratio2 * xratio;
74
75 return a0 * xratio3 + a1 * xratio2 + a2 * xratio + a3;
76}
77
78template<typename Ty, typename Tp>
79__device__ inline static Ty bicubicInterpFunc(Ty val[4][4], Tp xratio,

Callers 2

bicubicInterpFuncFunction · 0.70
operator()Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected