mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
Bit more implementation (nw)
This commit is contained in:
parent
84aa21184b
commit
32300be45d
@ -40,7 +40,7 @@ public:
|
||||
inline rgbaint_t() { }
|
||||
inline rgbaint_t(UINT32 rgba) { set(rgba); }
|
||||
inline rgbaint_t(UINT32 a, UINT32 r, UINT32 g, UINT32 b) { set(a, r, g, b); }
|
||||
inline rgbaint_t(rgb_t& rgba) { set(rgba); }
|
||||
inline rgbaint_t(rgb_t& rgb) { set(rgb); }
|
||||
|
||||
inline void set(rgbaint_t& other) { m_value = other.m_value; }
|
||||
inline void set(UINT32 rgba) { m_value = _mm_and_si128(_mm_set1_epi32(0xff), _mm_set_epi32(rgba >> 24, rgba >> 16, rgba >> 8, rgba)); }
|
||||
@ -143,22 +143,22 @@ public:
|
||||
return _mm_extract_epi16(m_value, 0);
|
||||
}
|
||||
|
||||
inline UINT16 get_a32()
|
||||
inline UINT32 get_a32()
|
||||
{
|
||||
return (_mm_extract_epi16(m_value, 7) << 16) | _mm_extract_epi16(m_value, 6);
|
||||
}
|
||||
|
||||
inline UINT16 get_r32()
|
||||
inline UINT32 get_r32()
|
||||
{
|
||||
return (_mm_extract_epi16(m_value, 5) << 16) | _mm_extract_epi16(m_value, 4);
|
||||
}
|
||||
|
||||
inline UINT16 get_g32()
|
||||
inline UINT32 get_g32()
|
||||
{
|
||||
return (_mm_extract_epi16(m_value, 3) << 16) | _mm_extract_epi16(m_value, 2);
|
||||
}
|
||||
|
||||
inline UINT16 get_b32()
|
||||
inline UINT32 get_b32()
|
||||
{
|
||||
return (_mm_extract_epi16(m_value, 1) << 16) | _mm_extract_epi16(m_value, 0);
|
||||
}
|
||||
@ -392,7 +392,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline void merge_alpha(rgbaint_t& alpha)
|
||||
inline void merge_alpha(const rgbaint_t& alpha)
|
||||
{
|
||||
m_value = _mm_insert_epi16(m_value, _mm_extract_epi16(alpha.m_value, 7), 7);
|
||||
m_value = _mm_insert_epi16(m_value, _mm_extract_epi16(alpha.m_value, 6), 6);
|
||||
|
@ -23,6 +23,7 @@ const rgbaint_t::VECU32 rgbaint_t::alpha_mask = { 0x00000000, 0xffffffff, 0xffff
|
||||
const rgbaint_t::VECU32 rgbaint_t::red_mask = { 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff };
|
||||
const rgbaint_t::VECU32 rgbaint_t::green_mask = { 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff };
|
||||
const rgbaint_t::VECU32 rgbaint_t::blue_mask = { 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000 };
|
||||
const rgbaint_t::VECU8 rgbaint_t::merge_aplha_perm = { 16, 17, 18, 19, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
|
||||
const rgbaint_t::VECU16 rgbaint_t::scale_table[256] = {
|
||||
{ 0, 256, 0, 256, 0, 256, 0, 256 }, { 1, 255, 1, 255, 1, 255, 1, 255 },
|
||||
{ 2, 254, 2, 254, 2, 254, 2, 254 }, { 3, 253, 3, 253, 3, 253, 3, 253 },
|
||||
|
@ -232,8 +232,8 @@ public:
|
||||
|
||||
inline void shl_imm_all(const UINT8 shift)
|
||||
{
|
||||
const vector unsigned char limit = { 128, 128, 128, 128, 128, 128, 128, 128 };
|
||||
const vector unsigned char temp = { shift, shift, shift, shift, shift, shift, shift, shift };
|
||||
const vector unsigned char limit = { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 };
|
||||
const vector unsigned char temp = { shift, shift, shift, shift, shift, shift, shift, shift, shift, shift, shift, shift, shift, shift, shift, shift };
|
||||
m_value = vec_and(vec_slo(m_value, temp), (vector unsigned int)vec_cmpgt(limit, temp));
|
||||
}
|
||||
|
||||
@ -252,8 +252,8 @@ public:
|
||||
|
||||
inline void shr_imm_all(const UINT8 shift)
|
||||
{
|
||||
const vector unsigned char limit = { 128, 128, 128, 128, 128, 128, 128, 128 };
|
||||
const vector unsigned char temp = { shift, shift, shift, shift, shift, shift, shift, shift };
|
||||
const vector unsigned char limit = { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 };
|
||||
const vector unsigned char temp = { shift, shift, shift, shift, shift, shift, shift, shift, shift, shift, shift, shift, shift, shift, shift, shift };
|
||||
m_value = vec_and(vec_sro(m_value, temp), (vector unsigned int)vec_cmpgt(limit, temp));
|
||||
}
|
||||
|
||||
@ -452,10 +452,9 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline void merge_alpha(rgbaint_t& alpha)
|
||||
inline void merge_alpha(const rgbaint_t& alpha)
|
||||
{
|
||||
m_value = _mm_insert_epi16(m_value, _mm_extract_epi16(alpha.m_value, 7), 7);
|
||||
m_value = _mm_insert_epi16(m_value, _mm_extract_epi16(alpha.m_value, 6), 6);
|
||||
m_value = vec_perm(m_value, alpha.m_value, merge_alpha_perm);
|
||||
}
|
||||
|
||||
static UINT32 bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v);
|
||||
@ -472,6 +471,7 @@ protected:
|
||||
static const VECU32 red_mask;
|
||||
static const VECU32 green_mask;
|
||||
static const VECU32 blue_mask;
|
||||
static const VECU8 merge_aplha_perm;
|
||||
static const VECU16 scale_table[256];
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user