diff options
author | 2016-11-19 05:35:54 +1100 | |
---|---|---|
committer | 2016-11-19 05:38:48 +1100 | |
commit | 8179a84458204a5e767446fcf7d10f032a40fd0c (patch) | |
tree | 16105e1667f811dcb24dbf0fc255166cb06df5c2 /src/emu/video | |
parent | 1b489fe83034072149fb0637b20c7ba57dc72a7a (diff) |
Introduce u8/u16/u32/u64/s8/s16/s32/s64
* New abbreviated types are in osd and util namespaces, and also in global namespace for things that #include "emu.h"
* Get rid of import of cstdint types to global namespace (C99 does this anyway)
* Remove the cstdint types from everything in emu
* Get rid of U64/S64 macros
* Fix a bug in dps16 caused by incorrect use of macro
* Fix debugcon not checking for "do " prefix case-insensitively
* Fix a lot of messed up tabulation
* More constexpr
* Fix up many __names
Diffstat (limited to 'src/emu/video')
-rw-r--r-- | src/emu/video/generic.h | 8 | ||||
-rw-r--r-- | src/emu/video/resnet.cpp | 10 | ||||
-rw-r--r-- | src/emu/video/resnet.h | 24 | ||||
-rw-r--r-- | src/emu/video/rgbgen.cpp | 50 | ||||
-rw-r--r-- | src/emu/video/rgbgen.h | 156 | ||||
-rw-r--r-- | src/emu/video/rgbsse.cpp | 4 | ||||
-rw-r--r-- | src/emu/video/rgbsse.h | 132 | ||||
-rw-r--r-- | src/emu/video/rgbvmx.cpp | 4 | ||||
-rw-r--r-- | src/emu/video/rgbvmx.h | 138 |
9 files changed, 263 insertions, 263 deletions
diff --git a/src/emu/video/generic.h b/src/emu/video/generic.h index 5f2ef27966c..3dbb717018d 100644 --- a/src/emu/video/generic.h +++ b/src/emu/video/generic.h @@ -8,10 +8,10 @@ *********************************************************************/ -#pragma once +#ifndef MAME_EMU_VIDEO_GENERIC_H +#define MAME_EMU_VIDEO_GENERIC_H -#ifndef __VIDEO_GENERIC_H__ -#define __VIDEO_GENERIC_H__ +#pragma once @@ -28,4 +28,4 @@ extern const gfx_layout gfx_8x8x6_planar; extern const gfx_layout gfx_16x16x4_planar; -#endif /* __VIDEO_GENERIC_H__ */ +#endif /* MAME_EMU_VIDEO_GENERIC_H */ diff --git a/src/emu/video/resnet.cpp b/src/emu/video/resnet.cpp index 1b467d016c4..f746f8448d6 100644 --- a/src/emu/video/resnet.cpp +++ b/src/emu/video/resnet.cpp @@ -449,7 +449,7 @@ int compute_res_net(int inputs, int channel, const res_net_info &di) { double rTotal=0.0; double v = 0; - int i; + int i; double vBias = di.rgb[channel].vBias; double vOH = di.vOH; @@ -459,7 +459,7 @@ int compute_res_net(int inputs, int channel, const res_net_info &di) double vcc = di.vcc; double ttlHRes = 0; double rGnd = di.rgb[channel].rGnd; - uint8_t OpenCol = di.OpenCol; + u8 OpenCol = di.OpenCol; /* Global options */ @@ -692,15 +692,15 @@ int compute_res_net(int inputs, int channel, const res_net_info &di) return (int) (v * 255 / vcc + 0.4); } -void compute_res_net_all(std::vector<rgb_t> &rgb, const uint8_t *prom, const res_net_decode_info &rdi, const res_net_info &di) +void compute_res_net_all(std::vector<rgb_t> &rgb, const u8 *prom, const res_net_decode_info &rdi, const res_net_info &di) { - uint8_t r,g,b; + u8 r,g,b; int i,j,k; rgb.resize(rdi.end - rdi.start + 1); for (i=rdi.start; i<=rdi.end; i++) { - uint8_t t[3] = {0,0,0}; + u8 t[3] = {0,0,0}; int s; for (j=0;j<rdi.numcomp;j++) for (k=0; k<3; k++) diff --git a/src/emu/video/resnet.h b/src/emu/video/resnet.h index 28e0b6b76e6..297da2e7db0 100644 --- a/src/emu/video/resnet.h +++ b/src/emu/video/resnet.h @@ -8,10 +8,10 @@ *****************************************************************************/ -#pragma once +#ifndef MAME_EMU_VIDEO_RESNET_H +#define MAME_EMU_VIDEO_RESNET_H -#ifndef _RESNET_H_ -#define _RESNET_H_ +#pragma once /********************************************************************** * Rbias @@ -95,7 +95,7 @@ struct res_net_channel_info { // per channel options - uint32_t options; + u32 options; // Pullup resistor value in Ohms double rBias; // Pulldown resistor value in Ohms @@ -104,7 +104,7 @@ struct res_net_channel_info { int num; // Resistor values // - Least significant bit first - double R[8]; + double R[8]; // Minimum output voltage // - Applicable if output is routed through a complimentary // - darlington circuit @@ -121,7 +121,7 @@ struct res_net_channel_info { struct res_net_info { // global options - uint32_t options; + u32 options; // The three color channels res_net_channel_info rgb[3]; // Supply Voltage @@ -136,7 +136,7 @@ struct res_net_info { // - CMOS: 0.05V (@5v vcc) double vOH; // Open Collector flag - uint8_t OpenCol; + u8 OpenCol; }; #define RES_NET_MAX_COMP 3 @@ -145,9 +145,9 @@ struct res_net_decode_info { int numcomp; int start; int end; - uint16_t offset[3 * RES_NET_MAX_COMP]; - int16_t shift[3 * RES_NET_MAX_COMP]; - uint16_t mask[3 * RES_NET_MAX_COMP]; + u16 offset[3 * RES_NET_MAX_COMP]; + s16 shift[3 * RES_NET_MAX_COMP]; + u16 mask[3 * RES_NET_MAX_COMP]; }; /* return a single value for one channel */ @@ -156,7 +156,7 @@ int compute_res_net(int inputs, int channel, const res_net_info &di); /* compute all values */ -void compute_res_net_all(std::vector<rgb_t> &rgb, const uint8_t *prom, const res_net_decode_info &rdi, const res_net_info &di); +void compute_res_net_all(std::vector<rgb_t> &rgb, const u8 *prom, const res_net_decode_info &rdi, const res_net_info &di); /* legacy interface */ @@ -196,4 +196,4 @@ double compute_resistor_net_outputs( -#endif /*_RESNET_H_*/ +#endif /* MAME_EMU_VIDEO_RESNET_H */ diff --git a/src/emu/video/rgbgen.cpp b/src/emu/video/rgbgen.cpp index ef55504d90c..09b27090887 100644 --- a/src/emu/video/rgbgen.cpp +++ b/src/emu/video/rgbgen.cpp @@ -22,10 +22,10 @@ scale factor -------------------------------------------------*/ -void rgbaint_t::blend(const rgbaint_t& color2, uint8_t color1scale) +void rgbaint_t::blend(const rgbaint_t& color2, u8 color1scale) { - int32_t scale1 = (int32_t)color1scale; - int32_t scale2 = 256 - scale1; + s32 scale1 = s32(color1scale); + s32 scale2 = 256 - scale1; m_a = (m_a * scale1 + color2.m_a * scale2) >> 8; m_r = (m_r * scale1 + color2.m_r * scale2) >> 8; @@ -44,7 +44,7 @@ void rgbaint_t::blend(const rgbaint_t& color2, uint8_t color1scale) per channel, and clamp to byte values -------------------------------------------------*/ -void rgbaint_t::scale_imm_and_clamp(int32_t scale) +void rgbaint_t::scale_imm_and_clamp(s32 scale) { m_a = (m_a * scale) >> 8; m_r = (m_r * scale) >> 8; @@ -54,10 +54,10 @@ void rgbaint_t::scale_imm_and_clamp(int32_t scale) m_r |= (m_r & 0x00800000) ? 0xff000000 : 0; m_g |= (m_g & 0x00800000) ? 0xff000000 : 0; m_b |= (m_b & 0x00800000) ? 0xff000000 : 0; - if ((uint32_t)m_a > 255) { m_a = (m_a < 0) ? 0 : 255; } - if ((uint32_t)m_r > 255) { m_r = (m_r < 0) ? 0 : 255; } - if ((uint32_t)m_g > 255) { m_g = (m_g < 0) ? 0 : 255; } - if ((uint32_t)m_b > 255) { m_b = (m_b < 0) ? 0 : 255; } + if (u32(m_a) > 255) { m_a = (m_a < 0) ? 0 : 255; } + if (u32(m_r) > 255) { m_r = (m_r < 0) ? 0 : 255; } + if (u32(m_g) > 255) { m_g = (m_g < 0) ? 0 : 255; } + if (u32(m_b) > 255) { m_b = (m_b < 0) ? 0 : 255; } } void rgbaint_t::scale_and_clamp(const rgbaint_t& scale) @@ -70,14 +70,14 @@ void rgbaint_t::scale_and_clamp(const rgbaint_t& scale) m_r |= (m_r & 0x00800000) ? 0xff000000 : 0; m_g |= (m_g & 0x00800000) ? 0xff000000 : 0; m_b |= (m_b & 0x00800000) ? 0xff000000 : 0; - if ((uint32_t)m_a > 255) { m_a = (m_a < 0) ? 0 : 255; } - if ((uint32_t)m_r > 255) { m_r = (m_r < 0) ? 0 : 255; } - if ((uint32_t)m_g > 255) { m_g = (m_g < 0) ? 0 : 255; } - if ((uint32_t)m_b > 255) { m_b = (m_b < 0) ? 0 : 255; } + if (u32(m_a) > 255) { m_a = (m_a < 0) ? 0 : 255; } + if (u32(m_r) > 255) { m_r = (m_r < 0) ? 0 : 255; } + if (u32(m_g) > 255) { m_g = (m_g < 0) ? 0 : 255; } + if (u32(m_b) > 255) { m_b = (m_b < 0) ? 0 : 255; } } -void rgbaint_t::scale_imm_add_and_clamp(int32_t scale, const rgbaint_t& other) +void rgbaint_t::scale_imm_add_and_clamp(s32 scale, const rgbaint_t& other) { m_a = (m_a * scale) >> 8; m_r = (m_r * scale) >> 8; @@ -91,10 +91,10 @@ void rgbaint_t::scale_imm_add_and_clamp(int32_t scale, const rgbaint_t& other) m_r += other.m_r; m_g += other.m_g; m_b += other.m_b; - if ((uint32_t)m_a > 255) { m_a = (m_a < 0) ? 0 : 255; } - if ((uint32_t)m_r > 255) { m_r = (m_r < 0) ? 0 : 255; } - if ((uint32_t)m_g > 255) { m_g = (m_g < 0) ? 0 : 255; } - if ((uint32_t)m_b > 255) { m_b = (m_b < 0) ? 0 : 255; } + if (u32(m_a) > 255) { m_a = (m_a < 0) ? 0 : 255; } + if (u32(m_r) > 255) { m_r = (m_r < 0) ? 0 : 255; } + if (u32(m_g) > 255) { m_g = (m_g < 0) ? 0 : 255; } + if (u32(m_b) > 255) { m_b = (m_b < 0) ? 0 : 255; } } void rgbaint_t::scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other) @@ -111,10 +111,10 @@ void rgbaint_t::scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& oth m_r += other.m_r; m_g += other.m_g; m_b += other.m_b; - if ((uint32_t)m_a > 255) { m_a = (m_a < 0) ? 0 : 255; } - if ((uint32_t)m_r > 255) { m_r = (m_r < 0) ? 0 : 255; } - if ((uint32_t)m_g > 255) { m_g = (m_g < 0) ? 0 : 255; } - if ((uint32_t)m_b > 255) { m_b = (m_b < 0) ? 0 : 255; } + if (u32(m_a) > 255) { m_a = (m_a < 0) ? 0 : 255; } + if (u32(m_r) > 255) { m_r = (m_r < 0) ? 0 : 255; } + if (u32(m_g) > 255) { m_g = (m_g < 0) ? 0 : 255; } + if (u32(m_b) > 255) { m_b = (m_b < 0) ? 0 : 255; } } void rgbaint_t::scale2_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other, const rgbaint_t& scale2) @@ -127,10 +127,10 @@ void rgbaint_t::scale2_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& ot m_r |= (m_r & 0x00800000) ? 0xff000000 : 0; m_g |= (m_g & 0x00800000) ? 0xff000000 : 0; m_b |= (m_b & 0x00800000) ? 0xff000000 : 0; - if ((uint32_t)m_a > 255) { m_a = (m_a < 0) ? 0 : 255; } - if ((uint32_t)m_r > 255) { m_r = (m_r < 0) ? 0 : 255; } - if ((uint32_t)m_g > 255) { m_g = (m_g < 0) ? 0 : 255; } - if ((uint32_t)m_b > 255) { m_b = (m_b < 0) ? 0 : 255; } + if (u32(m_a) > 255) { m_a = (m_a < 0) ? 0 : 255; } + if (u32(m_r) > 255) { m_r = (m_r < 0) ? 0 : 255; } + if (u32(m_g) > 255) { m_g = (m_g < 0) ? 0 : 255; } + if (u32(m_b) > 255) { m_b = (m_b < 0) ? 0 : 255; } } #endif // !defined(__ALTIVEC__) diff --git a/src/emu/video/rgbgen.h b/src/emu/video/rgbgen.h index 66dac76aa53..197769946a8 100644 --- a/src/emu/video/rgbgen.h +++ b/src/emu/video/rgbgen.h @@ -20,16 +20,16 @@ class rgbaint_t { public: rgbaint_t(): m_a(0), m_r(0), m_g(0), m_b(0) { } - explicit rgbaint_t(uint32_t rgba) { set(rgba); } - rgbaint_t(int32_t a, int32_t r, int32_t g, int32_t b) { set(a, r, g, b); } + explicit rgbaint_t(u32 rgba) { set(rgba); } + rgbaint_t(s32 a, s32 r, s32 g, s32 b) { set(a, r, g, b); } explicit rgbaint_t(const rgb_t& rgba) { set(rgba); } rgbaint_t(const rgbaint_t& other) = default; rgbaint_t &operator=(const rgbaint_t& other) = default; void set(const rgbaint_t& other) { set(other.m_a, other.m_r, other.m_g, other.m_b); } - void set(uint32_t rgba) { set((rgba >> 24) & 0xff, (rgba >> 16) & 0xff, (rgba >> 8) & 0xff, rgba & 0xff); } - void set(int32_t a, int32_t r, int32_t g, int32_t b) + void set(u32 rgba) { set((rgba >> 24) & 0xff, (rgba >> 16) & 0xff, (rgba >> 8) & 0xff, rgba & 0xff); } + void set(s32 a, s32 r, s32 g, s32 b) { m_a = a; m_r = r; @@ -42,39 +42,39 @@ public: rgb_t to_rgba_clamp() const { - const uint8_t a = (m_a < 0) ? 0 : (m_a > 255) ? 255 : m_a; - const uint8_t r = (m_r < 0) ? 0 : (m_r > 255) ? 255 : m_r; - const uint8_t g = (m_g < 0) ? 0 : (m_g > 255) ? 255 : m_g; - const uint8_t b = (m_b < 0) ? 0 : (m_b > 255) ? 255 : m_b; + const u8 a = (m_a < 0) ? 0 : (m_a > 255) ? 255 : m_a; + const u8 r = (m_r < 0) ? 0 : (m_r > 255) ? 255 : m_r; + const u8 g = (m_g < 0) ? 0 : (m_g > 255) ? 255 : m_g; + const u8 b = (m_b < 0) ? 0 : (m_b > 255) ? 255 : m_b; return rgb_t(a, r, g, b); } - void set_a(const int32_t value) { m_a = value; } - void set_r(const int32_t value) { m_r = value; } - void set_g(const int32_t value) { m_g = value; } - void set_b(const int32_t value) { m_b = value; } + void set_a(const s32 value) { m_a = value; } + void set_r(const s32 value) { m_r = value; } + void set_g(const s32 value) { m_g = value; } + void set_b(const s32 value) { m_b = value; } - uint8_t get_a() const { return uint8_t(uint32_t(m_a)); } - uint8_t get_r() const { return uint8_t(uint32_t(m_r)); } - uint8_t get_g() const { return uint8_t(uint32_t(m_g)); } - uint8_t get_b() const { return uint8_t(uint32_t(m_b)); } + u8 get_a() const { return u8(u32(m_a)); } + u8 get_r() const { return u8(u32(m_r)); } + u8 get_g() const { return u8(u32(m_g)); } + u8 get_b() const { return u8(u32(m_b)); } - int32_t get_a32() const { return m_a; } - int32_t get_r32() const { return m_r; } - int32_t get_g32() const { return m_g; } - int32_t get_b32() const { return m_b; } + s32 get_a32() const { return m_a; } + s32 get_r32() const { return m_r; } + s32 get_g32() const { return m_g; } + s32 get_b32() const { return m_b; } inline void add(const rgbaint_t& color) { add_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); } - inline void add_imm(const int32_t imm) + inline void add_imm(const s32 imm) { add_imm_rgba(imm, imm, imm, imm); } - inline void add_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void add_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { m_a += a; m_r += r; @@ -87,12 +87,12 @@ public: sub_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); } - inline void sub_imm(const int32_t imm) + inline void sub_imm(const s32 imm) { sub_imm_rgba(imm, imm, imm, imm); } - inline void sub_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void sub_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { m_a -= a; m_r -= r; @@ -105,12 +105,12 @@ public: subr_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); } - inline void subr_imm(const int32_t imm) + inline void subr_imm(const s32 imm) { subr_imm_rgba(imm, imm, imm, imm); } - inline void subr_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void subr_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { m_a = a - m_a; m_r = r - m_r; @@ -123,12 +123,12 @@ public: mul_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); } - inline void mul_imm(const int32_t imm) + inline void mul_imm(const s32 imm) { mul_imm_rgba(imm, imm, imm, imm); } - inline void mul_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void mul_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { m_a *= a; m_r *= r; @@ -144,7 +144,7 @@ public: m_b <<= shift.m_b; } - inline void shl_imm(const uint8_t shift) + inline void shl_imm(const u8 shift) { if (shift == 0) return; @@ -157,21 +157,21 @@ public: inline void shr(const rgbaint_t& shift) { - m_a = int32_t(uint32_t(m_a) >> shift.m_a); - m_r = int32_t(uint32_t(m_r) >> shift.m_r); - m_g = int32_t(uint32_t(m_g) >> shift.m_g); - m_b = int32_t(uint32_t(m_b) >> shift.m_b); + m_a = s32(u32(m_a) >> shift.m_a); + m_r = s32(u32(m_r) >> shift.m_r); + m_g = s32(u32(m_g) >> shift.m_g); + m_b = s32(u32(m_b) >> shift.m_b); } - inline void shr_imm(const uint8_t shift) + inline void shr_imm(const u8 shift) { if (shift == 0) return; - m_a = int32_t(uint32_t(m_a) >> shift); - m_r = int32_t(uint32_t(m_r) >> shift); - m_g = int32_t(uint32_t(m_g) >> shift); - m_b = int32_t(uint32_t(m_b) >> shift); + m_a = s32(u32(m_a) >> shift); + m_r = s32(u32(m_r) >> shift); + m_g = s32(u32(m_g) >> shift); + m_b = s32(u32(m_b) >> shift); } inline void sra(const rgbaint_t& shift) @@ -193,10 +193,10 @@ public: m_b |= ~0 << (32 - shift.m_b); } - inline void sra_imm(const uint8_t shift) + inline void sra_imm(const u8 shift) { - const uint32_t high_bit = 1 << (31 - shift); - const uint32_t high_mask = ~0 << (32 - shift); + const u32 high_bit = 1 << (31 - shift); + const u32 high_mask = ~0 << (32 - shift); m_a >>= shift; if (m_a & high_bit) @@ -221,11 +221,11 @@ public: void andnot_reg(const rgbaint_t& color) { and_imm_rgba(~color.m_a, ~color.m_r, ~color.m_g, ~color.m_b); } - void or_imm(int32_t imm) { or_imm_rgba(imm, imm, imm, imm); } - void and_imm(int32_t imm) { and_imm_rgba(imm, imm, imm, imm); } - void xor_imm(int32_t imm) { xor_imm_rgba(imm, imm, imm, imm); } + void or_imm(s32 imm) { or_imm_rgba(imm, imm, imm, imm); } + void and_imm(s32 imm) { and_imm_rgba(imm, imm, imm, imm); } + void xor_imm(s32 imm) { xor_imm_rgba(imm, imm, imm, imm); } - inline void or_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void or_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { m_a |= a; m_r |= r; @@ -233,7 +233,7 @@ public: m_b |= b; } - inline void and_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void and_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { m_a &= a; m_r &= r; @@ -241,7 +241,7 @@ public: m_b &= b; } - inline void xor_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void xor_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { m_a ^= a; m_r ^= r; @@ -249,7 +249,7 @@ public: m_b ^= b; } - inline void clamp_and_clear(const uint32_t sign) + inline void clamp_and_clear(const u32 sign) { if (m_a & sign) m_a = 0; if (m_r & sign) m_r = 0; @@ -267,7 +267,7 @@ public: m_b = (m_b < 0) ? 0 : (m_b > 255) ? 255 : m_b; } - inline void sign_extend(const uint32_t compare, const uint32_t sign) + inline void sign_extend(const u32 compare, const u32 sign) { if ((m_a & compare) == compare) m_a |= sign; @@ -282,7 +282,7 @@ public: m_b |= sign; } - inline void min(const int32_t value) + inline void min(const s32 value) { m_a = (m_a > value) ? value : m_a; m_r = (m_r > value) ? value : m_r; @@ -290,7 +290,7 @@ public: m_b = (m_b > value) ? value : m_b; } - inline void max(const int32_t value) + inline void max(const s32 value) { m_a = (m_a < value) ? value : m_a; m_r = (m_r < value) ? value : m_r; @@ -298,23 +298,23 @@ public: m_b = (m_b < value) ? value : m_b; } - void blend(const rgbaint_t& other, uint8_t factor); + void blend(const rgbaint_t& other, u8 factor); void scale_and_clamp(const rgbaint_t& scale); - void scale_imm_and_clamp(const int32_t scale); + void scale_imm_and_clamp(const s32 scale); void scale2_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other, const rgbaint_t& scale2); void scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other); - void scale_imm_add_and_clamp(const int32_t scale, const rgbaint_t& other); + void scale_imm_add_and_clamp(const s32 scale, const rgbaint_t& other); void cmpeq(const rgbaint_t& value) { cmpeq_imm_rgba(value.m_a, value.m_r, value.m_g, value.m_b); } void cmpgt(const rgbaint_t& value) { cmpgt_imm_rgba(value.m_a, value.m_r, value.m_g, value.m_b); } void cmplt(const rgbaint_t& value) { cmplt_imm_rgba(value.m_a, value.m_r, value.m_g, value.m_b); } - void cmpeq_imm(int32_t value) { cmpeq_imm_rgba(value, value, value, value); } - void cmpgt_imm(int32_t value) { cmpgt_imm_rgba(value, value, value, value); } - void cmplt_imm(int32_t value) { cmplt_imm_rgba(value, value, value, value); } + void cmpeq_imm(s32 value) { cmpeq_imm_rgba(value, value, value, value); } + void cmpgt_imm(s32 value) { cmpgt_imm_rgba(value, value, value, value); } + void cmplt_imm(s32 value) { cmplt_imm_rgba(value, value, value, value); } - void cmpeq_imm_rgba(int32_t a, int32_t r, int32_t g, int32_t b) + void cmpeq_imm_rgba(s32 a, s32 r, s32 g, s32 b) { m_a = (m_a == a) ? 0xffffffff : 0; m_r = (m_r == r) ? 0xffffffff : 0; @@ -322,7 +322,7 @@ public: m_b = (m_b == b) ? 0xffffffff : 0; } - void cmpgt_imm_rgba(int32_t a, int32_t r, int32_t g, int32_t b) + void cmpgt_imm_rgba(s32 a, s32 r, s32 g, s32 b) { m_a = (m_a > a) ? 0xffffffff : 0; m_r = (m_r > r) ? 0xffffffff : 0; @@ -330,7 +330,7 @@ public: m_b = (m_b > b) ? 0xffffffff : 0; } - void cmplt_imm_rgba(int32_t a, int32_t r, int32_t g, int32_t b) + void cmplt_imm_rgba(s32 a, s32 r, s32 g, s32 b) { m_a = (m_a < a) ? 0xffffffff : 0; m_r = (m_r < r) ? 0xffffffff : 0; @@ -349,7 +349,7 @@ public: return *this; } - rgbaint_t& operator+=(const int32_t other) + rgbaint_t& operator+=(const s32 other) { add_imm_rgba(other, other, other, other); return *this; @@ -367,30 +367,30 @@ public: return *this; } - rgbaint_t& operator*=(const int32_t other) + rgbaint_t& operator*=(const s32 other) { mul_imm_rgba(other, other, other, other); return *this; } - rgbaint_t& operator>>=(const int32_t shift) + rgbaint_t& operator>>=(const s32 shift) { sra_imm(shift); return *this; } - static uint32_t bilinear_filter(uint32_t rgb00, uint32_t rgb01, uint32_t rgb10, uint32_t rgb11, uint8_t u, uint8_t v) + static u32 bilinear_filter(u32 rgb00, u32 rgb01, u32 rgb10, u32 rgb11, u8 u, u8 v) { - uint32_t rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); - uint32_t rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); + u32 rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); + u32 rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); rgb00 >>= 8; rgb01 >>= 8; rgb10 >>= 8; rgb11 >>= 8; - uint32_t ag0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); - uint32_t ag1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); + u32 ag0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); + u32 ag1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); rb0 = (rb0 & 0x00ff00ff) + ((((rb1 & 0x00ff00ff) - (rb0 & 0x00ff00ff)) * v) >> 8); ag0 = (ag0 & 0x00ff00ff) + ((((ag1 & 0x00ff00ff) - (ag0 & 0x00ff00ff)) * v) >> 8); @@ -398,31 +398,31 @@ public: return ((ag0 << 8) & 0xff00ff00) | (rb0 & 0x00ff00ff); } - void bilinear_filter_rgbaint(uint32_t rgb00, uint32_t rgb01, uint32_t rgb10, uint32_t rgb11, uint8_t u, uint8_t v) + void bilinear_filter_rgbaint(u32 rgb00, u32 rgb01, u32 rgb10, u32 rgb11, u8 u, u8 v) { - uint32_t rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); - uint32_t rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); + u32 rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); + u32 rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); rgb00 >>= 8; rgb01 >>= 8; rgb10 >>= 8; rgb11 >>= 8; - uint32_t ag0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); - uint32_t ag1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); + u32 ag0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); + u32 ag1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); rb0 = (rb0 & 0x00ff00ff) + ((((rb1 & 0x00ff00ff) - (rb0 & 0x00ff00ff)) * v) >> 8); ag0 = (ag0 & 0x00ff00ff) + ((((ag1 & 0x00ff00ff) - (ag0 & 0x00ff00ff)) * v) >> 8); - uint32_t result = ((ag0 << 8) & 0xff00ff00) | (rb0 & 0x00ff00ff); + u32 result = ((ag0 << 8) & 0xff00ff00) | (rb0 & 0x00ff00ff); this->set(result); } protected: - int32_t m_a; - int32_t m_r; - int32_t m_g; - int32_t m_b; + s32 m_a; + s32 m_r; + s32 m_g; + s32 m_b; }; #endif // MAME_EMU_VIDEO_RGBGEN_H diff --git a/src/emu/video/rgbsse.cpp b/src/emu/video/rgbsse.cpp index 87c4f7b33e0..35ea6a1948f 100644 --- a/src/emu/video/rgbsse.cpp +++ b/src/emu/video/rgbsse.cpp @@ -164,7 +164,7 @@ const struct rgbaint_t::_statics rgbaint_t::statics = HIGHER LEVEL OPERATIONS ***************************************************************************/ -void rgbaint_t::blend(const rgbaint_t& other, uint8_t factor) +void rgbaint_t::blend(const rgbaint_t& other, u8 factor) { const __m128i scale1 = _mm_set1_epi32(factor); const rgbaint_t scale2(_mm_sub_epi32(_mm_set1_epi32(0x100), scale1)); @@ -184,7 +184,7 @@ void rgbaint_t::scale_and_clamp(const rgbaint_t& scale) clamp_to_uint8(); } -void rgbaint_t::scale_imm_and_clamp(const int32_t scale) +void rgbaint_t::scale_imm_and_clamp(const s32 scale) { mul_imm(scale); sra_imm(8); diff --git a/src/emu/video/rgbsse.h b/src/emu/video/rgbsse.h index 521000f4488..83028f894d2 100644 --- a/src/emu/video/rgbsse.h +++ b/src/emu/video/rgbsse.h @@ -29,8 +29,8 @@ class rgbaint_t { public: rgbaint_t() { } - explicit rgbaint_t(uint32_t rgba) { set(rgba); } - rgbaint_t(int32_t a, int32_t r, int32_t g, int32_t b) { set(a, r, g, b); } + explicit rgbaint_t(u32 rgba) { set(rgba); } + rgbaint_t(s32 a, s32 r, s32 g, s32 b) { set(a, r, g, b); } explicit rgbaint_t(const rgb_t& rgb) { set(rgb); } explicit rgbaint_t(__m128i rgba) { m_value = rgba; } @@ -38,8 +38,8 @@ public: rgbaint_t &operator=(const rgbaint_t& other) = default; void set(const rgbaint_t& other) { m_value = other.m_value; } - void set(uint32_t rgba) { m_value = _mm_and_si128(_mm_set1_epi32(0xff), _mm_set_epi32(rgba >> 24, rgba >> 16, rgba >> 8, rgba)); } - void set(int32_t a, int32_t r, int32_t g, int32_t b) { m_value = _mm_set_epi32(a, r, g, b); } + void set(u32 rgba) { m_value = _mm_and_si128(_mm_set1_epi32(0xff), _mm_set_epi32(rgba >> 24, rgba >> 16, rgba >> 8, rgba)); } + void set(s32 a, s32 r, s32 g, s32 b) { m_value = _mm_set_epi32(a, r, g, b); } void set(const rgb_t& rgb) { m_value = _mm_unpacklo_epi16(_mm_unpacklo_epi8(_mm_cvtsi32_si128(rgb), _mm_setzero_si128()), _mm_setzero_si128()); } inline rgb_t to_rgba() const @@ -53,32 +53,32 @@ public: } #ifdef __SSE4_1__ - void set_a(const int32_t value) { m_value = _mm_insert_epi32(m_value, value, 3); } - void set_r(const int32_t value) { m_value = _mm_insert_epi32(m_value, value, 2); } - void set_g(const int32_t value) { m_value = _mm_insert_epi32(m_value, value, 1); } - void set_b(const int32_t value) { m_value = _mm_insert_epi32(m_value, value, 0); } + void set_a(const s32 value) { m_value = _mm_insert_epi32(m_value, value, 3); } + void set_r(const s32 value) { m_value = _mm_insert_epi32(m_value, value, 2); } + void set_g(const s32 value) { m_value = _mm_insert_epi32(m_value, value, 1); } + void set_b(const s32 value) { m_value = _mm_insert_epi32(m_value, value, 0); } #else - void set_a(const int32_t value) { m_value = _mm_or_si128(_mm_and_si128(m_value, alpha_mask()), _mm_set_epi32(value, 0, 0, 0)); } - void set_r(const int32_t value) { m_value = _mm_or_si128(_mm_and_si128(m_value, red_mask()), _mm_set_epi32(0, value, 0, 0)); } - void set_g(const int32_t value) { m_value = _mm_or_si128(_mm_and_si128(m_value, green_mask()), _mm_set_epi32(0, 0, value, 0)); } - void set_b(const int32_t value) { m_value = _mm_or_si128(_mm_and_si128(m_value, blue_mask()), _mm_set_epi32(0, 0, 0, value)); } + void set_a(const s32 value) { m_value = _mm_or_si128(_mm_and_si128(m_value, alpha_mask()), _mm_set_epi32(value, 0, 0, 0)); } + void set_r(const s32 value) { m_value = _mm_or_si128(_mm_and_si128(m_value, red_mask()), _mm_set_epi32(0, value, 0, 0)); } + void set_g(const s32 value) { m_value = _mm_or_si128(_mm_and_si128(m_value, green_mask()), _mm_set_epi32(0, 0, value, 0)); } + void set_b(const s32 value) { m_value = _mm_or_si128(_mm_and_si128(m_value, blue_mask()), _mm_set_epi32(0, 0, 0, value)); } #endif - uint8_t get_a() const { return uint8_t(unsigned(_mm_extract_epi16(m_value, 6))); } - uint8_t get_r() const { return uint8_t(unsigned(_mm_extract_epi16(m_value, 4))); } - uint8_t get_g() const { return uint8_t(unsigned(_mm_extract_epi16(m_value, 2))); } - uint8_t get_b() const { return uint8_t(unsigned(_mm_extract_epi16(m_value, 0))); } + u8 get_a() const { return u8(unsigned(_mm_extract_epi16(m_value, 6))); } + u8 get_r() const { return u8(unsigned(_mm_extract_epi16(m_value, 4))); } + u8 get_g() const { return u8(unsigned(_mm_extract_epi16(m_value, 2))); } + u8 get_b() const { return u8(unsigned(_mm_extract_epi16(m_value, 0))); } #ifdef __SSE4_1__ - int32_t get_a32() const { return _mm_extract_epi32(m_value, 3); } - int32_t get_r32() const { return _mm_extract_epi32(m_value, 2); } - int32_t get_g32() const { return _mm_extract_epi32(m_value, 1); } - int32_t get_b32() const { return _mm_extract_epi32(m_value, 0); } + s32 get_a32() const { return _mm_extract_epi32(m_value, 3); } + s32 get_r32() const { return _mm_extract_epi32(m_value, 2); } + s32 get_g32() const { return _mm_extract_epi32(m_value, 1); } + s32 get_b32() const { return _mm_extract_epi32(m_value, 0); } #else - int32_t get_a32() const { return (_mm_extract_epi16(m_value, 7) << 16) | _mm_extract_epi16(m_value, 6); } - int32_t get_r32() const { return (_mm_extract_epi16(m_value, 5) << 16) | _mm_extract_epi16(m_value, 4); } - int32_t get_g32() const { return (_mm_extract_epi16(m_value, 3) << 16) | _mm_extract_epi16(m_value, 2); } - int32_t get_b32() const { return (_mm_extract_epi16(m_value, 1) << 16) | _mm_extract_epi16(m_value, 0); } + s32 get_a32() const { return (_mm_extract_epi16(m_value, 7) << 16) | _mm_extract_epi16(m_value, 6); } + s32 get_r32() const { return (_mm_extract_epi16(m_value, 5) << 16) | _mm_extract_epi16(m_value, 4); } + s32 get_g32() const { return (_mm_extract_epi16(m_value, 3) << 16) | _mm_extract_epi16(m_value, 2); } + s32 get_b32() const { return (_mm_extract_epi16(m_value, 1) << 16) | _mm_extract_epi16(m_value, 0); } #endif inline void add(const rgbaint_t& color2) @@ -86,12 +86,12 @@ public: m_value = _mm_add_epi32(m_value, color2.m_value); } - inline void add_imm(const int32_t imm) + inline void add_imm(const s32 imm) { m_value = _mm_add_epi32(m_value, _mm_set1_epi32(imm)); } - inline void add_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void add_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { m_value = _mm_add_epi32(m_value, _mm_set_epi32(a, r, g, b)); } @@ -101,12 +101,12 @@ public: m_value = _mm_sub_epi32(m_value, color2.m_value); } - inline void sub_imm(const int32_t imm) + inline void sub_imm(const s32 imm) { m_value = _mm_sub_epi32(m_value, _mm_set1_epi32(imm)); } - inline void sub_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void sub_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { m_value = _mm_sub_epi32(m_value, _mm_set_epi32(a, r, g, b)); } @@ -116,12 +116,12 @@ public: m_value = _mm_sub_epi32(color2.m_value, m_value); } - inline void subr_imm(const int32_t imm) + inline void subr_imm(const s32 imm) { m_value = _mm_sub_epi32(_mm_set1_epi32(imm), m_value); } - inline void subr_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void subr_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { m_value = _mm_sub_epi32(_mm_set_epi32(a, r, g, b), m_value); } @@ -133,7 +133,7 @@ public: m_value = _mm_unpacklo_epi32(_mm_shuffle_epi32(tmp1, _MM_SHUFFLE(0, 0, 2, 0)), _mm_shuffle_epi32(tmp2, _MM_SHUFFLE(0, 0, 2, 0))); } - inline void mul_imm(const int32_t imm) + inline void mul_imm(const s32 imm) { __m128i immv = _mm_set1_epi32(imm); __m128i tmp1 = _mm_mul_epu32(m_value, immv); @@ -141,7 +141,7 @@ public: m_value = _mm_unpacklo_epi32(_mm_shuffle_epi32(tmp1, _MM_SHUFFLE(0, 0, 2, 0)), _mm_shuffle_epi32(tmp2, _MM_SHUFFLE(0, 0, 2, 0))); } - inline void mul_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void mul_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { __m128i immv = _mm_set_epi32(a, r, g, b); __m128i tmp1 = _mm_mul_epu32(m_value, immv); @@ -166,7 +166,7 @@ public: set(areg.get_a32(), rreg.get_r32(), greg.get_g32(), breg.get_b32()); } - inline void shl_imm(const uint8_t shift) + inline void shl_imm(const u8 shift) { m_value = _mm_slli_epi32(m_value, shift); } @@ -188,7 +188,7 @@ public: set(areg.get_a32(), rreg.get_r32(), greg.get_g32(), breg.get_b32()); } - inline void shr_imm(const uint8_t shift) + inline void shr_imm(const u8 shift) { m_value = _mm_srli_epi32(m_value, shift); } @@ -210,7 +210,7 @@ public: set(areg.get_a32(), rreg.get_r32(), greg.get_g32(), breg.get_b32()); } - inline void sra_imm(const uint8_t shift) + inline void sra_imm(const u8 shift) { m_value = _mm_srai_epi32(m_value, shift); } @@ -221,15 +221,15 @@ public: void andnot_reg(const rgbaint_t& color2) { m_value = _mm_andnot_si128(color2.m_value, m_value); } - void or_imm(int32_t value) { m_value = _mm_or_si128(m_value, _mm_set1_epi32(value)); } - void and_imm(int32_t value) { m_value = _mm_and_si128(m_value, _mm_set1_epi32(value)); } - void xor_imm(int32_t value) { m_value = _mm_xor_si128(m_value, _mm_set1_epi32(value)); } + void or_imm(s32 value) { m_value = _mm_or_si128(m_value, _mm_set1_epi32(value)); } + void and_imm(s32 value) { m_value = _mm_and_si128(m_value, _mm_set1_epi32(value)); } + void xor_imm(s32 value) { m_value = _mm_xor_si128(m_value, _mm_set1_epi32(value)); } - void or_imm_rgba(int32_t a, int32_t r, int32_t g, int32_t b) { m_value = _mm_or_si128(m_value, _mm_set_epi32(a, r, g, b)); } - void and_imm_rgba(int32_t a, int32_t r, int32_t g, int32_t b) { m_value = _mm_and_si128(m_value, _mm_set_epi32(a, r, g, b)); } - void xor_imm_rgba(int32_t a, int32_t r, int32_t g, int32_t b) { m_value = _mm_xor_si128(m_value, _mm_set_epi32(a, r, g, b)); } + void or_imm_rgba(s32 a, s32 r, s32 g, s32 b) { m_value = _mm_or_si128(m_value, _mm_set_epi32(a, r, g, b)); } + void and_imm_rgba(s32 a, s32 r, s32 g, s32 b) { m_value = _mm_and_si128(m_value, _mm_set_epi32(a, r, g, b)); } + void xor_imm_rgba(s32 a, s32 r, s32 g, s32 b) { m_value = _mm_xor_si128(m_value, _mm_set_epi32(a, r, g, b)); } - inline void clamp_and_clear(const uint32_t sign) + inline void clamp_and_clear(const u32 sign) { __m128i vsign = _mm_set1_epi32(sign); m_value = _mm_and_si128(m_value, _mm_cmpeq_epi32(_mm_and_si128(m_value, vsign), _mm_setzero_si128())); @@ -247,7 +247,7 @@ public: m_value = _mm_unpacklo_epi16(m_value, _mm_setzero_si128()); } - inline void sign_extend(const uint32_t compare, const uint32_t sign) + inline void sign_extend(const u32 compare, const u32 sign) { __m128i compare_vec = _mm_set1_epi32(compare); __m128i compare_mask = _mm_cmpeq_epi32(_mm_and_si128(m_value, compare_vec), compare_vec); @@ -255,7 +255,7 @@ public: m_value = _mm_or_si128(m_value, compared); } - inline void min(const int32_t value) + inline void min(const s32 value) { __m128i val = _mm_set1_epi32(value); __m128i is_greater_than = _mm_cmpgt_epi32(m_value, val); @@ -267,7 +267,7 @@ public: m_value = _mm_or_si128(val_to_set, m_value); } - inline void max(const int32_t value) + inline void max(const s32 value) { __m128i val = _mm_set1_epi32(value); __m128i is_less_than = _mm_cmplt_epi32(m_value, val); @@ -279,12 +279,12 @@ public: m_value = _mm_or_si128(val_to_set, m_value); } - void blend(const rgbaint_t& other, uint8_t factor); + void blend(const rgbaint_t& other, u8 factor); void scale_and_clamp(const rgbaint_t& scale); - void scale_imm_and_clamp(const int32_t scale); + void scale_imm_and_clamp(const s32 scale); - inline void scale_imm_add_and_clamp(const int32_t scale, const rgbaint_t& other) + inline void scale_imm_add_and_clamp(const s32 scale, const rgbaint_t& other) { mul_imm(scale); sra_imm(8); @@ -315,13 +315,13 @@ public: void cmpgt(const rgbaint_t& value) { m_value = _mm_cmpgt_epi32(m_value, value.m_value); } void cmplt(const rgbaint_t& value) { m_value = _mm_cmplt_epi32(m_value, value.m_value); } - void cmpeq_imm(int32_t value) { m_value = _mm_cmpeq_epi32(m_value, _mm_set1_epi32(value)); } - void cmpgt_imm(int32_t value) { m_value = _mm_cmpgt_epi32(m_value, _mm_set1_epi32(value)); } - void cmplt_imm(int32_t value) { m_value = _mm_cmplt_epi32(m_value, _mm_set1_epi32(value)); } + void cmpeq_imm(s32 value) { m_value = _mm_cmpeq_epi32(m_value, _mm_set1_epi32(value)); } + void cmpgt_imm(s32 value) { m_value = _mm_cmpgt_epi32(m_value, _mm_set1_epi32(value)); } + void cmplt_imm(s32 value) { m_value = _mm_cmplt_epi32(m_value, _mm_set1_epi32(value)); } - void cmpeq_imm_rgba(int32_t a, int32_t r, int32_t g, int32_t b) { m_value = _mm_cmpeq_epi32(m_value, _mm_set_epi32(a, r, g, b)); } - void cmpgt_imm_rgba(int32_t a, int32_t r, int32_t g, int32_t b) { m_value = _mm_cmpgt_epi32(m_value, _mm_set_epi32(a, r, g, b)); } - void cmplt_imm_rgba(int32_t a, int32_t r, int32_t g, int32_t b) { m_value = _mm_cmplt_epi32(m_value, _mm_set_epi32(a, r, g, b)); } + void cmpeq_imm_rgba(s32 a, s32 r, s32 g, s32 b) { m_value = _mm_cmpeq_epi32(m_value, _mm_set_epi32(a, r, g, b)); } + void cmpgt_imm_rgba(s32 a, s32 r, s32 g, s32 b) { m_value = _mm_cmpgt_epi32(m_value, _mm_set_epi32(a, r, g, b)); } + void cmplt_imm_rgba(s32 a, s32 r, s32 g, s32 b) { m_value = _mm_cmplt_epi32(m_value, _mm_set_epi32(a, r, g, b)); } inline rgbaint_t& operator+=(const rgbaint_t& other) { @@ -329,7 +329,7 @@ public: return *this; } - inline rgbaint_t& operator+=(const int32_t other) + inline rgbaint_t& operator+=(const s32 other) { m_value = _mm_add_epi32(m_value, _mm_set1_epi32(other)); return *this; @@ -347,14 +347,14 @@ public: return *this; } - inline rgbaint_t& operator*=(const int32_t other) + inline rgbaint_t& operator*=(const s32 other) { const __m128i immv = _mm_set1_epi32(other); m_value = _mm_unpacklo_epi32(_mm_shuffle_epi32(_mm_mul_epu32(m_value, immv), _MM_SHUFFLE(0, 0, 2, 0)), _mm_shuffle_epi32(_mm_mul_epu32(_mm_srli_si128(m_value, 4), _mm_srli_si128(immv, 4)), _MM_SHUFFLE(0, 0, 2, 0))); return *this; } - inline rgbaint_t& operator>>=(const int32_t shift) + inline rgbaint_t& operator>>=(const s32 shift) { m_value = _mm_srai_epi32(m_value, shift); return *this; @@ -370,7 +370,7 @@ public: #endif } - static uint32_t bilinear_filter(uint32_t rgb00, uint32_t rgb01, uint32_t rgb10, uint32_t rgb11, uint8_t u, uint8_t v) + static u32 bilinear_filter(u32 rgb00, u32 rgb01, u32 rgb10, u32 rgb11, u8 u, u8 v) { __m128i color00 = _mm_cvtsi32_si128(rgb00); __m128i color01 = _mm_cvtsi32_si128(rgb01); @@ -394,7 +394,7 @@ public: return _mm_cvtsi128_si32(color01); } - void bilinear_filter_rgbaint(uint32_t rgb00, uint32_t rgb01, uint32_t rgb10, uint32_t rgb11, uint8_t u, uint8_t v) + void bilinear_filter_rgbaint(u32 rgb00, u32 rgb01, u32 rgb10, u32 rgb11, u8 u, u8 v) { __m128i color00 = _mm_cvtsi32_si128(rgb00); __m128i color01 = _mm_cvtsi32_si128(rgb01); @@ -419,18 +419,18 @@ protected: struct _statics { __m128 dummy_for_alignment; - uint16_t alpha_mask[8]; - uint16_t red_mask[8]; - uint16_t green_mask[8]; - uint16_t blue_mask[8]; - int16_t scale_table[256][8]; + u16 alpha_mask[8]; + u16 red_mask[8]; + u16 green_mask[8]; + u16 blue_mask[8]; + s16 scale_table[256][8]; }; static __m128i alpha_mask() { return *(__m128i *)&statics.alpha_mask[0]; } static __m128i red_mask() { return *(__m128i *)&statics.red_mask[0]; } static __m128i green_mask() { return *(__m128i *)&statics.green_mask[0]; } static __m128i blue_mask() { return *(__m128i *)&statics.blue_mask[0]; } - static __m128i scale_factor(uint8_t index) { return *(__m128i *)&statics.scale_table[index][0]; } + static __m128i scale_factor(u8 index) { return *(__m128i *)&statics.scale_table[index][0]; } __m128i m_value; @@ -438,4 +438,4 @@ protected: }; -#endif /* __RGBSSE__ */ +#endif /* MAME_EMU_VIDEO_RGBSSE_H */ diff --git a/src/emu/video/rgbvmx.cpp b/src/emu/video/rgbvmx.cpp index e7c035fa53c..5673e82a7bf 100644 --- a/src/emu/video/rgbvmx.cpp +++ b/src/emu/video/rgbvmx.cpp @@ -164,7 +164,7 @@ const rgbaint_t::VECS16 rgbaint_t::scale_table[256] = { HIGHER LEVEL OPERATIONS ***************************************************************************/ -void rgbaint_t::blend(const rgbaint_t& other, uint8_t factor) +void rgbaint_t::blend(const rgbaint_t& other, u8 factor) { const VECU32 shift = vec_splat_u32(-16); const VECS32 scale1 = { factor, factor, factor, factor }; @@ -189,7 +189,7 @@ void rgbaint_t::scale_and_clamp(const rgbaint_t& scale) clamp_to_uint8(); } -void rgbaint_t::scale_imm_and_clamp(const int32_t scale) +void rgbaint_t::scale_imm_and_clamp(const s32 scale) { mul_imm(scale); sra_imm(8); diff --git a/src/emu/video/rgbvmx.h b/src/emu/video/rgbvmx.h index 302e42af998..1686f0d0b6b 100644 --- a/src/emu/video/rgbvmx.h +++ b/src/emu/video/rgbvmx.h @@ -29,8 +29,8 @@ protected: public: rgbaint_t() { set(0, 0, 0, 0); } - explicit rgbaint_t(uint32_t rgba) { set(rgba); } - rgbaint_t(int32_t a, int32_t r, int32_t g, int32_t b) { set(a, r, g, b); } + explicit rgbaint_t(u32 rgba) { set(rgba); } + rgbaint_t(s32 a, s32 r, s32 g, s32 b) { set(a, r, g, b); } explicit rgbaint_t(const rgb_t& rgb) { set(rgb); } explicit rgbaint_t(VECS32 rgba) : m_value(rgba) { } @@ -39,7 +39,7 @@ public: void set(const rgbaint_t& other) { m_value = other.m_value; } - void set(uint32_t rgba) + void set(u32 rgba) { const VECU32 zero = { 0, 0, 0, 0 }; #ifdef __LITTLE_ENDIAN__ @@ -51,7 +51,7 @@ public: #endif } - void set(int32_t a, int32_t r, int32_t g, int32_t b) + void set(s32 a, s32 r, s32 g, s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 result = { b, g, r, a }; @@ -77,7 +77,7 @@ public: { VECU32 temp = VECU32(vec_packs(m_value, m_value)); temp = VECU32(vec_packsu(VECS16(temp), VECS16(temp))); - uint32_t result; + u32 result; vec_ste(temp, 0, &result); return result; } @@ -86,38 +86,38 @@ public: { VECU32 temp = VECU32(vec_packs(m_value, m_value)); temp = VECU32(vec_packsu(VECS16(temp), VECS16(temp))); - uint32_t result; + u32 result; vec_ste(temp, 0, &result); return result; } - void set_a(const int32_t value) + void set_a(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_perm(m_value, temp, alpha_perm); } - void set_r(const int32_t value) + void set_r(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_perm(m_value, temp, red_perm); } - void set_g(const int32_t value) + void set_g(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_perm(m_value, temp, green_perm); } - void set_b(const int32_t value) + void set_b(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_perm(m_value, temp, blue_perm); } - uint8_t get_a() const + u8 get_a() const { - uint8_t result; + u8 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(VECU8(m_value), 12), 0, &result); #else @@ -126,9 +126,9 @@ public: return result; } - uint8_t get_r() const + u8 get_r() const { - uint8_t result; + u8 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(VECU8(m_value), 8), 0, &result); #else @@ -137,9 +137,9 @@ public: return result; } - uint8_t get_g() const + u8 get_g() const { - uint8_t result; + u8 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(VECU8(m_value), 4), 0, &result); #else @@ -148,9 +148,9 @@ public: return result; } - uint8_t get_b() const + u8 get_b() const { - uint8_t result; + u8 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(VECU8(m_value), 0), 0, &result); #else @@ -159,9 +159,9 @@ public: return result; } - int32_t get_a32() const + s32 get_a32() const { - int32_t result; + s32 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(m_value, 3), 0, &result); #else @@ -170,9 +170,9 @@ public: return result; } - int32_t get_r32() const + s32 get_r32() const { - int32_t result; + s32 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(m_value, 2), 0, &result); #else @@ -181,9 +181,9 @@ public: return result; } - int32_t get_g32() const + s32 get_g32() const { - int32_t result; + s32 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(m_value, 1), 0, &result); #else @@ -192,9 +192,9 @@ public: return result; } - int32_t get_b32() const + s32 get_b32() const { - int32_t result; + s32 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(m_value, 0), 0, &result); #else @@ -208,13 +208,13 @@ public: m_value = vec_add(m_value, color2.m_value); } - inline void add_imm(const int32_t imm) + inline void add_imm(const s32 imm) { const VECS32 temp = { imm, imm, imm, imm }; m_value = vec_add(m_value, temp); } - inline void add_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void add_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -229,13 +229,13 @@ public: m_value = vec_sub(m_value, color2.m_value); } - inline void sub_imm(const int32_t imm) + inline void sub_imm(const s32 imm) { const VECS32 temp = { imm, imm, imm, imm }; m_value = vec_sub(m_value, temp); } - inline void sub_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void sub_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -250,13 +250,13 @@ public: m_value = vec_sub(color2.m_value, m_value); } - inline void subr_imm(const int32_t imm) + inline void subr_imm(const s32 imm) { const VECS32 temp = { imm, imm, imm, imm }; m_value = vec_sub(temp, m_value); } - inline void subr_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void subr_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -277,9 +277,9 @@ public: #endif } - inline void mul_imm(const int32_t imm) + inline void mul_imm(const s32 imm) { - const VECU32 value = { uint32_t(imm), uint32_t(imm), uint32_t(imm), uint32_t(imm) }; + const VECU32 value = { u32(imm), u32(imm), u32(imm), u32(imm) }; const VECU32 shift = vec_splat_u32(-16); const VECU32 temp = vec_msum(VECU16(m_value), VECU16(vec_rl(value, shift)), vec_splat_u32(0)); #ifdef __LITTLE_ENDIAN__ @@ -289,12 +289,12 @@ public: #endif } - inline void mul_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void mul_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ - const VECU32 value = { uint32_t(b), uint32_t(g), uint32_t(r), uint32_t(a) }; + const VECU32 value = { u32(b), u32(g), u32(r), u32(a) }; #else - const VECU32 value = { uint32_t(a), uint32_t(r), uint32_t(g), uint32_t(b) }; + const VECU32 value = { u32(a), u32(r), u32(g), u32(b) }; #endif const VECU32 shift = vec_splat_u32(-16); const VECU32 temp = vec_msum(VECU16(m_value), VECU16(vec_rl(value, shift)), vec_splat_u32(0)); @@ -311,7 +311,7 @@ public: m_value = vec_and(vec_sl(m_value, VECU32(shift.m_value)), vec_cmpgt(limit, VECU32(shift.m_value))); } - inline void shl_imm(const uint8_t shift) + inline void shl_imm(const u8 shift) { const VECU32 temp = { shift, shift, shift, shift }; m_value = vec_sl(m_value, temp); @@ -323,7 +323,7 @@ public: m_value = vec_and(vec_sr(m_value, VECU32(shift.m_value)), vec_cmpgt(limit, VECU32(shift.m_value))); } - inline void shr_imm(const uint8_t shift) + inline void shr_imm(const u8 shift) { const VECU32 temp = { shift, shift, shift, shift }; m_value = vec_sr(m_value, temp); @@ -335,7 +335,7 @@ public: m_value = vec_sra(m_value, vec_min(VECU32(shift.m_value), limit)); } - inline void sra_imm(const uint8_t shift) + inline void sra_imm(const u8 shift) { const VECU32 temp = { shift, shift, shift, shift }; m_value = vec_sra(m_value, temp); @@ -346,13 +346,13 @@ public: m_value = vec_or(m_value, color2.m_value); } - inline void or_imm(const int32_t value) + inline void or_imm(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_or(m_value, temp); } - inline void or_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void or_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -372,13 +372,13 @@ public: m_value = vec_andc(m_value, color.m_value); } - inline void and_imm(const int32_t value) + inline void and_imm(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_and(m_value, temp); } - inline void and_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void and_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -393,13 +393,13 @@ public: m_value = vec_xor(m_value, color2.m_value); } - inline void xor_imm(const int32_t value) + inline void xor_imm(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_xor(m_value, temp); } - inline void xor_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void xor_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -409,10 +409,10 @@ public: m_value = vec_xor(m_value, temp); } - inline void clamp_and_clear(const uint32_t sign) + inline void clamp_and_clear(const u32 sign) { const VECS32 vzero = { 0, 0, 0, 0 }; - VECS32 vsign = { int32_t(sign), int32_t(sign), int32_t(sign), int32_t(sign) }; + VECS32 vsign = { s32(sign), s32(sign), s32(sign), s32(sign) }; m_value = vec_and(m_value, vec_cmpeq(vec_and(m_value, vsign), vzero)); vsign = vec_nor(vec_sra(vsign, vec_splat_u32(1)), vzero); const VECS32 mask = VECS32(vec_cmpgt(m_value, vsign)); @@ -433,32 +433,32 @@ public: #endif } - inline void sign_extend(const uint32_t compare, const uint32_t sign) + inline void sign_extend(const u32 compare, const u32 sign) { - const VECS32 compare_vec = { int32_t(compare), int32_t(compare), int32_t(compare), int32_t(compare) }; + const VECS32 compare_vec = { s32(compare), s32(compare), s32(compare), s32(compare) }; const VECS32 compare_mask = VECS32(vec_cmpeq(vec_and(m_value, compare_vec), compare_vec)); - const VECS32 sign_vec = { int32_t(sign), int32_t(sign), int32_t(sign), int32_t(sign) }; + const VECS32 sign_vec = { s32(sign), s32(sign), s32(sign), s32(sign) }; m_value = vec_or(m_value, vec_and(sign_vec, compare_mask)); } - inline void min(const int32_t value) + inline void min(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_min(m_value, temp); } - inline void max(const int32_t value) + inline void max(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_max(m_value, temp); } - void blend(const rgbaint_t& other, uint8_t factor); + void blend(const rgbaint_t& other, u8 factor); void scale_and_clamp(const rgbaint_t& scale); - void scale_imm_and_clamp(const int32_t scale); + void scale_imm_and_clamp(const s32 scale); - void scale_imm_add_and_clamp(const int32_t scale, const rgbaint_t& other) + void scale_imm_add_and_clamp(const s32 scale, const rgbaint_t& other) { mul_imm(scale); sra_imm(8); @@ -490,13 +490,13 @@ public: m_value = VECS32(vec_cmpeq(m_value, value.m_value)); } - inline void cmpeq_imm(const int32_t value) + inline void cmpeq_imm(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = VECS32(vec_cmpeq(m_value, temp)); } - inline void cmpeq_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void cmpeq_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -511,13 +511,13 @@ public: m_value = VECS32(vec_cmpgt(m_value, value.m_value)); } - inline void cmpgt_imm(const int32_t value) + inline void cmpgt_imm(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = VECS32(vec_cmpgt(m_value, temp)); } - inline void cmpgt_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void cmpgt_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -532,13 +532,13 @@ public: m_value = VECS32(vec_cmplt(m_value, value.m_value)); } - inline void cmplt_imm(const int32_t value) + inline void cmplt_imm(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = VECS32(vec_cmplt(m_value, temp)); } - inline void cmplt_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void cmplt_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -554,7 +554,7 @@ public: return *this; } - inline rgbaint_t& operator+=(const int32_t other) + inline rgbaint_t& operator+=(const s32 other) { const VECS32 temp = { other, other, other, other }; m_value = vec_add(m_value, temp); @@ -579,7 +579,7 @@ public: return *this; } - inline rgbaint_t& operator*=(const int32_t other) + inline rgbaint_t& operator*=(const s32 other) { const VECS32 value = { other, other, other, other }; const VECU32 shift = vec_splat_u32(-16); @@ -592,9 +592,9 @@ public: return *this; } - inline rgbaint_t& operator>>=(const int32_t shift) + inline rgbaint_t& operator>>=(const s32 shift) { - const VECU32 temp = { uint32_t(shift), uint32_t(shift), uint32_t(shift), uint32_t(shift) }; + const VECU32 temp = { u32(shift), u32(shift), u32(shift), u32(shift) }; m_value = vec_sra(m_value, temp); return *this; } @@ -604,7 +604,7 @@ public: m_value = vec_perm(m_value, alpha.m_value, alpha_perm); } - static uint32_t bilinear_filter(const uint32_t &rgb00, const uint32_t &rgb01, const uint32_t &rgb10, const uint32_t &rgb11, uint8_t u, uint8_t v) + static u32 bilinear_filter(const u32 &rgb00, const u32 &rgb01, const u32 &rgb10, const u32 &rgb11, u8 u, u8 v) { const VECS32 zero = vec_splat_s32(0); @@ -642,12 +642,12 @@ public: color01 = VECS32(vec_packs(color01, color01)); color01 = VECS32(vec_packsu(VECS16(color01), VECS16(color01))); - uint32_t result; + u32 result; vec_ste(VECU32(color01), 0, &result); return result; } - void bilinear_filter_rgbaint(const uint32_t &rgb00, const uint32_t &rgb01, const uint32_t &rgb10, const uint32_t &rgb11, uint8_t u, uint8_t v) + void bilinear_filter_rgbaint(const u32 &rgb00, const u32 &rgb01, const u32 &rgb10, const u32 &rgb11, u8 u, u8 v) { const VECS32 zero = vec_splat_s32(0); |