Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/sequencer/intern/render.c')
-rw-r--r--source/blender/sequencer/intern/render.c71
1 files changed, 42 insertions, 29 deletions
diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c
index b0898be3765..b7dc0e7035d 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -233,7 +233,7 @@ void seq_render_state_init(SeqRenderState *state)
state->scene_parents = NULL;
}
-StripElem *SEQ_render_give_stripelem(Sequence *seq, int timeline_frame)
+StripElem *SEQ_render_give_stripelem(const Scene *scene, Sequence *seq, int timeline_frame)
{
StripElem *se = seq->strip->stripdata;
@@ -242,7 +242,7 @@ StripElem *SEQ_render_give_stripelem(Sequence *seq, int timeline_frame)
* all other strips don't use this...
*/
- int frame_index = (int)seq_give_frame_index(seq, timeline_frame);
+ int frame_index = (int)seq_give_frame_index(scene, seq, timeline_frame);
if (frame_index == -1 || se == NULL) {
return NULL;
@@ -258,14 +258,15 @@ static int seq_channel_cmp_fn(const void *a, const void *b)
return (*(Sequence **)a)->machine - (*(Sequence **)b)->machine;
}
-int seq_get_shown_sequences(ListBase *channels,
+int seq_get_shown_sequences(const Scene *scene,
+ ListBase *channels,
ListBase *seqbase,
const int timeline_frame,
const int chanshown,
Sequence **r_seq_arr)
{
SeqCollection *collection = SEQ_query_rendered_strips(
- channels, seqbase, timeline_frame, chanshown);
+ scene, channels, seqbase, timeline_frame, chanshown);
const int strip_count = BLI_gset_len(collection->set);
if (strip_count > MAXSEQ) {
@@ -795,7 +796,7 @@ static ImBuf *seq_render_effect_strip_impl(const SeqRenderData *context,
}
if (seq->flag & SEQ_USE_EFFECT_DEFAULT_FADE) {
- sh.get_default_fac(seq, timeline_frame, &fac);
+ sh.get_default_fac(scene, seq, timeline_frame, &fac);
}
else {
fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "effect_fader", 0, NULL);
@@ -936,7 +937,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, timeline_frame);
+ StripElem *s_elem = SEQ_render_give_stripelem(context->scene, seq, timeline_frame);
if (s_elem == NULL) {
return NULL;
}
@@ -1024,7 +1025,8 @@ static ImBuf *seq_render_movie_strip_custom_file_proxy(const SeqRenderData *cont
}
}
- int frameno = (int)seq_give_frame_index(seq, timeline_frame) + seq->anim_startofs;
+ int frameno = (int)seq_give_frame_index(context->scene, seq, timeline_frame) +
+ seq->anim_startofs;
return IMB_anim_absolute(proxy->anim, frameno, IMB_TC_NONE, IMB_PROXY_NONE);
}
@@ -1445,8 +1447,8 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context,
if ((sequencer_view3d_fn && do_seq_gl && camera) && is_thread_main) {
char err_out[256] = "unknown";
- const int width = (scene->r.xsch * scene->r.size) / 100;
- const int height = (scene->r.ysch * scene->r.size) / 100;
+ int width, height;
+ BKE_render_resolution(&scene->r, false, &width, &height);
const char *viewname = BKE_scene_multiview_render_view_name_get(&scene->r, context->view_id);
unsigned int draw_flags = V3D_OFSDRAW_NONE;
@@ -1622,7 +1624,7 @@ static ImBuf *do_render_strip_uncached(const SeqRenderData *context,
bool *r_is_proxy_image)
{
ImBuf *ibuf = NULL;
- float frame_index = seq_give_frame_index(seq, timeline_frame);
+ float frame_index = seq_give_frame_index(context->scene, seq, timeline_frame);
int type = (seq->type & SEQ_TYPE_EFFECT) ? SEQ_TYPE_EFFECT : seq->type;
switch (type) {
case SEQ_TYPE_META: {
@@ -1826,7 +1828,7 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context,
ImBuf *out = NULL;
count = seq_get_shown_sequences(
- channels, seqbasep, timeline_frame, chanshown, (Sequence **)&seq_arr);
+ context->scene, channels, seqbasep, timeline_frame, chanshown, (Sequence **)&seq_arr);
if (count == 0) {
return NULL;
@@ -1940,7 +1942,7 @@ ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, float timeline_frame,
Sequence *seq_arr[MAXSEQ + 1];
int count;
- count = seq_get_shown_sequences(channels, seqbasep, timeline_frame, chanshown, seq_arr);
+ count = seq_get_shown_sequences(scene, channels, seqbasep, timeline_frame, chanshown, seq_arr);
if (count) {
out = seq_cache_get(context, seq_arr[count - 1], timeline_frame, SEQ_CACHE_STORE_FINAL_OUT);
@@ -1992,13 +1994,17 @@ ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData *context,
return ibuf;
}
-float SEQ_render_thumbnail_first_frame_get(Sequence *seq, float frame_step, rctf *view_area)
+float SEQ_render_thumbnail_first_frame_get(const Scene *scene,
+ Sequence *seq,
+ float frame_step,
+ rctf *view_area)
{
- int first_drawable_frame = max_iii(seq->startdisp, seq->start, view_area->xmin);
+ int first_drawable_frame = max_iii(
+ SEQ_time_left_handle_frame_get(scene, seq), seq->start, view_area->xmin);
/* First frame should correspond to handle position. */
- if (first_drawable_frame == seq->startdisp) {
- return seq->startdisp;
+ if (first_drawable_frame == SEQ_time_left_handle_frame_get(scene, seq)) {
+ return SEQ_time_left_handle_frame_get(scene, seq);
}
float aligned_frame_offset = (int)((first_drawable_frame - seq->start) / frame_step) *
@@ -2006,12 +2012,15 @@ float SEQ_render_thumbnail_first_frame_get(Sequence *seq, float frame_step, rctf
return seq->start + aligned_frame_offset;
}
-float SEQ_render_thumbnail_next_frame_get(Sequence *seq, float last_frame, float frame_step)
+float SEQ_render_thumbnail_next_frame_get(const Scene *scene,
+ Sequence *seq,
+ float last_frame,
+ float frame_step)
{
float next_frame = last_frame + frame_step;
/* If handle position was displayed, align next frame with `seq->start`. */
- if (last_frame == seq->startdisp) {
+ if (last_frame == SEQ_time_left_handle_frame_get(scene, seq)) {
next_frame = seq->start + ((int)((last_frame - seq->start) / frame_step) + 1) * frame_step;
}
@@ -2085,21 +2094,23 @@ void SEQ_render_thumbnails(const SeqRenderData *context,
{
SeqRenderState state;
seq_render_state_init(&state);
+ const Scene *scene = context->scene;
/* Adding the hold offset value (seq->anim_startofs) to the start frame. Position of image not
* affected, but frame loaded affected. */
- float upper_thumb_bound = SEQ_time_has_right_still_frames(seq) ? (seq->start + seq->len) :
- seq->enddisp;
+ float upper_thumb_bound = SEQ_time_has_right_still_frames(scene, seq) ?
+ (seq->start + seq->len) :
+ SEQ_time_right_handle_frame_get(scene, seq);
upper_thumb_bound = (upper_thumb_bound > view_area->xmax) ? view_area->xmax + frame_step :
upper_thumb_bound;
- float timeline_frame = SEQ_render_thumbnail_first_frame_get(seq, frame_step, view_area);
+ float timeline_frame = SEQ_render_thumbnail_first_frame_get(scene, seq, frame_step, view_area);
while ((timeline_frame < upper_thumb_bound) & !*stop) {
ImBuf *ibuf = seq_cache_get(
context, seq_orig, round_fl_to_int(timeline_frame), SEQ_CACHE_STORE_THUMBNAIL);
if (ibuf) {
IMB_freeImBuf(ibuf);
- timeline_frame = SEQ_render_thumbnail_next_frame_get(seq, timeline_frame, frame_step);
+ timeline_frame = SEQ_render_thumbnail_next_frame_get(scene, seq, timeline_frame, frame_step);
continue;
}
@@ -2116,14 +2127,15 @@ void SEQ_render_thumbnails(const SeqRenderData *context,
return;
}
- timeline_frame = SEQ_render_thumbnail_next_frame_get(seq, timeline_frame, frame_step);
+ timeline_frame = SEQ_render_thumbnail_next_frame_get(scene, seq, timeline_frame, frame_step);
}
}
-int SEQ_render_thumbnails_guaranteed_set_frame_step_get(const Sequence *seq)
+int SEQ_render_thumbnails_guaranteed_set_frame_step_get(const Scene *scene, const Sequence *seq)
{
- const int content_start = max_ii(seq->startdisp, seq->start);
- const int content_end = min_ii(seq->enddisp, seq->start + seq->len);
+ const int content_start = max_ii(SEQ_time_left_handle_frame_get(scene, seq), seq->start);
+ const int content_end = min_ii(SEQ_time_right_handle_frame_get(scene, seq),
+ seq->start + seq->len);
const int content_len = content_end - content_start;
/* Arbitrary, but due to performance reasons should be as low as possible. */
@@ -2142,11 +2154,12 @@ void SEQ_render_thumbnails_base_set(const SeqRenderData *context,
{
SeqRenderState state;
seq_render_state_init(&state);
+ const Scene *scene = context->scene;
- int timeline_frame = seq->startdisp;
- const int frame_step = SEQ_render_thumbnails_guaranteed_set_frame_step_get(seq);
+ int timeline_frame = SEQ_time_left_handle_frame_get(scene, seq);
+ const int frame_step = SEQ_render_thumbnails_guaranteed_set_frame_step_get(scene, seq);
- while (timeline_frame < seq->enddisp && !*stop) {
+ while (timeline_frame < SEQ_time_right_handle_frame_get(scene, seq) && !*stop) {
ImBuf *ibuf = seq_cache_get(
context, seq_orig, roundf(timeline_frame), SEQ_CACHE_STORE_THUMBNAIL);
if (ibuf) {