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:
authorUnderground78 <underground78@users.sourceforge.net>2012-06-10 17:47:05 +0400
committerUnderground78 <underground78@users.sourceforge.net>2012-06-10 17:47:05 +0400
commitb3678b44e91263064e2985c6391dc5fcd1d5c14c (patch)
treef731f96769ac1b9d737de7c9fbd13f3144cd0703
parent8de9239ac613a54e1258f531d3e728283b4adc55 (diff)
- Remove a couple of unused defines
- Use M_PI from math.h in SoundTouch - Replace the DegToRad macro with a function - Fix a few C4244 warnings Patch mostly by XhmikosR. git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@5072 10f7b99b-c216-0410-bff0-8a66a9350fd8
-rw-r--r--src/SubPic/CoordGeom.cpp6
-rw-r--r--src/SubPic/CoordGeom.h13
-rw-r--r--src/mpc-hc/MainFrm.cpp4
-rw-r--r--src/thirdparty/SoundTouch/source/AAFilter.cpp8
4 files changed, 15 insertions, 16 deletions
diff --git a/src/SubPic/CoordGeom.cpp b/src/SubPic/CoordGeom.cpp
index 3f1c0cc72..b143fe592 100644
--- a/src/SubPic/CoordGeom.cpp
+++ b/src/SubPic/CoordGeom.cpp
@@ -25,10 +25,6 @@
#include <math.h>
#include "CoordGeom.h"
-#define EPSILON (1e-7)
-#define BIGNUMBER (1e+9)
-#define IsZero(d) (fabs(d) < EPSILON)
-
//
// Vector
//
@@ -370,7 +366,7 @@ float Ray::GetDistanceFrom(Ray& r)
{
float t = (d | r.d);
if (IsZero(t)) {
- return -BIGNUMBER; // plane is paralell to the ray, return -infinite
+ return (float)-BIGNUMBER; // plane is paralell to the ray, return -infinite
}
return (((r.p - p) | r.d) / t);
}
diff --git a/src/SubPic/CoordGeom.h b/src/SubPic/CoordGeom.h
index 7c58a7596..64bdf9996 100644
--- a/src/SubPic/CoordGeom.h
+++ b/src/SubPic/CoordGeom.h
@@ -29,19 +29,18 @@
#define M_PI 3.14159265358979323846
#endif
-#define DegToRad(d) ((d) * M_PI / 180.0)
-#define RadToDeg(r) ((r) * 180.0 / M_PI)
+#define EPSILON (1e-7)
+#define BIGNUMBER (1e+9)
+#define IsZero(d) (fabs(d) < EPSILON)
#define Sgn(d) (IsZero(d) ? 0 : (d) > 0 ? 1 : -1)
-#define SgnPow(d, p) (IsZero(d) ? 0 : (pow(fabs(d), p) * Sgn(d)))
+//#define SgnPow(d, p) (IsZero(d) ? 0 : (pow(fabs(d), p) * Sgn(d)))
class Vector
{
public:
float x, y, z;
- Vector() {
- x = y = z = 0;
- }
+ Vector() { x = y = z = 0; }
Vector(float x, float y, float z);
void Set(float x, float y, float z);
@@ -92,6 +91,8 @@ public:
Vector& operator *= (Vector& v);
Vector& operator /= (float d);
Vector& operator /= (Vector& v);
+
+ template<typename T> static float DegToRad(T angle) { return (float)(angle * M_PI / 180); }
};
class Ray
diff --git a/src/mpc-hc/MainFrm.cpp b/src/mpc-hc/MainFrm.cpp
index b9a26ca1e..cb8f5e891 100644
--- a/src/mpc-hc/MainFrm.cpp
+++ b/src/mpc-hc/MainFrm.cpp
@@ -6889,7 +6889,7 @@ void CMainFrame::OnViewRotate(UINT nID)
return;
}
- m_pCAP->SetVideoAngle(Vector(DegToRad(m_AngleX), DegToRad(m_AngleY), DegToRad(m_AngleZ)));
+ m_pCAP->SetVideoAngle(Vector(Vector::DegToRad(m_AngleX), Vector::DegToRad(m_AngleY), Vector::DegToRad(m_AngleZ)));
CString info;
info.Format(_T("x: %d, y: %d, z: %d"), m_AngleX, m_AngleY, m_AngleZ);
@@ -9920,7 +9920,7 @@ void CMainFrame::MoveVideoWindow(bool fShowStats)
if (m_pCAP) {
m_pCAP->SetPosition(wr, vr);
- Vector v(DegToRad(m_AngleX), DegToRad(m_AngleY), DegToRad(m_AngleZ));
+ Vector v(Vector::DegToRad(m_AngleX), Vector::DegToRad(m_AngleY), Vector::DegToRad(m_AngleZ));
m_pCAP->SetVideoAngle(v);
} else {
HRESULT hr;
diff --git a/src/thirdparty/SoundTouch/source/AAFilter.cpp b/src/thirdparty/SoundTouch/source/AAFilter.cpp
index 191b97b13..3f6149e33 100644
--- a/src/thirdparty/SoundTouch/source/AAFilter.cpp
+++ b/src/thirdparty/SoundTouch/source/AAFilter.cpp
@@ -49,8 +49,10 @@
using namespace soundtouch;
-#define PI 3.141592655357989
-#define TWOPI (2 * PI)
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+#define TWOPI (2 * M_PI)
/*****************************************************************************
*
@@ -113,7 +115,7 @@ void AAFilter::calculateCoeffs()
coeffs = new SAMPLETYPE[length];
fc2 = 2.0 * cutoffFreq;
- wc = PI * fc2;
+ wc = M_PI * fc2;
tempCoeff = TWOPI / (double)length;
sum = 0;