diff options
Diffstat (limited to 'source/blender/blenkernel/intern/seqeffects.c')
-rw-r--r-- | source/blender/blenkernel/intern/seqeffects.c | 372 |
1 files changed, 177 insertions, 195 deletions
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 461cb075bb0..11075fe402e 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -35,6 +35,7 @@ #include "PIL_dynlib.h" #include "BLI_math.h" /* windows needs for M_PI */ +#include "BLI_utildefines.h" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" @@ -53,7 +54,7 @@ #include "RNA_access.h" /* **** XXX **** */ -static void error(const char *error, ...) {} +static void error(const char *UNUSED(error), ...) {} #define INT 96 #define FLO 128 @@ -69,23 +70,25 @@ 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 ? */ - out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect, 0); + out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect); } else if ((ibuf1 && ibuf1->rect_float) || (ibuf2 && ibuf2->rect_float) || (ibuf3 && ibuf3->rect_float)) { /* if any inputs are rectfloat, output is float too */ - out = IMB_allocImBuf((short)x, (short)y, 32, IB_rectfloat, 0); + out = IMB_allocImBuf((short)x, (short)y, 32, IB_rectfloat); } else { - out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect, 0); + out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect); } if (ibuf1 && !ibuf1->rect_float && out->rect_float) { @@ -117,8 +120,8 @@ static struct ImBuf * prepare_effect_imbufs( static void open_plugin_seq(PluginSeq *pis, const char *seqname) { - int (*version)(); - void* (*alloc_private)(); + int (*version)(void); + void* (*alloc_private)(void); char *cp; /* to be sure: (is tested for) */ @@ -141,7 +144,7 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname) if (pis->handle != 0) { /* find the address of the version function */ - version= (int (*)())PIL_dynlib_find_symbol(pis->handle, "plugin_seq_getversion"); + version= (int (*)(void))PIL_dynlib_find_symbol(pis->handle, "plugin_seq_getversion"); if (test_dlerr(pis->name, "plugin_seq_getversion")) return; if (version != 0) { @@ -175,7 +178,7 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname) return; } } - alloc_private = (void* (*)())PIL_dynlib_find_symbol( + alloc_private = (void* (*)(void))PIL_dynlib_find_symbol( pis->handle, "plugin_seq_alloc_private_data"); if (alloc_private) { pis->instance_private_data = alloc_private(); @@ -244,7 +247,7 @@ static void init_plugin(Sequence * seq, const char * fname) /* * FIXME: should query plugin! Could be generator, that needs zero inputs... */ -static int num_inputs_plugin() +static int num_inputs_plugin(void) { return 1; } @@ -273,9 +276,8 @@ static ImBuf * IMB_cast_away_list(ImBuf * i) } static struct ImBuf * do_plugin_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, - float facf0, float facf1, int x, int y, - int preview_render_size, + SeqRenderData context, Sequence *seq, float cfra, + float facf0, float facf1, struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -285,7 +287,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) { @@ -370,8 +374,8 @@ static struct ImBuf * do_plugin_effect( return out; } -static int do_plugin_early_out(struct Sequence *seq, - float facf0, float facf1) +static int do_plugin_early_out(struct Sequence *UNUSED(seq), + float UNUSED(facf0), float UNUSED(facf1)) { return 0; } @@ -524,22 +528,21 @@ static void do_alphaover_effect_float(float facf0, float facf1, int x, int y, } static struct ImBuf * do_alphaover_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, - float facf0, float facf1, int x, int y, - int 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 +699,22 @@ static void do_alphaunder_effect_float(float facf0, float facf1, int x, int y, } static struct ImBuf* do_alphaunder_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, - float facf0, float facf1, int x, int y, - int 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 +824,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 *bmain, Scene *scene, Sequence *seq, float cfra, - float facf0, float facf1, int x, int y, - int 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); } @@ -967,7 +970,7 @@ static void gamtabs(float gamma) } -static void build_gammatabs() +static void build_gammatabs(void) { if (gamma_tabs_init == FALSE) { gamtabs(2.0f); @@ -976,19 +979,19 @@ static void build_gammatabs() } } -static void init_gammacross(Sequence * seq) +static void init_gammacross(Sequence * UNUSED(seq)) { } -static void load_gammacross(Sequence * seq) +static void load_gammacross(Sequence * UNUSED(seq)) { } -static void free_gammacross(Sequence * seq) +static void free_gammacross(Sequence * UNUSED(seq)) { } -static void do_gammacross_effect_byte(float facf0, float facf1, +static void do_gammacross_effect_byte(float facf0, float UNUSED(facf1), int x, int y, unsigned char *rect1, unsigned char *rect2, @@ -1044,7 +1047,7 @@ static void do_gammacross_effect_byte(float facf0, float facf1, } -static void do_gammacross_effect_float(float facf0, float facf1, +static void do_gammacross_effect_float(float facf0, float UNUSED(facf1), int x, int y, float *rect1, float *rect2, float *out) @@ -1088,24 +1091,24 @@ static void do_gammacross_effect_float(float facf0, float facf1, } static struct ImBuf * do_gammacross_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, - float facf0, float facf1, int x, int y, - int 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 +1209,22 @@ static void do_add_effect_float(float facf0, float facf1, int x, int y, } } -static struct ImBuf * do_add_effect(Main *bmain, Scene *scene, Sequence *seq, float cfra, - float facf0, float facf1, int x, int y, - int 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 +1326,21 @@ static void do_sub_effect_float(float facf0, float facf1, int x, int y, } static struct ImBuf * do_sub_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, - float facf0, float facf1, int x, int y, - int 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 +1539,21 @@ static void do_mul_effect_float(float facf0, float facf1, int x, int y, } static struct ImBuf * do_mul_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, - float facf0, float facf1, int x, int y, - int 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); } @@ -1591,15 +1592,10 @@ static void precalc_wipe_zone(WipeZone *wipezone, WipeVars *wipe, int xo, int yo // This function calculates the blur band for the wipe effects static float in_band(WipeZone *wipezone,float width,float dist,float perc,int side,int dir) { - float t1,t2,alpha,percwidth; + float t1,t2,alpha; if(width == 0) return (float)side; - - if(side == 1) - percwidth = width * perc; - else - percwidth = width * (1 - perc); if(width < dist) return side; @@ -1860,7 +1856,7 @@ static void init_wipe_effect(Sequence *seq) seq->effectdata = MEM_callocN(sizeof(struct WipeVars), "wipevars"); } -static int num_inputs_wipe() +static int num_inputs_wipe(void) { return 1; } @@ -1876,7 +1872,7 @@ static void copy_wipe_effect(Sequence *dst, Sequence *src) dst->effectdata = MEM_dupallocN(src->effectdata); } -static void do_wipe_effect_byte(Sequence *seq, float facf0, float facf1, +static void do_wipe_effect_byte(Sequence *seq, float facf0, float UNUSED(facf1), int x, int y, unsigned char *rect1, unsigned char *rect2, unsigned char *out) @@ -1934,7 +1930,7 @@ static void do_wipe_effect_byte(Sequence *seq, float facf0, float facf1, } } -static void do_wipe_effect_float(Sequence *seq, float facf0, float facf1, +static void do_wipe_effect_float(Sequence *seq, float facf0, float UNUSED(facf1), int x, int y, float *rect1, float *rect2, float *out) @@ -1993,24 +1989,23 @@ static void do_wipe_effect_float(Sequence *seq, float facf0, float facf1, } static struct ImBuf * do_wipe_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, - float facf0, float facf1, int x, int y, - int 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; @@ -2045,7 +2040,7 @@ static void init_transform_effect(Sequence *seq) transform->uniform_scale=0; } -static int num_inputs_transform() +static int num_inputs_transform(void) { return 1; } @@ -2062,8 +2057,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; @@ -2111,7 +2106,7 @@ static void transform_image(int x, int y, struct ImBuf *ibuf1, struct ImBuf *out } } -static void do_transform(Scene *scene, Sequence *seq, float facf0, int x, int y, +static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x, int y, struct ImBuf *ibuf1,struct ImBuf *out) { TransformVars *transform = (TransformVars *)seq->effectdata; @@ -2144,15 +2139,15 @@ static void do_transform(Scene *scene, Sequence *seq, float facf0, int x, int y, static struct ImBuf * do_transform_effect( - Main *bmain, Scene *scene, Sequence *seq,float cfra, - float facf0, float facf1, int x, int y, - int 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; } @@ -2614,7 +2609,7 @@ static void init_glow_effect(Sequence *seq) glow->bNoComp = 0; } -static int num_inputs_glow() +static int num_inputs_glow(void) { return 1; } @@ -2631,55 +2626,56 @@ static void copy_glow_effect(Sequence *dst, Sequence *src) } //void do_glow_effect(Cast *cast, float facf0, float facf1, int xo, int yo, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *outbuf, ImBuf *use) -static void do_glow_effect_byte(Sequence *seq, float facf0, float facf1, +static void do_glow_effect_byte(Sequence *seq, int render_size, float facf0, float UNUSED(facf1), int x, int y, char *rect1, - char *rect2, char *out) + char *UNUSED(rect2), char *out) { unsigned char *outbuf=(unsigned char *)out; unsigned char *inbuf=(unsigned char *)rect1; GlowVars *glow = (GlowVars *)seq->effectdata; - int size= 100; // renderdata XXX RVIsolateHighlights_byte(inbuf, outbuf , x, y, glow->fMini*765, glow->fBoost * facf0, glow->fClamp); - RVBlurBitmap2_byte (outbuf, x, y, glow->dDist * (size / 100.0f),glow->dQuality); + RVBlurBitmap2_byte (outbuf, x, y, glow->dDist * (render_size / 100.0f),glow->dQuality); if (!glow->bNoComp) RVAddBitmaps_byte (inbuf , outbuf, outbuf, x, y); } -static void do_glow_effect_float(Sequence *seq, float facf0, float facf1, +static void do_glow_effect_float(Sequence *seq, int render_size, float facf0, float UNUSED(facf1), int x, int y, - float *rect1, float *rect2, float *out) + float *rect1, float *UNUSED(rect2), float *out) { float *outbuf = out; float *inbuf = rect1; GlowVars *glow = (GlowVars *)seq->effectdata; - int size= 100; // renderdata XXX RVIsolateHighlights_float(inbuf, outbuf , x, y, glow->fMini*3.0f, glow->fBoost * facf0, glow->fClamp); - RVBlurBitmap2_float (outbuf, x, y, glow->dDist * (size / 100.0f),glow->dQuality); + RVBlurBitmap2_float (outbuf, x, y, glow->dDist * (render_size / 100.0f),glow->dQuality); if (!glow->bNoComp) RVAddBitmaps_float (inbuf , outbuf, outbuf, x, y); } static struct ImBuf * do_glow_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, - float facf0, float facf1, int x, int y, - int 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*context.rectx/context.scene->r.xsch; if (out->rect_float) { - do_glow_effect_float(seq, - facf0, facf1, x, y, - ibuf1->rect_float, ibuf2->rect_float, - out->rect_float); + do_glow_effect_float(seq, render_size, + facf0, facf1, + context.rectx, context.recty, + ibuf1->rect_float, ibuf2->rect_float, + out->rect_float); } else { - do_glow_effect_byte(seq, - facf0, facf1, x, y, - (char*) ibuf1->rect, (char*) ibuf2->rect, - (char*) out->rect); + do_glow_effect_byte(seq, render_size, + facf0, facf1, + context.rectx, context.recty, + (char*) ibuf1->rect, (char*) ibuf2->rect, + (char*) out->rect); } return out; @@ -2700,7 +2696,7 @@ static void init_solid_color(Sequence *seq) cv->col[0] = cv->col[1] = cv->col[2] = 0.5; } -static int num_inputs_color() +static int num_inputs_color(void) { return 0; } @@ -2716,25 +2712,26 @@ static void copy_solid_color(Sequence *dst, Sequence *src) dst->effectdata = MEM_dupallocN(src->effectdata); } -static int early_out_color(struct Sequence *seq, - float facf0, float facf1) +static int early_out_color(struct Sequence *UNUSED(seq), + float UNUSED(facf0), float UNUSED(facf1)) { return -1; } static struct ImBuf * do_solid_color( - Main *bmain, Scene *scene, Sequence *seq, float cfra, - float facf0, float facf1, int x, int y, - int 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;*/ /*UNUSED*/ + int y; /*= context.recty;*/ /*UNUSED*/ if (out->rect) { unsigned char col0[3]; @@ -2808,22 +2805,21 @@ static struct ImBuf * do_solid_color( ********************************************************************** */ /* no effect inputs for multicam, we use give_ibuf_seq */ -static int num_inputs_multicam() +static int num_inputs_multicam(void) { return 0; } -static int early_out_multicam(struct Sequence *seq, float facf0, float facf1) +static int early_out_multicam(struct Sequence *UNUSED(seq), float UNUSED(facf0), float UNUSED(facf1)) { return -1; } static struct ImBuf * do_multicam( - Main *bmain, Scene *scene, 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) + SeqRenderData context, Sequence *seq, float cfra, + float UNUSED(facf0), float UNUSED(facf1), + struct ImBuf *UNUSED(ibuf1), struct ImBuf *UNUSED(ibuf2), + struct ImBuf *UNUSED(ibuf3)) { struct ImBuf * i; struct ImBuf * out; @@ -2834,7 +2830,7 @@ static struct ImBuf * do_multicam( return 0; } - ed = scene->ed; + ed = context.scene->ed; if (!ed) { return 0; } @@ -2843,13 +2839,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 { @@ -2873,7 +2868,7 @@ static void init_speed_effect(Sequence *seq) v = (SpeedControlVars *)seq->effectdata; v->globalSpeed = 1.0; v->frameMap = 0; - v->flags = 0; + v->flags |= SEQ_SPEED_INTEGRATE; /* should be default behavior */ v->length = 0; } @@ -2885,7 +2880,7 @@ static void load_speed_effect(Sequence * seq) v->length = 0; } -static int num_inputs_speed() +static int num_inputs_speed(void) { return 1; } @@ -2907,14 +2902,14 @@ static void copy_speed_effect(Sequence *dst, Sequence *src) v->length = 0; } -static int early_out_speed(struct Sequence *seq, - float facf0, float facf1) +static int early_out_speed(struct Sequence *UNUSED(seq), + float UNUSED(facf0), float UNUSED(facf1)) { return 1; } static void store_icu_yrange_speed(struct Sequence * seq, - short adrcode, float * ymin, float * ymax) + short UNUSED(adrcode), float * ymin, float * ymax) { SpeedControlVars * v = (SpeedControlVars *)seq->effectdata; @@ -2936,11 +2931,11 @@ static void store_icu_yrange_speed(struct Sequence * seq, } void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force) { - float ctime, div; int cfra; - float fallback_fac; + 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); @@ -2955,7 +2950,7 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force) /* XXX - new in 2.5x. should we use the animation system this way? * The fcurve is needed because many frames need evaluating at once - campbell */ - fcu= id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "speed_fader", 0); + fcu= id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "speed_factor", 0); if (!v->frameMap || v->length != seq->len) { @@ -2968,15 +2963,23 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force) } fallback_fac = 1.0; - - /* if there is no fcurve, try to make retiming easy by stretching the - strip */ - if (!fcu && seq->seq1->enddisp != seq->seq1->start && seq->seq1->len != 0) { - fallback_fac = (float) seq->seq1->len / - (float) (seq->seq1->enddisp - seq->seq1->start); + + 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 ((v->flags & SEQ_SPEED_INTEGRATE) != 0) { + if (flags & SEQ_SPEED_INTEGRATE) { float cursor = 0; float facf; @@ -2985,10 +2988,7 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force) for (cfra = 1; cfra < v->length; cfra++) { if(fcu) { - ctime = seq->startdisp + cfra; - div = 1.0; - - facf = evaluate_fcurve(fcu, ctime/div); + facf = evaluate_fcurve(fcu, seq->startdisp + cfra); } else { facf = fallback_fac; } @@ -3010,19 +3010,16 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force) for (cfra = 0; cfra < v->length; cfra++) { if(fcu) { - ctime = seq->startdisp + cfra; - div = 1.0; - - facf = evaluate_fcurve(fcu, ctime / div); - if (v->flags & SEQ_SPEED_COMPRESS_IPO_Y) { - facf *= v->length; - } + facf = evaluate_fcurve(fcu, seq->startdisp + cfra); + } else { + facf = fallback_fac; } - - if (!fcu) { - facf = (float) cfra * fallback_fac; + + if (flags & SEQ_SPEED_COMPRESS_IPO_Y) { + facf *= seq->seq1->len; } facf *= v->globalSpeed; + if (facf >= seq->seq1->len) { facf = seq->seq1->len - 1; } else { @@ -3033,56 +3030,43 @@ 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 ********************************************************************** */ -static void init_noop(struct Sequence *seq) +static void init_noop(struct Sequence *UNUSED(seq)) { } -static void load_noop(struct Sequence *seq) +static void load_noop(struct Sequence *UNUSED(seq)) { } -static void init_plugin_noop(struct Sequence *seq, const char * fname) +static void init_plugin_noop(struct Sequence *UNUSED(seq), const char *UNUSED(fname)) { } -static void free_noop(struct Sequence *seq) +static void free_noop(struct Sequence *UNUSED(seq)) { } -static int num_inputs_default() +static int num_inputs_default(void) { return 2; } -static int early_out_noop(struct Sequence *seq, - float facf0, float facf1) +static int early_out_noop(struct Sequence *UNUSED(seq), + float UNUSED(facf0), float UNUSED(facf1)) { return 0; } -static int early_out_fade(struct Sequence *seq, +static int early_out_fade(struct Sequence *UNUSED(seq), float facf0, float facf1) { if (facf0 == 0.0 && facf1 == 0.0) { @@ -3093,7 +3077,7 @@ static int early_out_fade(struct Sequence *seq, return 0; } -static int early_out_mul_input2(struct Sequence *seq, +static int early_out_mul_input2(struct Sequence *UNUSED(seq), float facf0, float facf1) { if (facf0 == 0.0 && facf1 == 0.0) { @@ -3102,13 +3086,13 @@ static int early_out_mul_input2(struct Sequence *seq, return 0; } -static void store_icu_yrange_noop(struct Sequence * seq, - short adrcode, float * ymin, float * ymax) +static void store_icu_yrange_noop(struct Sequence * UNUSED(seq), + short UNUSED(adrcode), float *UNUSED(ymin), float *UNUSED(ymax)) { /* defaults are fine */ } -static void get_default_fac_noop(struct Sequence *seq, float cfra, +static void get_default_fac_noop(struct Sequence *UNUSED(seq), float UNUSED(cfra), float * facf0, float * facf1) { *facf0 = *facf1 = 1.0; @@ -3123,15 +3107,17 @@ static void get_default_fac_fade(struct Sequence *seq, float cfra, *facf1 /= seq->len; } -static struct ImBuf * do_overdrop_effect(Main *bmain, Scene *scene, Sequence *seq, float cfra, +static struct ImBuf * do_overdrop_effect(SeqRenderData context, + Sequence *UNUSED(seq), + float UNUSED(cfra), float facf0, float facf1, - int x, int y, - int 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( @@ -3274,9 +3260,7 @@ static struct SeqEffectHandle get_sequence_effect_impl(int seq_type) struct SeqEffectHandle get_sequence_effect(Sequence * seq) { - struct SeqEffectHandle rval; - - memset(&rval, 0, sizeof(struct SeqEffectHandle)); + struct SeqEffectHandle rval= {0}; if (seq->type & SEQ_EFFECT) { rval = get_sequence_effect_impl(seq->type); @@ -3291,9 +3275,7 @@ struct SeqEffectHandle get_sequence_effect(Sequence * seq) struct SeqEffectHandle get_sequence_blend(Sequence * seq) { - struct SeqEffectHandle rval; - - memset(&rval, 0, sizeof(struct SeqEffectHandle)); + struct SeqEffectHandle rval= {0}; if (seq->blend_mode != 0) { rval = get_sequence_effect_impl(seq->blend_mode); |