Blender V4.3
render.cc File Reference
#include <ctime>
#include "MEM_guardedalloc.h"
#include "DNA_defaults.h"
#include "DNA_mask_types.h"
#include "DNA_scene_types.h"
#include "DNA_sequence_types.h"
#include "DNA_space_types.h"
#include "BLI_linklist.h"
#include "BLI_listbase.h"
#include "BLI_math_geom.h"
#include "BLI_math_rotation.h"
#include "BLI_path_utils.hh"
#include "BLI_rect.h"
#include "BLI_task.hh"
#include "BKE_anim_data.hh"
#include "BKE_animsys.h"
#include "BKE_fcurve.hh"
#include "BKE_global.hh"
#include "BKE_image.hh"
#include "BKE_layer.hh"
#include "BKE_lib_id.hh"
#include "BKE_main.hh"
#include "BKE_mask.h"
#include "BKE_movieclip.h"
#include "BKE_scene.hh"
#include "BKE_sequencer_offscreen.h"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_query.hh"
#include "IMB_colormanagement.hh"
#include "IMB_imbuf.hh"
#include "IMB_imbuf_types.hh"
#include "IMB_metadata.hh"
#include "RNA_prototypes.hh"
#include "RE_engine.h"
#include "RE_pipeline.h"
#include "SEQ_channels.hh"
#include "SEQ_effects.hh"
#include "SEQ_iterator.hh"
#include "SEQ_modifier.hh"
#include "SEQ_proxy.hh"
#include "SEQ_relations.hh"
#include "SEQ_render.hh"
#include "SEQ_sequencer.hh"
#include "SEQ_time.hh"
#include "SEQ_transform.hh"
#include "SEQ_utils.hh"
#include "effects.hh"
#include "image_cache.hh"
#include "multiview.hh"
#include "prefetch.hh"
#include "proxy.hh"
#include "render.hh"
#include "utils.hh"
#include <algorithm>

Go to the source code of this file.

Classes

struct  OpaqueQuad
 
struct  OpaqueQuadTracker
 
struct  RenderEffectInitData
 
struct  RenderEffectThread
 

Functions

Strip Stack Rendering Functions
static ImBufseq_render_strip_stack (const SeqRenderData *context, SeqRenderState *state, ListBase *channels, ListBase *seqbasep, float timeline_frame, int chanshown)
 
static ImBufdo_render_strip_uncached (const SeqRenderData *context, SeqRenderState *state, Sequence *seq, float timeline_frame, bool *r_is_proxy_image)
 
ImBufseq_render_strip (const SeqRenderData *context, SeqRenderState *state, Sequence *seq, float timeline_frame)
 
static bool seq_must_swap_input_in_blend_mode (Sequence *seq)
 
static StripEarlyOut seq_get_early_out_for_blend_mode (Sequence *seq)
 
static ImBufseq_render_strip_stack_apply_effect (const SeqRenderData *context, Sequence *seq, float timeline_frame, ImBuf *ibuf1, ImBuf *ibuf2)
 
static bool is_opaque_alpha_over (const Sequence *seq)
 
ImBufSEQ_render_give_ibuf (const SeqRenderData *context, float timeline_frame, int chanshown)
 
ImBufseq_render_give_ibuf_seqbase (const SeqRenderData *context, float timeline_frame, int chan_shown, ListBase *channels, ListBase *seqbasep)
 
ImBufSEQ_render_give_ibuf_direct (const SeqRenderData *context, float timeline_frame, Sequence *seq)
 
bool SEQ_render_is_muted (const ListBase *channels, const Sequence *seq)
 
Color-space utility functions
void seq_imbuf_assign_spaces (const Scene *scene, ImBuf *ibuf)
 
void seq_imbuf_to_sequencer_space (const Scene *scene, ImBuf *ibuf, bool make_float)
 
void SEQ_render_imbuf_from_sequencer_space (Scene *scene, ImBuf *ibuf)
 
void SEQ_render_pixel_from_sequencer_space_v4 (Scene *scene, float pixel[4])
 
Rendering utility functions
void SEQ_render_new_render_data (Main *bmain, Depsgraph *depsgraph, Scene *scene, int rectx, int recty, int preview_render_size, int for_render, SeqRenderData *r_context)
 
