Changeset View
Changeset View
Standalone View
Standalone View
source/blender/sequencer/intern/render.c
| Show First 20 Lines • Show All 756 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| if (context->is_proxy_render == false && | if (context->is_proxy_render == false && | ||||
| (ibuf->x != context->rectx || ibuf->y != context->recty)) { | (ibuf->x != context->rectx || ibuf->y != context->recty)) { | ||||
| use_preprocess = true; | use_preprocess = true; | ||||
| } | } | ||||
| /* Proxies and effect strips are not stored in cache. */ | /* Proxies and effect strips are not stored in cache. */ | ||||
| if (!is_proxy_image && (seq->type & SEQ_TYPE_EFFECT) == 0) { | if (!is_proxy_image && (seq->type & SEQ_TYPE_EFFECT) == 0) { | ||||
| seq_cache_put(context, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibuf, false); | seq_cache_put(context, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibuf); | ||||
| } | } | ||||
| if (use_preprocess) { | if (use_preprocess) { | ||||
| ibuf = input_preprocess(context, seq, timeline_frame, ibuf, is_proxy_image); | ibuf = input_preprocess(context, seq, timeline_frame, ibuf, is_proxy_image); | ||||
| } | } | ||||
| seq_cache_put(context, seq, timeline_frame, SEQ_CACHE_STORE_PREPROCESSED, ibuf, false); | seq_cache_put(context, seq, timeline_frame, SEQ_CACHE_STORE_PREPROCESSED, ibuf); | ||||
| return ibuf; | return ibuf; | ||||
| } | } | ||||
| typedef struct RenderEffectInitData { | typedef struct RenderEffectInitData { | ||||
| struct SeqEffectHandle *sh; | struct SeqEffectHandle *sh; | ||||
| const SeqRenderData *context; | const SeqRenderData *context; | ||||
| Sequence *seq; | Sequence *seq; | ||||
| float timeline_frame, facf0, facf1; | float timeline_frame, facf0, facf1; | ||||
| ▲ Show 20 Lines • Show All 851 Lines • ▼ Show 20 Lines | for (int view_id = 0; view_id < totviews; view_id++) { | ||||
| seq_imbuf_to_sequencer_space(context->scene, ibufs_arr[view_id], false); | seq_imbuf_to_sequencer_space(context->scene, ibufs_arr[view_id], false); | ||||
| } | } | ||||
| else if (rres.rect32) { | else if (rres.rect32) { | ||||
| ibufs_arr[view_id] = IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect); | ibufs_arr[view_id] = IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect); | ||||
| memcpy(ibufs_arr[view_id]->rect, rres.rect32, 4 * rres.rectx * rres.recty); | memcpy(ibufs_arr[view_id]->rect, rres.rect32, 4 * rres.rectx * rres.recty); | ||||
| } | } | ||||
| if (view_id != context->view_id) { | if (view_id != context->view_id) { | ||||
| seq_cache_put( | seq_cache_put(&localcontext, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibufs_arr[view_id]); | ||||
| &localcontext, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibufs_arr[view_id], false); | |||||
| } | } | ||||
| RE_ReleaseResultImage(re); | RE_ReleaseResultImage(re); | ||||
| } | } | ||||
| /* return the original requested ImBuf */ | /* return the original requested ImBuf */ | ||||
| ibuf = ibufs_arr[context->view_id]; | ibuf = ibufs_arr[context->view_id]; | ||||
| ▲ Show 20 Lines • Show All 158 Lines • ▼ Show 20 Lines | ImBuf *seq_render_strip(const SeqRenderData *context, | ||||
| SeqRenderState *state, | SeqRenderState *state, | ||||
| Sequence *seq, | Sequence *seq, | ||||
| float timeline_frame) | float timeline_frame) | ||||
| { | { | ||||
| ImBuf *ibuf = NULL; | ImBuf *ibuf = NULL; | ||||
| bool use_preprocess = false; | bool use_preprocess = false; | ||||
| bool is_proxy_image = false; | bool is_proxy_image = false; | ||||
| ibuf = seq_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_PREPROCESSED, false); | ibuf = seq_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_PREPROCESSED); | ||||
| if (ibuf != NULL) { | if (ibuf != NULL) { | ||||
| return ibuf; | return ibuf; | ||||
| } | } | ||||
| /* Proxies are not stored in cache. */ | /* Proxies are not stored in cache. */ | ||||
| if (!SEQ_can_use_proxy(seq, SEQ_rendersize_to_proxysize(context->preview_render_size))) { | if (!SEQ_can_use_proxy(seq, SEQ_rendersize_to_proxysize(context->preview_render_size))) { | ||||
| ibuf = seq_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_RAW, false); | ibuf = seq_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_RAW); | ||||
| } | } | ||||
| if (ibuf == NULL) { | if (ibuf == NULL) { | ||||
| ibuf = do_render_strip_uncached(context, state, seq, timeline_frame, &is_proxy_image); | ibuf = do_render_strip_uncached(context, state, seq, timeline_frame, &is_proxy_image); | ||||
| } | } | ||||
| if (ibuf) { | if (ibuf) { | ||||
| use_preprocess = seq_input_have_to_preprocess(context, seq, timeline_frame); | use_preprocess = seq_input_have_to_preprocess(context, seq, timeline_frame); | ||||
| ▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | static ImBuf *seq_render_strip_stack(const SeqRenderData *context, | ||||
| if (count == 0) { | if (count == 0) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| for (i = count - 1; i >= 0; i--) { | for (i = count - 1; i >= 0; i--) { | ||||
| int early_out; | int early_out; | ||||
| Sequence *seq = seq_arr[i]; | Sequence *seq = seq_arr[i]; | ||||
| out = seq_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_COMPOSITE, false); | out = seq_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_COMPOSITE); | ||||
| if (out) { | if (out) { | ||||
| break; | break; | ||||
| } | } | ||||
| if (seq->blend_mode == SEQ_BLEND_REPLACE) { | if (seq->blend_mode == SEQ_BLEND_REPLACE) { | ||||
| out = seq_render_strip(context, state, seq, timeline_frame); | out = seq_render_strip(context, state, seq, timeline_frame); | ||||
| break; | break; | ||||
| } | } | ||||
| Show All 12 Lines | switch (early_out) { | ||||
| break; | break; | ||||
| case EARLY_DO_EFFECT: | case EARLY_DO_EFFECT: | ||||
| if (i == 0) { | if (i == 0) { | ||||
| ImBuf *ibuf1 = IMB_allocImBuf(context->rectx, context->recty, 32, IB_rect); | ImBuf *ibuf1 = IMB_allocImBuf(context->rectx, context->recty, 32, IB_rect); | ||||
| ImBuf *ibuf2 = seq_render_strip(context, state, seq, timeline_frame); | ImBuf *ibuf2 = seq_render_strip(context, state, seq, timeline_frame); | ||||
| out = seq_render_strip_stack_apply_effect(context, seq, timeline_frame, ibuf1, ibuf2); | out = seq_render_strip_stack_apply_effect(context, seq, timeline_frame, ibuf1, ibuf2); | ||||
| seq_cache_put( | seq_cache_put(context, seq_arr[i], timeline_frame, SEQ_CACHE_STORE_COMPOSITE, out); | ||||
| context, seq_arr[i], timeline_frame, SEQ_CACHE_STORE_COMPOSITE, out, false); | |||||
| IMB_freeImBuf(ibuf1); | IMB_freeImBuf(ibuf1); | ||||
| IMB_freeImBuf(ibuf2); | IMB_freeImBuf(ibuf2); | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| if (out) { | if (out) { | ||||
| break; | break; | ||||
| Show All 9 Lines | if (seq_get_early_out_for_blend_mode(seq) == EARLY_DO_EFFECT) { | ||||
| ImBuf *ibuf2 = seq_render_strip(context, state, seq, timeline_frame); | ImBuf *ibuf2 = seq_render_strip(context, state, seq, timeline_frame); | ||||
| out = seq_render_strip_stack_apply_effect(context, seq, timeline_frame, ibuf1, ibuf2); | out = seq_render_strip_stack_apply_effect(context, seq, timeline_frame, ibuf1, ibuf2); | ||||
| IMB_freeImBuf(ibuf1); | IMB_freeImBuf(ibuf1); | ||||
| IMB_freeImBuf(ibuf2); | IMB_freeImBuf(ibuf2); | ||||
| } | } | ||||
| seq_cache_put(context, seq_arr[i], timeline_frame, SEQ_CACHE_STORE_COMPOSITE, out, false); | seq_cache_put(context, seq_arr[i], timeline_frame, SEQ_CACHE_STORE_COMPOSITE, out); | ||||
| } | } | ||||
| return out; | return out; | ||||
| } | } | ||||
| /** | /** | ||||
| * \return The image buffer or NULL. | * \return The image buffer or NULL. | ||||
| * | * | ||||
| Show All 22 Lines | ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, float timeline_frame, int chanshown) | ||||
| seq_render_state_init(&state); | seq_render_state_init(&state); | ||||
| ImBuf *out = NULL; | ImBuf *out = NULL; | ||||
| Sequence *seq_arr[MAXSEQ + 1]; | Sequence *seq_arr[MAXSEQ + 1]; | ||||
| int count; | int count; | ||||
| count = seq_get_shown_sequences(seqbasep, timeline_frame, chanshown, seq_arr); | count = seq_get_shown_sequences(seqbasep, timeline_frame, chanshown, seq_arr); | ||||
| if (count) { | if (count) { | ||||
| out = seq_cache_get( | out = seq_cache_get(context, seq_arr[count - 1], timeline_frame, SEQ_CACHE_STORE_FINAL_OUT); | ||||
| context, seq_arr[count - 1], timeline_frame, SEQ_CACHE_STORE_FINAL_OUT, false); | |||||
| } | } | ||||
| seq_cache_free_temp_cache(context->scene, context->task_id, timeline_frame); | seq_cache_free_temp_cache(context->scene, context->task_id, timeline_frame); | ||||
| if (count && !out) { | if (count && !out) { | ||||
| BLI_mutex_lock(&seq_render_mutex); | BLI_mutex_lock(&seq_render_mutex); | ||||
| out = seq_render_strip_stack(context, &state, seqbasep, timeline_frame, chanshown); | out = seq_render_strip_stack(context, &state, seqbasep, timeline_frame, chanshown); | ||||
| if (context->is_prefetch_render) { | if (context->is_prefetch_render) { | ||||
| seq_cache_put( | seq_cache_put(context, seq_arr[count - 1], timeline_frame, SEQ_CACHE_STORE_FINAL_OUT, out); | ||||
| context, seq_arr[count - 1], timeline_frame, SEQ_CACHE_STORE_FINAL_OUT, out, false); | |||||
| } | } | ||||
| else { | else { | ||||
| seq_cache_put_if_possible( | seq_cache_put_if_possible( | ||||
| context, seq_arr[count - 1], timeline_frame, SEQ_CACHE_STORE_FINAL_OUT, out, false); | context, seq_arr[count - 1], timeline_frame, SEQ_CACHE_STORE_FINAL_OUT, out); | ||||
| } | } | ||||
| BLI_mutex_unlock(&seq_render_mutex); | BLI_mutex_unlock(&seq_render_mutex); | ||||
| } | } | ||||
| seq_prefetch_start(context, timeline_frame); | seq_prefetch_start(context, timeline_frame); | ||||
| return out; | return out; | ||||
| } | } | ||||
| Show All 24 Lines | |||||