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>2011-05-16 21:14:47 +0400
committerPeter Schlaile <peter@schlaile.de>2011-05-16 21:14:47 +0400
commit70b832589a2bb90fbed2106f30d34d77f49d2010 (patch)
tree847e9fb95d4a8c153963de73c34ef3889a5ac014 /source/blender/blenkernel
parentb434e7f93337f65909c003ce865cc34f167c3973 (diff)
[PATCH] == Sequencer ==
This patch adds adjustment layer tracks to the sequencer and does some cleaning up of the code. What's an adjustment layer? Think of it as an effect track, which takes no explicit input, but alters the output of everything down the layer stack. So: you can add several stages of color correction with it. And: you can even use it with metastrips to group several adjustments together.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h4
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c82
-rw-r--r--source/blender/blenkernel/intern/sequencer.c102
3 files changed, 128 insertions, 60 deletions
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index 57829e957f7..94c474c668f 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -268,6 +268,10 @@ void seq_translate(struct Scene *scene, struct Sequence *seq, int delta);
void seq_sound_init(struct Scene *scene, struct Sequence *seq);
struct Sequence *seq_foreground_frame_get(struct Scene *scene, int frame);
struct ListBase *seq_seqbase(struct ListBase *seqbase, struct Sequence *seq);
+struct Sequence *seq_metastrip(
+ ListBase * seqbase /* = ed->seqbase */,
+ struct Sequence * meta /* = NULL */, struct Sequence *seq);
+
void seq_offset_animdata(struct Scene *scene, struct Sequence *seq, int ofs);
void seq_dupe_animdata(struct Scene *scene, char *name_from, char *name_to);
int shuffle_seq(struct ListBase * seqbasep, struct Sequence *test, struct Scene *evil_scene);
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 6f49155c0fd..d2f05a8ca53 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -2859,6 +2859,83 @@ static struct ImBuf * do_multicam(
}
/* **********************************************************************
+ ADJUSTMENT
+ ********************************************************************** */
+
+/* no effect inputs for adjustment, we use give_ibuf_seq */
+static int num_inputs_adjustment(void)
+{
+ return 0;
+}
+
+static int early_out_adjustment(struct Sequence *UNUSED(seq), float UNUSED(facf0), float UNUSED(facf1))
+{
+ return -1;
+}
+
+static struct ImBuf * do_adjustment_impl(SeqRenderData context, Sequence * seq,
+ float cfra)
+{
+ Editing * ed;
+ ListBase * seqbasep;
+ struct ImBuf * i = 0;
+
+ ed = context.scene->ed;
+
+ seqbasep = seq_seqbase(&ed->seqbase, seq);
+
+ if (seq->machine > 0) {
+ i = give_ibuf_seqbase(context, cfra,
+ seq->machine - 1, seqbasep);
+ }
+
+ /* found nothing? so let's work the way up the metastrip stack, so
+ that it is possible to group a bunch of adjustment strips into
+ a metastrip and have that work on everything below the metastrip
+ */
+
+ if (!i) {
+ Sequence * meta;
+
+ meta = seq_metastrip(&ed->seqbase, NULL, seq);
+
+ if (meta) {
+ i = do_adjustment_impl(context, meta, cfra);
+ }
+ }
+
+ return i;
+}
+
+static struct ImBuf * do_adjustment(
+ 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 = 0;
+ struct ImBuf * out;
+ Editing * ed;
+
+ ed = context.scene->ed;
+
+ if (!ed) {
+ return NULL;
+ }
+
+ i = do_adjustment_impl(context, seq, cfra);
+
+ if (input_have_to_preprocess(context, seq, cfra)) {
+ out = IMB_dupImBuf(i);
+ IMB_freeImBuf(i);
+ } else {
+ out = i;
+ }
+
+ return out;
+}
+
+/* **********************************************************************
SPEED
********************************************************************** */
static void init_speed_effect(Sequence *seq)
@@ -3256,6 +3333,11 @@ static struct SeqEffectHandle get_sequence_effect_impl(int seq_type)
rval.early_out = early_out_multicam;
rval.execute = do_multicam;
break;
+ case SEQ_ADJUSTMENT:
+ rval.num_inputs = num_inputs_adjustment;
+ rval.early_out = early_out_adjustment;
+ rval.execute = do_adjustment;
+ break;
}
return rval;
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index e3639dd1c51..b0da40bf0c5 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -79,9 +79,15 @@
#define snprintf _snprintf
#endif
-/* **** XXX ******** */
-//static void waitcursor(int val) {}
-//static int blender_test_break() {return 0;}
+
+static ImBuf* seq_render_strip_stack(
+ SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown);
+
+static ImBuf * seq_render_strip(
+ SeqRenderData context, Sequence * seq, float cfra);
+
+static void seq_free_animdata(Scene *scene, Sequence *seq);
+
/* **** XXX ******** */
#define SELECT 1
@@ -177,8 +183,6 @@ void seq_free_strip(Strip *strip)
MEM_freeN(strip);
}
-static void seq_free_animdata(Scene *scene, Sequence *seq);
-
void seq_free_sequence(Scene *scene, Sequence *seq)
{
if(seq->strip) seq_free_strip(seq->strip);
@@ -191,6 +195,10 @@ void seq_free_sequence(Scene *scene, Sequence *seq)
sh.free(seq);
}
+ if(seq->sound) {
+ ((ID *)seq->sound)->us--;
+ }
+
/* clipboard has no scene and will never have a sound handle or be active */
if(scene) {
Editing *ed = scene->ed;
@@ -446,51 +454,6 @@ void seq_end(SeqIterator *iter)
* in metastrips!)
**********************************************************************
*/
-#if 0 /* UNUSED */
-static void do_seq_count(ListBase *seqbase, int *totseq)
-{
- Sequence *seq;
-
- seq= seqbase->first;
- while(seq) {
- (*totseq)++;
- if(seq->seqbase.first) do_seq_count(&seq->seqbase, totseq);
- seq= seq->next;
- }
-}
-
-static void do_build_seqar(ListBase *seqbase, Sequence ***seqar, int depth)
-{
- Sequence *seq;
-
- seq= seqbase->first;
- while(seq) {
- seq->depth= depth;
- if(seq->seqbase.first) do_build_seqar(&seq->seqbase, seqar, depth+1);
- **seqar= seq;
- (*seqar)++;
- seq= seq->next;
- }
-}
-
-static void build_seqar(ListBase *seqbase, Sequence ***seqar, int *totseq)
-{
- Sequence **tseqar;
-
- *totseq= 0;
- do_seq_count(seqbase, totseq);
-
- if(*totseq==0) {
- *seqar= NULL;
- return;
- }
- *seqar= MEM_mallocN(sizeof(void *)* *totseq, "seqar");
- tseqar= *seqar;
-
- do_build_seqar(seqbase, seqar, 0);
- *seqar= tseqar;
-}
-#endif /* UNUSED */
static void do_seq_count_cb(ListBase *seqbase, int *totseq,
int (*test_func)(Sequence * seq))
@@ -916,6 +879,7 @@ static const char *give_seqname_by_type(int type)
case SEQ_TRANSFORM: return "Transform";
case SEQ_COLOR: return "Color";
case SEQ_MULTICAM: return "Multicam";
+ case SEQ_ADJUSTMENT: return "Adjustment";
case SEQ_SPEED: return "Speed";
default:
return NULL;
@@ -1093,15 +1057,12 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se
}
if(evaluate_seq_frame_gen(seq_arr, seqbasep, cfra)) {
- if (b > 0) {
- if (seq_arr[b] == NULL) {
- return 0;
- }
- } else {
- for (b = MAXSEQ; b > 0; b--) {
- if (video_seq_is_rendered(seq_arr[b])) {
- break;
- }
+ if (b == 0) {
+ b = MAXSEQ;
+ }
+ for (; b > 0; b--) {
+ if (video_seq_is_rendered(seq_arr[b])) {
+ break;
}
}
}
@@ -2855,7 +2816,10 @@ void seq_tx_set_final_right(Sequence *seq, int val)
since they work a bit differently to normal image seq's (during transform) */
int seq_single_check(Sequence *seq)
{
- return (seq->len==1 && ELEM3(seq->type, SEQ_IMAGE, SEQ_COLOR, SEQ_MULTICAM));
+ return (seq->len==1 && (
+ seq->type == SEQ_IMAGE
+ || ((seq->type & SEQ_EFFECT) &&
+ get_sequence_effect_num_inputs(seq->type) == 0)));
}
/* check if the selected seq's reference unselected seq's */
@@ -3214,6 +3178,24 @@ ListBase *seq_seqbase(ListBase *seqbase, Sequence *seq)
return NULL;
}
+Sequence *seq_metastrip(ListBase * seqbase, Sequence * meta, Sequence *seq)
+{
+ Sequence * iseq;
+
+ for(iseq = seqbase->first; iseq; iseq = iseq->next) {
+ Sequence * rval;
+
+ if (seq == iseq) {
+ return meta;
+ } else if(iseq->seqbase.first &&
+ (rval = seq_metastrip(&iseq->seqbase, iseq, seq))) {
+ return rval;
+ }
+ }
+
+ return NULL;
+}
+
int seq_swap(Sequence *seq_a, Sequence *seq_b)
{
char name[sizeof(seq_a->name)];