StripElemSEQ_render_give_stripelem (const Scene *scene, const Sequence *seq, int timeline_frame)
 
Vector< Sequence * > seq_get_shown_sequences (const Scene *scene, ListBase *channels, ListBase *seqbase, const int timeline_frame, const int chanshown)
 
StripScreenQuad get_strip_screen_quad (const SeqRenderData *context, const Sequence *seq)
 
static bool is_quad_a_inside_b (const StripScreenQuad &a, const StripScreenQuad &b)
 
Preprocessing & Effects

Input preprocessing for SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE, SEQ_TYPE_MOVIECLIP and SEQ_TYPE_SCENE.

Do all the things you can't really do afterwards using sequence effects (read: before re-scaling to render resolution has been done).

Order is important!

  • De-interlace.
  • Crop and transform in image source coordinate space.
  • Flip X + Flip Y (could be done afterwards, backward compatibility).
  • Promote image to float data (affects pipeline operations afterwards).
  • Color balance (is most efficient in the byte -> float (future: half -> float should also work fine!) case, if done on load, since we can use lookup tables).
  • Pre-multiply.
static bool sequencer_use_transform (const Sequence *seq)
 
static bool sequencer_use_crop (const Sequence *seq)
 
static bool seq_input_have_to_preprocess (const SeqRenderData *context, Sequence *seq, float)
 
static bool seq_need_scale_to_render_size (const Sequence *seq, bool is_proxy_image)
 
static void sequencer_image_crop_transform_matrix (const Sequence *seq, const ImBuf *in, const ImBuf *out, const float image_scale_factor, const float preview_scale_factor, float r_transform_matrix[4][4])
 
static void sequencer_image_crop_init (const Sequence *seq, const ImBuf *in, float crop_scale_factor, rctf *r_crop)
 
static bool is_strip_covering_screen (const SeqRenderData *context, const Sequence *seq)
 
static eIMBInterpolationFilterMode get_auto_filter (const StripTransform *transform)
 
static void sequencer_preprocess_transform_crop (ImBuf *in, ImBuf *out, const SeqRenderData *context, Sequence *seq, const bool is_proxy_image)
 
static void multiply_ibuf (ImBuf *ibuf, const float fmul, const bool multiply_alpha)
 
static ImBufinput_preprocess (const SeqRenderData *context, Sequence *seq, float timeline_frame, ImBuf *ibuf, const bool is_proxy_image)
 
static ImBufseq_render_preprocess_ibuf (const SeqRenderData *context, Sequence *seq, ImBuf *ibuf, float timeline_frame, bool use_preprocess, const bool is_proxy_image)
 
static void render_effect_execute_init_handle (void *handle_v, int start_line, int tot_line, void *init_data_v)
 
static void * render_effect_execute_do_thread (void *thread_data_v)
 
ImBufseq_render_effect_execute_threaded (SeqEffectHandle *sh, const SeqRenderData *context, Sequence *seq, float timeline_frame, float fac, ImBuf *ibuf1, ImBuf *ibuf2)
 
static ImBufseq_render_effect_strip_impl (const SeqRenderData *context, SeqRenderState *state, Sequence *seq, float timeline_frame)
 
Individual strip rendering functions
static ImBufseq_render_image_strip_view (const SeqRenderData *context, Sequence *seq, char *filepath, char *prefix, const char *ext, int view_id)
 
static bool seq_image_strip_is_multiview_render (Scene *scene, Sequence *seq, int totfiles, const char *filepath, char *r_prefix, const char *r_ext)
 
static ImBufcreate_missing_media_image (const SeqRenderData *context, int width, int height)
 
static ImBufseq_render_image_strip (const SeqRenderData *context, Sequence *seq, int timeline_frame, bool *r_is_proxy_image)
 
static ImBufseq_render_movie_strip_custom_file_proxy (const SeqRenderData *context, Sequence *seq, int timeline_frame)
 
static IMB_Timecode_Type seq_render_movie_strip_timecode_get (Sequence *seq)
 
static ImBufseq_render_movie_strip_view (const SeqRenderData *context, Sequence *seq, float timeline_frame, StripAnim *sanim, bool *r_is_proxy_image)
 
