diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_add.c | 14 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_draw.c | 38 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 49 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_intern.h | 4 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_select.c | 8 | ||||
-rw-r--r-- | source/blender/sequencer/SEQ_sequencer.h | 24 | ||||
-rw-r--r-- | source/blender/sequencer/intern/effects.c | 98 | ||||
-rw-r--r-- | source/blender/sequencer/intern/image_cache.c | 2 | ||||
-rw-r--r-- | source/blender/sequencer/intern/modifier.c | 17 | ||||
-rw-r--r-- | source/blender/sequencer/intern/proxy.c | 34 | ||||
-rw-r--r-- | source/blender/sequencer/intern/proxy.h | 4 | ||||
-rw-r--r-- | source/blender/sequencer/intern/render.c | 291 | ||||
-rw-r--r-- | source/blender/sequencer/intern/render.h | 12 | ||||
-rw-r--r-- | source/blender/sequencer/intern/sequencer.c | 30 | ||||
-rw-r--r-- | source/blender/sequencer/intern/sequencer.h | 6 |
15 files changed, 337 insertions, 294 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 7335882e947..37dfcdbc765 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -148,7 +148,7 @@ static int sequencer_generic_invoke_xy_guess_channel(bContext *C, int type) Sequence *seq; Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, true); - int cfra = (int)CFRA; + int timeline_frame = (int)CFRA; int proximity = INT_MAX; if (!ed || !ed->seqbasep) { @@ -156,10 +156,10 @@ static int sequencer_generic_invoke_xy_guess_channel(bContext *C, int type) } for (seq = ed->seqbasep->first; seq; seq = seq->next) { - if ((type == -1 || seq->type == type) && (seq->enddisp < cfra) && - (cfra - seq->enddisp < proximity)) { + if ((type == -1 || seq->type == type) && (seq->enddisp < timeline_frame) && + (timeline_frame - seq->enddisp < proximity)) { tgt = seq; - proximity = cfra - seq->enddisp; + proximity = timeline_frame - seq->enddisp; } } @@ -173,17 +173,17 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, i { Scene *scene = CTX_data_scene(C); - int cfra = (int)CFRA; + int timeline_frame = (int)CFRA; /* Effect strips don't need a channel initialized from the mouse. */ if (!(flag & SEQPROP_NOCHAN) && RNA_struct_property_is_set(op->ptr, "channel") == 0) { RNA_int_set(op->ptr, "channel", sequencer_generic_invoke_xy_guess_channel(C, type)); } - RNA_int_set(op->ptr, "frame_start", cfra); + RNA_int_set(op->ptr, "frame_start", timeline_frame); if ((flag & SEQPROP_ENDFRAME) && RNA_struct_property_is_set(op->ptr, "frame_end") == 0) { - RNA_int_set(op->ptr, "frame_end", cfra + 25); /* XXX arbitrary but ok for now. */ + RNA_int_set(op->ptr, "frame_end", timeline_frame + 25); /* XXX arbitrary but ok for now. */ } if (!(flag & SEQPROP_NOPATHS)) { diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 7e23f4ed281..8ac562f0ae0 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -970,14 +970,14 @@ static void fcurve_batch_add_verts(GPUVertBuf *vbo, float y1, float y2, float y_height, - int cfra, + int timeline_frame, float curve_val, unsigned int *vert_count) { float vert_pos[2][2]; - copy_v2_fl2(vert_pos[0], cfra, (curve_val * y_height) + y1); - copy_v2_fl2(vert_pos[1], cfra, y2); + copy_v2_fl2(vert_pos[0], timeline_frame, (curve_val * y_height) + y1); + copy_v2_fl2(vert_pos[1], timeline_frame, y2); GPU_vertbuf_vert_set(vbo, *vert_count, vert_pos[0]); GPU_vertbuf_vert_set(vbo, *vert_count + 1, vert_pos[1]); @@ -1026,23 +1026,25 @@ static void draw_seq_fcurve( float prev_val = INT_MIN; bool skip = false; - for (int cfra = eval_start; cfra <= eval_end; cfra += eval_step) { - curve_val = evaluate_fcurve(fcu, cfra); + for (int timeline_frame = eval_start; timeline_frame <= eval_end; + timeline_frame += eval_step) { + curve_val = evaluate_fcurve(fcu, timeline_frame); CLAMP(curve_val, 0.0f, 1.0f); /* Avoid adding adjacent verts that have the same value. */ - if (curve_val == prev_val && cfra < eval_end - eval_step) { + if (curve_val == prev_val && timeline_frame < eval_end - eval_step) { skip = true; continue; } /* If some frames were skipped above, we need to close the shape. */ if (skip) { - fcurve_batch_add_verts(vbo, y1, y2, y_height, cfra - eval_step, prev_val, &vert_count); + fcurve_batch_add_verts( + vbo, y1, y2, y_height, timeline_frame - eval_step, prev_val, &vert_count); skip = false; } - fcurve_batch_add_verts(vbo, y1, y2, y_height, cfra, curve_val, &vert_count); + fcurve_batch_add_verts(vbo, y1, y2, y_height, timeline_frame, curve_val, &vert_count); prev_val = curve_val; } @@ -1241,7 +1243,7 @@ ImBuf *sequencer_ibuf_get(struct Main *bmain, struct Depsgraph *depsgraph, Scene *scene, SpaceSeq *sseq, - int cfra, + int timeline_frame, int frame_ofs, const char *viewname) { @@ -1285,10 +1287,10 @@ ImBuf *sequencer_ibuf_get(struct Main *bmain, } if (special_seq_update) { - ibuf = SEQ_render_give_ibuf_direct(&context, cfra + frame_ofs, special_seq_update); + ibuf = SEQ_render_give_ibuf_direct(&context, timeline_frame + frame_ofs, special_seq_update); } else { - ibuf = SEQ_render_give_ibuf(&context, cfra + frame_ofs, sseq->chanshown); + ibuf = SEQ_render_give_ibuf(&context, timeline_frame + frame_ofs, sseq->chanshown); } if (viewport) { @@ -1766,7 +1768,7 @@ void sequencer_draw_preview(const bContext *C, Scene *scene, ARegion *region, SpaceSeq *sseq, - int cfra, + int timeline_frame, int offset, bool draw_overlay, bool draw_backdrop) @@ -1788,7 +1790,7 @@ void sequencer_draw_preview(const bContext *C, /* Get image. */ ibuf = sequencer_ibuf_get( - bmain, region, depsgraph, scene, sseq, cfra, offset, names[sseq->multiview_eye]); + bmain, region, depsgraph, scene, sseq, timeline_frame, offset, names[sseq->multiview_eye]); /* Setup off-screen buffers. */ GPUViewport *viewport = WM_draw_region_get_viewport(region); @@ -2318,9 +2320,9 @@ void draw_timeline_seq(const bContext *C, ARegion *region) /* Draw overlap frame frame indicator. */ if (scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) { - int cfra_over = (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ? - scene->ed->over_cfra : - scene->r.cfra + scene->ed->over_ofs; + int overlap_frame = (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ? + scene->ed->over_cfra : + scene->r.cfra + scene->ed->over_ofs; uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); @@ -2334,8 +2336,8 @@ void draw_timeline_seq(const bContext *C, ARegion *region) immUniformThemeColor(TH_CFRAME); immBegin(GPU_PRIM_LINES, 2); - immVertex2f(pos, cfra_over, v2d->cur.ymin); - immVertex2f(pos, cfra_over, v2d->cur.ymax); + immVertex2f(pos, overlap_frame, v2d->cur.ymin); + immVertex2f(pos, overlap_frame, v2d->cur.ymax); immEnd(); immUnbindProgram(); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 8f3a3ba50a0..eb4a1601187 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -985,21 +985,21 @@ static bool split_seq_list( return (seq_first_new != NULL); } -static bool sequence_offset_after_frame(Scene *scene, const int delta, const int cfra) +static bool sequence_offset_after_frame(Scene *scene, const int delta, const int timeline_frame) { Sequence *seq; Editing *ed = BKE_sequencer_editing_get(scene, false); bool done = false; TimeMarker *marker; - /* All strips >= cfra are shifted. */ + /* All strips >= timeline_frame are shifted. */ if (ed == NULL) { return 0; } for (seq = ed->seqbasep->first; seq; seq = seq->next) { - if (seq->startdisp >= cfra) { + if (seq->startdisp >= timeline_frame) { BKE_sequence_translate(scene, seq, delta); BKE_sequence_calc(scene, seq); BKE_sequence_invalidate_cache_preprocessed(scene, seq); @@ -1009,7 +1009,7 @@ static bool sequence_offset_after_frame(Scene *scene, const int delta, const int if (!scene->toolsettings->lock_markers) { for (marker = scene->markers.first; marker; marker = marker->next) { - if (marker->frame >= cfra) { + if (marker->frame >= timeline_frame) { marker->frame += delta; } } @@ -1095,7 +1095,7 @@ static int sequencer_gap_remove_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); rctf rectf; - int cfra, efra, sfra; + int timeline_frame, efra, sfra; bool first = false, done; bool do_all = RNA_boolean_get(op->ptr, "all"); @@ -1105,24 +1105,24 @@ static int sequencer_gap_remove_exec(bContext *C, wmOperator *op) efra = (int)rectf.xmax; /* Check if the current frame has a gap already. */ - for (cfra = CFRA; cfra >= sfra; cfra--) { - if (SEQ_render_evaluate_frame(scene, cfra)) { + for (timeline_frame = CFRA; timeline_frame >= sfra; timeline_frame--) { + if (SEQ_render_evaluate_frame(scene, timeline_frame)) { first = true; break; } } - for (; cfra < efra; cfra++) { + for (; timeline_frame < efra; timeline_frame++) { /* There's still no strip to remove a gap for. */ if (first == false) { - if (SEQ_render_evaluate_frame(scene, cfra)) { + if (SEQ_render_evaluate_frame(scene, timeline_frame)) { first = true; } } - else if (SEQ_render_evaluate_frame(scene, cfra) == 0) { + else if (SEQ_render_evaluate_frame(scene, timeline_frame) == 0) { done = true; - while (SEQ_render_evaluate_frame(scene, cfra) == 0) { - done = sequence_offset_after_frame(scene, -1, cfra); + while (SEQ_render_evaluate_frame(scene, timeline_frame) == 0) { + done = sequence_offset_after_frame(scene, -1, timeline_frame); if (done == false) { break; } @@ -2659,7 +2659,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) Sequence *seq, *seq_new; Strip *strip_new; StripElem *se, *se_new; - int start_ofs, cfra, frame_end; + int start_ofs, timeline_frame, frame_end; int step = RNA_int_get(op->ptr, "length"); seq = ed->seqbasep->first; /* Poll checks this is valid. */ @@ -2676,12 +2676,12 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) /* if (seq->ipo) id_us_min(&seq->ipo->id); */ /* XXX, remove fcurve and assign to split image strips */ - start_ofs = cfra = BKE_sequence_tx_get_final_left(seq, false); + start_ofs = timeline_frame = BKE_sequence_tx_get_final_left(seq, false); frame_end = BKE_sequence_tx_get_final_right(seq, false); - while (cfra < frame_end) { + while (timeline_frame < frame_end) { /* New seq. */ - se = SEQ_render_give_stripelem(seq, cfra); + se = SEQ_render_give_stripelem(seq, timeline_frame); seq_new = BKE_sequence_dupli_recursive( scene, scene, ed->seqbasep, seq, SEQ_DUPE_UNIQUE_NAME); @@ -2713,7 +2713,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) /* XXX, COPY FCURVES */ - cfra++; + timeline_frame++; start_ofs += step; } @@ -3019,11 +3019,12 @@ static bool strip_jump_internal(Scene *scene, const bool do_center) { bool changed = false; - int cfra = CFRA; - int nfra = BKE_sequencer_find_next_prev_edit(scene, cfra, side, do_skip_mute, do_center, false); + int timeline_frame = CFRA; + int next_frame = BKE_sequencer_find_next_prev_edit( + scene, timeline_frame, side, do_skip_mute, do_center, false); - if (nfra != cfra) { - CFRA = nfra; + if (next_frame != timeline_frame) { + CFRA = next_frame; changed = true; } @@ -3788,7 +3789,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) Sequence *seq = BKE_sequencer_active_get(scene); const bool is_relative_path = RNA_boolean_get(op->ptr, "relative_path"); const bool use_placeholders = RNA_boolean_get(op->ptr, "use_placeholders"); - int minframe, numdigits; + int minext_frameme, numdigits; if (seq->type == SEQ_TYPE_IMAGE) { char directory[FILE_MAX]; @@ -3797,7 +3798,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) /* Need to find min/max frame for placeholders. */ if (use_placeholders) { - len = sequencer_image_seq_get_minmax_frame(op, seq->sfra, &minframe, &numdigits); + len = sequencer_image_seq_get_minmax_frame(op, seq->sfra, &minext_frameme, &numdigits); } else { len = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files")); @@ -3821,7 +3822,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) seq->strip->stripdata = se = MEM_callocN(len * sizeof(StripElem), "stripelem"); if (use_placeholders) { - sequencer_image_seq_reserve_frames(op, se, len, minframe, numdigits); + sequencer_image_seq_reserve_frames(op, se, len, minext_frameme, numdigits); } else { RNA_BEGIN (op->ptr, itemptr, "files") { diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index df36453bd2e..1ea4fb05d53 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -47,7 +47,7 @@ void sequencer_draw_preview(const struct bContext *C, struct Scene *scene, struct ARegion *region, struct SpaceSeq *sseq, - int cfra, + int timeline_frame, int offset, bool draw_overlay, bool draw_backdrop); @@ -64,7 +64,7 @@ struct ImBuf *sequencer_ibuf_get(struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct SpaceSeq *sseq, - int cfra, + int timeline_frame, int frame_ofs, const char *viewname); diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index f7c8c35d563..a6b2d7feae3 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -975,18 +975,18 @@ static int sequencer_select_side_of_frame_exec(bContext *C, wmOperator *op) if (extend == false) { ED_sequencer_deselect_all(scene); } - const int cfra = CFRA; + const int timeline_frame = CFRA; SEQ_CURRENT_BEGIN (ed, seq) { bool test = false; switch (side) { case -1: - test = (cfra >= seq->enddisp); + test = (timeline_frame >= seq->enddisp); break; case 1: - test = (cfra <= seq->startdisp); + test = (timeline_frame <= seq->startdisp); break; case 0: - test = (cfra <= seq->enddisp) && (cfra >= seq->startdisp); + test = (timeline_frame <= seq->enddisp) && (timeline_frame >= seq->startdisp); break; } diff --git a/source/blender/sequencer/SEQ_sequencer.h b/source/blender/sequencer/SEQ_sequencer.h index edd88ba9195..d9e2d32db0b 100644 --- a/source/blender/sequencer/SEQ_sequencer.h +++ b/source/blender/sequencer/SEQ_sequencer.h @@ -145,9 +145,11 @@ typedef struct SeqRenderData { // bool gpu_full_samples; } SeqRenderData; -struct ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, float cfra, int chanshown); +struct ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, + float timeline_frame, + int chanshown); struct ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData *context, - float cfra, + float timeline_frame, struct Sequence *seq); void SEQ_render_init_colorspace(struct Sequence *seq); void SEQ_render_new_render_data(struct Main *bmain, @@ -158,8 +160,8 @@ void SEQ_render_new_render_data(struct Main *bmain, int preview_render_size, int for_render, SeqRenderData *r_context); -int SEQ_render_evaluate_frame(struct Scene *scene, int cfra); -struct StripElem *SEQ_render_give_stripelem(struct Sequence *seq, int cfra); +int SEQ_render_evaluate_frame(struct Scene *scene, int timeline_frame); +struct StripElem *SEQ_render_give_stripelem(struct Sequence *seq, int timeline_frame); /* ********************************************************************** * render.c @@ -196,7 +198,7 @@ int BKE_sequencer_recursive_apply(struct Sequence *seq, void *arg); float BKE_sequence_get_fps(struct Scene *scene, struct Sequence *seq); int BKE_sequencer_find_next_prev_edit(struct Scene *scene, - int cfra, + int timeline_frame, const short side, const bool do_skip_mute, const bool do_center, @@ -355,7 +357,7 @@ void BKE_sequence_invalidate_cache_in_range(struct Scene *scene, struct Sequence *seq, struct Sequence *range_mask, int invalidate_types); -void BKE_sequencer_all_free_anim_ibufs(struct Scene *scene, int cfra); +void BKE_sequencer_all_free_anim_ibufs(struct Scene *scene, int timeline_frame); /* ********************************************************************** * sequencer.c @@ -403,7 +405,7 @@ typedef struct SeqLoadInfo { /* use as an api function */ typedef struct Sequence *(*SeqLoadFn)(struct bContext *, ListBase *, struct SeqLoadInfo *); -struct Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine, int type); +struct Sequence *BKE_sequence_alloc(ListBase *lb, int timeline_frame, int machine, int type); struct Sequence *BKE_sequencer_add_image_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load); @@ -460,7 +462,7 @@ struct SequenceModifierData *BKE_sequence_modifier_find_by_name(struct Sequence struct ImBuf *BKE_sequence_modifier_apply_stack(const SeqRenderData *context, struct Sequence *seq, struct ImBuf *ibuf, - int cfra); + int timeline_frame); void BKE_sequence_modifier_list_copy(struct Sequence *seqn, struct Sequence *seq); int BKE_sequence_supports_modifiers(struct Sequence *seq); @@ -509,7 +511,7 @@ struct SeqEffectHandle { void (*store_icu_yrange)(struct Sequence *seq, short adrcode, float *ymin, float *ymax); /* stores the default facf0 and facf1 if no IPO is present */ - void (*get_default_fac)(struct Sequence *seq, float cfra, float *facf0, float *facf1); + void (*get_default_fac)(struct Sequence *seq, float timeline_frame, float *facf0, float *facf1); /* execute the effect * sequence effects are only required to either support @@ -518,7 +520,7 @@ struct SeqEffectHandle { struct ImBuf *(*execute)(const SeqRenderData *context, struct Sequence *seq, - float cfra, + float timeline_frame, float facf0, float facf1, struct ImBuf *ibuf1, @@ -532,7 +534,7 @@ struct SeqEffectHandle { void (*execute_slice)(const SeqRenderData *context, struct Sequence *seq, - float cfra, + float timeline_frame, float facf0, float facf1, struct ImBuf *ibuf1, diff --git a/source/blender/sequencer/intern/effects.c b/source/blender/sequencer/intern/effects.c index 039c18bf51d..041ef1c411d 100644 --- a/source/blender/sequencer/intern/effects.c +++ b/source/blender/sequencer/intern/effects.c @@ -354,7 +354,7 @@ static void do_alphaover_effect_float( static void do_alphaover_effect(const SeqRenderData *context, Sequence *UNUSED(seq), - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -561,7 +561,7 @@ static void do_alphaunder_effect_float( static void do_alphaunder_effect(const SeqRenderData *context, Sequence *UNUSED(seq), - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -696,7 +696,7 @@ static void do_cross_effect_float( static void do_cross_effect(const SeqRenderData *context, Sequence *UNUSED(seq), - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -994,7 +994,7 @@ static struct ImBuf *gammacross_init_execution(const SeqRenderData *context, static void do_gammacross_effect(const SeqRenderData *context, Sequence *UNUSED(seq), - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -1129,7 +1129,7 @@ static void do_add_effect_float( static void do_add_effect(const SeqRenderData *context, Sequence *UNUSED(seq), - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -1264,7 +1264,7 @@ static void do_sub_effect_float( static void do_sub_effect(const SeqRenderData *context, Sequence *UNUSED(seq), - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -1515,7 +1515,7 @@ static void do_mul_effect_float( static void do_mul_effect(const SeqRenderData *context, Sequence *UNUSED(seq), - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -1805,7 +1805,7 @@ static void do_blend_effect_byte(float facf0, static void do_blend_mode_effect(const SeqRenderData *context, Sequence *seq, - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -1846,7 +1846,7 @@ static void init_colormix_effect(Sequence *seq) static void do_colormix_effect(const SeqRenderData *context, Sequence *seq, - float UNUSED(cfra), + float UNUSED(timeline_frame), float UNUSED(facf0), float UNUSED(facf1), ImBuf *ibuf1, @@ -2311,7 +2311,7 @@ static void do_wipe_effect_float(Sequence *seq, static ImBuf *do_wipe_effect(const SeqRenderData *context, Sequence *seq, - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -2442,7 +2442,7 @@ static void transform_image(int x, static void do_transform_effect(const SeqRenderData *context, Sequence *seq, - float UNUSED(cfra), + float UNUSED(timeline_frame), float UNUSED(facf0), float UNUSED(facf1), ImBuf *ibuf1, @@ -2789,7 +2789,7 @@ static void do_glow_effect_float(Sequence *seq, static ImBuf *do_glow_effect(const SeqRenderData *context, Sequence *seq, - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -2868,7 +2868,7 @@ static int early_out_color(Sequence *UNUSED(seq), float UNUSED(facf0), float UNU static ImBuf *do_solid_color(const SeqRenderData *context, Sequence *seq, - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -2966,7 +2966,7 @@ static int early_out_multicam(Sequence *UNUSED(seq), float UNUSED(facf0), float static ImBuf *do_multicam(const SeqRenderData *context, Sequence *seq, - float cfra, + float timeline_frame, float UNUSED(facf0), float UNUSED(facf1), ImBuf *UNUSED(ibuf1), @@ -2990,7 +2990,7 @@ static ImBuf *do_multicam(const SeqRenderData *context, return NULL; } - out = seq_render_give_ibuf_seqbase(context, cfra, seq->multicam_source, seqbasep); + out = seq_render_give_ibuf_seqbase(context, timeline_frame, seq->multicam_source, seqbasep); return out; } @@ -3008,7 +3008,7 @@ static int early_out_adjustment(Sequence *UNUSED(seq), float UNUSED(facf0), floa return EARLY_NO_INPUT; } -static ImBuf *do_adjustment_impl(const SeqRenderData *context, Sequence *seq, float cfra) +static ImBuf *do_adjustment_impl(const SeqRenderData *context, Sequence *seq, float timeline_frame) { Editing *ed; ListBase *seqbasep; @@ -3019,7 +3019,7 @@ static ImBuf *do_adjustment_impl(const SeqRenderData *context, Sequence *seq, fl seqbasep = BKE_sequence_seqbase(&ed->seqbase, seq); if (seq->machine > 1) { - i = seq_render_give_ibuf_seqbase(context, cfra, seq->machine - 1, seqbasep); + i = seq_render_give_ibuf_seqbase(context, timeline_frame, seq->machine - 1, seqbasep); } /* found nothing? so let's work the way up the metastrip stack, so @@ -3033,7 +3033,7 @@ static ImBuf *do_adjustment_impl(const SeqRenderData *context, Sequence *seq, fl meta = BKE_sequence_metastrip(&ed->seqbase, NULL, seq); if (meta) { - i = do_adjustment_impl(context, meta, cfra); + i = do_adjustment_impl(context, meta, timeline_frame); } } @@ -3042,7 +3042,7 @@ static ImBuf *do_adjustment_impl(const SeqRenderData *context, Sequence *seq, fl static ImBuf *do_adjustment(const SeqRenderData *context, Sequence *seq, - float cfra, + float timeline_frame, float UNUSED(facf0), float UNUSED(facf1), ImBuf *UNUSED(ibuf1), @@ -3058,7 +3058,7 @@ static ImBuf *do_adjustment(const SeqRenderData *context, return NULL; } - out = do_adjustment_impl(context, seq, cfra); + out = do_adjustment_impl(context, seq, timeline_frame); return out; } @@ -3146,7 +3146,7 @@ static void store_icu_yrange_speed(Sequence *seq, short UNUSED(adrcode), float * void BKE_sequence_effect_speed_rebuild_map(Scene *scene, Sequence *seq, bool force) { - int cfra; + int timeline_frame; float fallback_fac = 1.0f; SpeedControlVars *v = (SpeedControlVars *)seq->effectdata; FCurve *fcu = NULL; @@ -3199,9 +3199,9 @@ void BKE_sequence_effect_speed_rebuild_map(Scene *scene, Sequence *seq, bool for v->frameMap[0] = 0; v->lastValidFrame = 0; - for (cfra = 1; cfra < v->length; cfra++) { + for (timeline_frame = 1; timeline_frame < v->length; timeline_frame++) { if (fcu) { - facf = evaluate_fcurve(fcu, seq->startdisp + cfra); + facf = evaluate_fcurve(fcu, seq->startdisp + timeline_frame); } else { facf = fallback_fac; @@ -3211,11 +3211,11 @@ void BKE_sequence_effect_speed_rebuild_map(Scene *scene, Sequence *seq, bool for cursor += facf; if (cursor >= seq->seq1->len) { - v->frameMap[cfra] = seq->seq1->len - 1; + v->frameMap[timeline_frame] = seq->seq1->len - 1; } else { - v->frameMap[cfra] = cursor; - v->lastValidFrame = cfra; + v->frameMap[timeline_frame] = cursor; + v->lastValidFrame = timeline_frame; } } } @@ -3223,10 +3223,10 @@ void BKE_sequence_effect_speed_rebuild_map(Scene *scene, Sequence *seq, bool for float facf; v->lastValidFrame = 0; - for (cfra = 0; cfra < v->length; cfra++) { + for (timeline_frame = 0; timeline_frame < v->length; timeline_frame++) { if (fcu) { - facf = evaluate_fcurve(fcu, seq->startdisp + cfra); + facf = evaluate_fcurve(fcu, seq->startdisp + timeline_frame); } else { facf = fallback_fac; @@ -3241,45 +3241,47 @@ void BKE_sequence_effect_speed_rebuild_map(Scene *scene, Sequence *seq, bool for facf = seq->seq1->len - 1; } else { - v->lastValidFrame = cfra; + v->lastValidFrame = timeline_frame; } - v->frameMap[cfra] = facf; + v->frameMap[timeline_frame] = facf; } } } -/* Override cfra when rendering speed effect input. */ +/* Override timeline_frame when rendering speed effect input. */ float BKE_sequencer_speed_effect_target_frame_get(const SeqRenderData *context, Sequence *seq, - float cfra, + float timeline_frame, int input) { - int nr = seq_give_stripelem_index(seq, cfra); + int frame_index = seq_give_frame_index(seq, timeline_frame); SpeedControlVars *s = (SpeedControlVars *)seq->effectdata; BKE_sequence_effect_speed_rebuild_map(context->scene, seq, false); /* No interpolation. */ if ((s->flags & SEQ_SPEED_USE_INTERPOLATION) == 0) { - return seq->start + s->frameMap[nr]; + return seq->start + s->frameMap[frame_index]; } /* We need to provide current and next image for interpolation. */ if (input == 0) { /* Current frame. */ - return floor(seq->start + s->frameMap[nr]); + return floor(seq->start + s->frameMap[frame_index]); } /* Next frame. */ - return ceil(seq->start + s->frameMap[nr]); + return ceil(seq->start + s->frameMap[frame_index]); } -static float speed_effect_interpolation_ratio_get(SpeedControlVars *s, Sequence *seq, float cfra) +static float speed_effect_interpolation_ratio_get(SpeedControlVars *s, + Sequence *seq, + float timeline_frame) { - int nr = seq_give_stripelem_index(seq, cfra); - return s->frameMap[nr] - floor(s->frameMap[nr]); + int frame_index = seq_give_frame_index(seq, timeline_frame); + return s->frameMap[frame_index] - floor(s->frameMap[frame_index]); } static ImBuf *do_speed_effect(const SeqRenderData *context, Sequence *seq, - float cfra, + float timeline_frame, float facf0, float facf1, ImBuf *ibuf1, @@ -3292,10 +3294,10 @@ static ImBuf *do_speed_effect(const SeqRenderData *context, if (s->flags & SEQ_SPEED_USE_INTERPOLATION) { out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3); - facf0 = facf1 = speed_effect_interpolation_ratio_get(s, seq, cfra); + facf0 = facf1 = speed_effect_interpolation_ratio_get(s, seq, timeline_frame); /* Current frame is ibuf1, next frame is ibuf2. */ out = seq_render_effect_execute_threaded( - &cross_effect, context, NULL, cfra, facf0, facf1, ibuf1, ibuf2, ibuf3); + &cross_effect, context, NULL, timeline_frame, facf0, facf1, ibuf1, ibuf2, ibuf3); return out; } @@ -3307,7 +3309,7 @@ static ImBuf *do_speed_effect(const SeqRenderData *context, static void do_overdrop_effect(const SeqRenderData *context, Sequence *UNUSED(seq), - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -3731,7 +3733,7 @@ static void *render_effect_execute_do_y_thread(void *thread_data_v) static ImBuf *do_gaussian_blur_effect(const SeqRenderData *context, Sequence *seq, - float UNUSED(cfra), + float UNUSED(timeline_frame), float UNUSED(facf0), float UNUSED(facf1), ImBuf *ibuf1, @@ -3870,7 +3872,7 @@ static int early_out_text(Sequence *seq, float UNUSED(facf0), float UNUSED(facf1 static ImBuf *do_text_effect(const SeqRenderData *context, Sequence *seq, - float UNUSED(cfra), + float UNUSED(timeline_frame), float UNUSED(facf0), float UNUSED(facf1), ImBuf *ibuf1, @@ -4044,16 +4046,16 @@ static void store_icu_yrange_noop(Sequence *UNUSED(seq), } static void get_default_fac_noop(Sequence *UNUSED(seq), - float UNUSED(cfra), + float UNUSED(timeline_frame), float *facf0, float *facf1) { *facf0 = *facf1 = 1.0; } -static void get_default_fac_fade(Sequence *seq, float cfra, float *facf0, float *facf1) +static void get_default_fac_fade(Sequence *seq, float timeline_frame, float *facf0, float *facf1) { - *facf0 = (float)(cfra - seq->startdisp); + *facf0 = (float)(timeline_frame - seq->startdisp); *facf1 = (float)(*facf0 + 0.5f); *facf0 /= seq->len; *facf1 /= seq->len; diff --git a/source/blender/sequencer/intern/image_cache.c b/source/blender/sequencer/intern/image_cache.c index 4bbf1838b4e..be6a640dd3f 100644 --- a/source/blender/sequencer/intern/image_cache.c +++ b/source/blender/sequencer/intern/image_cache.c @@ -740,7 +740,7 @@ static float seq_cache_timeline_frame_to_frame_index(Sequence *seq, float timeli * images or extended frame range of movies will only generate one cache entry. No special * treatment in converting frame index to timeline_frame is needed. */ if (type == SEQ_CACHE_STORE_RAW) { - return seq_give_stripelem_index(seq, timeline_frame); + return seq_give_frame_index(seq, timeline_frame); } return timeline_frame - seq->start; diff --git a/source/blender/sequencer/intern/modifier.c b/source/blender/sequencer/intern/modifier.c index a7d4ce2801a..ae5aae4f412 100644 --- a/source/blender/sequencer/intern/modifier.c +++ b/source/blender/sequencer/intern/modifier.c @@ -86,13 +86,13 @@ typedef struct ModifierThread { } ModifierThread; /** - * \a cfra is offset by \a fra_offset only in case we are using a real mask. + * \a timeline_frame is offset by \a fra_offset only in case we are using a real mask. */ static ImBuf *modifier_render_mask_input(const SeqRenderData *context, int mask_input_type, Sequence *mask_sequence, Mask *mask_id, - int cfra, + int timeline_frame, int fra_offset, bool make_float) { @@ -103,7 +103,7 @@ static ImBuf *modifier_render_mask_input(const SeqRenderData *context, SeqRenderState state; seq_render_state_init(&state); - mask_input = seq_render_strip(context, &state, mask_sequence, cfra); + mask_input = seq_render_strip(context, &state, mask_sequence, timeline_frame); if (make_float) { if (!mask_input->rect_float) { @@ -118,7 +118,7 @@ static ImBuf *modifier_render_mask_input(const SeqRenderData *context, } } else if (mask_input_type == SEQUENCE_MASK_INPUT_ID) { - mask_input = seq_render_mask(context, mask_id, cfra - fra_offset, make_float); + mask_input = seq_render_mask(context, mask_id, timeline_frame - fra_offset, make_float); } return mask_input; @@ -126,7 +126,7 @@ static ImBuf *modifier_render_mask_input(const SeqRenderData *context, static ImBuf *modifier_mask_get(SequenceModifierData *smd, const SeqRenderData *context, - int cfra, + int timeline_frame, int fra_offset, bool make_float) { @@ -134,7 +134,7 @@ static ImBuf *modifier_mask_get(SequenceModifierData *smd, smd->mask_input_type, smd->mask_sequence, smd->mask_id, - cfra, + timeline_frame, fra_offset, make_float); } @@ -1410,7 +1410,7 @@ SequenceModifierData *BKE_sequence_modifier_find_by_name(Sequence *seq, const ch ImBuf *BKE_sequence_modifier_apply_stack(const SeqRenderData *context, Sequence *seq, ImBuf *ibuf, - int cfra) + int timeline_frame) { SequenceModifierData *smd; ImBuf *processed_ibuf = ibuf; @@ -1442,7 +1442,8 @@ ImBuf *BKE_sequence_modifier_apply_stack(const SeqRenderData *context, frame_offset = smd->mask_id ? ((Mask *)smd->mask_id)->sfra : 0; } - ImBuf *mask = modifier_mask_get(smd, context, cfra, frame_offset, ibuf->rect_float != NULL); + ImBuf *mask = modifier_mask_get( + smd, context, timeline_frame, frame_offset, ibuf->rect_float != NULL); if (processed_ibuf == ibuf) { processed_ibuf = IMB_dupImBuf(ibuf); diff --git a/source/blender/sequencer/intern/proxy.c b/source/blender/sequencer/intern/proxy.c index 94d5f5b701d..83231a00f91 100644 --- a/source/blender/sequencer/intern/proxy.c +++ b/source/blender/sequencer/intern/proxy.c @@ -132,7 +132,7 @@ bool seq_proxy_get_custom_file_fname(Sequence *seq, char *name, const int view_i static bool seq_proxy_get_fname(Editing *ed, Sequence *seq, - int cfra, + int timeline_frame, eSpaceSeq_Proxy_RenderSize render_size, char *name, const int view_id) @@ -186,7 +186,7 @@ static bool seq_proxy_get_fname(Editing *ed, "%s/images/%d/%s_proxy%s", dir, proxy_size_number, - SEQ_render_give_stripelem(seq, cfra)->name, + SEQ_render_give_stripelem(seq, timeline_frame)->name, suffix); BLI_path_abs(name, BKE_main_blendfile_path_from_global()); strcat(name, ".jpg"); @@ -203,7 +203,7 @@ bool SEQ_can_use_proxy(Sequence *seq, int psize) return (seq->flag & SEQ_USE_PROXY) != 0 && psize != IMB_PROXY_NONE && (size_flags & psize) != 0; } -ImBuf *seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int cfra) +ImBuf *seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int timeline_frame) { char name[PROXY_MAXFILE]; StripProxy *proxy = seq->strip->proxy; @@ -217,9 +217,9 @@ ImBuf *seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int cfra) } if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) { - int frameno = (int)seq_give_stripelem_index(seq, cfra) + seq->anim_startofs; + int frameno = (int)seq_give_frame_index(seq, timeline_frame) + seq->anim_startofs; if (proxy->anim == NULL) { - if (seq_proxy_get_fname(ed, seq, cfra, psize, name, context->view_id) == 0) { + if (seq_proxy_get_fname(ed, seq, timeline_frame, psize, name, context->view_id) == 0) { return NULL; } @@ -238,7 +238,7 @@ ImBuf *seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int cfra) return IMB_anim_absolute(proxy->anim, frameno, IMB_TC_NONE, IMB_PROXY_NONE); } - if (seq_proxy_get_fname(ed, seq, cfra, psize, name, context->view_id) == 0) { + if (seq_proxy_get_fname(ed, seq, timeline_frame, psize, name, context->view_id) == 0) { return NULL; } @@ -258,7 +258,7 @@ ImBuf *seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int cfra) static void seq_proxy_build_frame(const SeqRenderData *context, SeqRenderState *state, Sequence *seq, - int cfra, + int timeline_frame, int proxy_render_size, const bool overwrite) { @@ -269,7 +269,7 @@ static void seq_proxy_build_frame(const SeqRenderData *context, ImBuf *ibuf_tmp, *ibuf; Editing *ed = context->scene->ed; - if (!seq_proxy_get_fname(ed, seq, cfra, proxy_render_size, name, context->view_id)) { + if (!seq_proxy_get_fname(ed, seq, timeline_frame, proxy_render_size, name, context->view_id)) { return; } @@ -277,7 +277,7 @@ static void seq_proxy_build_frame(const SeqRenderData *context, return; } - ibuf_tmp = seq_render_strip(context, state, seq, cfra); + ibuf_tmp = seq_render_strip(context, state, seq, timeline_frame); rectx = (proxy_render_size * ibuf_tmp->x) / 100; recty = (proxy_render_size * ibuf_tmp->y) / 100; @@ -471,7 +471,7 @@ void SEQ_proxy_rebuild(SeqIndexBuildContext *context, Sequence *seq = context->seq; Scene *scene = context->scene; Main *bmain = context->bmain; - int cfra; + int timeline_frame; if (seq->type == SEQ_TYPE_MOVIE) { if (context->index_context) { @@ -508,21 +508,23 @@ void SEQ_proxy_rebuild(SeqIndexBuildContext *context, SeqRenderState state; seq_render_state_init(&state); - for (cfra = seq->startdisp + seq->startstill; cfra < seq->enddisp - seq->endstill; cfra++) { + for (timeline_frame = seq->startdisp + seq->startstill; + timeline_frame < seq->enddisp - seq->endstill; + timeline_frame++) { if (context->size_flags & IMB_PROXY_25) { - seq_proxy_build_frame(&render_context, &state, seq, cfra, 25, overwrite); + seq_proxy_build_frame(&render_context, &state, seq, timeline_frame, 25, overwrite); } if (context->size_flags & IMB_PROXY_50) { - seq_proxy_build_frame(&render_context, &state, seq, cfra, 50, overwrite); + seq_proxy_build_frame(&render_context, &state, seq, timeline_frame, 50, overwrite); } if (context->size_flags & IMB_PROXY_75) { - seq_proxy_build_frame(&render_context, &state, seq, cfra, 75, overwrite); + seq_proxy_build_frame(&render_context, &state, seq, timeline_frame, 75, overwrite); } if (context->size_flags & IMB_PROXY_100) { - seq_proxy_build_frame(&render_context, &state, seq, cfra, 100, overwrite); + seq_proxy_build_frame(&render_context, &state, seq, timeline_frame, 100, overwrite); } - *progress = (float)(cfra - seq->startdisp - seq->startstill) / + *progress = (float)(timeline_frame - seq->startdisp - seq->startstill) / (seq->enddisp - seq->endstill - seq->startdisp - seq->startstill); *do_update = true; diff --git a/source/blender/sequencer/intern/proxy.h b/source/blender/sequencer/intern/proxy.h index 3777cea9317..a2a94f036b1 100644 --- a/source/blender/sequencer/intern/proxy.h +++ b/source/blender/sequencer/intern/proxy.h @@ -32,7 +32,9 @@ struct SeqRenderData; struct Sequence; #define PROXY_MAXFILE (2 * FILE_MAXDIR + FILE_MAXFILE) -struct ImBuf *seq_proxy_fetch(const struct SeqRenderData *context, struct Sequence *seq, int cfra); +struct ImBuf *seq_proxy_fetch(const struct SeqRenderData *context, + struct Sequence *seq, + int timeline_frame); bool seq_proxy_get_custom_file_fname(struct Sequence *seq, char *name, const int view_id); #ifdef __cplusplus diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c index c2e04ebeff8..2a11c61d137 100644 --- a/source/blender/sequencer/intern/render.c +++ b/source/blender/sequencer/intern/render.c @@ -73,7 +73,7 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, SeqRenderState *state, ListBase *seqbasep, - float cfra, + float timeline_frame, int chanshown); static ThreadMutex seq_render_mutex = BLI_MUTEX_INITIALIZER; @@ -257,9 +257,9 @@ void seq_render_state_init(SeqRenderState *state) state->scene_parents = NULL; } -float seq_give_stripelem_index(Sequence *seq, float cfra) +float seq_give_frame_index(Sequence *seq, float timeline_frame) { - float nr; + float frame_index; int sta = seq->start; int end = seq->start + seq->len - 1; @@ -273,25 +273,25 @@ float seq_give_stripelem_index(Sequence *seq, float cfra) if (seq->flag & SEQ_REVERSE_FRAMES) { /*reverse frame in this sequence */ - if (cfra <= sta) { - nr = end - sta; + if (timeline_frame <= sta) { + frame_index = end - sta; } - else if (cfra >= end) { - nr = 0; + else if (timeline_frame >= end) { + frame_index = 0; } else { - nr = end - cfra; + frame_index = end - timeline_frame; } } else { - if (cfra <= sta) { - nr = 0; + if (timeline_frame <= sta) { + frame_index = 0; } - else if (cfra >= end) { - nr = end - sta; + else if (timeline_frame >= end) { + frame_index = end - sta; } else { - nr = cfra - sta; + frame_index = timeline_frame - sta; } } @@ -300,13 +300,13 @@ float seq_give_stripelem_index(Sequence *seq, float cfra) } if (seq->strobe > 1.0f) { - nr -= fmodf((double)nr, (double)seq->strobe); + frame_index -= fmodf((double)frame_index, (double)seq->strobe); } - return nr; + return frame_index; } -StripElem *SEQ_render_give_stripelem(Sequence *seq, int cfra) +StripElem *SEQ_render_give_stripelem(Sequence *seq, int timeline_frame) { StripElem *se = seq->strip->stripdata; @@ -315,18 +315,21 @@ StripElem *SEQ_render_give_stripelem(Sequence *seq, int cfra) * all other strips don't use this... */ - int nr = (int)seq_give_stripelem_index(seq, cfra); + int frame_index = (int)seq_give_frame_index(seq, timeline_frame); - if (nr == -1 || se == NULL) { + if (frame_index == -1 || se == NULL) { return NULL; } - se += nr + seq->anim_startofs; + se += frame_index + seq->anim_startofs; } return se; } -static int evaluate_seq_frame_gen(Sequence **seq_arr, ListBase *seqbase, int cfra, int chanshown) +static int evaluate_seq_frame_gen(Sequence **seq_arr, + ListBase *seqbase, + int timeline_frame, + int chanshown) { /* Use arbitrary sized linked list, the size could be over MAXSEQ. */ LinkNodePair effect_inputs = {NULL, NULL}; @@ -335,7 +338,7 @@ static int evaluate_seq_frame_gen(Sequence **seq_arr, ListBase *seqbase, int cfr memset(seq_arr, 0, sizeof(Sequence *) * (MAXSEQ + 1)); LISTBASE_FOREACH (Sequence *, seq, seqbase) { - if ((seq->startdisp <= cfra) && (seq->enddisp > cfra)) { + if ((seq->startdisp <= timeline_frame) && (seq->enddisp > timeline_frame)) { if ((seq->type & SEQ_TYPE_EFFECT) && !(seq->flag & SEQ_MUTE)) { if (seq->seq1) { @@ -378,7 +381,7 @@ static int evaluate_seq_frame_gen(Sequence **seq_arr, ListBase *seqbase, int cfr return totseq; } -int SEQ_render_evaluate_frame(Scene *scene, int cfra) +int SEQ_render_evaluate_frame(Scene *scene, int timeline_frame) { Editing *ed = BKE_sequencer_editing_get(scene, false); Sequence *seq_arr[MAXSEQ + 1]; @@ -387,7 +390,7 @@ int SEQ_render_evaluate_frame(Scene *scene, int cfra) return 0; } - return evaluate_seq_frame_gen(seq_arr, ed->seqbasep, cfra, 0); + return evaluate_seq_frame_gen(seq_arr, ed->seqbasep, timeline_frame, 0); } static bool video_seq_is_rendered(Sequence *seq) @@ -395,7 +398,10 @@ static bool video_seq_is_rendered(Sequence *seq) return (seq && !(seq->flag & SEQ_MUTE) && seq->type != SEQ_TYPE_SOUND_RAM); } -int seq_get_shown_sequences(ListBase *seqbasep, int cfra, int chanshown, Sequence **seq_arr_out) +int seq_get_shown_sequences(ListBase *seqbasep, + int timeline_frame, + int chanshown, + Sequence **seq_arr_out) { Sequence *seq_arr[MAXSEQ + 1]; int b = chanshown; @@ -405,7 +411,7 @@ int seq_get_shown_sequences(ListBase *seqbasep, int cfra, int chanshown, Sequenc return 0; } - if (evaluate_seq_frame_gen(seq_arr, seqbasep, cfra, chanshown)) { + if (evaluate_seq_frame_gen(seq_arr, seqbasep, timeline_frame, chanshown)) { if (b == 0) { b = MAXSEQ; } @@ -500,7 +506,7 @@ static bool sequencer_use_crop(const Sequence *seq) static bool BKE_sequencer_input_have_to_preprocess(const SeqRenderData *context, Sequence *seq, - float UNUSED(cfra)) + float UNUSED(timeline_frame)) { float mul; @@ -648,7 +654,7 @@ static void multibuf(ImBuf *ibuf, const float fmul) static ImBuf *input_preprocess(const SeqRenderData *context, Sequence *seq, - float cfra, + float timeline_frame, ImBuf *ibuf, const bool UNUSED(is_proxy_image)) { @@ -761,7 +767,8 @@ static ImBuf *input_preprocess(const SeqRenderData *context, } if (seq->modifiers.first) { - ImBuf *ibuf_new = BKE_sequence_modifier_apply_stack(context, seq, preprocessed_ibuf, cfra); + ImBuf *ibuf_new = BKE_sequence_modifier_apply_stack( + context, seq, preprocessed_ibuf, timeline_frame); if (ibuf_new != preprocessed_ibuf) { IMB_metadata_copy(ibuf_new, preprocessed_ibuf); @@ -776,7 +783,7 @@ static ImBuf *input_preprocess(const SeqRenderData *context, static ImBuf *seq_render_preprocess_ibuf(const SeqRenderData *context, Sequence *seq, ImBuf *ibuf, - float cfra, + float timeline_frame, clock_t begin, bool use_preprocess, const bool is_proxy_image) @@ -793,16 +800,18 @@ static ImBuf *seq_render_preprocess_ibuf(const SeqRenderData *context, * but it adds quite a bit of complexity. Since proxies are fast to read, I would * rather simplify existing code a bit. */ if (!is_proxy_image) { - BKE_sequencer_cache_put(context, seq, cfra, SEQ_CACHE_STORE_RAW, ibuf, cost, false); + BKE_sequencer_cache_put( + context, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibuf, cost, false); } /* Reset timer so we can get partial render time. */ begin = seq_estimate_render_cost_begin(); - ibuf = input_preprocess(context, seq, cfra, ibuf, is_proxy_image); + ibuf = input_preprocess(context, seq, timeline_frame, ibuf, is_proxy_image); } float cost = seq_estimate_render_cost_end(context->scene, begin); - BKE_sequencer_cache_put(context, seq, cfra, SEQ_CACHE_STORE_PREPROCESSED, ibuf, cost, false); + BKE_sequencer_cache_put( + context, seq, timeline_frame, SEQ_CACHE_STORE_PREPROCESSED, ibuf, cost, false); return ibuf; } @@ -810,7 +819,7 @@ typedef struct RenderEffectInitData { struct SeqEffectHandle *sh; const SeqRenderData *context; Sequence *seq; - float cfra, facf0, facf1; + float timeline_frame, facf0, facf1; ImBuf *ibuf1, *ibuf2, *ibuf3; ImBuf *out; @@ -820,7 +829,7 @@ typedef struct RenderEffectThread { struct SeqEffectHandle *sh; const SeqRenderData *context; Sequence *seq; - float cfra, facf0, facf1; + float timeline_frame, facf0, facf1; ImBuf *ibuf1, *ibuf2, *ibuf3; ImBuf *out; @@ -838,7 +847,7 @@ static void render_effect_execute_init_handle(void *handle_v, handle->sh = init_data->sh; handle->context = init_data->context; handle->seq = init_data->seq; - handle->cfra = init_data->cfra; + handle->timeline_frame = init_data->timeline_frame; handle->facf0 = init_data->facf0; handle->facf1 = init_data->facf1; handle->ibuf1 = init_data->ibuf1; @@ -856,7 +865,7 @@ static void *render_effect_execute_do_thread(void *thread_data_v) thread_data->sh->execute_slice(thread_data->context, thread_data->seq, - thread_data->cfra, + thread_data->timeline_frame, thread_data->facf0, thread_data->facf1, thread_data->ibuf1, @@ -872,7 +881,7 @@ static void *render_effect_execute_do_thread(void *thread_data_v) ImBuf *seq_render_effect_execute_threaded(struct SeqEffectHandle *sh, const SeqRenderData *context, Sequence *seq, - float cfra, + float timeline_frame, float facf0, float facf1, ImBuf *ibuf1, @@ -885,7 +894,7 @@ ImBuf *seq_render_effect_execute_threaded(struct SeqEffectHandle *sh, init_data.sh = sh; init_data.context = context; init_data.seq = seq; - init_data.cfra = cfra; + init_data.timeline_frame = timeline_frame; init_data.facf0 = facf0; init_data.facf1 = facf1; init_data.ibuf1 = ibuf1; @@ -905,7 +914,7 @@ ImBuf *seq_render_effect_execute_threaded(struct SeqEffectHandle *sh, static ImBuf *seq_render_effect_strip_impl(const SeqRenderData *context, SeqRenderState *state, Sequence *seq, - float cfra) + float timeline_frame) { Scene *scene = context->scene; float fac, facf; @@ -930,13 +939,13 @@ static ImBuf *seq_render_effect_strip_impl(const SeqRenderData *context, } if (seq->flag & SEQ_USE_EFFECT_DEFAULT_FADE) { - sh.get_default_fac(seq, cfra, &fac, &facf); + sh.get_default_fac(seq, timeline_frame, &fac, &facf); facf = fac; } else { fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "effect_fader", 0, NULL); if (fcu) { - fac = facf = evaluate_fcurve(fcu, cfra); + fac = facf = evaluate_fcurve(fcu, timeline_frame); } else { fac = facf = seq->effect_fader; @@ -947,18 +956,19 @@ static ImBuf *seq_render_effect_strip_impl(const SeqRenderData *context, switch (early_out) { case EARLY_NO_INPUT: - out = sh.execute(context, seq, cfra, fac, facf, NULL, NULL, NULL); + out = sh.execute(context, seq, timeline_frame, fac, facf, NULL, NULL, NULL); break; case EARLY_DO_EFFECT: for (i = 0; i < 3; i++) { - /* Speed effect requires time remapping of `cfra` for input(s). */ + /* Speed effect requires time remapping of `timeline_frame` for input(s). */ if (input[0] && seq->type == SEQ_TYPE_SPEED) { - float target_frame = BKE_sequencer_speed_effect_target_frame_get(context, seq, cfra, i); + float target_frame = BKE_sequencer_speed_effect_target_frame_get( + context, seq, timeline_frame, i); ibuf[i] = seq_render_strip(context, state, input[0], target_frame); } else { /* Other effects. */ if (input[i]) { - ibuf[i] = seq_render_strip(context, state, input[i], cfra); + ibuf[i] = seq_render_strip(context, state, input[i], timeline_frame); } } } @@ -966,21 +976,21 @@ static ImBuf *seq_render_effect_strip_impl(const SeqRenderData *context, if (ibuf[0] && (ibuf[1] || BKE_sequence_effect_get_num_inputs(seq->type) == 1)) { if (sh.multithreaded) { out = seq_render_effect_execute_threaded( - &sh, context, seq, cfra, fac, facf, ibuf[0], ibuf[1], ibuf[2]); + &sh, context, seq, timeline_frame, fac, facf, ibuf[0], ibuf[1], ibuf[2]); } else { - out = sh.execute(context, seq, cfra, fac, facf, ibuf[0], ibuf[1], ibuf[2]); + out = sh.execute(context, seq, timeline_frame, fac, facf, ibuf[0], ibuf[1], ibuf[2]); } } break; case EARLY_USE_INPUT_1: if (input[0]) { - out = seq_render_strip(context, state, input[0], cfra); + out = seq_render_strip(context, state, input[0], timeline_frame); } break; case EARLY_USE_INPUT_2: if (input[1]) { - out = seq_render_strip(context, state, input[1], cfra); + out = seq_render_strip(context, state, input[1], timeline_frame); } break; } @@ -1061,8 +1071,8 @@ static bool seq_image_strip_is_multiview_render( static ImBuf *seq_render_image_strip(const SeqRenderData *context, Sequence *seq, - float UNUSED(nr), - float cfra, + float UNUSED(frame_index), + float timeline_frame, bool *r_is_proxy_image) { char name[FILE_MAX]; @@ -1070,7 +1080,7 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context, char prefix[FILE_MAX]; ImBuf *ibuf = NULL; - StripElem *s_elem = SEQ_render_give_stripelem(seq, cfra); + StripElem *s_elem = SEQ_render_give_stripelem(seq, timeline_frame); if (s_elem == NULL) { return NULL; } @@ -1079,7 +1089,7 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context, BLI_path_abs(name, BKE_main_blendfile_path_from_global()); /* Try to get a proxy image. */ - ibuf = seq_proxy_fetch(context, seq, cfra); + ibuf = seq_proxy_fetch(context, seq, timeline_frame); if (ibuf != NULL) { s_elem->orig_width = ibuf->x; s_elem->orig_height = ibuf->y; @@ -1114,7 +1124,7 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context, if (view_id != context->view_id) { ibufs_arr[view_id] = seq_render_preprocess_ibuf( - &localcontext, seq, ibufs_arr[view_id], cfra, clock(), true, false); + &localcontext, seq, ibufs_arr[view_id], timeline_frame, clock(), true, false); } } @@ -1146,7 +1156,7 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context, static ImBuf *seq_render_movie_strip_custom_file_proxy(const SeqRenderData *context, Sequence *seq, - int cfra) + int timeline_frame) { char name[PROXY_MAXFILE]; StripProxy *proxy = seq->strip->proxy; @@ -1160,7 +1170,7 @@ static ImBuf *seq_render_movie_strip_custom_file_proxy(const SeqRenderData *cont } } - int frameno = (int)seq_give_stripelem_index(seq, cfra) + seq->anim_startofs; + int frameno = (int)seq_give_frame_index(seq, timeline_frame) + seq->anim_startofs; return IMB_anim_absolute(proxy->anim, frameno, IMB_TC_NONE, IMB_PROXY_NONE); } @@ -1169,8 +1179,8 @@ static ImBuf *seq_render_movie_strip_custom_file_proxy(const SeqRenderData *cont */ static ImBuf *seq_render_movie_strip_view(const SeqRenderData *context, Sequence *seq, - float nr, - float cfra, + float frame_index, + float timeline_frame, StripAnim *sanim, bool *r_is_proxy_image) { @@ -1184,11 +1194,11 @@ static ImBuf *seq_render_movie_strip_view(const SeqRenderData *context, * Movie proxies are handled by ImBuf module with exception of `custom file` setting. */ if (context->scene->ed->proxy_storage != SEQ_EDIT_PROXY_DIR_STORAGE && seq->strip->proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) { - ibuf = seq_render_movie_strip_custom_file_proxy(context, seq, cfra); + ibuf = seq_render_movie_strip_custom_file_proxy(context, seq, timeline_frame); } else { ibuf = IMB_anim_absolute(sanim->anim, - nr + seq->anim_startofs, + frame_index + seq->anim_startofs, seq->strip->proxy ? seq->strip->proxy->tc : IMB_TC_RECORD_RUN, psize); } @@ -1201,7 +1211,7 @@ static ImBuf *seq_render_movie_strip_view(const SeqRenderData *context, /* Fetching for requested proxy size failed, try fetching the original instead. */ if (ibuf == NULL) { ibuf = IMB_anim_absolute(sanim->anim, - nr + seq->anim_startofs, + frame_index + seq->anim_startofs, seq->strip->proxy ? seq->strip->proxy->tc : IMB_TC_RECORD_RUN, IMB_PROXY_NONE); } @@ -1219,8 +1229,11 @@ static ImBuf *seq_render_movie_strip_view(const SeqRenderData *context, return ibuf; } -static ImBuf *seq_render_movie_strip( - const SeqRenderData *context, Sequence *seq, float nr, float cfra, bool *r_is_proxy_image) +static ImBuf *seq_render_movie_strip(const SeqRenderData *context, + Sequence *seq, + float frame_index, + float timeline_frame, + bool *r_is_proxy_image) { /* Load all the videos. */ seq_open_anim_file(context->scene, seq, false); @@ -1241,7 +1254,7 @@ static ImBuf *seq_render_movie_strip( for (ibuf_view_id = 0, sanim = seq->anims.first; sanim; sanim = sanim->next, ibuf_view_id++) { if (sanim->anim) { ibuf_arr[ibuf_view_id] = seq_render_movie_strip_view( - context, seq, nr, cfra, sanim, r_is_proxy_image); + context, seq, frame_index, timeline_frame, sanim, r_is_proxy_image); } } @@ -1261,7 +1274,7 @@ static ImBuf *seq_render_movie_strip( if (view_id != context->view_id) { ibuf_arr[view_id] = seq_render_preprocess_ibuf( - &localcontext, seq, ibuf_arr[view_id], cfra, clock(), true, false); + &localcontext, seq, ibuf_arr[view_id], timeline_frame, clock(), true, false); } } @@ -1278,7 +1291,8 @@ static ImBuf *seq_render_movie_strip( MEM_freeN(ibuf_arr); } else { - ibuf = seq_render_movie_strip_view(context, seq, nr, cfra, sanim, r_is_proxy_image); + ibuf = seq_render_movie_strip_view( + context, seq, frame_index, timeline_frame, sanim, r_is_proxy_image); } if (ibuf == NULL) { @@ -1306,7 +1320,7 @@ static ImBuf *seq_get_movieclip_ibuf(Sequence *seq, MovieClipUser user) static ImBuf *seq_render_movieclip_strip(const SeqRenderData *context, Sequence *seq, - float nr, + float frame_index, bool *r_is_proxy_image) { ImBuf *ibuf = NULL; @@ -1319,7 +1333,7 @@ static ImBuf *seq_render_movieclip_strip(const SeqRenderData *context, memset(&user, 0, sizeof(MovieClipUser)); - BKE_movieclip_user_set_frame(&user, nr + seq->anim_startofs + seq->clip->start_frame); + BKE_movieclip_user_set_frame(&user, frame_index + seq->anim_startofs + seq->clip->start_frame); user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL; switch (psize) { @@ -1360,7 +1374,10 @@ static ImBuf *seq_render_movieclip_strip(const SeqRenderData *context, return ibuf; } -ImBuf *seq_render_mask(const SeqRenderData *context, Mask *mask, float nr, bool make_float) +ImBuf *seq_render_mask(const SeqRenderData *context, + Mask *mask, + float frame_index, + bool make_float) { /* TODO - add option to rasterize to alpha imbuf? */ ImBuf *ibuf = NULL; @@ -1378,12 +1395,12 @@ ImBuf *seq_render_mask(const SeqRenderData *context, Mask *mask, float nr, bool mask_temp = (Mask *)BKE_id_copy_ex( NULL, &mask->id, NULL, LIB_ID_COPY_LOCALIZE | LIB_ID_COPY_NO_ANIMDATA); - BKE_mask_evaluate(mask_temp, mask->sfra + nr, true); + BKE_mask_evaluate(mask_temp, mask->sfra + frame_index, true); /* anim-data */ adt = BKE_animdata_from_id(&mask->id); const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct( - context->depsgraph, mask->sfra + nr); + context->depsgraph, mask->sfra + frame_index); BKE_animsys_evaluate_animdata(&mask_temp->id, adt, &anim_eval_context, ADT_RECALC_ANIM, false); maskbuf = MEM_mallocN(sizeof(float) * context->rectx * context->recty, __func__); @@ -1441,17 +1458,17 @@ ImBuf *seq_render_mask(const SeqRenderData *context, Mask *mask, float nr, bool return ibuf; } -static ImBuf *seq_render_mask_strip(const SeqRenderData *context, Sequence *seq, float nr) +static ImBuf *seq_render_mask_strip(const SeqRenderData *context, Sequence *seq, float frame_index) { bool make_float = (seq->flag & SEQ_MAKE_FLOAT) != 0; - return seq_render_mask(context, seq->mask, nr, make_float); + return seq_render_mask(context, seq->mask, frame_index, make_float); } static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq, - float nr, - float cfra) + float frame_index, + float timeline_frame) { ImBuf *ibuf = NULL; double frame; @@ -1459,7 +1476,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, struct { int scemode; - int cfra; + int timeline_frame; float subframe; #ifdef DURIAN_CAMERA_SWITCH @@ -1519,7 +1536,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, } scene = seq->scene; - frame = (double)scene->r.sfra + (double)nr + (double)seq->anim_startofs; + frame = (double)scene->r.sfra + (double)frame_index + (double)seq->anim_startofs; #if 0 /* UNUSED */ have_seq = (scene->r.scemode & R_DOSEQ) && scene->ed && scene->ed->seqbase.first); @@ -1532,7 +1549,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Depsgraph *depsgraph = NULL; orig_data.scemode = scene->r.scemode; - orig_data.cfra = scene->r.cfra; + orig_data.timeline_frame = scene->r.cfra; orig_data.subframe = scene->r.subframe; #ifdef DURIAN_CAMERA_SWITCH orig_data.mode = scene->r.mode; @@ -1564,7 +1581,8 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, scene->r.mode |= R_NO_CAMERA_SWITCH; #endif - is_frame_update = (orig_data.cfra != scene->r.cfra) || (orig_data.subframe != scene->r.subframe); + is_frame_update = (orig_data.timeline_frame != scene->r.cfra) || + (orig_data.subframe != scene->r.subframe); if ((sequencer_view3d_fn && do_seq_gl && camera) && is_thread_main) { char err_out[256] = "unknown"; @@ -1663,7 +1681,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, if (view_id != context->view_id) { BKE_sequencer_cache_put( - &localcontext, seq, cfra, SEQ_CACHE_STORE_RAW, ibufs_arr[view_id], 0, false); + &localcontext, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibufs_arr[view_id], 0, false); } RE_ReleaseResultImage(re); @@ -1684,7 +1702,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, finally: /* restore */ scene->r.scemode = orig_data.scemode; - scene->r.cfra = orig_data.cfra; + scene->r.cfra = orig_data.timeline_frame; scene->r.subframe = orig_data.subframe; if (is_frame_update && (depsgraph != NULL)) { @@ -1705,7 +1723,7 @@ finally: static ImBuf *do_render_strip_seqbase(const SeqRenderData *context, SeqRenderState *state, Sequence *seq, - float nr) + float frame_index) { ImBuf *ibuf = NULL; ListBase *seqbase = NULL; @@ -1716,14 +1734,14 @@ static ImBuf *do_render_strip_seqbase(const SeqRenderData *context, if (seqbase && !BLI_listbase_is_empty(seqbase)) { if (seq->flag & SEQ_SCENE_STRIPS && seq->scene) { - BKE_animsys_evaluate_all_animation(context->bmain, context->depsgraph, nr + offset); + BKE_animsys_evaluate_all_animation(context->bmain, context->depsgraph, frame_index + offset); } ibuf = seq_render_strip_stack(context, state, seqbase, /* scene strips don't have their start taken into account */ - nr + offset, + frame_index + offset, 0); } @@ -1737,15 +1755,15 @@ static ImBuf *do_render_strip_seqbase(const SeqRenderData *context, static ImBuf *do_render_strip_uncached(const SeqRenderData *context, SeqRenderState *state, Sequence *seq, - float cfra, + float timeline_frame, bool *r_is_proxy_image) { ImBuf *ibuf = NULL; - float nr = seq_give_stripelem_index(seq, cfra); + float frame_index = seq_give_frame_index(seq, timeline_frame); int type = (seq->type & SEQ_TYPE_EFFECT) ? SEQ_TYPE_EFFECT : seq->type; switch (type) { case SEQ_TYPE_META: { - ibuf = do_render_strip_seqbase(context, state, seq, nr); + ibuf = do_render_strip_seqbase(context, state, seq, frame_index); break; } @@ -1770,7 +1788,7 @@ static ImBuf *do_render_strip_uncached(const SeqRenderData *context, local_context.scene = seq->scene; local_context.skip_cache = true; - ibuf = do_render_strip_seqbase(&local_context, state, seq, nr); + ibuf = do_render_strip_seqbase(&local_context, state, seq, frame_index); /* step back in the list */ state->scene_parents = state->scene_parents->next; @@ -1778,29 +1796,29 @@ static ImBuf *do_render_strip_uncached(const SeqRenderData *context, } else { /* scene can be NULL after deletions */ - ibuf = seq_render_scene_strip(context, seq, nr, cfra); + ibuf = seq_render_scene_strip(context, seq, frame_index, timeline_frame); } break; } case SEQ_TYPE_EFFECT: { - ibuf = seq_render_effect_strip_impl(context, state, seq, cfra); + ibuf = seq_render_effect_strip_impl(context, state, seq, timeline_frame); break; } case SEQ_TYPE_IMAGE: { - ibuf = seq_render_image_strip(context, seq, nr, cfra, r_is_proxy_image); + ibuf = seq_render_image_strip(context, seq, frame_index, timeline_frame, r_is_proxy_image); break; } case SEQ_TYPE_MOVIE: { - ibuf = seq_render_movie_strip(context, seq, nr, cfra, r_is_proxy_image); + ibuf = seq_render_movie_strip(context, seq, frame_index, timeline_frame, r_is_proxy_image); break; } case SEQ_TYPE_MOVIECLIP: { - ibuf = seq_render_movieclip_strip(context, seq, nr, r_is_proxy_image); + ibuf = seq_render_movieclip_strip(context, seq, frame_index, r_is_proxy_image); if (ibuf) { /* duplicate frame so movie cache wouldn't be confused by sequencer's stuff */ @@ -1818,7 +1836,7 @@ static ImBuf *do_render_strip_uncached(const SeqRenderData *context, case SEQ_TYPE_MASK: { /* ibuf is always new */ - ibuf = seq_render_mask_strip(context, seq, nr); + ibuf = seq_render_mask_strip(context, seq, frame_index); break; } } @@ -1833,7 +1851,7 @@ static ImBuf *do_render_strip_uncached(const SeqRenderData *context, ImBuf *seq_render_strip(const SeqRenderData *context, SeqRenderState *state, Sequence *seq, - float cfra) + float timeline_frame) { ImBuf *ibuf = NULL; bool use_preprocess = false; @@ -1841,20 +1859,21 @@ ImBuf *seq_render_strip(const SeqRenderData *context, clock_t begin = seq_estimate_render_cost_begin(); - ibuf = BKE_sequencer_cache_get(context, seq, cfra, SEQ_CACHE_STORE_PREPROCESSED, false); + ibuf = BKE_sequencer_cache_get( + context, seq, timeline_frame, SEQ_CACHE_STORE_PREPROCESSED, false); if (ibuf != NULL) { return ibuf; } - ibuf = BKE_sequencer_cache_get(context, seq, cfra, SEQ_CACHE_STORE_RAW, false); + ibuf = BKE_sequencer_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_RAW, false); if (ibuf == NULL) { - ibuf = do_render_strip_uncached(context, state, seq, cfra, &is_proxy_image); + ibuf = do_render_strip_uncached(context, state, seq, timeline_frame, &is_proxy_image); } if (ibuf) { - use_preprocess = BKE_sequencer_input_have_to_preprocess(context, seq, cfra); + use_preprocess = BKE_sequencer_input_have_to_preprocess(context, seq, timeline_frame); ibuf = seq_render_preprocess_ibuf( - context, seq, ibuf, cfra, begin, use_preprocess, is_proxy_image); + context, seq, ibuf, timeline_frame, begin, use_preprocess, is_proxy_image); } if (ibuf == NULL) { @@ -1901,7 +1920,7 @@ static int seq_get_early_out_for_blend_mode(Sequence *seq) } static ImBuf *seq_render_strip_stack_apply_effect( - const SeqRenderData *context, Sequence *seq, float cfra, ImBuf *ibuf1, ImBuf *ibuf2) + const SeqRenderData *context, Sequence *seq, float timeline_frame, ImBuf *ibuf1, ImBuf *ibuf2) { ImBuf *out; struct SeqEffectHandle sh = BKE_sequence_get_blend(seq); @@ -1911,19 +1930,19 @@ static ImBuf *seq_render_strip_stack_apply_effect( if (swap_input) { if (sh.multithreaded) { out = seq_render_effect_execute_threaded( - &sh, context, seq, cfra, facf, facf, ibuf2, ibuf1, NULL); + &sh, context, seq, timeline_frame, facf, facf, ibuf2, ibuf1, NULL); } else { - out = sh.execute(context, seq, cfra, facf, facf, ibuf2, ibuf1, NULL); + out = sh.execute(context, seq, timeline_frame, facf, facf, ibuf2, ibuf1, NULL); } } else { if (sh.multithreaded) { out = seq_render_effect_execute_threaded( - &sh, context, seq, cfra, facf, facf, ibuf1, ibuf2, NULL); + &sh, context, seq, timeline_frame, facf, facf, ibuf1, ibuf2, NULL); } else { - out = sh.execute(context, seq, cfra, facf, facf, ibuf1, ibuf2, NULL); + out = sh.execute(context, seq, timeline_frame, facf, facf, ibuf1, ibuf2, NULL); } } @@ -1933,7 +1952,7 @@ static ImBuf *seq_render_strip_stack_apply_effect( static ImBuf *seq_render_strip_stack(const SeqRenderData *context, SeqRenderState *state, ListBase *seqbasep, - float cfra, + float timeline_frame, int chanshown) { Sequence *seq_arr[MAXSEQ + 1]; @@ -1942,7 +1961,7 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, ImBuf *out = NULL; clock_t begin; - count = seq_get_shown_sequences(seqbasep, cfra, chanshown, (Sequence **)&seq_arr); + count = seq_get_shown_sequences(seqbasep, timeline_frame, chanshown, (Sequence **)&seq_arr); if (count == 0) { return NULL; @@ -1952,13 +1971,13 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, int early_out; Sequence *seq = seq_arr[i]; - out = BKE_sequencer_cache_get(context, seq, cfra, SEQ_CACHE_STORE_COMPOSITE, false); + out = BKE_sequencer_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_COMPOSITE, false); if (out) { break; } if (seq->blend_mode == SEQ_BLEND_REPLACE) { - out = seq_render_strip(context, state, seq, cfra); + out = seq_render_strip(context, state, seq, timeline_frame); break; } @@ -1967,7 +1986,7 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, switch (early_out) { case EARLY_NO_INPUT: case EARLY_USE_INPUT_2: - out = seq_render_strip(context, state, seq, cfra); + out = seq_render_strip(context, state, seq, timeline_frame); break; case EARLY_USE_INPUT_1: if (i == 0) { @@ -1979,13 +1998,13 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, begin = seq_estimate_render_cost_begin(); ImBuf *ibuf1 = IMB_allocImBuf(context->rectx, context->recty, 32, IB_rect); - ImBuf *ibuf2 = seq_render_strip(context, state, seq, cfra); + ImBuf *ibuf2 = seq_render_strip(context, state, seq, timeline_frame); - out = seq_render_strip_stack_apply_effect(context, seq, cfra, ibuf1, ibuf2); + out = seq_render_strip_stack_apply_effect(context, seq, timeline_frame, ibuf1, ibuf2); float cost = seq_estimate_render_cost_end(context->scene, begin); BKE_sequencer_cache_put( - context, seq_arr[i], cfra, SEQ_CACHE_STORE_COMPOSITE, out, cost, false); + context, seq_arr[i], timeline_frame, SEQ_CACHE_STORE_COMPOSITE, out, cost, false); IMB_freeImBuf(ibuf1); IMB_freeImBuf(ibuf2); @@ -2004,9 +2023,9 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, if (seq_get_early_out_for_blend_mode(seq) == EARLY_DO_EFFECT) { ImBuf *ibuf1 = out; - ImBuf *ibuf2 = seq_render_strip(context, state, seq, cfra); + ImBuf *ibuf2 = seq_render_strip(context, state, seq, timeline_frame); - out = seq_render_strip_stack_apply_effect(context, seq, cfra, ibuf1, ibuf2); + out = seq_render_strip_stack_apply_effect(context, seq, timeline_frame, ibuf1, ibuf2); IMB_freeImBuf(ibuf1); IMB_freeImBuf(ibuf2); @@ -2014,7 +2033,7 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, float cost = seq_estimate_render_cost_end(context->scene, begin); BKE_sequencer_cache_put( - context, seq_arr[i], cfra, SEQ_CACHE_STORE_COMPOSITE, out, cost, false); + context, seq_arr[i], timeline_frame, SEQ_CACHE_STORE_COMPOSITE, out, cost, false); } return out; @@ -2025,7 +2044,7 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, * you have to free after usage! */ -ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, float cfra, int chanshown) +ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, float timeline_frame, int chanshown) { Scene *scene = context->scene; Editing *ed = BKE_sequencer_editing_get(scene, false); @@ -2050,56 +2069,68 @@ ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, float cfra, int chansh Sequence *seq_arr[MAXSEQ + 1]; int count; - count = seq_get_shown_sequences(seqbasep, cfra, chanshown, seq_arr); + count = seq_get_shown_sequences(seqbasep, timeline_frame, chanshown, seq_arr); if (count) { out = BKE_sequencer_cache_get( - context, seq_arr[count - 1], cfra, SEQ_CACHE_STORE_FINAL_OUT, false); + context, seq_arr[count - 1], timeline_frame, SEQ_CACHE_STORE_FINAL_OUT, false); } - BKE_sequencer_cache_free_temp_cache(context->scene, context->task_id, cfra); + BKE_sequencer_cache_free_temp_cache(context->scene, context->task_id, timeline_frame); clock_t begin = seq_estimate_render_cost_begin(); float cost = 0; if (count && !out) { BLI_mutex_lock(&seq_render_mutex); - out = seq_render_strip_stack(context, &state, seqbasep, cfra, chanshown); + out = seq_render_strip_stack(context, &state, seqbasep, timeline_frame, chanshown); cost = seq_estimate_render_cost_end(context->scene, begin); if (context->is_prefetch_render) { - BKE_sequencer_cache_put( - context, seq_arr[count - 1], cfra, SEQ_CACHE_STORE_FINAL_OUT, out, cost, false); + BKE_sequencer_cache_put(context, + seq_arr[count - 1], + timeline_frame, + SEQ_CACHE_STORE_FINAL_OUT, + out, + cost, + false); } else { - BKE_sequencer_cache_put_if_possible( - context, seq_arr[count - 1], cfra, SEQ_CACHE_STORE_FINAL_OUT, out, cost, false); + BKE_sequencer_cache_put_if_possible(context, + seq_arr[count - 1], + timeline_frame, + SEQ_CACHE_STORE_FINAL_OUT, + out, + cost, + false); } BLI_mutex_unlock(&seq_render_mutex); } - BKE_sequencer_prefetch_start(context, cfra, cost); + BKE_sequencer_prefetch_start(context, timeline_frame, cost); return out; } ImBuf *seq_render_give_ibuf_seqbase(const SeqRenderData *context, - float cfra, + float timeline_frame, int chan_shown, ListBase *seqbasep) { SeqRenderState state; seq_render_state_init(&state); - return seq_render_strip_stack(context, &state, seqbasep, cfra, chan_shown); + return seq_render_strip_stack(context, &state, seqbasep, timeline_frame, chan_shown); } -ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData *context, float cfra, Sequence *seq) +ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData *context, + float timeline_frame, + Sequence *seq) { SeqRenderState state; seq_render_state_init(&state); - ImBuf *ibuf = seq_render_strip(context, &state, seq, cfra); + ImBuf *ibuf = seq_render_strip(context, &state, seq, timeline_frame); return ibuf; } diff --git a/source/blender/sequencer/intern/render.h b/source/blender/sequencer/intern/render.h index 83214934e05..2d0365d74e9 100644 --- a/source/blender/sequencer/intern/render.h +++ b/source/blender/sequencer/intern/render.h @@ -42,31 +42,31 @@ typedef struct SeqRenderState { void seq_render_state_init(SeqRenderState *state); struct ImBuf *seq_render_give_ibuf_seqbase(const struct SeqRenderData *context, - float cfra, + float timeline_frame, int chan_shown, struct ListBase *seqbasep); struct ImBuf *seq_render_effect_execute_threaded(struct SeqEffectHandle *sh, const SeqRenderData *context, struct Sequence *seq, - float cfra, + float timeline_frame, float facf0, float facf1, struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3); void seq_imbuf_to_sequencer_space(struct Scene *scene, struct ImBuf *ibuf, bool make_float); -float seq_give_stripelem_index(struct Sequence *seq, float cfra); +float seq_give_frame_index(struct Sequence *seq, float timeline_frame); int seq_get_shown_sequences(struct ListBase *seqbasep, - int cfra, + int timeline_frame, int chanshown, struct Sequence **seq_arr_out); struct ImBuf *seq_render_strip(const struct SeqRenderData *context, struct SeqRenderState *state, struct Sequence *seq, - float cfra); + float timeline_frame); struct ImBuf *seq_render_mask(const struct SeqRenderData *context, struct Mask *mask, - float nr, + float frame_index, bool make_float); void seq_imbuf_assign_spaces(struct Scene *scene, struct ImBuf *ibuf); diff --git a/source/blender/sequencer/intern/sequencer.c b/source/blender/sequencer/intern/sequencer.c index 89709c54942..29c0a4b9241 100644 --- a/source/blender/sequencer/intern/sequencer.c +++ b/source/blender/sequencer/intern/sequencer.c @@ -2562,7 +2562,7 @@ static Strip *seq_strip_alloc(int type) return strip; } -Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine, int type) +Sequence *BKE_sequence_alloc(ListBase *lb, int timeline_frame, int machine, int type) { Sequence *seq; @@ -2573,7 +2573,7 @@ Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine, int type) seq->name[2] = 0; seq->flag = SELECT; - seq->start = cfra; + seq->start = timeline_frame; seq->machine = machine; seq->sat = 1.0; seq->mul = 1.0; @@ -3109,7 +3109,7 @@ bool BKE_sequence_is_valid_check(Sequence *seq) } int BKE_sequencer_find_next_prev_edit(Scene *scene, - int cfra, + int timeline_frame, const short side, const bool do_skip_mute, const bool do_center, @@ -3118,7 +3118,7 @@ int BKE_sequencer_find_next_prev_edit(Scene *scene, Editing *ed = BKE_sequencer_editing_get(scene, false); Sequence *seq; - int dist, best_dist, best_frame = cfra; + int dist, best_dist, best_frame = timeline_frame; int seq_frames[2], seq_frames_tot; /* In case where both is passed, @@ -3127,7 +3127,7 @@ int BKE_sequencer_find_next_prev_edit(Scene *scene, best_dist = MAXFRAME * 2; if (ed == NULL) { - return cfra; + return timeline_frame; } for (seq = ed->seqbasep->first; seq; seq = seq->next) { @@ -3159,17 +3159,17 @@ int BKE_sequencer_find_next_prev_edit(Scene *scene, switch (side) { case SEQ_SIDE_LEFT: - if (seq_frame < cfra) { - dist = cfra - seq_frame; + if (seq_frame < timeline_frame) { + dist = timeline_frame - seq_frame; } break; case SEQ_SIDE_RIGHT: - if (seq_frame > cfra) { - dist = seq_frame - cfra; + if (seq_frame > timeline_frame) { + dist = seq_frame - timeline_frame; } break; case SEQ_SIDE_BOTH: - dist = abs(seq_frame - cfra); + dist = abs(seq_frame - timeline_frame); break; } @@ -3183,25 +3183,25 @@ int BKE_sequencer_find_next_prev_edit(Scene *scene, return best_frame; } -static void sequencer_all_free_anim_ibufs(ListBase *seqbase, int cfra) +static void sequencer_all_free_anim_ibufs(ListBase *seqbase, int timeline_frame) { for (Sequence *seq = seqbase->first; seq != NULL; seq = seq->next) { - if (seq->enddisp < cfra || seq->startdisp > cfra) { + if (seq->enddisp < timeline_frame || seq->startdisp > timeline_frame) { BKE_sequence_free_anim(seq); } if (seq->type == SEQ_TYPE_META) { - sequencer_all_free_anim_ibufs(&seq->seqbase, cfra); + sequencer_all_free_anim_ibufs(&seq->seqbase, timeline_frame); } } } -void BKE_sequencer_all_free_anim_ibufs(Scene *scene, int cfra) +void BKE_sequencer_all_free_anim_ibufs(Scene *scene, int timeline_frame) { Editing *ed = BKE_sequencer_editing_get(scene, false); if (ed == NULL) { return; } - sequencer_all_free_anim_ibufs(&ed->seqbase, cfra); + sequencer_all_free_anim_ibufs(&ed->seqbase, timeline_frame); BKE_sequencer_cache_cleanup(scene); } diff --git a/source/blender/sequencer/intern/sequencer.h b/source/blender/sequencer/intern/sequencer.h index a7217e45ddf..58f82cc54e0 100644 --- a/source/blender/sequencer/intern/sequencer.h +++ b/source/blender/sequencer/intern/sequencer.h @@ -68,7 +68,7 @@ void BKE_sequencer_cache_put(const SeqRenderData *context, bool skip_disk_cache); bool BKE_sequencer_cache_put_if_possible(const SeqRenderData *context, struct Sequence *seq, - float cfra, + float timeline_frame, int type, struct ImBuf *nval, float cost, @@ -90,7 +90,7 @@ bool BKE_sequencer_cache_is_full(struct Scene *scene); * Sequencer frame prefetching * ********************************************************************** */ -void BKE_sequencer_prefetch_start(const SeqRenderData *context, float cfra, float cost); +void BKE_sequencer_prefetch_start(const SeqRenderData *context, float timeline_frame, float cost); void BKE_sequencer_prefetch_free(struct Scene *scene); bool BKE_sequencer_prefetch_job_is_running(struct Scene *scene); void BKE_sequencer_prefetch_get_time_range(struct Scene *scene, int *start, int *end); @@ -109,7 +109,7 @@ struct SeqEffectHandle BKE_sequence_get_blend(struct Sequence *seq); void BKE_sequence_effect_speed_rebuild_map(struct Scene *scene, struct Sequence *seq, bool force); float BKE_sequencer_speed_effect_target_frame_get(const SeqRenderData *context, struct Sequence *seq, - float cfra, + float timeline_frame, int input); /* ********************************************************************** |