18#define SET_CUBIC_SPLINE_WEIGHTS(u, t) \
20 u[0] = (((-1.0f / 6.0f) * t + 0.5f) * t - 0.5f) * t + (1.0f / 6.0f); \
21 u[1] = ((0.5f * t - 1.0f) * t) * t + (2.0f / 3.0f); \
22 u[2] = ((-0.5f * t + 0.5f) * t + 0.5f) * t + (1.0f / 6.0f); \
23 u[3] = (1.0f / 6.0f) * t * t * t; \
38 if constexpr (std::is_same_v<OutT, float4>) {
53 const float f = 1.0f / 255.0f;
59 return r * (1.0f / 255.0f);
79 return r * (1.0f / 65535.0f);
84 const float f = 1.0f / 65535.0f;
91 read(
const TexT *
data,
const int x,
int y,
const int width,
const int )
99 read_clip(
const TexT *
data,
const int x,
int y,
const int width,
const int height)
118 return clamp(
x, 0, width - 1);
123 const int m =
abs(
x + (
x < 0)) % (2 * width);
125 return 2 * width - m - 1;
134 const int width = info.
width;
135 const int height = info.
height;
137 frac(
x * (
float)width, &ix);
138 frac(
y * (
float)height, &iy);
146 if (ix < 0 || ix >= width || iy < 0 || iy >= height) {
163 const TexT *
data = (
const TexT *)info.
data;
164 return read(
data, ix, iy, width, height);
169 const int width = info.
width;
170 const int height = info.
height;
175 const float tx =
frac(
x * (
float)width - 0.5f, &ix);
176 const float ty =
frac(
y * (
float)height - 0.5f, &iy);
177 const TexT *
data = (
const TexT *)info.
data;
189 if (ix < -1 || ix >= width || iy < -1 || iy >= height) {
194 return (1.0f - ty) * (1.0f - tx) *
read_clip(
data, ix, iy, width, height) +
215 return (1.0f - ty) * (1.0f - tx) *
read(
data, ix, iy, width, height) +
216 (1.0f - ty) * tx *
read(
data, nix, iy, width, height) +
217 ty * (1.0f - tx) *
read(
data, ix, niy, width, height) +
218 ty * tx *
read(
data, nix, niy, width, height);
223 const int width = info.
width;
224 const int height = info.
height;
228 const float tx =
frac(
x * (
float)width - 0.5f, &ix);
229 const float ty =
frac(
y * (
float)height - 0.5f, &iy);
249 if (ix < -2 || ix > width || iy < -2 || iy > height) {
288 const TexT *
data = (
const TexT *)info.
data;
289 const int xc[4] = {pix, ix, nix, nnix};
290 const int yc[4] = {piy, iy, niy, nniy};
296#define DATA(x, y) (read_clip(data, xc[x], yc[y], width, height))
299 (u[0] * DATA(0, col) + u[1] * DATA(1, col) + u[2] * DATA(2, col) + u[3] * DATA(3, col)))
323#undef SET_CUBIC_SPLINE_WEIGHTS
BMesh const char void * data
ATTR_WARN_UNUSED_RESULT const BMVert * v
#define SET_CUBIC_SPLINE_WEIGHTS(u, t)
CCL_NAMESPACE_BEGIN ccl_device_inline float frac(const float x, ccl_private int *ix)
ccl_device float4 kernel_tex_image_interp(KernelGlobals kg, const int id, const float x, float y)
#define kernel_assert(cond)
#define kernel_data_fetch(name, index)
#define ccl_always_inline
const ThreadKernelGlobalsCPU * KernelGlobals
#define ccl_device_inline
#define CCL_NAMESPACE_END
#define assert(assertion)
constexpr T clamp(T, U, U) RET
ccl_device_inline float4 half4_to_float4_image(const half4 h)
ccl_device_inline float half_to_float_image(half h)
ccl_device_inline int float_to_int(const float f)
CCL_NAMESPACE_BEGIN ccl_device_inline float4 zero_float4()
static ccl_always_inline OutT interp(const TextureInfo &info, const float x, float y)
static ccl_always_inline OutT read(const TexT *data, const int x, int y, const int width, const int)
static ccl_always_inline float read(const uint16_t r)
static ccl_always_inline int wrap_mirror(const int x, const int width)
static ccl_always_inline float4 read(const uchar4 r)
static ccl_always_inline OutT zero()
static ccl_always_inline float read(const uchar r)
static ccl_always_inline OutT interp_linear(const TextureInfo &info, const float x, float y)
static ccl_always_inline OutT interp_cubic(const TextureInfo &info, const float x, float y)
static ccl_always_inline OutT interp_closest(const TextureInfo &info, const float x, float y)
static ccl_always_inline int wrap_periodic(int x, const int width)
static ccl_always_inline float4 read(const float4 r)
static ccl_always_inline float4 read(ushort4 r)
static ccl_always_inline OutT read_clip(const TexT *data, const int x, int y, const int width, const int height)
static ccl_always_inline float4 read(half4 r)
static ccl_always_inline int wrap_clamp(const int x, const int width)
static ccl_always_inline float read(const float r)
static ccl_always_inline float read(half r)
@ IMAGE_DATA_TYPE_USHORT4