~jsjgruber/junk/vvvvnux

« back to all changes in this revision

Viewing changes to debian/patches/04-ubuntu-ls-blur-weight-adjustment.patch

  • Committer: John S Gruber
  • Date: 2013-06-22 22:39:25 UTC
  • Revision ID: johnsgruber@gmail.com-20130622223925-bbgiyfu51xsbtvcf
Add 04-ubuntu-ls-blur-weight-adjustment.patch--Simulate the 
weight distribution of the current LS blur. For odd numbers of
non-zero samples drop the last, sacrificing a little more accuracy
for speed. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
## Description: Simulate the weight distribution of the current LS blur.
 
2
##    For odd numbers of non-zero samples drop the last, sacrificing a 
 
3
##    little more accuracy for speed.
 
4
## Origin/Author: John S. Gruber <JohnSGruber@gmail.com>
 
5
## Depends upon: 02-ubuntu-ls-blur-return.patch 03-ubuntu-ls-blur-loop-fix.patch
 
6
## Bug: https://bugs.launchpad.net/ubuntu/+source/nux/+bug/1167018
 
7
--- a/NuxGraphics/GraphicsEngine.cpp
 
8
+++ b/NuxGraphics/GraphicsEngine.cpp
 
9
@@ -1356,7 +1356,7 @@
 
10
     
 
11
     // Go through the gaussian points pair by pair and find a composite
 
12
     // offset and weight to represent each pair
 
13
-    for (int i = 1; i <= support; i+=2)
 
14
+    for (int i = 1; i < support; i+=2)
 
15
     {
 
16
       float w1 = exp(-(i*i)/(2*sigma*sigma))/(sqrt(2*constants::pi)*sigma);
 
17
       float w2 = exp(-((i+1)*(i+1))/(2*sigma*sigma))/(sqrt(2*constants::pi)*sigma);
 
18
@@ -1364,6 +1364,10 @@
 
19
       // and should not be sampled--make the last sample offset exactly i.
 
20
       if (i+1 > support) w2 = 0;
 
21
 
 
22
+      // Emulate weights used previously to produce comparable blur
 
23
+      w1 *= 2;
 
24
+      w2 *= 2;
 
25
+
 
26
       weights.push_back(w1 + w2);
 
27
       total += 2.0f * (w1 + w2);
 
28