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:
authorPeter Schlaile <peter@schlaile.de>2010-11-21 23:00:31 +0300
committerPeter Schlaile <peter@schlaile.de>2010-11-21 23:00:31 +0300
commita0517e63381822651d6dc1582bdddebb141ef936 (patch)
treee02dc79865ffc5f5a7d69f0bb9bd255e76f9a7c4 /source/blender/blenkernel/intern/seqeffects.c
parenta2dc1fe4b0d011dba00ae685a59985a69d50d736 (diff)
== 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)
Diffstat (limited to 'source/blender/blenkernel/intern/seqeffects.c')
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c220
1 files changed, 111 insertions, 109 deletions
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index f5dc04ca569..2efef52ed3e 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -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(