== Sequencer ==

* documented and rewrote the render interface of the sequencer.
  (now, the geometry / render_type / etc. settings are stored within a
  seperate structure called SeqRenderData that is passed within the code.)

* that fixes
  * cache problems, since the caching system didn't keep track of
    proxy files vs. final renders.
  * is a necessary step, to bring back frame blending in speed effect
    (the SeqRenderData structure elements are already there)
  * will make motion blur render options available within the sequencer!

* this patch also fixes:
  * "easy retiming" using speed effects. (in Blender 2.49, you could 
    add a speed effect and resize the source track to retime it to that
    length)
  * adds labels for the Original dimensions for Image + Movie tracks
    (worked in 2.49, too)
This commit is contained in:
Peter Schlaile 2010-11-21 20:00:31 +00:00
parent a2dc1fe4b0
commit a0517e6338
8 changed files with 434 additions and 289 deletions

@ -384,6 +384,8 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel):
col.label(text="Frame Offset %d:%d" % (strip.frame_offset_start, strip.frame_offset_end))
col.label(text="Frame Still %d:%d" % (strip.frame_still_start, strip.frame_still_end))
if strip.type in ('MOVIE', 'IMAGE'):
col.label(text="Orig Dim: %dx%d" % (strip.orig_width, strip.orig_height))
class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
@ -443,12 +445,14 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
row.prop(strip, "use_only_boost")
elif strip.type == 'SPEED':
layout.prop(strip, "use_as_speed")
if strip.use_as_speed:
layout.prop(strip, "speed_factor")
else:
layout.prop(strip, "speed_factor", text="Frame number")
layout.prop(strip, "scale_to_length")
layout.prop(strip, "use_default_fade", "Stretch to input strip length")
if not strip.use_default_fade:
layout.prop(strip, "use_as_speed")
if strip.use_as_speed:
layout.prop(strip, "speed_factor")
else:
layout.prop(strip, "speed_factor", text="Frame number")
layout.prop(strip, "scale_to_length")
#doesn't work currently
#layout.prop(strip, "use_frame_blend")
@ -573,6 +577,7 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(strip, "filepath", text="")
col.prop(strip, "mpeg_preseek", text="MPEG Preseek")
# TODO, sound???
# end drawing filename

