52static float in_band(
float width,
float dist,
int side,
int dir)
65 alpha = (dist + 0.5f * width) / (width);
68 alpha = (0.5f * width - dist) / (width);
80 float posx, posy, hyp, hyp2,
angle, hwidth, b1, b2, b3, pointdist;
81 float temp1, temp2, temp3, temp4;
82 int xo = wipezone->
xo;
83 int yo = wipezone->
yo;
84 float halfx = xo * 0.5f;
85 float halfy = yo * 0.5f;
100 posy = yo - fac * yo;
103 switch (wipezone->
type) {
106 width =
min_ii(width, yo - fac * yo);
114 b1 = posy - (-
angle) * posx;
148 width = wipezone->
width;
149 hwidth = width * 0.5f;
152 b3 = yo - posy * 0.5f;
155 hyp =
fabsf(
y - posy * 0.5f);
156 hyp2 =
fabsf(
y - (yo - posy * 0.5f));
159 b1 = posy * 0.5f - (-
angle) * posx * 0.5f;
160 b3 = (yo - posy * 0.5f) - (-
angle) * (xo - posx * 0.5f);
164 hyp2 =
fabsf(
angle *
x +
y + (-(yo - posy * 0.5f) -
angle * (xo - posx * 0.5f))) *
170 if (b2 < b1 && b2 < b3) {
173 else if (b2 > b1 && b2 > b3) {
177 if (hyp < hwidth && hyp2 > hwidth) {
180 else if (hyp > hwidth && hyp2 < hwidth) {
200 temp1 = 2.0f * float(
M_PI) * fac;
203 temp1 = 2.0f * float(
M_PI) - temp1;
211 temp2 += 2.0f * float(
M_PI);
215 temp3 = temp1 - widthf * fac;
216 temp4 = temp1 + widthf * (1 - fac);
219 temp3 = temp1 - widthf * (1 - fac);
220 temp4 = temp1 + widthf * fac;
222 temp3 = std::max<float>(temp3, 0);
223 temp4 = std::min(temp4, 2.0f *
float(
M_PI));
228 else if (temp2 > temp4) {
232 output = (temp2 - temp3) / (temp4 - temp3);
234 if (
x == 0 &&
y == 0) {
256 width = wipezone->
width;
257 hwidth = width * 0.5f;
259 temp1 = (halfx - (halfx)*fac);
260 pointdist =
hypotf(temp1, temp1);
262 temp2 =
hypotf(halfx -
x, halfy -
y);
263 if (temp2 > pointdist) {
311 const Strip *strip,
float fac,
int width,
int height,
const T *rect1,
const T *rect2,
T *
out)
318 const T *cp1 = rect1 ? rect1 + y_range.
first() * width * 4 :
nullptr;
319 const T *cp2 = rect2 ? rect2 + y_range.
first() * width * 4 :
nullptr;
320 T *rt =
out + y_range.
first() * width * 4;
321 for (
const int y : y_range) {
322 for (
int x = 0;
x < width;
x++) {
328 float4 col = col1 * check + col2 * (1.0f - check);
337 memcpy(rt, cp2,
sizeof(
T) * 4);
345 if (cp1 !=
nullptr) {
348 if (cp2 !=
nullptr) {
365 if (
out->float_buffer.data) {
372 out->float_buffer.data);
381 out->byte_buffer.data);
MINLINE int min_ii(int a, int b)
MINLINE float min_ff(float a, float b)
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
constexpr int64_t first() const
void * MEM_callocN(size_t len, const char *str)
void * MEM_dupallocN(const void *vmemh)
void MEM_freeN(void *vmemh)
static float check_zone(const WipeZone *wipezone, int x, int y, float fac)
static void free_wipe_effect(Strip *strip, const bool)
void wipe_effect_get_handle(EffectHandle &rval)
static void copy_wipe_effect(Strip *dst, const Strip *src, const int)
static int num_inputs_wipe()
static void init_wipe_effect(Strip *strip)
void store_premul_pixel(const blender::float4 &pix, uchar *dst)
ImBuf * prepare_effect_imbufs(const RenderData *context, ImBuf *ibuf1, ImBuf *ibuf2, bool uninitialized_pixels)
void store_opaque_black_pixel(uchar *dst)
void get_default_fac_fade(const Scene *scene, const Strip *strip, float timeline_frame, float *fac)
blender::float4 load_premul_pixel(const uchar *ptr)
static void do_wipe_effect(const Strip *strip, float fac, int width, int height, const T *rect1, const T *rect2, T *out)
static WipeZone precalc_wipe_zone(const WipeVars *wipe, int xo, int yo)
static float in_band(float width, float dist, int side, int dir)
StripEarlyOut early_out_fade(const Strip *, float fac)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
VecBase< float, 4 > float4
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer
void(* copy)(Strip *dst, const Strip *src, int flag)
ImBuf *(* execute)(const RenderData *context, Strip *strip, float timeline_frame, float fac, ImBuf *ibuf1, ImBuf *ibuf2)
void(* get_default_fac)(const Scene *scene, const Strip *strip, float timeline_frame, float *fac)
void(* free)(Strip *strip, bool do_id_user)
StripEarlyOut(* early_out)(const Strip *strip, float fac)
void(* init)(Strip *strip)