51 if (u <
float(size)) {
68 return x ? size -
x : 0;
92 for (
int i = 0; i < components; i++) {
98 const float *
data = buffer + (
int64_t(width) *
y +
x) * components;
99 for (
int i = 0; i < components; i++) {
135 const uchar *buffer,
int width,
int height,
float u,
float v)
143 const float *buffer,
float *
output,
int width,
int height,
int components,
float u,
float v)
151 for (
int i = 0; i < components; i++) {
157 const float *
data = buffer + (
int64_t(width) *
y +
x) * components;
158 for (
int i = 0; i < components; i++) {
164 const float *buffer,
int width,
int height,
float u,
float v)
185 const int x = u > 0 ? (u < width ? int(u) : width - 1) : 0;
186 const int y =
v > 0 ? (
v < height ? int(
v) : height - 1) : 0;
196 const uchar *buffer,
int width,
int height,
float u,
float v)
204 const float *buffer,
float *
output,
int width,
int height,
int components,
float u,
float v)
207 const int x = u > 0 ? (u < width ? int(u) : width - 1) : 0;
208 const int y =
v > 0 ? (
v < height ? int(
v) : height - 1) : 0;
210 const float *
data = buffer + (
int64_t(width) *
y +
x) * components;
211 for (
int i = 0; i < components; i++) {
217 const float *buffer,
int width,
int height,
float u,
float v)
233 return x ? size -
x : 0;
258 const uchar *buffer,
int width,
int height,
float u,
float v)
266 const float *buffer,
float *
output,
int width,
int height,
int components,
float u,
float v)
273 const float *
data = buffer + (
int64_t(width) *
y +
x) * components;
274 for (
int i = 0; i < components; i++) {
280 const float *buffer,
int width,
int height,
float u,
float v)
301 BLI_assert(components > 0 && components <= 4);
308 const float *row1, *row2, *row3, *row4;
309 const float empty[4] = {0.0f, 0.0f, 0.0f, 0.0f};
311 row1 = buffer + (
int64_t(width) * y1 + x1) * components;
312 row2 = buffer + (
int64_t(width) * y2 + x1) * components;
313 row3 = buffer + (
int64_t(width) * y1 + x2) * components;
314 row4 = buffer + (
int64_t(width) * y2 + x2) * components;
341 float ma_b = (1.0f - a) *
b;
342 float a_mb = a * (1.0f -
b);
343 float ma_mb = (1.0f - a) * (1.0f -
b);
345 if (components == 1) {
346 output[0] = ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + a_b * row4[0];
348 else if (components == 2) {
349 output[0] = ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + a_b * row4[0];
350 output[1] = ma_mb * row1[1] + a_mb * row3[1] + ma_b * row2[1] + a_b * row4[1];
352 else if (components == 3) {
353 output[0] = ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + a_b * row4[0];
354 output[1] = ma_mb * row1[1] + a_mb * row3[1] + ma_b * row2[1] + a_b * row4[1];
355 output[2] = ma_mb * row1[2] + a_mb * row3[2] + ma_b * row2[2] + a_b * row4[2];
359 __m128 rgba1 = _mm_loadu_ps(row1);
360 __m128 rgba2 = _mm_loadu_ps(row2);
361 __m128 rgba3 = _mm_loadu_ps(row3);
362 __m128 rgba4 = _mm_loadu_ps(row4);
363 rgba1 = _mm_mul_ps(_mm_set1_ps(ma_mb), rgba1);
364 rgba2 = _mm_mul_ps(_mm_set1_ps(ma_b), rgba2);
365 rgba3 = _mm_mul_ps(_mm_set1_ps(a_mb), rgba3);
366 rgba4 = _mm_mul_ps(_mm_set1_ps(a_b), rgba4);
367 __m128 rgba13 = _mm_add_ps(rgba1, rgba3);
368 __m128 rgba24 = _mm_add_ps(rgba2, rgba4);
369 __m128 rgba = _mm_add_ps(rgba13, rgba24);
370 _mm_storeu_ps(
output, rgba);
372 output[0] = ma_mb * row1[0] + a_mb * row3[0] + ma_b * row2[0] + a_b * row4[0];
373 output[1] = ma_mb * row1[1] + a_mb * row3[1] + ma_b * row2[1] + a_b * row4[1];
374 output[2] = ma_mb * row1[2] + a_mb * row3[2] + ma_b * row2[2] + a_b * row4[2];
375 output[3] = ma_mb * row1[3] + a_mb * row3[3] + ma_b * row2[3] + a_b * row4[3];
392 const uchar *buffer,
int width,
int height,
float u,
float v);
395 const float *buffer,
int width,
int height,
float u,
float v);
398 const float *buffer,
float *
output,
int width,
int height,
int components,
float u,
float v);
412 const uchar *buffer,
int width,
int height,
float u,
float v);
415 const float *buffer,
int width,
int height,
float u,
float v);
418 const float *buffer,
float *
output,
int width,
int height,
int components,
float u,
float v);
426 const uchar *buffer,
int width,
int height,
float u,
float v);
429 const float *buffer,
int width,
int height,
float u,
float v);
447 const uchar *buffer,
int width,
int height,
float u,
float v);
450 const float *buffer,
int width,
int height,
float u,
float v);
453 const float *buffer,
float *
output,
int width,
int height,
int components,
float u,
float v);
478 const uchar *buffer,
int width,
int height,
float u,
float v);
481 const float *buffer,
int width,
int height,
float u,
float v);
484 const float *buffer,
float *
output,
int width,
int height,
int components,
float u,
float v);
491#define EWA_MAXIDX 255
497 float A,
float B,
float C,
float F,
float *a,
float *
b,
float *th,
float *ecc);
BLI_INLINE Texture * wrap(MTLTexture *texture)
float4 interpolate_bilinear_fl(const ImBuf *in, float u, float v)
uchar4 interpolate_bilinear_wrap_byte(const ImBuf *in, float u, float v)
uchar4 interpolate_bilinear_byte(const ImBuf *in, float u, float v)
uchar4 interpolate_cubic_mitchell_byte(const ImBuf *in, float u, float v)
uchar4 interpolate_cubic_bspline_byte(const ImBuf *in, float u, float v)
float4 interpolate_cubic_bspline_fl(const ImBuf *in, float u, float v)
uchar4 interpolate_bilinear_border_byte(const ImBuf *in, float u, float v)
float4 interpolate_bilinear_wrap_fl(const ImBuf *in, float u, float v)
float4 interpolate_bilinear_border_fl(const ImBuf *in, float u, float v)
void interpolate_nearest_wrap_fl(const float *buffer, float *output, int width, int height, int components, float u, float v)
void interpolate_nearest_fl(const float *buffer, float *output, int width, int height, int components, float u, float v)
void interpolate_nearest_border_fl(const float *buffer, float *output, int width, int height, int components, float u, float v)
BLI_INLINE int32_t wrap_coord(float u, int32_t size, InterpWrapMode wrap)
void interpolate_nearest_byte(const uchar *buffer, uchar *output, int width, int height, float u, float v)
BLI_INLINE void interpolate_bilinear_wrapmode_fl(const float *buffer, float *output, int width, int height, int components, float u, float v, InterpWrapMode wrap_x, InterpWrapMode wrap_y)
BLI_INLINE void interpolate_nearest_wrapmode_fl(const float *buffer, float *output, int width, int height, int components, float u, float v, InterpWrapMode wrap_u, InterpWrapMode wrap_v)
float4 interpolate_cubic_mitchell_fl(const float *buffer, int width, int height, float u, float v)
void interpolate_nearest_wrap_byte(const uchar *buffer, uchar *output, int width, int height, float u, float v)
void interpolate_nearest_border_byte(const uchar *buffer, uchar *output, int width, int height, float u, float v)
void interpolate_cubic_bspline_wrapmode_fl(const float *buffer, float *output, int width, int height, int components, float u, float v, InterpWrapMode wrap_u, InterpWrapMode wrap_v)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void BLI_ewa_filter(int width, int height, bool intpol, bool use_alpha, const float uv[2], const float du[2], const float dv[2], ewa_filter_read_pixel_cb read_pixel_cb, void *userdata, float result[4], bool clip=true)
VecBase< uint8_t, 4 > uchar4
void(*)(void *userdata, int x, int y, float result[4]) ewa_filter_read_pixel_cb
ATTR_WARN_UNUSED_RESULT const BMVert * v
VecBase< float, 4 > float4
BMesh const char void * data
const float EWA_WTS[EWA_MAXIDX+1]
void BLI_ewa_imp2radangle(float A, float B, float C, float F, float *a, float *b, float *th, float *ecc)