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:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-07-20 13:37:07 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-07-20 13:37:07 +0400
commit5f3fc624a5c55c709efe4ccd632286e6fee80c59 (patch)
tree48391c5462afe90c81ff2dd3bf55476248fa822d
parent5290c3a1454895dd946d122eef5fdf95a4b17f2c (diff)
Sequencer: Fix wrong blur result when one of the sizes is zero
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 0a856bd87f1..d2dc9da47f9 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -2685,7 +2685,7 @@ static void do_gaussian_blur_effect_byte(Sequence *seq,
float accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
float accum_weight = 0.0f;
for (current_y = i - size_y;
- current_y < i + size_y;
+ current_y <= i + size_y;
++current_y)
{
if (current_y < -start_line ||
@@ -2696,7 +2696,7 @@ static void do_gaussian_blur_effect_byte(Sequence *seq,
}
for (current_x = j - size_x;
- current_x < j + size_x;
+ current_x <= j + size_x;
++current_x)
{
float weight;
@@ -2708,8 +2708,16 @@ static void do_gaussian_blur_effect_byte(Sequence *seq,
BLI_assert(index >= 0);
BLI_assert(index < frame_width * frame_height * 4);
- weight = gausstab_x[current_x - j + size_x] *
- gausstab_y[current_y - i + size_y];
+ if (size_x != 0 && size_y != 0) {
+ weight = gausstab_x[current_x - j + size_x] *
+ gausstab_y[current_y - i + size_y];
+ }
+ else if (size_x == 0) {
+ weight = gausstab_y[current_y - i + size_y];
+ }
+ else {
+ weight = gausstab_x[current_x - j + size_x];
+ }
accum[0] += rect[index] * weight;
accum[1] += rect[index + 1] * weight;
accum[2] += rect[index + 2] * weight;
@@ -2761,7 +2769,7 @@ static void do_gaussian_blur_effect_float(Sequence *seq,
float accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
float accum_weight = 0.0f;
for (current_y = i - size_y;
- current_y < i + size_y;
+ current_y <= i + size_y;
++current_y)
{
float weight;
@@ -2773,7 +2781,7 @@ static void do_gaussian_blur_effect_float(Sequence *seq,
}
for (current_x = j - size_x;
- current_x < j + size_x;
+ current_x <= j + size_x;
++current_x)
{
int index = INDEX(current_x, current_y + start_line);
@@ -2782,8 +2790,16 @@ static void do_gaussian_blur_effect_float(Sequence *seq,
continue;
}
- weight = gausstab_x[current_x - j + size_x] *
- gausstab_y[current_y - i + size_y];
+ if (size_x != 0 && size_y != 0) {
+ weight = gausstab_x[current_x - j + size_x] *
+ gausstab_y[current_y - i + size_y];
+ }
+ else if (size_x == 0) {
+ weight = gausstab_y[current_y - i + size_y];
+ }
+ else {
+ weight = gausstab_x[current_x - j + size_x];
+ }
madd_v4_v4fl(accum, &rect[index], weight);
accum_weight += weight;
}