Kaydet (Commit) f31e6deb authored tarafından Pedro Giffuni's avatar Pedro Giffuni Kaydeden (comit) Caolán McNamara

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 d1f61b3f)

Conflicts:
	vcl/inc/vcl/bitmap.hxx

Change-Id: I5f01db1688eedee25a2943ca3aa6e957b400c759
üst f55c6464
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#ifndef _SV_BITMAP_HXX #ifndef _SV_BITMAP_HXX
#define _SV_BITMAP_HXX #define _SV_BITMAP_HXX
#include <boost/math/special_functions/sinc.hpp>
#include <tools/color.hxx> #include <tools/color.hxx>
#include <tools/link.hxx> #include <tools/link.hxx>
#include <tools/solar.h> #include <tools/solar.h>
...@@ -207,7 +208,8 @@ public: ...@@ -207,7 +208,8 @@ public:
class Lanczos3Kernel : public Kernel class Lanczos3Kernel : public Kernel
{ {
typedef boost::math::policies::policy<
boost::math::policies::promote_double<false> > SincPolicy;
public: public:
Lanczos3Kernel() : Kernel () {} Lanczos3Kernel() : Kernel () {}
virtual double GetWidth() const { return 3.0; } virtual double GetWidth() const { return 3.0; }
...@@ -223,7 +225,7 @@ public: ...@@ -223,7 +225,7 @@ public:
return 1.0; return 1.0;
} }
x = x * M_PI; x = x * M_PI;
return sin(x) / x; return boost::math::sinc_pi(x, SincPolicy());
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment