Hi

New version with changed commit message is attached

Einar
From dcdaa0575aac460809528761bb5d748141164aa3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Einar=20R=C3=BCnkaru?= <[email protected]>
Date: Mon, 21 Nov 2011 19:55:40 +0200
Subject: [PATCH] Fixed interpolation in "Blur" video plugin

Do not interpolate on-off-switches for two reasons:

- It does not make sense. To use the setting of the preceding keyframe
 is the only thing that makes sense.

- When both the previous and the next keyframe have the setting at one,
 then the exact result of the numeric computation should be one as
 well. However, the sum of prev_scale and next_scale can be slightly
 less than one due to floatingpoint rounding. In such a case, the
 value is truncated to zero, and causes the blur to be turned off
 spuriously, causing flickering video in the interpolated range.

Also do not just truncate the interpolated value of the blur radius,
but round it.

Fix proposed by Michal Fapso <[email protected]>
---
 plugins/blur/blur.C |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/plugins/blur/blur.C b/plugins/blur/blur.C
index fff9572..5505577 100644
--- a/plugins/blur/blur.C
+++ b/plugins/blur/blur.C
@@ -79,9 +79,9 @@ void BlurConfig::interpolate(BlurConfig &prev,
 
 
 //printf("BlurConfig::interpolate %d %d %d\n", prev_frame, next_frame, current_frame);
-	this->vertical = (int)(prev.vertical * prev_scale + next.vertical * next_scale);
-	this->horizontal = (int)(prev.horizontal * prev_scale + next.horizontal * next_scale);
-	this->radius = (int)(prev.radius * prev_scale + next.radius * next_scale);
+	this->vertical = prev.vertical;
+	this->horizontal = prev.horizontal;
+	this->radius = round(prev.radius * prev_scale + next.radius * next_scale);
 	a = prev.a;
 	r = prev.r;
 	g = prev.g;
-- 
1.7.0.4

Reply via email to