@ -83,6 +83,22 @@ void seq_array(struct Editing *ed, struct Sequence ***seqarray, int *tot, int us
seq_end(&iter); \
}
typedef struct SeqRenderData {
struct Main *bmain;
struct Scene *scene;
int rectx;
int recty;
int preview_render_size;
int motion_blur_samples;
float motion_blur_shutter;
} SeqRenderData;
SeqRenderData seq_new_render_data(
struct Main * bmain, struct Scene * scene,
int rectx, int recty, int preview_render_size);
int seq_cmp_render_data(SeqRenderData * a, SeqRenderData * b);
unsigned int seq_hash_render_data(SeqRenderData * a);
/* Wipe effect */
enum {DO_SINGLE_WIPE, DO_DOUBLE_WIPE, DO_BOX_WIPE, DO_CROSS_WIPE,
@ -129,35 +145,39 @@ struct SeqEffectHandle {
(mixed cases are handled one layer up...) */
struct ImBuf* (*execute)(
struct Main *bmain,
struct Scene *scene, struct Sequence *seq, float cfra,
SeqRenderData context,
struct Sequence *seq, float cfra,
float facf0, float facf1,
int x, int y, int preview_render_size,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3);
};
/* ********************* prototypes *************** */
/* sequence.c */
void printf_strip(struct Sequence *seq);
/* **********************************************************************
* sequence.c
* sequencer render functions
********************************************************************** */
struct ImBuf *give_ibuf_seq(SeqRenderData context, float cfra, int chanshown);
struct ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown);
struct ImBuf *give_ibuf_seq_direct(SeqRenderData context, float cfra, struct Sequence *seq);
struct ImBuf *give_ibuf_seqbase(SeqRenderData context, float cfra, int chan_shown, struct ListBase *seqbasep);
void give_ibuf_prefetch_request(SeqRenderData context, float cfra, int chan_shown);
/* apply functions recursively */
int seqbase_recursive_apply(struct ListBase *seqbase, int (*apply_func)(struct Sequence *seq, void *), void *arg);
int seq_recursive_apply(struct Sequence *seq, int (*apply_func)(struct Sequence *, void *), void *arg);
// extern
/* maintainance functions, mostly for RNA */
// extern
void seq_free_sequence(struct Scene *scene, struct Sequence *seq);
void seq_free_strip(struct Strip *strip);
void seq_free_editing(struct Scene *scene);
void seq_free_clipboard(void);
struct Editing *seq_give_editing(struct Scene *scene, int alloc);
char *give_seqname(struct Sequence *seq);
struct ImBuf *give_ibuf_seq(struct Main *bmain, struct Scene *scene, int rectx, int recty, int cfra, int chanshown, int preview_render_size);
struct ImBuf *give_ibuf_seq_threaded(struct Main *bmain, struct Scene *scene, int rectx, int recty, int cfra, int chanshown, int preview_render_size);
struct ImBuf *give_ibuf_seq_direct(struct Main *bmain, struct Scene *scene, int rectx, int recty, int cfra, int preview_render_size, struct Sequence *seq);
struct ImBuf *give_ibuf_seqbase(struct Main *bmain, struct Scene *scene, int rectx, int recty, int cfra, int chan_shown, int preview_render_size, struct ListBase *seqbasep);
void give_ibuf_prefetch_request(int rectx, int recty, int cfra, int chanshown, int render_size);
void calc_sequence(struct Scene *scene, struct Sequence *seq);
void calc_sequence_disp(struct Scene *scene, struct Sequence *seq);
void new_tstripdata(struct Sequence *seq);
@ -168,14 +188,18 @@ void build_seqar_cb(struct ListBase *seqbase, struct Sequence ***seqar, int *to
int evaluate_seq_frame(struct Scene *scene, int cfra);
struct StripElem *give_stripelem(struct Sequence *seq, int cfra);
// intern?
// intern
void printf_strip(struct Sequence *seq); // debugging function (unused)
void update_changed_seq_and_deps(struct Scene *scene, struct Sequence *changed_seq, int len_change, int ibuf_change);
int input_have_to_preprocess(
struct Scene *scene, struct Sequence * seq,
float cfra, int seqrectx, int seqrecty);
SeqRenderData context, struct Sequence * seq, float cfra);
/* seqcache.c */
/* **********************************************************************
seqcache.c
Sequencer memory cache management functions
********************************************************************** */
typedef enum {
SEQ_STRIPELEM_IBUF,
@ -190,22 +214,33 @@ void seq_stripelem_cache_destruct();
void seq_stripelem_cache_cleanup();
struct ImBuf * seq_stripelem_cache_get(
struct Sequence * seq, int rectx, int recty,
SeqRenderData context, struct Sequence * seq,
float cfra, seq_stripelem_ibuf_t type);
void seq_stripelem_cache_put(
struct Sequence * seq, int rectx, int recty,
SeqRenderData context, struct Sequence * seq,
float cfra, seq_stripelem_ibuf_t type, struct ImBuf * nval);
/* **********************************************************************
seqeffects.c
/* seqeffects.c */
// intern?
Sequencer effect strip managment functions
**********************************************************************
*/
/* intern */
struct SeqEffectHandle get_sequence_blend(struct Sequence *seq);
void sequence_effect_speed_rebuild_map(struct Scene *scene, struct Sequence *seq, int force);
// extern
/* extern */
struct SeqEffectHandle get_sequence_effect(struct Sequence *seq);
int get_sequence_effect_num_inputs(int seq_type);
/* **********************************************************************
Sequencer editing functions
**********************************************************************
*/
/* for transform but also could use elsewhere */
int seq_tx_get_start(struct Sequence *seq);
int seq_tx_get_end(struct Sequence *seq);

@ -42,8 +42,7 @@
typedef struct seqCacheKey
{
struct Sequence * seq;
int rectx;
int recty;
SeqRenderData context;
float cfra;
seq_stripelem_ibuf_t type;
} seqCacheKey;
@ -64,7 +63,7 @@ static int ibufs_rem = 0;
static unsigned int HashHash(void *key_)
{
seqCacheKey * key = (seqCacheKey*) key_;
unsigned int rval = key->rectx + key->recty;
unsigned int rval = seq_hash_render_data(&key->context);
rval ^= *(unsigned int*) &key->cfra;
rval += key->type;
@ -99,21 +98,7 @@ static int HashCmp(void *a_, void *b_)
return 1;
}
if (a->rectx < b->rectx) {
return -1;
}
if (a->rectx > b->rectx) {
return 1;
}
if (a->recty < b->recty) {
return -1;
}
if (a->recty > b->recty) {
return 1;
}
return 0;
return seq_cmp_render_data(&a->context, &b->context);
}
static void HashKeyFree(void *key)
@ -192,7 +177,7 @@ void seq_stripelem_cache_cleanup()
}
struct ImBuf * seq_stripelem_cache_get(
struct Sequence * seq, int rectx, int recty,
SeqRenderData context, struct Sequence * seq,
float cfra, seq_stripelem_ibuf_t type)
{
seqCacheKey key;
@ -207,8 +192,7 @@ struct ImBuf * seq_stripelem_cache_get(
}
key.seq = seq;
key.rectx = rectx;
key.recty = recty;
key.context = context;
key.cfra = cfra - seq->start;
key.type = type;
@ -224,7 +208,7 @@ struct ImBuf * seq_stripelem_cache_get(
}
void seq_stripelem_cache_put(
struct Sequence * seq, int rectx, int recty,
SeqRenderData context, struct Sequence * seq,
float cfra, seq_stripelem_ibuf_t type, struct ImBuf * i)
{
seqCacheKey * key;
@ -243,8 +227,7 @@ void seq_stripelem_cache_put(
key = (seqCacheKey*) BLI_mempool_alloc(keypool);
key->seq = seq;
key->rectx = rectx;
key->recty = recty;
key->context = context;
key->cfra = cfra - seq->start;
key->type = type;

@ -69,11 +69,13 @@ enum {
};
static struct ImBuf * prepare_effect_imbufs(
int x, int y,
SeqRenderData context,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
struct ImBuf * out;
int x = context.rectx;
int y = context.recty;
if (!ibuf1 && !ibuf2 && !ibuf3) {
/* hmmm, global float option ? */
@ -273,9 +275,8 @@ static ImBuf * IMB_cast_away_list(ImBuf * i)
}
static struct ImBuf * do_plugin_effect(
Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *seq, float cfra,
float facf0, float facf1, int x, int y,
int UNUSED(preview_render_size),
SeqRenderData context, Sequence *seq, float cfra,
float facf0, float facf1,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
@ -285,7 +286,9 @@ static struct ImBuf * do_plugin_effect(
old plugins) do very bad stuff
with imbuf-internals */
struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
int x = context.rectx;
int y = context.recty;
if(seq->plugin && seq->plugin->doit) {
@ -524,22 +527,21 @@ static void do_alphaover_effect_float(float facf0, float facf1, int x, int y,
}
static struct ImBuf * do_alphaover_effect(
Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1, int x, int y,
int UNUSED(preview_render_size),
SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
if (out->rect_float) {
do_alphaover_effect_float(
facf0, facf1, x, y,
facf0, facf1, context.rectx, context.recty,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
} else {
do_alphaover_effect_byte(
facf0, facf1, x, y,
facf0, facf1, context.rectx, context.recty,
(char*) ibuf1->rect, (char*) ibuf2->rect,
(char*) out->rect);
}
@ -696,22 +698,22 @@ static void do_alphaunder_effect_float(float facf0, float facf1, int x, int y,
}
static struct ImBuf* do_alphaunder_effect(
Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1, int x, int y,
int UNUSED(preview_render_size),
SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
struct ImBuf * out = prepare_effect_imbufs(
context, ibuf1, ibuf2, ibuf3);
if (out->rect_float) {
do_alphaunder_effect_float(
facf0, facf1, x, y,
facf0, facf1, context.rectx, context.recty,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
} else {
do_alphaunder_effect_byte(
facf0, facf1, x, y,
facf0, facf1, context.rectx, context.recty,
(char*) ibuf1->rect, (char*) ibuf2->rect,
(char*) out->rect);
}
@ -821,22 +823,22 @@ void do_cross_effect_float(float facf0, float facf1, int x, int y,
/* carefull: also used by speed effect! */
static struct ImBuf* do_cross_effect(
Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1, int x, int y,
int UNUSED(preview_render_size),
SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
struct ImBuf * out = prepare_effect_imbufs(
context, ibuf1, ibuf2, ibuf3);
if (out->rect_float) {
do_cross_effect_float(
facf0, facf1, x, y,
facf0, facf1, context.rectx, context.recty,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
} else {
do_cross_effect_byte(
facf0, facf1, x, y,
facf0, facf1, context.rectx, context.recty,
(char*) ibuf1->rect, (char*) ibuf2->rect,
(char*) out->rect);
}
@ -1088,24 +1090,24 @@ static void do_gammacross_effect_float(float facf0, float UNUSED(facf1),
}
static struct ImBuf * do_gammacross_effect(
Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1, int x, int y,
int UNUSED(preview_render_size),
SeqRenderData context,
Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
build_gammatabs();
if (out->rect_float) {
do_gammacross_effect_float(
facf0, facf1, x, y,
facf0, facf1, context.rectx, context.recty,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
} else {
do_gammacross_effect_byte(
facf0, facf1, x, y,
facf0, facf1, context.rectx, context.recty,
(unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
(unsigned char*) out->rect);
}
@ -1206,22 +1208,22 @@ static void do_add_effect_float(float facf0, float facf1, int x, int y,
}
}
static struct ImBuf * do_add_effect(Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1, int x, int y,
int UNUSED(preview_render_size),
static struct ImBuf * do_add_effect(SeqRenderData context,
Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
if (out->rect_float) {
do_add_effect_float(
facf0, facf1, x, y,
facf0, facf1, context.rectx, context.recty,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
} else {
do_add_effect_byte(
facf0, facf1, x, y,
facf0, facf1, context.rectx, context.recty,
(unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
(unsigned char*) out->rect);
}
@ -1323,22 +1325,21 @@ static void do_sub_effect_float(float facf0, float facf1, int x, int y,
}
static struct ImBuf * do_sub_effect(
Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1, int x, int y,
int UNUSED(preview_render_size),
SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
if (out->rect_float) {
do_sub_effect_float(
facf0, facf1, x, y,
facf0, facf1, context.rectx, context.recty,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
} else {
do_sub_effect_byte(
facf0, facf1, x, y,
facf0, facf1, context.rectx, context.recty,
(char*) ibuf1->rect, (char*) ibuf2->rect,
(char*) out->rect);
}
@ -1537,22 +1538,21 @@ static void do_mul_effect_float(float facf0, float facf1, int x, int y,
}
static struct ImBuf * do_mul_effect(
Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1, int x, int y,
int UNUSED(preview_render_size),
SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra),
float facf0, float facf1,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
if (out->rect_float) {
do_mul_effect_float(
facf0, facf1, x, y,
facf0, facf1, context.rectx, context.recty,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
} else {
do_mul_effect_byte(
facf0, facf1, x, y,
facf0, facf1, context.rectx, context.recty,
(unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
(unsigned char*) out->rect);
}
@ -1993,24 +1993,23 @@ static void do_wipe_effect_float(Sequence *seq, float facf0, float UNUSED(facf1)
}
static struct ImBuf * do_wipe_effect(
Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *seq, float UNUSED(cfra),
float facf0, float facf1, int x, int y,
int UNUSED(preview_render_size),
SeqRenderData context, Sequence *seq, float UNUSED(cfra),
float facf0, float facf1,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
if (out->rect_float) {
do_wipe_effect_float(seq,
facf0, facf1, x, y,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
facf0, facf1, context.rectx, context.recty,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
} else {
do_wipe_effect_byte(seq,
facf0, facf1, x, y,
(unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
(unsigned char*) out->rect);
facf0, facf1, context.rectx, context.recty,
(unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
(unsigned char*) out->rect);
}
return out;
@ -2062,8 +2061,8 @@ static void copy_transform_effect(Sequence *dst, Sequence *src)
}
static void transform_image(int x, int y, struct ImBuf *ibuf1, struct ImBuf *out,
float scale_x, float scale_y, float translate_x, float translate_y,
float rotate, int interpolation)
float scale_x, float scale_y, float translate_x, float translate_y,
float rotate, int interpolation)
{
int xo, yo, xi, yi;
float xt, yt, xr, yr;
@ -2144,15 +2143,15 @@ static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x
static struct ImBuf * do_transform_effect(
Main *UNUSED(bmain), Scene *scene, Sequence *seq,float UNUSED(cfra),
float facf0, float UNUSED(facf1), int x, int y,
int UNUSED(preview_render_size),
SeqRenderData context, Sequence *seq,float UNUSED(cfra),
float facf0, float UNUSED(facf1),
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
do_transform(scene, seq, facf0, x, y, ibuf1, out);
do_transform(context.scene, seq, facf0,
context.rectx, context.recty, ibuf1, out);
return out;
}
@ -2660,26 +2659,27 @@ static void do_glow_effect_float(Sequence *seq, int render_size, float facf0, fl
}
static struct ImBuf * do_glow_effect(
Main *UNUSED(bmain), Scene * scene, Sequence *seq, float UNUSED(cfra),
float facf0, float facf1, int x, int y,
int UNUSED(preview_render_size),
SeqRenderData context, Sequence *seq, float UNUSED(cfra),
float facf0, float facf1,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
int render_size = 100*x/scene->r.xsch;
int render_size = 100*context.rectx/context.scene->r.xsch;
if (out->rect_float) {
do_glow_effect_float(seq, render_size,
facf0, facf1, x, y,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
facf0, facf1,
context.rectx, context.recty,
ibuf1->rect_float, ibuf2->rect_float,
out->rect_float);
} else {
do_glow_effect_byte(seq, render_size,
facf0, facf1, x, y,
(char*) ibuf1->rect, (char*) ibuf2->rect,
(char*) out->rect);
facf0, facf1,
context.rectx, context.recty,
(char*) ibuf1->rect, (char*) ibuf2->rect,
(char*) out->rect);
}
return out;
@ -2723,18 +2723,19 @@ static int early_out_color(struct Sequence *UNUSED(seq),
}
static struct ImBuf * do_solid_color(
Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *seq, float UNUSED(cfra),
float facf0, float facf1, int x, int y,
int UNUSED(preview_render_size),
SeqRenderData context, Sequence *seq, float UNUSED(cfra),
float facf0, float facf1,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
SolidColorVars *cv = (SolidColorVars *)seq->effectdata;
unsigned char *rect;
float *rect_float;
int x = context.rectx;
int y = context.recty;
if (out->rect) {
unsigned char col0[3];
@ -2819,9 +2820,8 @@ static int early_out_multicam(struct Sequence *UNUSED(seq), float UNUSED(facf0),
}
static struct ImBuf * do_multicam(
Main *bmain, Scene *scene, Sequence *seq, float cfra,
float UNUSED(facf0), float UNUSED(facf1), int x, int y,
int preview_render_size,
SeqRenderData context, Sequence *seq, float cfra,
float UNUSED(facf0), float UNUSED(facf1),
struct ImBuf *UNUSED(ibuf1), struct ImBuf *UNUSED(ibuf2),
struct ImBuf *UNUSED(ibuf3))
{
@ -2834,7 +2834,7 @@ static struct ImBuf * do_multicam(
return 0;
}
ed = scene->ed;
ed = context.scene->ed;
if (!ed) {
return 0;
}
@ -2843,13 +2843,12 @@ static struct ImBuf * do_multicam(
return 0;
}
i = give_ibuf_seqbase(bmain, scene, x, y, cfra, seq->multicam_source,
preview_render_size, seqbasep);
i = give_ibuf_seqbase(context, cfra, seq->multicam_source, seqbasep);
if (!i) {
return 0;
}
if (input_have_to_preprocess(scene, seq, cfra, x, y)) {
if (input_have_to_preprocess(context, seq, cfra)) {
out = IMB_dupImBuf(i);
IMB_freeImBuf(i);
} else {
@ -2940,6 +2939,7 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
float fallback_fac = 1.0f;
SpeedControlVars * v = (SpeedControlVars *)seq->effectdata;
FCurve *fcu= NULL;
int flags = v->flags;
/* if not already done, load / initialize data */
get_sequence_effect(seq);
@ -2965,12 +2965,25 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
v->frameMap = MEM_callocN(sizeof(float) * v->length,
"speedcontrol frameMap");
}
/* if there is no fcurve, use value as simple multiplier */
if (!fcu)
fallback_fac = seq->speed_fader; /* same as speed_factor in rna*/
if (v->flags & SEQ_SPEED_INTEGRATE) {
fallback_fac = 1.0;
if (seq->flag & SEQ_USE_EFFECT_DEFAULT_FADE) {
if (seq->seq1->enddisp != seq->seq1->start
&& seq->seq1->len != 0) {
fallback_fac = (float) seq->seq1->len /
(float) (seq->seq1->enddisp - seq->seq1->start);
flags = SEQ_SPEED_INTEGRATE;
fcu = NULL;
}
} else {
/* if there is no fcurve, use value as simple multiplier */
if (!fcu) {
fallback_fac = seq->speed_fader; /* same as speed_factor in rna*/
}
}
if (flags & SEQ_SPEED_INTEGRATE) {
float cursor = 0;
float facf;
@ -3006,7 +3019,7 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
facf = fallback_fac;
}
if (v->flags & SEQ_SPEED_COMPRESS_IPO_Y) {
if (flags & SEQ_SPEED_COMPRESS_IPO_Y) {
facf *= seq->seq1->len;
}
facf *= v->globalSpeed;
@ -3021,19 +3034,6 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
}
}
/*
simply reuse do_cross_effect for blending...
static void do_speed_effect(Sequence * seq,int cfra,
float facf0, float facf1, int x, int y,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3, struct ImBuf *out)
{
}
*/
/* **********************************************************************
sequence effect factory
********************************************************************** */
@ -3111,15 +3111,17 @@ static void get_default_fac_fade(struct Sequence *seq, float cfra,
*facf1 /= seq->len;
}
static struct ImBuf * do_overdrop_effect(Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra),
static struct ImBuf * do_overdrop_effect(SeqRenderData context,
Sequence *UNUSED(seq),
float UNUSED(cfra),
float facf0, float facf1,
int x, int y,
int UNUSED(preview_render_size),
struct ImBuf * ibuf1,
struct ImBuf * ibuf2,
struct ImBuf * ibuf3)
{
struct ImBuf * out = prepare_effect_imbufs(x, y, ibuf1, ibuf2, ibuf3);
struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
int x = context.rectx;
int y = context.recty;
if (out->rect_float) {
do_drop_effect_float(

@ -242,6 +242,94 @@ void seq_free_editing(Scene *scene)
MEM_freeN(ed);
}
/* **********************************************************************
* sequencer pipeline functions
********************************************************************** */
SeqRenderData seq_new_render_data(
struct Main * bmain, struct Scene * scene,
int rectx, int recty, int preview_render_size)
{
SeqRenderData rval;
rval.bmain = bmain;
rval.scene = scene;
rval.rectx = rectx;
rval.recty = recty;
rval.preview_render_size = preview_render_size;
rval.motion_blur_samples = 0;
rval.motion_blur_shutter = 0;
return rval;
}
int seq_cmp_render_data(SeqRenderData * a, SeqRenderData * b)
{
if (a->preview_render_size < b->preview_render_size) {
return -1;
}
if (a->preview_render_size > b->preview_render_size) {
return 1;
}
if (a->rectx < b->rectx) {
return -1;
}
if (a->rectx > b->rectx) {
return 1;
}
if (a->recty < b->recty) {
return -1;
}
if (a->recty > b->recty) {
return 1;
}
if (a->bmain < b->bmain) {
return -1;
}
if (a->bmain > b->bmain) {
return 1;
}
if (a->scene < b->scene) {
return -1;
}
if (a->scene > b->scene) {
return 1;
}
if (a->motion_blur_shutter < b->motion_blur_shutter) {
return -1;
}
if (a->motion_blur_shutter > b->motion_blur_shutter) {
return 1;
}
if (a->motion_blur_samples < b->motion_blur_samples) {
return -1;
}
if (a->motion_blur_samples > b->motion_blur_samples) {
return 1;
}
return 0;
}
unsigned int seq_hash_render_data(SeqRenderData * a)
{
unsigned int rval = a->rectx + a->recty;
rval ^= a->preview_render_size;
rval ^= ((intptr_t) a->bmain) << 6;
rval ^= ((intptr_t) a->scene) << 6;
rval ^= (int) (a->motion_blur_shutter * 100.0) << 10;
rval ^= a->motion_blur_samples << 24;
return rval;
}
/* ************************* itterator ************************** */
/* *************** (replaces old WHILE_SEQ) ********************* */
/* **************** use now SEQ_BEGIN() SEQ_END ***************** */
@ -1024,7 +1112,7 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se
#define PROXY_MAXFILE (2*FILE_MAXDIR+FILE_MAXFILE)
static int seq_proxy_get_fname(Scene *UNUSED(scene), Sequence * seq, int cfra, char * name, int preview_render_size)
static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, char * name)
{
int frameno;
char dir[FILE_MAXDIR];
@ -1055,17 +1143,19 @@ static int seq_proxy_get_fname(Scene *UNUSED(scene), Sequence * seq, int cfra, c
switch(seq->type) {
case SEQ_IMAGE:
snprintf(name, PROXY_MAXFILE, "%s/images/%d/%s_proxy", dir,
preview_render_size, give_stripelem(seq, cfra)->name);
context.preview_render_size,
give_stripelem(seq, cfra)->name);
frameno = 1;
break;
case SEQ_MOVIE:
frameno = (int) give_stripelem_index(seq, cfra) + seq->anim_startofs;
snprintf(name, PROXY_MAXFILE, "%s/%s/%d/####", dir,
seq->strip->stripdata->name, preview_render_size);
seq->strip->stripdata->name, context.preview_render_size);
break;
default:
frameno = (int) give_stripelem_index(seq, cfra) + seq->anim_startofs;
snprintf(name, PROXY_MAXFILE, "%s/proxy_misc/%d/####", dir, preview_render_size);
snprintf(name, PROXY_MAXFILE, "%s/proxy_misc/%d/####", dir,
context.preview_render_size);
}
BLI_path_abs(name, G.main->name);
@ -1076,7 +1166,7 @@ static int seq_proxy_get_fname(Scene *UNUSED(scene), Sequence * seq, int cfra, c
return TRUE;
}
static struct ImBuf * seq_proxy_fetch(Scene *scene, Sequence * seq, int cfra, int preview_render_size)
static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int cfra)
{
char name[PROXY_MAXFILE];
@ -1085,14 +1175,14 @@ static struct ImBuf * seq_proxy_fetch(Scene *scene, Sequence * seq, int cfra, in
}
/* rendering at 100% ? No real sense in proxy-ing, right? */
if (preview_render_size == 100) {
if (context.preview_render_size == 100) {
return 0;
}
if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
int frameno = (int) give_stripelem_index(seq, cfra) + seq->anim_startofs;
if (seq->strip->proxy->anim == NULL) {
if (seq_proxy_get_fname(scene, seq, cfra, name, preview_render_size)==0) {
if (seq_proxy_get_fname(context, seq, cfra, name)==0) {
return 0;
}
@ -1105,7 +1195,7 @@ static struct ImBuf * seq_proxy_fetch(Scene *scene, Sequence * seq, int cfra, in
return IMB_anim_absolute(seq->strip->proxy->anim, frameno);
}
if (seq_proxy_get_fname(scene, seq, cfra, name, preview_render_size)==0) {
if (seq_proxy_get_fname(context, seq, cfra, name) == 0) {
return 0;
}
@ -1437,12 +1527,12 @@ static void color_balance(Sequence * seq, ImBuf* ibuf, float mul)
*/
int input_have_to_preprocess(
Scene *UNUSED(scene), Sequence * seq, float UNUSED(cfra), int UNUSED(seqrectx), int UNUSED(seqrecty))
SeqRenderData UNUSED(context), Sequence * seq, float cfra)
{
float mul;
if (seq->flag & (SEQ_FILTERY|SEQ_USE_CROP|SEQ_USE_TRANSFORM|SEQ_FLIPX|
SEQ_FLIPY|SEQ_USE_COLOR_BALANCE|SEQ_MAKE_PREMUL)) {
SEQ_FLIPY|SEQ_USE_COLOR_BALANCE|SEQ_MAKE_PREMUL)) {
return TRUE;
}
@ -1464,7 +1554,7 @@ int input_have_to_preprocess(
}
static ImBuf * input_preprocess(
Scene *scene, Sequence *seq, float UNUSED(cfra), int seqrectx, int seqrecty, ImBuf * ibuf)
SeqRenderData context, Sequence *seq, float UNUSED(cfra), ImBuf * ibuf)
{
float mul;
@ -1493,8 +1583,8 @@ static ImBuf * input_preprocess(
dy = sy;
if (seq->flag & SEQ_USE_TRANSFORM) {
dx = scene->r.xsch;
dy = scene->r.ysch;
dx = context.scene->r.xsch;
dy = context.scene->r.ysch;
}
if (c.top + c.bottom >= ibuf->y || c.left + c.right >= ibuf->x ||
@ -1576,30 +1666,30 @@ static ImBuf * input_preprocess(
}
if(ibuf->x != seqrectx || ibuf->y != seqrecty ) {
if(scene->r.mode & R_OSA) {
IMB_scaleImBuf(ibuf, (short)seqrectx, (short)seqrecty);
if(ibuf->x != context.rectx || ibuf->y != context.recty ) {
if(context.scene->r.mode & R_OSA) {
IMB_scaleImBuf(ibuf, (short)context.rectx, (short)context.recty);
} else {
IMB_scalefastImBuf(ibuf, (short)seqrectx, (short)seqrecty);
IMB_scalefastImBuf(ibuf, (short)context.rectx, (short)context.recty);
}
}
return ibuf;
}
static ImBuf * copy_from_ibuf_still(Sequence * seq, float nr,
int seqrectx, int seqrecty)
static ImBuf * copy_from_ibuf_still(SeqRenderData context, Sequence * seq,
float nr)
{
ImBuf * rval = 0;
ImBuf * ibuf = 0;
if (nr == 0) {
ibuf = seq_stripelem_cache_get(
seq, seqrectx, seqrecty, seq->start,
context, seq, seq->start,
SEQ_STRIPELEM_IBUF_STARTSTILL);
}
if (nr == seq->len - 1) {
ibuf = seq_stripelem_cache_get(
seq, seqrectx, seqrecty, seq->start,
context, seq, seq->start,
SEQ_STRIPELEM_IBUF_ENDSTILL);
}
@ -1611,17 +1701,17 @@ static ImBuf * copy_from_ibuf_still(Sequence * seq, float nr,
return rval;
}
static void copy_to_ibuf_still(Sequence * seq, float nr,
static void copy_to_ibuf_still(SeqRenderData context, Sequence * seq, float nr,
ImBuf * ibuf)
{
if (nr == 0) {
seq_stripelem_cache_put(
seq, 0, 0, seq->start,
context, seq, seq->start,
SEQ_STRIPELEM_IBUF_STARTSTILL, ibuf);
}
if (nr == seq->len - 1) {
seq_stripelem_cache_put(
seq, 0, 0, seq->start,
context, seq, seq->start,
SEQ_STRIPELEM_IBUF_ENDSTILL, ibuf);
}
}
@ -1630,15 +1720,15 @@ static void copy_to_ibuf_still(Sequence * seq, float nr,
strip rendering functions
********************************************************************** */
static ImBuf* seq_render_strip_stack( Main *bmain, Scene *scene, ListBase *seqbasep,
float cfra, int chanshown, int preview_render_size, int seqrectx, int seqrecty);
static ImBuf* seq_render_strip_stack(
SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown);
static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float cfra,
int preview_render_size, int seqrectx, int seqrecty);
static ImBuf * seq_render_strip(
SeqRenderData context, Sequence * seq, float cfra);
static ImBuf* seq_render_effect_strip_impl(Main *bmain, Scene *scene, float cfra,
Sequence *seq, int preview_render_size, int seqrectx, int seqrecty)
static ImBuf* seq_render_effect_strip_impl(
SeqRenderData context, Sequence *seq, float cfra)
{
float fac, facf;
int early_out;
@ -1654,21 +1744,22 @@ static ImBuf* seq_render_effect_strip_impl(Main *bmain, Scene *scene, float cfra
input[0] = seq->seq1; input[1] = seq->seq2; input[2] = seq->seq3;
if (!sh.execute) { /* effect not supported in this version... */
out = IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rect);
out = IMB_allocImBuf((short)context.rectx,
(short)context.recty, 32, IB_rect);
return out;
}
if (seq->flag & SEQ_USE_EFFECT_DEFAULT_FADE) {
sh.get_default_fac(seq, cfra, &fac, &facf);
if ((scene->r.mode & R_FIELDS)==0)
if ((context.scene->r.mode & R_FIELDS)==0)
facf= fac;
}
else {
fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "effect_fader", 0);
fcu = id_data_find_fcurve(&context.scene->id, seq, &RNA_Sequence, "effect_fader", 0);
if (fcu) {
fac = facf = evaluate_fcurve(fcu, cfra);
if( scene->r.mode & R_FIELDS ) {
if( context.scene->r.mode & R_FIELDS ) {
facf = evaluate_fcurve(fcu, cfra + 0.5);
}
} else {
@ -1680,27 +1771,26 @@ static ImBuf* seq_render_effect_strip_impl(Main *bmain, Scene *scene, float cfra
switch (early_out) {
case EARLY_NO_INPUT:
out = sh.execute(bmain, scene, seq, cfra, fac, facf,
seqrectx, seqrecty, preview_render_size, NULL, NULL, NULL);
out = sh.execute(context, seq, cfra, fac, facf,
NULL, NULL, NULL);
case EARLY_DO_EFFECT:
for(i=0; i<3; i++) {
if(input[i])
ibuf[i] = seq_render_strip(bmain, scene, input[i], cfra,
preview_render_size, seqrectx, seqrecty);
ibuf[i] = seq_render_strip(
context, input[i], cfra);
}
if (ibuf[0] && ibuf[1]) {
out = sh.execute(bmain, scene, seq, cfra, fac, facf, seqrectx, seqrecty,
preview_render_size, ibuf[0], ibuf[1], ibuf[2]);
out = sh.execute(context, seq, cfra, fac, facf,
ibuf[0], ibuf[1], ibuf[2]);
}
break;
case EARLY_USE_INPUT_1:
if (input[0]) {
ibuf[0] = seq_render_strip(bmain, scene, input[0], cfra,
preview_render_size, seqrectx, seqrecty);
ibuf[0] = seq_render_strip(context, input[0], cfra);
}
if (ibuf[0]) {
if (input_have_to_preprocess(scene, seq, cfra, seqrectx, seqrecty)) {
if (input_have_to_preprocess(context, seq, cfra)) {
out = IMB_dupImBuf(ibuf[0]);
} else {
out = ibuf[0];
@ -1710,11 +1800,10 @@ static ImBuf* seq_render_effect_strip_impl(Main *bmain, Scene *scene, float cfra
break;
case EARLY_USE_INPUT_2:
if (input[1]) {
ibuf[1] = seq_render_strip(bmain, scene, input[1], cfra,
preview_render_size, seqrectx, seqrecty);
ibuf[1] = seq_render_strip(context, input[1], cfra);
}
if (ibuf[1]) {
if (input_have_to_preprocess(scene, seq, cfra, seqrectx, seqrecty)) {
if (input_have_to_preprocess(context, seq, cfra)) {
out = IMB_dupImBuf(ibuf[1]);
} else {
out = ibuf[1];
@ -1729,7 +1818,7 @@ static ImBuf* seq_render_effect_strip_impl(Main *bmain, Scene *scene, float cfra
}
if (out == NULL) {
out = IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rect);
out = IMB_allocImBuf((short)context.rectx, (short)context.recty, 32, IB_rect);
}
return out;
@ -1737,7 +1826,7 @@ static ImBuf* seq_render_effect_strip_impl(Main *bmain, Scene *scene, float cfra
static ImBuf * seq_render_scene_strip_impl(
Main *bmain, Scene * scene, Sequence * seq, float nr, int seqrectx, int seqrecty)
SeqRenderData context, Sequence * seq, float nr)
{
ImBuf * ibuf = 0;
float frame= seq->sfra + nr + seq->anim_startofs;
@ -1795,8 +1884,8 @@ static ImBuf * seq_render_scene_strip_impl(
oldcamera= seq->scene->camera;
/* prevent eternal loop */
doseq= scene->r.scemode & R_DOSEQ;
scene->r.scemode &= ~R_DOSEQ;
doseq= context.scene->r.scemode & R_DOSEQ;
context.scene->r.scemode &= ~R_DOSEQ;
seq->scene->r.cfra= frame;
if(seq->scene_camera)
@ -1810,25 +1899,25 @@ static ImBuf * seq_render_scene_strip_impl(
seq->scene->markers.first= seq->scene->markers.last= NULL;
#endif
if(sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (seq->scene == scene || have_seq==0) && seq->scene->camera) {
if(sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (seq->scene == context.scene || have_seq==0) && seq->scene->camera) {
/* for old scened this can be uninitialized, should probably be added to do_versions at some point if the functionality stays */
if(scene->r.seq_prev_type==0)
scene->r.seq_prev_type = 3 /* ==OB_SOLID */;
if(context.scene->r.seq_prev_type==0)
context.scene->r.seq_prev_type = 3 /* ==OB_SOLID */;
/* opengl offscreen render */
scene_update_for_newframe(bmain, seq->scene, seq->scene->lay);
ibuf= sequencer_view3d_cb(seq->scene, seqrectx, seqrecty, IB_rect, scene->r.seq_prev_type);
scene_update_for_newframe(context.bmain, seq->scene, seq->scene->lay);
ibuf= sequencer_view3d_cb(seq->scene, context.rectx, context.recty, IB_rect, context.scene->r.seq_prev_type);
}
else {
Render *re = RE_GetRender(sce->id.name);
RenderResult rres;
/* XXX: this if can be removed when sequence preview rendering uses the job system */
if(rendering || scene != sce) {
if(rendering || context.scene != sce) {
if(re==NULL)
re= RE_NewRender(sce->id.name);
RE_BlenderFrame(re, bmain, sce, NULL, sce->lay, frame, FALSE);
RE_BlenderFrame(re, context.bmain, sce, NULL, sce->lay, frame, FALSE);
/* restore previous state after it was toggled on & off by RE_BlenderFrame */
G.rendering = rendering;
@ -1859,7 +1948,7 @@ static ImBuf * seq_render_scene_strip_impl(
}
/* restore */
scene->r.scemode |= doseq;
context.scene->r.scemode |= doseq;
seq->scene->r.cfra = oldcfra;
seq->scene->camera= oldcamera;
@ -1872,27 +1961,26 @@ static ImBuf * seq_render_scene_strip_impl(
return ibuf;
}
static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float cfra,
int preview_render_size, int seqrectx, int seqrecty)
static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfra)
{
ImBuf * ibuf = NULL;
char name[FILE_MAXDIR+FILE_MAXFILE];
int use_preprocess = input_have_to_preprocess(scene, seq, cfra, seqrectx, seqrecty);
int use_preprocess = input_have_to_preprocess(context, seq, cfra);
float nr = give_stripelem_index(seq, cfra);
/* all effects are handled similarly with the exception of speed effect */
int type = (seq->type & SEQ_EFFECT && seq->type != SEQ_SPEED) ? SEQ_EFFECT : seq->type;
ibuf = seq_stripelem_cache_get(seq, seqrectx, seqrecty, cfra, SEQ_STRIPELEM_IBUF);
ibuf = seq_stripelem_cache_get(context, seq, cfra, SEQ_STRIPELEM_IBUF);
if (ibuf == NULL)
ibuf = copy_from_ibuf_still(seq,nr,seqrectx,seqrecty);
ibuf = copy_from_ibuf_still(context, seq, nr);
/* currently, we cache preprocessed images */
if (ibuf)
use_preprocess = FALSE;
if (ibuf == NULL)
ibuf = seq_proxy_fetch(scene, seq, cfra, preview_render_size);
ibuf = seq_proxy_fetch(context, seq, cfra);
if(ibuf == NULL) switch(type) {
case SEQ_META:
@ -1900,8 +1988,9 @@ static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float
ImBuf * meta_ibuf = NULL;
if(seq->seqbase.first)
meta_ibuf = seq_render_strip_stack(bmain, scene, &seq->seqbase,
seq->start + nr, 0, preview_render_size, seqrectx, seqrecty);
meta_ibuf = seq_render_strip_stack(
context, &seq->seqbase,
seq->start + nr, 0);
if(meta_ibuf) {
ibuf = meta_ibuf;
@ -1922,13 +2011,12 @@ static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float
float f_cfra;
SpeedControlVars * s = (SpeedControlVars *)seq->effectdata;
sequence_effect_speed_rebuild_map(scene, seq, 0);
sequence_effect_speed_rebuild_map(context.scene,seq, 0);
/* weeek! */
f_cfra = seq->start + s->frameMap[(int) nr];
child_ibuf = seq_render_strip(bmain, scene, seq->seq1, f_cfra, preview_render_size,
seqrectx, seqrecty);
child_ibuf = seq_render_strip(context,seq->seq1,f_cfra);
if (child_ibuf) {
ibuf = child_ibuf;
@ -1944,8 +2032,7 @@ static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float
}
case SEQ_EFFECT:
{
ibuf = seq_render_effect_strip_impl(bmain, scene, cfra, seq, preview_render_size,
seqrectx, seqrecty);
ibuf = seq_render_effect_strip_impl(context, seq, cfra);
break;
}
case SEQ_IMAGE:
@ -1966,7 +2053,7 @@ static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float
if(ibuf->profile == IB_PROFILE_LINEAR_RGB)
IMB_convert_profile(ibuf, IB_PROFILE_NONE);
copy_to_ibuf_still(seq, nr, ibuf);
copy_to_ibuf_still(context, seq, nr, ibuf);
}
break;
}
@ -1977,7 +2064,7 @@ static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float
BLI_path_abs(name, G.main->name);
seq->anim = openanim(name, IB_rect |
((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0));
((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0));
}
if(seq->anim) {
@ -1988,28 +2075,28 @@ static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float
imb_freerectImBuf(ibuf);
}
copy_to_ibuf_still(seq, nr, ibuf);
copy_to_ibuf_still(context, seq, nr, ibuf);
break;
}
case SEQ_SCENE:
{ // scene can be NULL after deletions
ibuf = seq_render_scene_strip_impl(bmain, scene, seq, nr, seqrectx, seqrecty);
ibuf = seq_render_scene_strip_impl(context, seq, nr);
copy_to_ibuf_still(seq, nr, ibuf);
copy_to_ibuf_still(context, seq, nr, ibuf);
break;
}
}
if (ibuf == NULL)
ibuf = IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rect);
ibuf = IMB_allocImBuf((short)context.rectx, (short)context.recty, 32, IB_rect);
if (ibuf->x != seqrectx || ibuf->y != seqrecty)
if (ibuf->x != context.rectx || ibuf->y != context.recty)
use_preprocess = TRUE;
if (use_preprocess)
ibuf = input_preprocess(scene, seq, cfra, seqrectx, seqrecty, ibuf);
ibuf = input_preprocess(context, seq, cfra, ibuf);
seq_stripelem_cache_put(seq, seqrectx, seqrecty, cfra, SEQ_STRIPELEM_IBUF, ibuf);
seq_stripelem_cache_put(context, seq, cfra, SEQ_STRIPELEM_IBUF, ibuf);
return ibuf;
}
@ -2053,8 +2140,7 @@ static int seq_get_early_out_for_blend_mode(Sequence * seq)
}
static ImBuf* seq_render_strip_stack(
Main *bmain, Scene *scene, ListBase *seqbasep, float cfra, int chanshown,
int preview_render_size, int seqrectx, int seqrecty)
SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown)
{
Sequence* seq_arr[MAXSEQ+1];
int count;
@ -2075,15 +2161,17 @@ static ImBuf* seq_render_strip_stack(
}
#endif
out = seq_stripelem_cache_get(seq_arr[count - 1], seqrectx, seqrecty, cfra, SEQ_STRIPELEM_IBUF_COMP);
out = seq_stripelem_cache_get(context, seq_arr[count - 1],
cfra, SEQ_STRIPELEM_IBUF_COMP);
if (out) {
return out;
}
if(count == 1) {
out = seq_render_strip(bmain, scene, seq_arr[0], cfra, preview_render_size, seqrectx, seqrecty);
seq_stripelem_cache_put(seq_arr[0], seqrectx, seqrecty, cfra, SEQ_STRIPELEM_IBUF_COMP, out);
out = seq_render_strip(context, seq_arr[0], cfra);
seq_stripelem_cache_put(context, seq_arr[0], cfra,
SEQ_STRIPELEM_IBUF_COMP, out);
return out;
}
@ -2093,13 +2181,14 @@ static ImBuf* seq_render_strip_stack(
int early_out;
Sequence *seq = seq_arr[i];
out = seq_stripelem_cache_get(seq, seqrectx, seqrecty, cfra, SEQ_STRIPELEM_IBUF_COMP);
out = seq_stripelem_cache_get(
context, seq, cfra, SEQ_STRIPELEM_IBUF_COMP);
if (out) {
break;
}
if (seq->blend_mode == SEQ_BLEND_REPLACE) {
out = seq_render_strip(bmain, scene, seq, cfra, preview_render_size, seqrectx, seqrecty);
out = seq_render_strip(context, seq, cfra);
break;
}
@ -2108,16 +2197,16 @@ static ImBuf* seq_render_strip_stack(
switch (early_out) {
case EARLY_NO_INPUT:
case EARLY_USE_INPUT_2:
out = seq_render_strip(bmain, scene, seq, cfra, preview_render_size, seqrectx, seqrecty);
out = seq_render_strip(context, seq, cfra);
break;
case EARLY_USE_INPUT_1:
if (i == 0) {
out = IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rect);
out = IMB_allocImBuf((short)context.rectx, (short)context.recty, 32, IB_rect);
}
break;
case EARLY_DO_EFFECT:
if (i == 0) {
out = seq_render_strip(bmain, scene, seq, cfra, preview_render_size, seqrectx, seqrecty);
out = seq_render_strip(context, seq, cfra);
}
break;
@ -2127,7 +2216,8 @@ static ImBuf* seq_render_strip_stack(
}
}
seq_stripelem_cache_put(seq_arr[i], seqrectx, seqrecty, cfra, SEQ_STRIPELEM_IBUF_COMP, out);
seq_stripelem_cache_put(context, seq_arr[i], cfra,
SEQ_STRIPELEM_IBUF_COMP, out);
i++;
@ -2138,29 +2228,27 @@ static ImBuf* seq_render_strip_stack(
if (seq_get_early_out_for_blend_mode(seq) == EARLY_DO_EFFECT) {
struct SeqEffectHandle sh = get_sequence_blend(seq);
ImBuf * ibuf1 = out;
ImBuf * ibuf2 = seq_render_strip(bmain, scene, seq, cfra, preview_render_size,
seqrectx, seqrecty);
ImBuf * ibuf2 = seq_render_strip(context, seq, cfra);
float facf = seq->blend_opacity / 100.0;
int swap_input = seq_must_swap_input_in_blend_mode(seq);
int x= seqrectx;
int y= seqrecty;
if (swap_input) {
out = sh.execute(bmain, scene, seq, cfra, facf, facf, x, y,
preview_render_size, ibuf2, ibuf1, 0);
out = sh.execute(context, seq, cfra,
facf, facf,
ibuf2, ibuf1, 0);
} else {
out = sh.execute(bmain, scene, seq, cfra, facf, facf, x, y,
preview_render_size, ibuf1, ibuf2, 0);
out = sh.execute(context, seq, cfra,
facf, facf,
ibuf1, ibuf2, 0);
}
IMB_freeImBuf(ibuf1);
IMB_freeImBuf(ibuf2);
}
seq_stripelem_cache_put(seq_arr[i], seqrectx, seqrecty, cfra,
SEQ_STRIPELEM_IBUF_COMP, out);
seq_stripelem_cache_put(context, seq_arr[i], cfra,
SEQ_STRIPELEM_IBUF_COMP, out);
}
return out;
@ -2171,9 +2259,9 @@ static ImBuf* seq_render_strip_stack(
* you have to free after usage!
*/
ImBuf *give_ibuf_seq(Main *bmain, Scene *scene, int rectx, int recty, int cfra, int chanshown, int preview_render_size)
ImBuf *give_ibuf_seq(SeqRenderData context, float cfra, int chanshown)
{
Editing *ed= seq_give_editing(scene, FALSE);
Editing *ed= seq_give_editing(context.scene, FALSE);
int count;
ListBase *seqbasep;
@ -2187,19 +2275,18 @@ ImBuf *give_ibuf_seq(Main *bmain, Scene *scene, int rectx, int recty, int cfra,
seqbasep= ed->seqbasep;
}
return seq_render_strip_stack(bmain, scene, seqbasep, cfra, chanshown,
preview_render_size, rectx, recty);
return seq_render_strip_stack(context, seqbasep, cfra, chanshown);
}
ImBuf *give_ibuf_seqbase(Main *bmain, Scene *scene, int rectx, int recty, int cfra, int chanshown, int preview_render_size, ListBase *seqbasep)
ImBuf *give_ibuf_seqbase(SeqRenderData context, float cfra, int chanshown, ListBase *seqbasep)
{
return seq_render_strip_stack(bmain, scene, seqbasep, cfra, chanshown, preview_render_size, rectx, recty);
return seq_render_strip_stack(context, seqbasep, cfra, chanshown);
}
ImBuf *give_ibuf_seq_direct(Main *bmain, Scene *scene, int rectx, int recty, int cfra, int preview_render_size, Sequence *seq)
ImBuf *give_ibuf_seq_direct(SeqRenderData context, float cfra, Sequence *seq)
{
return seq_render_strip(bmain, scene, seq, cfra, preview_render_size, rectx, recty);
return seq_render_strip(context, seq, cfra);
}
#if 0
@ -2249,7 +2336,7 @@ typedef struct PrefetchQueueElem {
int rectx;
int recty;
int cfra;
float cfra;
int chanshown;
int preview_render_size;
@ -2409,7 +2496,7 @@ static void seq_stop_threads()
}
#endif
void give_ibuf_prefetch_request(int rectx, int recty, int cfra, int chanshown, int preview_render_size)
void give_ibuf_prefetch_request(SeqRenderData context, float cfra, int chanshown)
{
PrefetchQueueElem *e;
if (seq_thread_shutdown) {
@ -2417,11 +2504,11 @@ void give_ibuf_prefetch_request(int rectx, int recty, int cfra, int chanshown, i
}
e = MEM_callocN(sizeof(PrefetchQueueElem), "prefetch_queue_elem");
e->rectx = rectx;
e->recty = recty;
e->rectx = context.rectx;
e->recty = context.recty;
e->cfra = cfra;
e->chanshown = chanshown;
e->preview_render_size = preview_render_size;
e->preview_render_size = context.preview_render_size;
e->monoton_cfra = monoton_cfra++;
pthread_mutex_lock(&queue_lock);
@ -2464,13 +2551,13 @@ static void seq_wait_for_prefetch_ready()
}
#endif
ImBuf *give_ibuf_seq_threaded(Main *bmain, Scene *scene, int rectx, int recty, int cfra, int chanshown, int preview_render_size)
ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown)
{
PrefetchQueueElem *e = NULL;
int found_something = FALSE;
if (seq_thread_shutdown) {
return give_ibuf_seq(bmain, scene, rectx, recty, cfra, chanshown, preview_render_size);
return give_ibuf_seq(context, cfra, chanshown);
}
while (!e) {
@ -2480,9 +2567,9 @@ ImBuf *give_ibuf_seq_threaded(Main *bmain, Scene *scene, int rectx, int recty, i
for (e = prefetch_done.first; e; e = e->next) {
if (cfra == e->cfra &&
chanshown == e->chanshown &&
rectx == e->rectx &&
recty == e->recty &&
preview_render_size == e->preview_render_size) {
context.rectx == e->rectx &&
context.recty == e->recty &&
context.preview_render_size == e->preview_render_size) {
success = TRUE;
found_something = TRUE;
break;
@ -2493,9 +2580,9 @@ ImBuf *give_ibuf_seq_threaded(Main *bmain, Scene *scene, int rectx, int recty, i
for (e = prefetch_wait.first; e; e = e->next) {
if (cfra == e->cfra &&
chanshown == e->chanshown &&
rectx == e->rectx &&
recty == e->recty &&
preview_render_size == e->preview_render_size) {
context.rectx == e->rectx &&
context.recty == e->recty &&
context.preview_render_size == e->preview_render_size) {
found_something = TRUE;
break;
}
@ -2510,9 +2597,9 @@ ImBuf *give_ibuf_seq_threaded(Main *bmain, Scene *scene, int rectx, int recty, i
if (tslot->current &&
cfra == tslot->current->cfra &&
chanshown == tslot->current->chanshown &&
rectx == tslot->current->rectx &&
recty == tslot->current->recty &&
preview_render_size== tslot->current->preview_render_size){
context.rectx == tslot->current->rectx &&
context.recty == tslot->current->recty &&
context.preview_render_size== tslot->current->preview_render_size){
found_something = TRUE;
break;
}

@ -693,6 +693,7 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
float proxy_size = 100.0;
GLuint texid;
GLuint last_texid;
SeqRenderData context;
render_size = sseq->render_size;
if (render_size == 0) {
@ -732,12 +733,14 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
if(G.rendering)
return;
context = seq_new_render_data(bmain, scene, rectx, recty, proxy_size);
if (special_seq_update)
ibuf= give_ibuf_seq_direct(bmain, scene, rectx, recty, cfra + frame_ofs, proxy_size, special_seq_update);
ibuf= give_ibuf_seq_direct(context, cfra + frame_ofs, special_seq_update);
else if (!U.prefetchframes) // XXX || (G.f & G_PLAYANIM) == 0) {
ibuf= (ImBuf *)give_ibuf_seq(bmain, scene, rectx, recty, cfra + frame_ofs, sseq->chanshown, proxy_size);
ibuf= (ImBuf *)give_ibuf_seq(context, cfra + frame_ofs, sseq->chanshown);
else
ibuf= (ImBuf *)give_ibuf_seq_threaded(bmain, scene, rectx, recty, cfra + frame_ofs, sseq->chanshown, proxy_size);
ibuf= (ImBuf *)give_ibuf_seq_threaded(context, cfra + frame_ofs, sseq->chanshown);
if(ibuf==NULL)
return;
@ -870,6 +873,7 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
UI_view2d_view_restore(C);
}
#if 0
void drawprefetchseqspace(Scene *scene, ARegion *UNUSED(ar), SpaceSeq *sseq)
{
int rectx, recty;
@ -893,6 +897,7 @@ void drawprefetchseqspace(Scene *scene, ARegion *UNUSED(ar), SpaceSeq *sseq)
proxy_size);
}
}
#endif
/* draw backdrop of the sequencer strips view */
static void draw_seq_backdrop(View2D *v2d)

@ -180,6 +180,19 @@ static int rna_Sequence_frame_length_get(PointerRNA *ptr)
return seq_tx_get_final_right(seq, 0)-seq_tx_get_final_left(seq, 0);
}
static int rna_Sequence_orx_get(PointerRNA *ptr)
{
Sequence *seq= (Sequence*)ptr->data;
return seq->strip->orx;
}
static int rna_Sequence_ory_get(PointerRNA *ptr)
{
Sequence *seq= (Sequence*)ptr->data;
return seq->strip->ory;
}
static void rna_Sequence_channel_set(PointerRNA *ptr, int value)
{
Sequence *seq= (Sequence*)ptr->data;
@ -1187,6 +1200,16 @@ static void rna_def_input(StructRNA *srna)
RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_anim_endofs_final_set", NULL); // overlap tests
RNA_def_property_ui_text(prop, "Animation End Offset", "Animation end offset (trim end)");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
prop= RNA_def_property(srna, "orig_width", PROP_INT, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Orig Width", "Original image width");
RNA_def_property_int_funcs(prop, "rna_Sequence_orx_get", NULL,NULL);
prop= RNA_def_property(srna, "orig_height", PROP_INT, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Orig Height", "Original image height");
RNA_def_property_int_funcs(prop, "rna_Sequence_ory_get", NULL,NULL);
}
static void rna_def_image(BlenderRNA *brna)

@ -2472,6 +2472,7 @@ static void do_render_seq(Render * re)
struct ImBuf *ibuf;
RenderResult *rr; /* don't assign re->result here as it might change during give_ibuf_seq */
int cfra = re->r.cfra;
SeqRenderData context;
re->i.cfra= cfra;
@ -2482,7 +2483,11 @@ static void do_render_seq(Render * re)
recurs_depth++;
ibuf= give_ibuf_seq(re->main, re->scene, re->result->rectx, re->result->recty, cfra, 0, 100.0);
context = seq_new_render_data(re->main, re->scene,
re->result->rectx, re->result->recty,
100);
ibuf = give_ibuf_seq(context, cfra, 0);
recurs_depth--;