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:
authorIchthyostega <prg@ichthyostega.de>2016-08-22 18:22:06 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-08-23 12:53:35 +0300
commit3dbe1744402c2790d7854f09cf977bb275436479 (patch)
tree74e27ddbcfe858e71ec47908d5d9b44aee6b5ef0 /source/blender/blenkernel/intern/tracking_stabilize.c
parent95d3ca8bc68c85643b9ce6b7340e2e1f48224fc2 (diff)
2D stabilization: flip orientation of the scale parameter
values > 1 will zoom in and values < 1 zoom out Rationale: the changed orientation is more natural from a user POV and doing it this way is also more consistent with the calculation of the other target_* parameters. Compatibility: This will break *.blend files saved with the previous version of this patch from the last days (test period). It will *not* break any old/migrated files: Previously, the DNA field "scale" was only used to cache autoscale. Only with the Stabilisator rework, "scale" becomes a first class persistent DNA field. There is migration code to init this field to 1.0
Diffstat (limited to 'source/blender/blenkernel/intern/tracking_stabilize.c')
-rw-r--r--source/blender/blenkernel/intern/tracking_stabilize.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/tracking_stabilize.c b/source/blender/blenkernel/intern/tracking_stabilize.c
index 0f047242f93..93addc47fe1 100644
--- a/source/blender/blenkernel/intern/tracking_stabilize.c
+++ b/source/blender/blenkernel/intern/tracking_stabilize.c
@@ -1020,13 +1020,13 @@ static void stabilization_calculate_data(StabContext *ctx,
float *r_scale,
float *r_angle)
{
- float target_pos[2];
+ float target_pos[2], target_scale;
float scaleinf = get_animated_scaleinf(ctx, framenr);
- *r_scale = get_animated_target_scale(ctx,framenr);
-
if (ctx->stab->flag & TRACKING_STABILIZE_SCALE) {
- *r_scale *= expf(scale_step * scaleinf); /* Averaged in log scale */
+ *r_scale = expf(scale_step * scaleinf); /* Averaged in log scale */
+ } else {
+ *r_scale = 1.0f;
}
mul_v2_fl(r_translation, get_animated_locinf(ctx, framenr));
@@ -1039,6 +1039,11 @@ static void stabilization_calculate_data(StabContext *ctx,
get_animated_target_pos(ctx, framenr, target_pos);
sub_v2_v2(r_translation, target_pos);
*r_angle -= get_animated_target_rot(ctx,framenr);
+ target_scale = get_animated_target_scale(ctx,framenr);
+ if (target_scale != 0.0f) {
+ *r_scale /= target_scale;
+ /* target_scale is an expected/intended reference zoom value*/
+ }
/* Convert from relative to absolute coordinates, square pixels. */
r_translation[0] *= (float)size * aspect;
@@ -1194,9 +1199,9 @@ static void stabilization_determine_safe_image_area(StabContext *ctx,
J = G - E;
K = G * F - E * H;
- S = (dx * I + dy * J + K) / (-w * I - h * J);
+ S = (-w * I - h * J) / (dx * I + dy * J + K);
- scale = min_ff(scale, S);
+ scale = max_ff(scale, S);
}
}
}
@@ -1205,7 +1210,7 @@ static void stabilization_determine_safe_image_area(StabContext *ctx,
stab->scale = scale;
if (stab->maxscale > 0.0f) {
- stab->scale = max_ff(stab->scale, 1.0f / stab->maxscale);
+ stab->scale = min_ff(stab->scale, stab->maxscale);
}
}