MCPcopy Create free account
hub / github.com/FastFlowLM/FastFlowLM / bicubic_kernel

Function bicubic_kernel

src/include/image_process_utils/imageproc.hpp:14–23  ·  view source on GitHub ↗

Keys bicubic kernel (a = -0.5) - matches PyTorch antialias=True

Source from the content-addressed store, hash-verified

12
13 // Keys bicubic kernel (a = -0.5) - matches PyTorch antialias=True
14 inline float bicubic_kernel(float x) {
15 const float a = -0.5f;
16 x = std::fabs(x);
17 if (x < 1.0f)
18 return ((a + 2.0f) * x - (a + 3.0f)) * x * x + 1.0f;
19 else if (x < 2.0f)
20 return ((a * x - 5.0f * a) * x + 8.0f * a) * x - 4.0f * a;
21 else
22 return 0.0f;
23 }
24
25 inline int clamp(int x, int lo, int hi) {
26 return std::max(lo, std::min(x, hi));

Callers 2

resize_bicubic_planeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected