Revision c0038328 libswscale/rgb2rgb.c

View differences:

libswscale/rgb2rgb.c
24 24
 */
25 25
#include <inttypes.h>
26 26
#include "config.h"
27
#include "libavutil/x86_cpu.h"
28 27
#include "libavutil/bswap.h"
29 28
#include "rgb2rgb.h"
30 29
#include "swscale.h"
......
95 94
                     long width, long height,
96 95
                     long lumStride, long chromStride, long srcStride);
97 96

  
98

  
99
#if ARCH_X86
100
DECLARE_ASM_CONST(8, uint64_t, mmx_ff)       = 0x00000000000000FFULL;
101
DECLARE_ASM_CONST(8, uint64_t, mmx_null)     = 0x0000000000000000ULL;
102
DECLARE_ASM_CONST(8, uint64_t, mmx_one)      = 0xFFFFFFFFFFFFFFFFULL;
103
DECLARE_ASM_CONST(8, uint64_t, mask32b)      = 0x000000FF000000FFULL;
104
DECLARE_ASM_CONST(8, uint64_t, mask32g)      = 0x0000FF000000FF00ULL;
105
DECLARE_ASM_CONST(8, uint64_t, mask32r)      = 0x00FF000000FF0000ULL;
106
DECLARE_ASM_CONST(8, uint64_t, mask32a)      = 0xFF000000FF000000ULL;
107
DECLARE_ASM_CONST(8, uint64_t, mask32)       = 0x00FFFFFF00FFFFFFULL;
108
DECLARE_ASM_CONST(8, uint64_t, mask3216br)   = 0x00F800F800F800F8ULL;
109
DECLARE_ASM_CONST(8, uint64_t, mask3216g)    = 0x0000FC000000FC00ULL;
110
DECLARE_ASM_CONST(8, uint64_t, mask3215g)    = 0x0000F8000000F800ULL;
111
DECLARE_ASM_CONST(8, uint64_t, mul3216)      = 0x2000000420000004ULL;
112
DECLARE_ASM_CONST(8, uint64_t, mul3215)      = 0x2000000820000008ULL;
113
DECLARE_ASM_CONST(8, uint64_t, mask24b)      = 0x00FF0000FF0000FFULL;
114
DECLARE_ASM_CONST(8, uint64_t, mask24g)      = 0xFF0000FF0000FF00ULL;
115
DECLARE_ASM_CONST(8, uint64_t, mask24r)      = 0x0000FF0000FF0000ULL;
116
DECLARE_ASM_CONST(8, uint64_t, mask24l)      = 0x0000000000FFFFFFULL;
117
DECLARE_ASM_CONST(8, uint64_t, mask24h)      = 0x0000FFFFFF000000ULL;
118
DECLARE_ASM_CONST(8, uint64_t, mask24hh)     = 0xffff000000000000ULL;
119
DECLARE_ASM_CONST(8, uint64_t, mask24hhh)    = 0xffffffff00000000ULL;
120
DECLARE_ASM_CONST(8, uint64_t, mask24hhhh)   = 0xffffffffffff0000ULL;
121
DECLARE_ASM_CONST(8, uint64_t, mask15b)      = 0x001F001F001F001FULL; /* 00000000 00011111  xxB */
122
DECLARE_ASM_CONST(8, uint64_t, mask15rg)     = 0x7FE07FE07FE07FE0ULL; /* 01111111 11100000  RGx */
123
DECLARE_ASM_CONST(8, uint64_t, mask15s)      = 0xFFE0FFE0FFE0FFE0ULL;
124
DECLARE_ASM_CONST(8, uint64_t, mask15g)      = 0x03E003E003E003E0ULL;
125
DECLARE_ASM_CONST(8, uint64_t, mask15r)      = 0x7C007C007C007C00ULL;
126
#define mask16b mask15b
127
DECLARE_ASM_CONST(8, uint64_t, mask16g)      = 0x07E007E007E007E0ULL;
128
DECLARE_ASM_CONST(8, uint64_t, mask16r)      = 0xF800F800F800F800ULL;
129
DECLARE_ASM_CONST(8, uint64_t, red_16mask)   = 0x0000f8000000f800ULL;
130
DECLARE_ASM_CONST(8, uint64_t, green_16mask) = 0x000007e0000007e0ULL;
131
DECLARE_ASM_CONST(8, uint64_t, blue_16mask)  = 0x0000001f0000001fULL;
132
DECLARE_ASM_CONST(8, uint64_t, red_15mask)   = 0x00007c0000007c00ULL;
133
DECLARE_ASM_CONST(8, uint64_t, green_15mask) = 0x000003e0000003e0ULL;
134
DECLARE_ASM_CONST(8, uint64_t, blue_15mask)  = 0x0000001f0000001fULL;
135
#endif /* ARCH_X86 */
136

  
137 97
#define RGB2YUV_SHIFT 8
138 98
#define BY ((int)( 0.098*(1<<RGB2YUV_SHIFT)+0.5))
139 99
#define BV ((int)(-0.071*(1<<RGB2YUV_SHIFT)+0.5))
......
145 105
#define RV ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5))
146 106
#define RU ((int)(-0.148*(1<<RGB2YUV_SHIFT)+0.5))
147 107

  
148
//Note: We have C, MMX, MMX2, 3DNOW versions, there is no 3DNOW + MMX2 one.
149 108
//plain C versions
150
#define COMPILE_TEMPLATE_MMX 0
151
#define COMPILE_TEMPLATE_MMX2 0
152
#define COMPILE_TEMPLATE_AMD3DNOW 0
153
#define COMPILE_TEMPLATE_SSE2 0
154
#define RENAME(a) a ## _C
155
#include "rgb2rgb_template.c"
156

  
157
#if ARCH_X86
158

  
159
//MMX versions
160
#undef RENAME
161
#undef COMPILE_TEMPLATE_MMX
162
#define COMPILE_TEMPLATE_MMX 1
163
#define RENAME(a) a ## _MMX
164
#include "rgb2rgb_template.c"
165

  
166
//MMX2 versions
167
#undef RENAME
168
#undef COMPILE_TEMPLATE_MMX2
169
#define COMPILE_TEMPLATE_MMX2 1
170
#define RENAME(a) a ## _MMX2
171
#include "rgb2rgb_template.c"
172

  
173
//SSE2 versions
174
#undef RENAME
175
#undef COMPILE_TEMPLATE_SSE2
176
#define COMPILE_TEMPLATE_SSE2 1
177
#define RENAME(a) a ## _SSE2
178
#include "rgb2rgb_template.c"
179

  
180
//3DNOW versions
181
#undef RENAME
182
#undef COMPILE_TEMPLATE_MMX2
183
#undef COMPILE_TEMPLATE_SSE2
184
#undef COMPILE_TEMPLATE_AMD3DNOW
185
#define COMPILE_TEMPLATE_MMX2 0
186
#define COMPILE_TEMPLATE_SSE2 1
187
#define COMPILE_TEMPLATE_AMD3DNOW 1
188
#define RENAME(a) a ## _3DNOW
189 109
#include "rgb2rgb_template.c"
190 110

  
191
#endif //ARCH_X86 || ARCH_X86_64
192 111

  
193 112
/*
194 113
 RGB15->RGB16 original by Strepto/Astral
......
199 118

  
200 119
void sws_rgb2rgb_init(int flags)
201 120
{
121
    rgb2rgb_init_c();
202 122
#if HAVE_MMX2 || HAVE_AMD3DNOW || HAVE_MMX
203
    if (flags & SWS_CPU_CAPS_SSE2)
204
        rgb2rgb_init_SSE2();
205
    else if (flags & SWS_CPU_CAPS_MMX2)
206
        rgb2rgb_init_MMX2();
207
    else if (flags & SWS_CPU_CAPS_3DNOW)
208
        rgb2rgb_init_3DNOW();
209
    else if (flags & SWS_CPU_CAPS_MMX)
210
        rgb2rgb_init_MMX();
211
    else
123
    rgb2rgb_init_x86(flags);
212 124
#endif /* HAVE_MMX2 || HAVE_AMD3DNOW || HAVE_MMX */
213
        rgb2rgb_init_C();
214 125
}
215 126

  
216 127
#if LIBSWSCALE_VERSION_MAJOR < 1

Also available in: Unified diff