summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/video/rgbsse.c
diff options
context:
space:
mode:
author therealmogminer@gmail.com <therealmogminer@gmail.com>2015-06-23 20:58:21 +0200
committer therealmogminer@gmail.com <therealmogminer@gmail.com>2015-06-23 21:02:59 +0200
commit1bef19e984cffcc052b0b3b9b57a6ecddde43e37 (patch)
tree8f44826909bc99102261fa80f857095d58a51cff /src/emu/video/rgbsse.c
parent0dcf906e4a9f3442e035a8d6f0d5efeb8f7ed513 (diff)
rdp-sse (nw) Proper fix for bilinear_filter
Diffstat (limited to 'src/emu/video/rgbsse.c')
-rw-r--r--src/emu/video/rgbsse.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/src/emu/video/rgbsse.c b/src/emu/video/rgbsse.c
index 2340c0a6925..b4e3701a187 100644
--- a/src/emu/video/rgbsse.c
+++ b/src/emu/video/rgbsse.c
@@ -14,7 +14,7 @@
#include "emu.h"
#include <emmintrin.h>
-#include "rgbutil.h"
+#include "rgbsse.h"
/***************************************************************************
HIGHER LEVEL OPERATIONS
@@ -32,6 +32,7 @@ void rgbaint_t::scale_and_clamp(const rgbaint_t& scale)
mul(scale);
shr(8);
min(255);
+ max(0);
}
void rgbaint_t::scale_imm_and_clamp(const INT32 scale)
@@ -39,11 +40,11 @@ void rgbaint_t::scale_imm_and_clamp(const INT32 scale)
mul_imm(scale);
shr(8);
min(255);
+ max(0);
}
void rgbaint_t::scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other, const rgbaint_t& scale2)
{
- mul(scale);
rgbaint_t color2(other);
color2.mul(scale2);
@@ -51,6 +52,7 @@ void rgbaint_t::scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& oth
add(color2);
shr(8);
min(255);
+ max(0);
}
void rgbaint_t::scale_imm_add_and_clamp(const INT32 scale, const rgbaint_t& other)
@@ -59,6 +61,7 @@ void rgbaint_t::scale_imm_add_and_clamp(const INT32 scale, const rgbaint_t& othe
add(other);
shr(8);
min(255);
+ max(0);
}
void rgbaint_t::scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other)
@@ -67,30 +70,7 @@ void rgbaint_t::scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& oth
add(other);
shr(8);
min(255);
-}
-
-UINT32 rgbaint_t::bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v)
-{
- __m128i color00 = _mm_cvtsi32_si128(rgb00);
- __m128i color01 = _mm_cvtsi32_si128(rgb01);
- __m128i color10 = _mm_cvtsi32_si128(rgb10);
- __m128i color11 = _mm_cvtsi32_si128(rgb11);
-
- /* interleave color01 and color00 at the byte level */
- color01 = _mm_unpacklo_epi8(color01, color00);
- color11 = _mm_unpacklo_epi8(color11, color10);
- color01 = _mm_unpacklo_epi8(color01, _mm_setzero_si128());
- color11 = _mm_unpacklo_epi8(color11, _mm_setzero_si128());
- color01 = _mm_madd_epi16(color01, *(__m128i *)&rgbsse_statics.scale_table[u][0]);
- color11 = _mm_madd_epi16(color11, *(__m128i *)&rgbsse_statics.scale_table[u][0]);
- color01 = _mm_slli_epi32(color01, 15);
- color11 = _mm_srli_epi32(color11, 1);
- color01 = _mm_max_epi16(color01, color11);
- color01 = _mm_madd_epi16(color01, *(__m128i *)&rgbsse_statics.scale_table[v][0]);
- color01 = _mm_srli_epi32(color01, 15);
- color01 = _mm_packs_epi32(color01, color01);
- color01 = _mm_packus_epi16(color01, color01);
- return _mm_cvtsi128_si32(color01);
+ max(0);
}
#endif // defined(__SSE2__) || defined(_MSC_VER)