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

Function cubicInterpFunc

src/backend/cpu/kernel/interp.hpp:45–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43
44template<typename InT, typename LocT>
45InT cubicInterpFunc(InT val[4], LocT xratio, bool spline) {
46 InT a0, a1, a2, a3;
47 if (spline) {
48 a0 = scalar<InT>(-0.5) * val[0] + scalar<InT>(1.5) * val[1] +
49 scalar<InT>(-1.5) * val[2] + scalar<InT>(0.5) * val[3];
50
51 a1 = scalar<InT>(1.0) * val[0] + scalar<InT>(-2.5) * val[1] +
52 scalar<InT>(2.0) * val[2] + scalar<InT>(-0.5) * val[3];
53
54 a2 = scalar<InT>(-0.5) * val[0] + scalar<InT>(0.5) * val[2];
55
56 a3 = val[1];
57 } else {
58 a0 = val[3] - val[2] - val[0] + val[1];
59 a1 = val[0] - val[1] - a0;
60 a2 = val[2] - val[0];
61 a3 = val[1];
62 }
63
64 LocT xratio2 = xratio * xratio;
65 LocT xratio3 = xratio2 * xratio;
66
67 return a0 * xratio3 + a1 * xratio2 + a2 * xratio + a3;
68}
69
70template<typename InT, typename LocT>
71InT bicubicInterpFunc(InT val[4][4], LocT xratio, LocT yratio, bool spline) {

Callers 2

bicubicInterpFuncFunction · 0.70
operator()Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected