diff options
author | Pedro Giffuni <pfg@apache.org> | 2013-02-08 15:35:48 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-24 18:54:38 +0100 |
commit | f31e6debfa7e330f985a0846a6ca91130d3dab20 (patch) | |
tree | 08c3224999a53e065c2082fe8b477c99d98786aa /include | |
parent | f55c6464fb9ee3ff8c011e815e0b75162ebea3fd (diff) |
A miscellaneous use of boost.
Sinc(x) is a simple function used in communications. boost
happens to use it for quaternion math. The implementation is
simple, however it looks fun to re-use the boost function
even if just to say we are using quaternion math somewhere ;).
The performance difference is not likely to be huge but JIC,
set up a specific Boost math policy to limit type promotion
with it's corresponding impact.
(cherry picked from commit d1f61b3f3564ca5421a13b77e4c7c78bb409e9e1)
Conflicts:
vcl/inc/vcl/bitmap.hxx
Change-Id: I5f01db1688eedee25a2943ca3aa6e957b400c759
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/bitmap.hxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index bacec110ab1a..4ca9cc1759f0 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -20,6 +20,7 @@ #ifndef _SV_BITMAP_HXX #define _SV_BITMAP_HXX +#include <boost/math/special_functions/sinc.hpp> #include <tools/color.hxx> #include <tools/link.hxx> #include <tools/solar.h> @@ -207,7 +208,8 @@ public: class Lanczos3Kernel : public Kernel { - + typedef boost::math::policies::policy< + boost::math::policies::promote_double<false> > SincPolicy; public: Lanczos3Kernel() : Kernel () {} virtual double GetWidth() const { return 3.0; } @@ -223,7 +225,7 @@ public: return 1.0; } x = x * M_PI; - return sin(x) / x; + return boost::math::sinc_pi(x, SincPolicy()); } }; |