Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@users.sourceforge.net>2013-05-26 21:08:28 +0400
committerXhmikosR <xhmikosr@users.sourceforge.net>2013-06-23 17:27:42 +0400
commit9655664afae893503a90afced8f1dc57b4585a6c (patch)
tree730f8977c6357412189751b07c13c396a3f165ff /src/filters
parent4b55c5fad5ef93099d5f11f2b9319d9837e843c9 (diff)
Use the M_PI and M_SQRT1_2 defines instead of the direct numbers.
Also remove the M_PI fallback define; we always build with `_USE_MATH_DEFINES` defined. This commit partially reverts dad01b003dc8c5934d8e08fa5dfef9b5536034ef.
Diffstat (limited to 'src/filters')
-rw-r--r--src/filters/source/D2VSource/idctfpu.cpp18
-rw-r--r--src/filters/source/D2VSource/idctref.cpp6
-rw-r--r--src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp2
3 files changed, 11 insertions, 15 deletions
diff --git a/src/filters/source/D2VSource/idctfpu.cpp b/src/filters/source/D2VSource/idctfpu.cpp
index 39e1939b7..089086485 100644
--- a/src/filters/source/D2VSource/idctfpu.cpp
+++ b/src/filters/source/D2VSource/idctfpu.cpp
@@ -29,9 +29,7 @@
/////////////////////////////////////////////////////
#include <math.h>
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
+#define PI M_PI
#define FLOAT double
const static double RC = 1.0*1024*1024*1024*1024*256*16 + 1024; // magic + clip center
@@ -81,19 +79,19 @@ void Initialize_FPU_IDCT()
{
int i;
- S2 = sqrt(0.5); // 1.0/sqrt(2);
+ S2 = M_SQRT1_2; // 1.0/sqrt(2);
- W1 = sqrt(2.0)*cos(M_PI*(1.0/16));
+ W1 = sqrt(2.0)*cos(PI*(1.0/16));
W1_8 = W1/8;
- W2 = sqrt(2.0)*cos(M_PI*(2.0/16));
+ W2 = sqrt(2.0)*cos(PI*(2.0/16));
W2_8 = W2/8;
- W3 = sqrt(2.0)*cos(M_PI*(3.0/16));
+ W3 = sqrt(2.0)*cos(PI*(3.0/16));
W3_8 = W3/8;
- W5 = sqrt(2.0)*cos(M_PI*(5.0/16));
+ W5 = sqrt(2.0)*cos(PI*(5.0/16));
W5_8 = W5/8;
- W6 = sqrt(2.0)*cos(M_PI*(6.0/16));
+ W6 = sqrt(2.0)*cos(PI*(6.0/16));
W6_8 = W6/8;
- W7 = sqrt(2.0)*cos(M_PI*(7.0/16));
+ W7 = sqrt(2.0)*cos(PI*(7.0/16));
W7_8 = W7/8;
W1mW7 = W1-W7; W1mW7_8 = W1mW7/8;
diff --git a/src/filters/source/D2VSource/idctref.cpp b/src/filters/source/D2VSource/idctref.cpp
index 3f870b194..e8886cacc 100644
--- a/src/filters/source/D2VSource/idctref.cpp
+++ b/src/filters/source/D2VSource/idctref.cpp
@@ -26,10 +26,8 @@
vary a little */
#include <math.h>
+#define PI M_PI
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
const static double HALF = 0.5;
/* private data */
@@ -49,7 +47,7 @@ void Initialize_REF_IDCT()
{
scale = (freq == 0) ? sqrt(0.125) : 0.5;
for (time=0; time<8; time++)
- c[freq][time] = scale*cos((M_PI/8.0)*freq*(time + 0.5));
+ c[freq][time] = scale*cos((PI/8.0)*freq*(time + 0.5));
}
#ifdef ModelX
diff --git a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp
index 78d162ce2..c072f9078 100644
--- a/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp
+++ b/src/filters/transform/Mpeg2DecFilter/Mpeg2DecFilter.cpp
@@ -1150,7 +1150,7 @@ void CMpeg2DecFilter::CalcBrCont(BYTE* YTbl, float bright, float cont)
void CMpeg2DecFilter::CalcHueSat(BYTE* UTbl, BYTE* VTbl, float hue, float sat)
{
int Sat = (int)(sat * 512);
- double Hue = (hue * 3.1415926) / 180.0;
+ double Hue = (hue * M_PI) / 180.0;
int Sin = (int)(sin(Hue) * 4096);
int Cos = (int)(cos(Hue) * 4096);