static ImBufseq_render_movie_strip (const SeqRenderData *context, Sequence *seq, float timeline_frame, bool *r_is_proxy_image)
 
static ImBufseq_get_movieclip_ibuf (Sequence *seq, MovieClipUser user)
 
static ImBufseq_render_movieclip_strip (const SeqRenderData *context, Sequence *seq, float frame_index, bool *r_is_proxy_image)
 
ImBufseq_render_mask (const SeqRenderData *context, Mask *mask, float frame_index, bool make_float)
 
static ImBufseq_render_mask_strip (const SeqRenderData *context, Sequence *seq, float frame_index)
 
static ImBufseq_render_scene_strip (const SeqRenderData *context, Sequence *seq, float frame_index, float timeline_frame)
 
static ImBufdo_render_strip_seqbase (const SeqRenderData *context, SeqRenderState *state, Sequence *seq, float frame_index)
 

Variables

static ThreadMutex seq_render_mutex = BLI_MUTEX_INITIALIZER
 
SequencerDrawView sequencer_view3d_fn = nullptr
 

Function Documentation

◆ create_missing_media_image()

static ImBuf * create_missing_media_image ( const SeqRenderData * context,
int width,
int height )
static

◆ do_render_strip_seqbase()

static ImBuf * do_render_strip_seqbase ( const SeqRenderData * context,
SeqRenderState * state,
Sequence * seq,
float frame_index )
static

◆ do_render_strip_uncached()

◆ get_auto_filter()

static eIMBInterpolationFilterMode get_auto_filter ( const StripTransform * transform)
static

◆ get_strip_screen_quad()

◆ input_preprocess()

◆ is_opaque_alpha_over()

◆ is_quad_a_inside_b()

static bool is_quad_a_inside_b ( const StripScreenQuad & a,
const StripScreenQuad & b )
static

Definition at line 310 of file render.cc.

References b, and isect_point_quad_v2().

Referenced by OpaqueQuadTracker::is_occluded(), and is_strip_covering_screen().

◆ is_strip_covering_screen()

static bool is_strip_covering_screen ( const SeqRenderData * context,
const Sequence * seq )
static

Definition at line 500 of file render.cc.

References float, get_strip_screen_quad(), is_quad_a_inside_b(), and quad.

Referenced by sequencer_preprocess_transform_crop().

◆ multiply_ibuf()

static void multiply_ibuf ( ImBuf * ibuf,
const float fmul,
const bool multiply_alpha )
static

◆ render_effect_execute_do_thread()

◆ render_effect_execute_init_handle()

static void render_effect_execute_init_handle ( void * handle_v,
int start_line,
int tot_line,
void * init_data_v )
static

Definition at line 761 of file render.cc.

References blender::init_data(), and RenderEffectInitData::sh.

Referenced by seq_render_effect_execute_threaded().

◆ seq_get_early_out_for_blend_mode()

◆ seq_get_movieclip_ibuf()

◆ seq_get_shown_sequences()

Vector< Sequence * > seq_get_shown_sequences ( const Scene * scene,
ListBase * channels,
ListBase * seqbase,
const int timeline_frame,
const int chanshown )

◆ seq_image_strip_is_multiview_render()

static bool seq_image_strip_is_multiview_render ( Scene * scene,
Sequence * seq,
int totfiles,
const char * filepath,
char * r_prefix,
const char * r_ext )
static

◆ seq_imbuf_assign_spaces()

◆ seq_imbuf_to_sequencer_space()

◆ seq_input_have_to_preprocess()

◆ seq_must_swap_input_in_blend_mode()

static bool seq_must_swap_input_in_blend_mode ( Sequence * seq)
static

◆ seq_need_scale_to_render_size()

static bool seq_need_scale_to_render_size ( const Sequence * seq,
bool is_proxy_image )
static

Effect, mask and scene in strip input strips are rendered in preview resolution. They are already down-scaled. input_preprocess() does not expect this to happen. Other strip types are rendered with original media resolution, unless proxies are enabled for them. With proxies is_proxy_image will be set correctly to true.

Definition at line 446 of file render.cc.

References Sequence::flag, SEQ_SCENE_STRIPS, SEQ_TYPE_EFFECT, SEQ_TYPE_MASK, SEQ_TYPE_META, SEQ_TYPE_SCENE, and Sequence::type.

