OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

32bpp_sse_type.h
1 /* $Id: 32bpp_sse_type.h 26258 2014-01-13 18:12:33Z rubidium $ */
2
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
9
12 #ifndef BLITTER_32BPP_SSE_TYPE_HPP
13 #define BLITTER_32BPP_SSE_TYPE_HPP
14
15 #ifdef WITH_SSE
16
17 #include "32bpp_simple.hpp"
18 #if (SSE_VERSION == 2)
19 #include <emmintrin.h>
20 #elif (SSE_VERSION == 3)
21 #include <tmmintrin.h>
22 #elif (SSE_VERSION == 4)
23 #include <smmintrin.h>
24 #endif
25
26 #define META_LENGTH 2
27 #define MARGIN_NORMAL_THRESHOLD (zoom == ZOOM_LVL_OUT_32X ? 8 : 4)
28 #define MARGIN_REMAP_THRESHOLD 4
29
30 #ifdef _MSC_VER
31 #define ALIGN(n) __declspec(align(n))
32 #else
33 #define ALIGN(n) __attribute__ ((aligned (n)))
34 #endif
35
36 typedef union ALIGN(16) um128i {
37 __m128i m128i;
38 uint8 m128i_u8[16];
39 uint16 m128i_u16[8];
40 uint32 m128i_u32[4];
41 uint64 m128i_u64[2];
42 } um128i;
43
44 #define CLEAR_HIGH_BYTE_MASK _mm_setr_epi8(-1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0)
45 #define ALPHA_CONTROL_MASK _mm_setr_epi8( 6, 7, 6, 7, 6, 7, -1, -1, 14, 15, 14, 15, 14, 15, -1, -1)
46 #define PACK_LOW_CONTROL_MASK _mm_setr_epi8( 0, 2, 4, -1, 8, 10, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1)
47 #define PACK_HIGH_CONTROL_MASK _mm_setr_epi8(-1, -1, -1, -1, -1, -1, -1, -1, 0, 2, 4, -1, 8, 10, 12, -1)
48 #define BRIGHTNESS_LOW_CONTROL_MASK _mm_setr_epi8( 1, 2, 1, 2, 1, 2, 0, 2, 3, 2, 3, 2, 3, 2, 0, 2)
49 #define BRIGHTNESS_DIV_CLEANER _mm_setr_epi8(-1, 1, -1, 1, -1, 1, -1, 0, -1, 1, -1, 1, -1, 1, -1, 0)
50 #define OVERBRIGHT_PRESENCE_MASK _mm_setr_epi8( 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0)
51 #define OVERBRIGHT_VALUE_MASK _mm_setr_epi8(-1, 0, -1, 0, -1, 0, 0, 0, -1, 0, -1, 0, -1, 0, 0, 0)
52 #define OVERBRIGHT_CONTROL_MASK _mm_setr_epi8( 0, 1, 0, 1, 0, 1, 7, 7, 2, 3, 2, 3, 2, 3, 7, 7)
53 #define TRANSPARENT_NOM_BASE _mm_setr_epi16(256, 256, 256, 256, 256, 256, 256, 256)
54
55 #endif /* WITH_SSE */
56 #endif /* BLITTER_32BPP_SSE_TYPE_HPP */