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:
Diffstat (limited to 'source/blender/sequencer')
-rw-r--r--source/blender/sequencer/SEQ_sequencer.h1
-rw-r--r--source/blender/sequencer/intern/effects.c1
-rw-r--r--source/blender/sequencer/intern/modifier.c111
-rw-r--r--source/blender/sequencer/intern/sequencer.c14
-rw-r--r--source/blender/sequencer/intern/strip_relations.c2
-rw-r--r--source/blender/sequencer/intern/strip_transform.c2
6 files changed, 120 insertions, 11 deletions
diff --git a/source/blender/sequencer/SEQ_sequencer.h b/source/blender/sequencer/SEQ_sequencer.h
index 7e733817630..1b8982da0d2 100644
--- a/source/blender/sequencer/SEQ_sequencer.h
+++ b/source/blender/sequencer/SEQ_sequencer.h
@@ -89,6 +89,7 @@ void SEQ_sequence_base_dupli_recursive(const struct Scene *scene_src,
const struct ListBase *seqbase,
int dupe_flag,
const int flag);
+bool SEQ_valid_strip_channel(struct Sequence *seq);
/* Read and Write functions for .blend file data */
void SEQ_blend_write(struct BlendWriter *writer, struct ListBase *seqbase);
diff --git a/source/blender/sequencer/intern/effects.c b/source/blender/sequencer/intern/effects.c
index 4448db013fe..427a8835879 100644
--- a/source/blender/sequencer/intern/effects.c
+++ b/source/blender/sequencer/intern/effects.c
@@ -3154,6 +3154,7 @@ void seq_effect_speed_rebuild_map(Scene *scene, Sequence *seq)
float target_frame = 0;
for (int frame_index = 1; frame_index < effect_strip_length; frame_index++) {
target_frame += evaluate_fcurve(fcu, seq->startdisp + frame_index);
+ CLAMP(target_frame, 0, seq->seq1->len);
v->frameMap[frame_index] = target_frame;
}
}
diff --git a/source/blender/sequencer/intern/modifier.c b/source/blender/sequencer/intern/modifier.c
index 07d09f4ae17..1a63f4c4655 100644
--- a/source/blender/sequencer/intern/modifier.c
+++ b/source/blender/sequencer/intern/modifier.c
@@ -216,7 +216,7 @@ static void modifier_apply_threaded(ImBuf *ibuf,
/** \name Color Balance Modifier
* \{ */
-static StripColorBalance calc_cb(StripColorBalance *cb_)
+static StripColorBalance calc_cb_lgg(StripColorBalance *cb_)
{
StripColorBalance cb = *cb_;
int c;
@@ -262,8 +262,52 @@ static StripColorBalance calc_cb(StripColorBalance *cb_)
return cb;
}
+static StripColorBalance calc_cb_sop(StripColorBalance *cb_)
+{
+ StripColorBalance cb = *cb_;
+ int c;
+
+ for (c = 0; c < 3; c++) {
+ if (cb.flag & SEQ_COLOR_BALANCE_INVERSE_SLOPE) {
+ if (cb.slope[c] != 0.0f) {
+ cb.slope[c] = 1.0f / cb.slope[c];
+ }
+ else {
+ cb.slope[c] = 1000000;
+ }
+ }
+
+ if (cb.flag & SEQ_COLOR_BALANCE_INVERSE_OFFSET) {
+ cb.offset[c] = -1.0f * (cb.offset[c] - 1.0f);
+ }
+ else {
+ cb.offset[c] = cb.offset[c] - 1.0f;
+ }
+
+ if (!(cb.flag & SEQ_COLOR_BALANCE_INVERSE_POWER)) {
+ if (cb.power[c] != 0.0f) {
+ cb.power[c] = 1.0f / cb.power[c];
+ }
+ else {
+ cb.power[c] = 1000000;
+ }
+ }
+ }
+
+ return cb;
+}
+
+static StripColorBalance calc_cb(StripColorBalance *cb_)
+{
+ if (cb_->method == SEQ_COLOR_BALANCE_METHOD_LIFTGAMMAGAIN) {
+ return calc_cb_lgg(cb_);
+ }
+ /* `cb_->method == SEQ_COLOR_BALANCE_METHOD_SLOPEOFFSETPOWER`. */
+ return calc_cb_sop(cb_);
+}
+
/* NOTE: lift is actually 2-lift. */
-MINLINE float color_balance_fl(
+MINLINE float color_balance_fl_lgg(
float in, const float lift, const float gain, const float gamma, const float mul)
{
float x = (((in - 1.0f) * lift) + 1.0f) * gain;
@@ -278,12 +322,40 @@ MINLINE float color_balance_fl(
return x;
}
-static void make_cb_table_float(float lift, float gain, float gamma, float *table, float mul)
+MINLINE float color_balance_fl_sop(float in,
+ const float slope,
+ const float offset,
+ const float power,
+ const float pivot,
+ float mul)
{
- int y;
+ float x = in * slope + offset;
+
+ /* prevent NaN */
+ if (x < 0.0f) {
+ x = 0.0f;
+ }
- for (y = 0; y < 256; y++) {
- float v = color_balance_fl((float)y * (1.0f / 255.0f), lift, gain, gamma, mul);
+ x = powf(x / pivot, power) * pivot;
+ x *= mul;
+ CLAMP(x, FLT_MIN, FLT_MAX);
+ return x;
+}
+
+static void make_cb_table_float_lgg(float lift, float gain, float gamma, float *table, float mul)
+{
+ for (int y = 0; y < 256; y++) {
+ float v = color_balance_fl_lgg((float)y * (1.0f / 255.0f), lift, gain, gamma, mul);
+
+ table[y] = v;
+ }
+}
+
+static void make_cb_table_float_sop(
+ float slope, float offset, float power, float pivot, float *table, float mul)
+{
+ for (int y = 0; y < 256; y++) {
+ float v = color_balance_fl_sop((float)y * (1.0f / 255.0f), slope, offset, power, pivot, mul);
table[y] = v;
}
@@ -310,7 +382,13 @@ static void color_balance_byte_byte(StripColorBalance *cb_,
straight_uchar_to_premul_float(p, cp);
for (c = 0; c < 3; c++) {
- float t = color_balance_fl(p[c], cb.lift[c], cb.gain[c], cb.gamma[c], mul);
+ float t;
+ if (cb.method == SEQ_COLOR_BALANCE_METHOD_LIFTGAMMAGAIN) {
+ t = color_balance_fl_lgg(p[c], cb.lift[c], cb.gain[c], cb.gamma[c], mul);
+ }
+ else {
+ t = color_balance_fl_sop(p[c], cb.slope[c], cb.offset[c], cb.power[c], 1.0, mul);
+ }
if (m) {
float m_normal = (float)m[c] / 255.0f;
@@ -352,7 +430,12 @@ static void color_balance_byte_float(StripColorBalance *cb_,
cb = calc_cb(cb_);
for (c = 0; c < 3; c++) {
- make_cb_table_float(cb.lift[c], cb.gain[c], cb.gamma[c], cb_tab[c], mul);
+ if (cb.method == SEQ_COLOR_BALANCE_METHOD_LIFTGAMMAGAIN) {
+ make_cb_table_float_lgg(cb.lift[c], cb.gain[c], cb.gamma[c], cb_tab[c], mul);
+ }
+ else {
+ make_cb_table_float_sop(cb.slope[c], cb.offset[c], cb.power[c], 1.0, cb_tab[c], mul);
+ }
}
for (i = 0; i < 256; i++) {
@@ -397,7 +480,13 @@ static void color_balance_float_float(StripColorBalance *cb_,
while (p < e) {
int c;
for (c = 0; c < 3; c++) {
- float t = color_balance_fl(p[c], cb.lift[c], cb.gain[c], cb.gamma[c], mul);
+ float t;
+ if (cb_->method == SEQ_COLOR_BALANCE_METHOD_LIFTGAMMAGAIN) {
+ t = color_balance_fl_lgg(p[c], cb.lift[c], cb.gain[c], cb.gamma[c], mul);
+ }
+ else {
+ t = color_balance_fl_sop(p[c], cb.slope[c], cb.offset[c], cb.power[c], 1.0, mul);
+ }
if (m) {
p[c] = p[c] * (1.0f - m[c]) + t * m[c];
@@ -507,11 +596,15 @@ static void colorBalance_init_data(SequenceModifierData *smd)
int c;
cbmd->color_multiply = 1.0f;
+ cbmd->color_balance.method = 0;
for (c = 0; c < 3; c++) {
cbmd->color_balance.lift[c] = 1.0f;
cbmd->color_balance.gamma[c] = 1.0f;
cbmd->color_balance.gain[c] = 1.0f;
+ cbmd->color_balance.slope[c] = 1.0f;
+ cbmd->color_balance.offset[c] = 1.0f;
+ cbmd->color_balance.power[c] = 1.0f;
}
}
diff --git a/source/blender/sequencer/intern/sequencer.c b/source/blender/sequencer/intern/sequencer.c
index 382bd51aae1..3478c2d4f97 100644
--- a/source/blender/sequencer/intern/sequencer.c
+++ b/source/blender/sequencer/intern/sequencer.c
@@ -144,6 +144,8 @@ Sequence *SEQ_sequence_alloc(ListBase *lb, int timeline_frame, int machine, int
seq->strip = seq_strip_alloc(type);
seq->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Sequence Stereo Format");
+ seq->color_tag = SEQUENCE_COLOR_NONE;
+
SEQ_relations_session_uuid_generate(seq);
return seq;
@@ -636,6 +638,18 @@ void SEQ_sequence_base_dupli_recursive(const Scene *scene_src,
seq_new_fix_links_recursive(seq);
}
}
+
+bool SEQ_valid_strip_channel(Sequence *seq)
+{
+ if (seq->machine < 1) {
+ return false;
+ }
+ if (seq->machine > MAXSEQ) {
+ return false;
+ }
+ return true;
+}
+
/* r_prefix + [" + escaped_name + "] + \0 */
#define SEQ_RNAPATH_MAXSTR ((30 + 2 + (SEQ_NAME_MAXSTR * 2) + 2) + 1)
diff --git a/source/blender/sequencer/intern/strip_relations.c b/source/blender/sequencer/intern/strip_relations.c
index 46fdd2c3d14..9822bfe38f9 100644
--- a/source/blender/sequencer/intern/strip_relations.c
+++ b/source/blender/sequencer/intern/strip_relations.c
@@ -526,4 +526,4 @@ struct Sequence *SEQ_find_metastrip_by_sequence(ListBase *seqbase, Sequence *met
}
return NULL;
-} \ No newline at end of file
+}
diff --git a/source/blender/sequencer/intern/strip_transform.c b/source/blender/sequencer/intern/strip_transform.c
index d5ff455c694..54ca4ef487f 100644
--- a/source/blender/sequencer/intern/strip_transform.c
+++ b/source/blender/sequencer/intern/strip_transform.c
@@ -278,7 +278,7 @@ bool SEQ_transform_seqbase_shuffle_ex(ListBase *seqbasep,
SEQ_time_update_sequence(evil_scene, test);
}
- if ((test->machine < 1) || (test->machine > MAXSEQ)) {
+ if (!SEQ_valid_strip_channel(test)) {
/* Blender 2.4x would remove the strip.
* nicer to move it to the end */