Referenced by sequencer_preprocess_transform_crop().

◆ seq_render_effect_execute_threaded()

◆ seq_render_effect_strip_impl()

◆ SEQ_render_give_ibuf()

◆ SEQ_render_give_ibuf_direct()

ImBuf * SEQ_render_give_ibuf_direct ( const SeqRenderData * context,
float timeline_frame,
Sequence * seq )

Definition at line 2144 of file render.cc.

References seq_render_strip(), and state.

Referenced by sequencer_ibuf_get().

◆ seq_render_give_ibuf_seqbase()

ImBuf * seq_render_give_ibuf_seqbase ( const SeqRenderData * context,
float timeline_frame,
int chan_shown,
ListBase * channels,
ListBase * seqbasep )

Definition at line 2133 of file render.cc.

References seq_render_strip_stack(), and state.

Referenced by do_adjustment_impl(), and do_multicam().

◆ SEQ_render_give_stripelem()

◆ seq_render_image_strip()

◆ seq_render_image_strip_view()

static ImBuf * seq_render_image_strip_view ( const SeqRenderData * context,
Sequence * seq,
char * filepath,
char * prefix,
const char * ext,
int view_id )
static

◆ SEQ_render_imbuf_from_sequencer_space()

◆ SEQ_render_is_muted()

◆ seq_render_mask()

◆ seq_render_mask_strip()

static ImBuf * seq_render_mask_strip ( const SeqRenderData * context,
Sequence * seq,
float frame_index )
static

Definition at line 1423 of file render.cc.

References Sequence::flag, Sequence::mask, SEQ_MAKE_FLOAT, and seq_render_mask().

Referenced by do_render_strip_uncached().

◆ seq_render_movie_strip()

◆ seq_render_movie_strip_custom_file_proxy()

◆ seq_render_movie_strip_timecode_get()

static IMB_Timecode_Type seq_render_movie_strip_timecode_get ( Sequence * seq)
static

◆ seq_render_movie_strip_view()

◆ seq_render_movieclip_strip()

◆ SEQ_render_new_render_data()

◆ SEQ_render_pixel_from_sequencer_space_v4()

void SEQ_render_pixel_from_sequencer_space_v4 ( Scene * scene,
float pixel[4] )

◆ seq_render_preprocess_ibuf()

static ImBuf * seq_render_preprocess_ibuf ( const SeqRenderData * context,
Sequence * seq,
ImBuf * ibuf,
float timeline_frame,
bool use_preprocess,
const bool is_proxy_image )
static

◆ seq_render_scene_strip()

◆ seq_render_strip()

◆ seq_render_strip_stack()

◆ seq_render_strip_stack_apply_effect()

static ImBuf * seq_render_strip_stack_apply_effect ( const SeqRenderData * context,
Sequence * seq,
float timeline_frame,
ImBuf * ibuf1,
ImBuf * ibuf2 )
static

◆ sequencer_image_crop_init()

static void sequencer_image_crop_init ( const Sequence * seq,
const ImBuf * in,
float crop_scale_factor,
rctf * r_crop )
static

◆ sequencer_image_crop_transform_matrix()

static void sequencer_image_crop_transform_matrix ( const Sequence * seq,
const ImBuf * in,
const ImBuf * out,
const float image_scale_factor,
const float preview_scale_factor,
float r_transform_matrix[4][4] )
static

◆ sequencer_preprocess_transform_crop()

◆ sequencer_use_crop()

static bool sequencer_use_crop ( const Sequence * seq)
static

◆ sequencer_use_transform()

static bool sequencer_use_transform ( const Sequence * seq)
static

Definition at line 380 of file render.cc.

References Sequence::strip, and Strip::transform.

Referenced by input_preprocess(), and seq_input_have_to_preprocess().

Variable Documentation

◆ seq_render_mutex

ThreadMutex seq_render_mutex = BLI_MUTEX_INITIALIZER
static

Definition at line 86 of file render.cc.

Referenced by SEQ_render_give_ibuf().

◆ sequencer_view3d_fn

SequencerDrawView sequencer_view3d_fn = nullptr

Definition at line 87 of file render.cc.

Referenced by ED_spacetype_sequencer(), and seq_render_scene_strip().