18#include "RNA_prototypes.hh"
31 strip->effectdata =
data;
33 data->speed_fader = 1.0f;
34 data->speed_fader_length = 0.0f;
35 data->speed_fader_frame_number = 0.0f;
40 if (strip->effectdata) {
43 MEM_delete(
v->frameMap);
46 strip->effectdata =
nullptr;
53 v->frameMap =
nullptr;
69 const int effect_strip_length = strip->right_handle(scene) - strip->left_handle();
71 if ((strip->input1 ==
nullptr) || (effect_strip_length < 1)) {
82 MEM_delete(
v->frameMap);
86 v->frameMap[0] = 0.0f;
88 float target_frame = 0;
89 for (
int frame_index = 1; frame_index < effect_strip_length; frame_index++) {
90 target_frame +=
evaluate_fcurve(fcu, strip->left_handle() + frame_index);
91 const int target_frame_max = strip->input1->length(scene);
92 CLAMP(target_frame, 0, target_frame_max);
93 v->frameMap[frame_index] = target_frame;
100 if (
v->frameMap !=
nullptr) {
109 float timeline_frame,
112 if (strip_speed->input1 ==
nullptr) {
119 const Strip *source = strip_speed->input1;
121 float target_frame = 0.0f;
125 const float target_content_length = source->length(scene) - source->startofs;
126 const float speed_effetct_length = strip_speed->right_handle(scene) -
127 strip_speed->left_handle();
128 const float ratio = frame_index / speed_effetct_length;
129 target_frame = target_content_length * ratio;
134 if (fcu !=
nullptr) {
136 target_frame = s->
frameMap[frame_index];
142 target_frame += source->length(scene);
155 CLAMP(target_frame, 0, source->length(scene));
156 target_frame += strip_speed->start;
165 return input == 0 ? target_frame :
ceil(target_frame);
170 float timeline_frame)
173 scene, strip_speed, timeline_frame, 0);
174 return target_frame -
floor(target_frame);
180 float timeline_frame,
194 out = cross_effect.
execute(context,
state,
nullptr, timeline_frame, fac, ibuf1, ibuf2);
#define PRF_scope_with_name(ui_name, category)
static float speed_effect_interpolation_ratio_get(Scene *scene, Strip *strip_speed, float timeline_frame)
static SeqResult do_speed_effect(const RenderData *context, SeqRenderState *state, Strip *strip, float timeline_frame, float fac, const SeqResult &ibuf1, const SeqResult &ibuf2)
EffectHandle strip_effect_handle_get(Strip *strip)
static void free_speed_effect(Strip *strip, const bool)
float give_frame_index(const Scene *scene, const Strip *strip, float timeline_frame)
static void copy_speed_effect(Strip *dst, const Strip *src, const int)
static void init_speed_effect(Strip *strip)
static FCurve * strip_effect_speed_speed_factor_curve_get(Scene *scene, Strip *strip)
static void strip_effect_speed_frame_map_ensure(Scene *scene, Strip *strip)
float strip_speed_effect_target_frame_get(Scene *scene, Strip *strip_speed, float timeline_frame, int input)
void speed_effect_get_handle(EffectHandle &rval)
void strip_effect_speed_rebuild_map(Scene *scene, Strip *strip)
EffectHandle effect_handle_get(StripType strip_type)
static StripEarlyOut early_out_speed(const Strip *, float)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
MINLINE int round_fl_to_int(float a)
ATTR_WARN_UNUSED_RESULT const BMVert * v
ImBuf * IMB_dupImBuf(const ImBuf *ibuf1)
BMesh const char void * data
@ SEQ_SPEED_USE_INTERPOLATION
FCurve * id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *prop_name, int index, bool *r_driven)
float evaluate_fcurve(const FCurve *fcu, float evaltime)
bool can_contain_alpha() const
eEffectSpeedControlType speed_control_type
eEffectSpeedControlFlags flags
float speed_fader_frame_number
void(*) copy(Strip *dst, const Strip *src, int flag)
void(*) free(Strip *strip, bool do_id_user)
void(*) init(Strip *strip)
StripEarlyOut(*) early_out(const Strip *strip, float fac)
SeqResult(*) execute(const RenderData *context, SeqRenderState *state, Strip *strip, float timeline_frame, float fac, const SeqResult &input1, const SeqResult &input2)