diff options
-rw-r--r-- | src/DSUtil/DSUtil.cpp | 2 | ||||
-rw-r--r-- | src/Subtitles/RTS.cpp | 9 | ||||
-rw-r--r-- | src/Subtitles/Rasterizer.cpp | 98 | ||||
-rw-r--r-- | src/Subtitles/Rasterizer.h | 4 |
4 files changed, 75 insertions, 38 deletions
diff --git a/src/DSUtil/DSUtil.cpp b/src/DSUtil/DSUtil.cpp index c92276354..325c462d0 100644 --- a/src/DSUtil/DSUtil.cpp +++ b/src/DSUtil/DSUtil.cpp @@ -914,7 +914,7 @@ void memsetd(void* dst, unsigned int c, size_t nbytes) {
size_t n = nbytes / 4;
-#ifndef _WIN64
+#if defined(_M_IX86_FP) && _M_IX86_FP < 2
if (!(g_cpuid.m_flags & g_cpuid.sse2)) { // No SSE2
__stosd((unsigned long*)dst, c, n);
return;
diff --git a/src/Subtitles/RTS.cpp b/src/Subtitles/RTS.cpp index 934c89b2e..c4fda9699 100644 --- a/src/Subtitles/RTS.cpp +++ b/src/Subtitles/RTS.cpp @@ -187,10 +187,13 @@ void CWord::Paint(const CPoint& p, const CPoint& org) void CWord::Transform(CPoint org)
{
- if (m_bUseSSE2) { // SSE code
- Transform_SSE2(org);
- } else { // C-code
+#if defined(_M_IX86_FP) && _M_IX86_FP < 2
+ if (!m_bUseSSE2) {
Transform_C(org);
+ } else
+#endif
+ {
+ Transform_SSE2(org);
}
}
diff --git a/src/Subtitles/Rasterizer.cpp b/src/Subtitles/Rasterizer.cpp index e61eb61b1..f76cc8e94 100644 --- a/src/Subtitles/Rasterizer.cpp +++ b/src/Subtitles/Rasterizer.cpp @@ -53,9 +53,11 @@ Rasterizer::Rasterizer() , mEdgeNext(0)
, mpScanBuffer(0)
{
+#if defined(_M_IX86_FP) && _M_IX86_FP < 2
int cpuInfo[4] = { -1 };
__cpuid(cpuInfo, 1);
m_bUseSSE2 = !!(cpuInfo[3] & (1 << 26));
+#endif
}
Rasterizer::~Rasterizer()
@@ -894,16 +896,19 @@ bool Rasterizer::Rasterize(int xsub, int ysub, int fBlur, double fGaussianBlur) byte* src = m_pOutlineData->mWideOutline.empty() ? m_pOverlayData->mpOverlayBufferBody : m_pOverlayData->mpOverlayBufferBorder;
- if (m_bUseSSE2) {
- SeparableFilterX_SSE2(src, tmp, m_pOverlayData->mOverlayWidth, m_pOverlayData->mOverlayHeight, pitch,
- filter.kernel, filter.width, filter.divisor);
- SeparableFilterY_SSE2(tmp, src, m_pOverlayData->mOverlayWidth, m_pOverlayData->mOverlayHeight, pitch,
- filter.kernel, filter.width, filter.divisor);
- } else {
+#if defined(_M_IX86_FP) && _M_IX86_FP < 2
+ if (!m_bUseSSE2) {
SeparableFilterX<1>(src, tmp, m_pOverlayData->mOverlayWidth, m_pOverlayData->mOverlayHeight, pitch,
filter.kernel, filter.width, filter.divisor);
SeparableFilterY<1>(tmp, src, m_pOverlayData->mOverlayWidth, m_pOverlayData->mOverlayHeight, pitch,
filter.kernel, filter.width, filter.divisor);
+ } else
+#endif
+ {
+ SeparableFilterX_SSE2(src, tmp, m_pOverlayData->mOverlayWidth, m_pOverlayData->mOverlayHeight, pitch,
+ filter.kernel, filter.width, filter.divisor);
+ SeparableFilterY_SSE2(tmp, src, m_pOverlayData->mOverlayWidth, m_pOverlayData->mOverlayHeight, pitch,
+ filter.kernel, filter.width, filter.divisor);
}
_aligned_free(tmp);
@@ -1592,18 +1597,24 @@ CRect Rasterizer::Draw(SubPicDesc& spd, CRect& clipRect, byte* pAlphaMask, int x if (switchpts[1] == DWORD_MAX) {
// fBody is true if we're rendering a fill or a shadow.
if (fBody) {
- if (m_bUseSSE2) {
- Draw_noAlpha_spFF_Body_sse2(rnfo);
- } else {
+#if defined(_M_IX86_FP) && _M_IX86_FP < 2
+ if (!m_bUseSSE2) {
Draw_noAlpha_spFF_Body_0(rnfo);
+ } else
+#endif
+ {
+ Draw_noAlpha_spFF_Body_sse2(rnfo);
}
}
// Not painting body, ie. painting border without fill in it
else {
- if (m_bUseSSE2) {
- Draw_noAlpha_spFF_noBody_sse2(rnfo);
- } else {
+#if defined(_M_IX86_FP) && _M_IX86_FP < 2
+ if (!m_bUseSSE2) {
Draw_noAlpha_spFF_noBody_0(rnfo);
+ } else
+#endif
+ {
+ Draw_noAlpha_spFF_noBody_sse2(rnfo);
}
}
}
@@ -1613,18 +1624,24 @@ CRect Rasterizer::Draw(SubPicDesc& spd, CRect& clipRect, byte* pAlphaMask, int x //const long *sw = switchpts;
if (fBody) {
- if (m_bUseSSE2) {
- Draw_noAlpha_sp_Body_sse2(rnfo);
- } else {
+#if defined(_M_IX86_FP) && _M_IX86_FP < 2
+ if (!m_bUseSSE2) {
Draw_noAlpha_sp_Body_0(rnfo);
+ } else
+#endif
+ {
+ Draw_noAlpha_sp_Body_sse2(rnfo);
}
}
// Not body
else {
- if (m_bUseSSE2) {
- Draw_noAlpha_sp_noBody_sse2(rnfo);
- } else {
+#if defined(_M_IX86_FP) && _M_IX86_FP < 2
+ if (!m_bUseSSE2) {
Draw_noAlpha_sp_noBody_0(rnfo);
+ } else
+#endif
+ {
+ Draw_noAlpha_sp_noBody_sse2(rnfo);
}
}
}
@@ -1633,32 +1650,44 @@ CRect Rasterizer::Draw(SubPicDesc& spd, CRect& clipRect, byte* pAlphaMask, int x else {
if (switchpts[1] == DWORD_MAX) {
if (fBody) {
- if (m_bUseSSE2) {
- Draw_Alpha_spFF_Body_sse2(rnfo);
- } else {
+#if defined(_M_IX86_FP) && _M_IX86_FP < 2
+ if (!m_bUseSSE2) {
Draw_Alpha_spFF_Body_0(rnfo);
+ } else
+#endif
+ {
+ Draw_Alpha_spFF_Body_sse2(rnfo);
}
} else {
- if (m_bUseSSE2) {
- Draw_Alpha_spFF_noBody_sse2(rnfo);
- } else {
+#if defined(_M_IX86_FP) && _M_IX86_FP < 2
+ if (!m_bUseSSE2) {
Draw_Alpha_spFF_noBody_0(rnfo);
+ } else
+#endif
+ {
+ Draw_Alpha_spFF_noBody_sse2(rnfo);
}
}
} else {
//const long *sw = switchpts;
if (fBody) {
- if (m_bUseSSE2) {
- Draw_Alpha_sp_Body_sse2(rnfo);
- } else {
+#if defined(_M_IX86_FP) && _M_IX86_FP < 2
+ if (!m_bUseSSE2) {
Draw_Alpha_sp_Body_0(rnfo);
+ } else
+#endif
+ {
+ Draw_Alpha_sp_Body_sse2(rnfo);
}
} else {
- if (m_bUseSSE2) {
- Draw_Alpha_sp_noBody_sse2(rnfo);
- } else {
+#if defined(_M_IX86_FP) && _M_IX86_FP < 2
+ if (!m_bUseSSE2) {
Draw_Alpha_sp_noBody_0(rnfo);
+ } else
+#endif
+ {
+ Draw_Alpha_sp_noBody_sse2(rnfo);
}
}
}
@@ -1679,10 +1708,13 @@ void Rasterizer::FillSolidRect(SubPicDesc& spd, int x, int y, int nWidth, int nH for (int wy = y; wy < y + nHeight; wy++) {
DWORD* dst = (DWORD*)((BYTE*)spd.bits + spd.pitch * wy) + x;
for (int wt = 0; wt < nWidth; ++wt) {
- if (m_bUseSSE2) {
- pixmix_sse2(&dst[wt], lColor, 0x40); // 0x40 because >> 6 in pixmix (to preserve tranparency)
- } else {
+#if defined(_M_IX86_FP) && _M_IX86_FP < 2
+ if (!m_bUseSSE2) {
pixmix(&dst[wt], lColor, 0x40);
+ } else
+#endif
+ {
+ pixmix_sse2(&dst[wt], lColor, 0x40); // 0x40 because >> 6 in pixmix (to preserve tranparency)
}
}
}
diff --git a/src/Subtitles/Rasterizer.h b/src/Subtitles/Rasterizer.h index 975c35f11..f653fa0c4 100644 --- a/src/Subtitles/Rasterizer.h +++ b/src/Subtitles/Rasterizer.h @@ -1,6 +1,6 @@ /*
* (C) 2003-2006 Gabest
- * (C) 2006-2014 see Authors.txt
+ * (C) 2006-2015 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -173,7 +173,9 @@ protected: BYTE* mpPathTypes;
POINT* mpPathPoints;
int mPathPoints;
+#if defined(_M_IX86_FP) && _M_IX86_FP < 2
bool m_bUseSSE2;
+#endif
private:
enum {
|