diff options
author | Spec-Chum <spec-chum@users.sourceforge.net> | 2010-02-25 21:59:42 +0300 |
---|---|---|
committer | Spec-Chum <spec-chum@users.sourceforge.net> | 2010-02-25 21:59:42 +0300 |
commit | 0c2afb13afba6a40f1a0a989545b8162d16a1298 (patch) | |
tree | a20564143be0fe6b5ae4aacd5ae4e0598f22992e /src/subtitles/Rasterizer.cpp | |
parent | c6265dccdd6b02524f67404e52e8769c1a1b4b99 (diff) |
Reinstate safe_subtract_sse2() after it was devoured by the update gremlins...
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1699 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/subtitles/Rasterizer.cpp')
-rw-r--r-- | src/subtitles/Rasterizer.cpp | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/src/subtitles/Rasterizer.cpp b/src/subtitles/Rasterizer.cpp index 7e0c7a0e4..61d1e7336 100644 --- a/src/subtitles/Rasterizer.cpp +++ b/src/subtitles/Rasterizer.cpp @@ -920,6 +920,15 @@ static __forceinline DWORD safe_subtract(DWORD a, DWORD b) #endif
}
+static __forceinline DWORD safe_subtract_sse2(DWORD a, DWORD b)
+{
+ __m128i ap = _mm_cvtsi32_si128(a);
+ __m128i bp = _mm_cvtsi32_si128(b);
+ __m128i rp = _mm_subs_epu16(ap, bp);
+
+ return (DWORD)_mm_cvtsi128_si32(rp);
+}
+
// For CPUID usage in Rasterizer::Draw
#include "../dsutil/vd.h"
@@ -1184,7 +1193,7 @@ void Rasterizer::Draw_noAlpha_spFF_noBody_sse2(RasterizerNfo& rnfo) while(h--)
{
for(int wt=0; wt<rnfo.w; ++wt)
- pixmix_sse2(&dst[wt], color, safe_subtract(src[wt*2+1], src[wt*2]));
+ pixmix_sse2(&dst[wt], color, safe_subtract_sse2(src[wt*2+1], src[wt*2]));
src += 2*rnfo.overlayp;
dst = (DWORD*)((char *)dst + rnfo.pitch);
@@ -1228,9 +1237,9 @@ void Rasterizer::Draw_noAlpha_sp_noBody_sse2(RasterizerNfo& rnfo) while(h--)
{
for(int wt=0; wt<gran; ++wt)
- pixmix_sse2(&dst[wt], color, safe_subtract(src[wt*2+1], src[wt*2]));
+ pixmix_sse2(&dst[wt], color, safe_subtract_sse2(src[wt*2+1], src[wt*2]));
for(int wt=gran; wt<rnfo.w; ++wt)
- pixmix_sse2(&dst[wt], color2, safe_subtract(src[wt*2+1], src[wt*2]));
+ pixmix_sse2(&dst[wt], color2, safe_subtract_sse2(src[wt*2+1], src[wt*2]));
src += 2*rnfo.overlayp;
dst = (DWORD*)((char *)dst + rnfo.pitch);
}
@@ -1284,9 +1293,9 @@ void Rasterizer::Draw_Alpha_spFF_noBody_sse2(RasterizerNfo& rnfo) {
for(int wt=0; wt<rnfo.w; ++wt)
#ifdef _VSMOD // patch m006. moveable vector clip
- pixmix2_sse2(&dst[wt], color, safe_subtract(src[wt*2+1], src[wt*2]), mod_vc.GetAlphaValue(wt,h));
+ pixmix2_sse2(&dst[wt], color, safe_subtract_sse2(src[wt*2+1], src[wt*2]), mod_vc.GetAlphaValue(wt,h));
#else
- pixmix2_sse2(&dst[wt], color, safe_subtract(src[wt*2+1], src[wt*2]), am[wt]);
+ pixmix2_sse2(&dst[wt], color, safe_subtract_sse2(src[wt*2+1], src[wt*2]), am[wt]);
am += rnfo.spdw;
#endif
src += 2*rnfo.overlayp;
@@ -1349,14 +1358,14 @@ void Rasterizer::Draw_Alpha_sp_noBody_sse2(RasterizerNfo& rnfo) {
#ifdef _VSMOD // patch m006. moveable vector clip
for(int wt=0; wt<gran; ++wt)
- pixmix2_sse2(&dst[wt], color, safe_subtract(src[wt*2+1], src[wt*2]), mod_vc.GetAlphaValue(wt,h));
+ pixmix2_sse2(&dst[wt], color, safe_subtract_sse2(src[wt*2+1], src[wt*2]), mod_vc.GetAlphaValue(wt,h));
for(int wt=gran; wt<rnfo.w; ++wt)
- pixmix2_sse2(&dst[wt], color, safe_subtract(src[wt*2+1], src[wt*2]), mod_vc.GetAlphaValue(wt,h));
+ pixmix2_sse2(&dst[wt], color, safe_subtract_sse2(src[wt*2+1], src[wt*2]), mod_vc.GetAlphaValue(wt,h));
#else
for(int wt=0; wt<gran; ++wt)
- pixmix2_sse2(&dst[wt], color, safe_subtract(src[wt*2+1], src[wt*2]), am[wt]);
+ pixmix2_sse2(&dst[wt], color, safe_subtract_sse2(src[wt*2+1], src[wt*2]), am[wt]);
for(int wt=gran; wt<rnfo.w; ++wt)
- pixmix2_sse2(&dst[wt], color, safe_subtract(src[wt*2+1], src[wt*2]), am[wt]);
+ pixmix2_sse2(&dst[wt], color, safe_subtract_sse2(src[wt*2+1], src[wt*2]), am[wt]);
am += rnfo.spdw;
#endif
src += 2*rnfo.overlayp;
@@ -1575,7 +1584,7 @@ void Rasterizer::Draw_Grad_noAlpha_spFF_noBody_sse2(RasterizerNfo& rnfo) while(h--)
{
for(int wt=0; wt<w; ++wt)
- pixmix_sse2(&dst[wt], mod_grad.getmixcolor(wt,h,typ), safe_subtract(src[wt*2+1], src[wt*2]));
+ pixmix_sse2(&dst[wt], mod_grad.getmixcolor(wt,h,typ), safe_subtract_sse2(src[wt*2+1], src[wt*2]));
src += 2*rnfo.overlayp;
dst = (DWORD*)((char *)dst + rnfo.pitch);
@@ -1618,9 +1627,9 @@ void Rasterizer::Draw_Grad_noAlpha_sp_noBody_sse2(RasterizerNfo& rnfo) while(h--)
{
for(int wt=0; wt<gran; ++wt)
- pixmix_sse2(&dst[wt], mod_grad.getmixcolor(wt,h,0), safe_subtract(src[wt*2+1], src[wt*2]));
+ pixmix_sse2(&dst[wt], mod_grad.getmixcolor(wt,h,0), safe_subtract_sse2(src[wt*2+1], src[wt*2]));
for(int wt=gran; wt<w; ++wt)
- pixmix_sse2(&dst[wt], mod_grad.getmixcolor(wt,h,1), safe_subtract(src[wt*2+1], src[wt*2]));
+ pixmix_sse2(&dst[wt], mod_grad.getmixcolor(wt,h,1), safe_subtract_sse2(src[wt*2+1], src[wt*2]));
src += 2*rnfo.overlayp;
dst = (DWORD*)((char *)dst + rnfo.pitch);
}
@@ -1662,7 +1671,7 @@ void Rasterizer::Draw_Grad_Alpha_spFF_noBody_sse2(RasterizerNfo& rnfo) while(h--)
{
for(int wt=0; wt<w; ++wt)
- pixmix2_sse2(&dst[wt], mod_grad.getmixcolor(wt,h,typ), safe_subtract(src[wt*2+1], src[wt*2]), mod_vc.GetAlphaValue(wt,h));
+ pixmix2_sse2(&dst[wt], mod_grad.getmixcolor(wt,h,typ), safe_subtract_sse2(src[wt*2+1], src[wt*2]), mod_vc.GetAlphaValue(wt,h));
src += 2*rnfo.overlayp;
dst = (DWORD*)((char *)dst + rnfo.pitch);
}
@@ -1706,9 +1715,9 @@ void Rasterizer::Draw_Grad_Alpha_sp_noBody_sse2(RasterizerNfo& rnfo) while(h--)
{
for(int wt=0; wt<gran; ++wt)
- pixmix2_sse2(&dst[wt], mod_grad.getmixcolor(wt,h,0), safe_subtract(src[wt*2+1], src[wt*2]), mod_vc.GetAlphaValue(wt,h));
+ pixmix2_sse2(&dst[wt], mod_grad.getmixcolor(wt,h,0), safe_subtract_sse2(src[wt*2+1], src[wt*2]), mod_vc.GetAlphaValue(wt,h));
for(int wt=gran; wt<w; ++wt)
- pixmix2_sse2(&dst[wt], mod_grad.getmixcolor(wt,h,1), safe_subtract(src[wt*2+1], src[wt*2]), mod_vc.GetAlphaValue(wt,h));
+ pixmix2_sse2(&dst[wt], mod_grad.getmixcolor(wt,h,1), safe_subtract_sse2(src[wt*2+1], src[wt*2]), mod_vc.GetAlphaValue(wt,h));
src += 2*rnfo.overlayp;
dst = (DWORD*)((char *)dst + rnfo.pitch);
}
|