annotate libvo/osd.c @ 5834:ece3a19677b9

Fix keypad volume control.
author atmos4
date Thu, 25 Apr 2002 20:59:12 +0000
parents 27cb0e43de32
children 5074aa8fae5a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
326
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
1 // Generic alpha renderers for all YUV modes and RGB depths.
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
2 // These are "reference implementations", should be optimized later (MMX, etc)
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
3 // Templating Code from Michael Niedermayer (michaelni@gmx.at) is under GPL
326
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
4
947
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
5 //#define FAST_OSD
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
6 //#define FAST_OSD_TABLE
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
7
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
8 #include "config.h"
622
6737025afed0 to be sure in that header is okey
arpi_esp
parents: 326
diff changeset
9 #include "osd.h"
2833
1b6c207c0410 Enable MMX stuff
nick
parents: 2823
diff changeset
10 //#define ENABLE_PROFILE
1b6c207c0410 Enable MMX stuff
nick
parents: 2823
diff changeset
11 #include "../my_profile.h"
2846
ab51228bf3cf p2/p3 bgr32 version (20%faster)
michael
parents: 2843
diff changeset
12 #include <inttypes.h>
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
13 #include "../cpudetect.h"
4245
27cb0e43de32 mangling in libvo
atmos4
parents: 3153
diff changeset
14 #include "../mangle.h"
2846
ab51228bf3cf p2/p3 bgr32 version (20%faster)
michael
parents: 2843
diff changeset
15
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
16 extern int verbose; // defined in mplayer.c
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
17
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
18 #ifdef ARCH_X86
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
19 #define CAN_COMPILE_X86_ASM
2846
ab51228bf3cf p2/p3 bgr32 version (20%faster)
michael
parents: 2843
diff changeset
20 #endif
622
6737025afed0 to be sure in that header is okey
arpi_esp
parents: 326
diff changeset
21
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
22 #ifdef CAN_COMPILE_X86_ASM
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
23 static const uint64_t bFF __attribute__((aligned(8))) = 0xFFFFFFFFFFFFFFFFULL;
2839
03ccbb72e2e9 Cloning 32 stuff to 24
nick
parents: 2835
diff changeset
24 static const unsigned long long mask24lh __attribute__((aligned(8))) = 0xFFFF000000000000ULL;
03ccbb72e2e9 Cloning 32 stuff to 24
nick
parents: 2835
diff changeset
25 static const unsigned long long mask24hl __attribute__((aligned(8))) = 0x0000FFFFFFFFFFFFULL;
03ccbb72e2e9 Cloning 32 stuff to 24
nick
parents: 2835
diff changeset
26 #endif
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
27
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
28 //Note: we have C, X86-nommx, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
29 //Plain C versions
3153
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
30 #if !defined (HAVE_MMX) || defined (RUNTIME_CPUDETECT)
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
31 #define COMPILE_C
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
32 #endif
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
33
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
34 #ifdef CAN_COMPILE_X86_ASM
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
35
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
36 #if (defined (HAVE_MMX) && !defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT)
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
37 #define COMPILE_MMX
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
38 #endif
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
39
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
40 #if defined (HAVE_MMX2) || defined (RUNTIME_CPUDETECT)
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
41 #define COMPILE_MMX2
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
42 #endif
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
43
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
44 #if (defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT)
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
45 #define COMPILE_3DNOW
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
46 #endif
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
47 #endif //CAN_COMPILE_X86_ASM
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
48
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
49 #undef HAVE_MMX
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
50 #undef HAVE_MMX2
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
51 #undef HAVE_3DNOW
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
52 #undef ARCH_X86
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
53
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
54 #ifdef COMPILE_C
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
55 #undef HAVE_MMX
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
56 #undef HAVE_MMX2
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
57 #undef HAVE_3DNOW
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
58 #undef ARCH_X86
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
59 #define RENAME(a) a ## _C
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
60 #include "osd_template.c"
3153
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
61 #endif
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
62
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
63 #ifdef CAN_COMPILE_X86_ASM
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
64
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
65 //X86 noMMX versions
3153
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
66 #ifdef COMPILE_C
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
67 #undef RENAME
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
68 #undef HAVE_MMX
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
69 #undef HAVE_MMX2
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
70 #undef HAVE_3DNOW
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
71 #define ARCH_X86
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
72 #define RENAME(a) a ## _X86
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
73 #include "osd_template.c"
3153
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
74 #endif
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
75
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
76 //MMX versions
3153
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
77 #ifdef COMPILE_MMX
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
78 #undef RENAME
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
79 #define HAVE_MMX
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
80 #undef HAVE_MMX2
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
81 #undef HAVE_3DNOW
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
82 #define ARCH_X86
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
83 #define RENAME(a) a ## _MMX
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
84 #include "osd_template.c"
3153
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
85 #endif
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
86
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
87 //MMX2 versions
3153
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
88 #ifdef COMPILE_MMX2
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
89 #undef RENAME
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
90 #define HAVE_MMX
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
91 #define HAVE_MMX2
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
92 #undef HAVE_3DNOW
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
93 #define ARCH_X86
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
94 #define RENAME(a) a ## _MMX2
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
95 #include "osd_template.c"
3153
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
96 #endif
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
97
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
98 //3DNOW versions
3153
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
99 #ifdef COMPILE_3DNOW
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
100 #undef RENAME
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
101 #define HAVE_MMX
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
102 #undef HAVE_MMX2
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
103 #define HAVE_3DNOW
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
104 #define ARCH_X86
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
105 #define RENAME(a) a ## _3DNow
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
106 #include "osd_template.c"
3153
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
107 #endif
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
108
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
109 #endif //CAN_COMPILE_X86_ASM
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
110
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
111 void vo_draw_alpha_yv12(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
3153
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
112 #ifdef RUNTIME_CPUDETECT
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
113 #ifdef CAN_COMPILE_X86_ASM
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
114 // ordered per speed fasterst first
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
115 if(gCpuCaps.hasMMX2)
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
116 vo_draw_alpha_yv12_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
117 else if(gCpuCaps.has3DNow)
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
118 vo_draw_alpha_yv12_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
119 else if(gCpuCaps.hasMMX)
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
120 vo_draw_alpha_yv12_MMX(w, h, src, srca, srcstride, dstbase, dststride);
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
121 else
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
122 vo_draw_alpha_yv12_X86(w, h, src, srca, srcstride, dstbase, dststride);
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
123 #else
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
124 vo_draw_alpha_yv12_C(w, h, src, srca, srcstride, dstbase, dststride);
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
125 #endif
3153
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
126 #else //RUNTIME_CPUDETECT
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
127 #ifdef HAVE_MMX2
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
128 vo_draw_alpha_yv12_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
129 #elif defined (HAVE_3DNOW)
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
130 vo_draw_alpha_yv12_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
131 #elif defined (HAVE_MMX)
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
132 vo_draw_alpha_yv12_MMX(w, h, src, srca, srcstride, dstbase, dststride);
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
133 #elif defined (ARCH_X86)
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
134 vo_draw_alpha_yv12_X86(w, h, src, srca, srcstride, dstbase, dststride);
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
135 #else
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
136 vo_draw_alpha_yv12_C(w, h, src, srca, srcstride, dstbase, dststride);
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
137 #endif
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
138 #endif //!RUNTIME_CPUDETECT
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
139 }
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
140
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
141 void vo_draw_alpha_yuy2(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
3153
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
142 #ifdef RUNTIME_CPUDETECT
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
143 #ifdef CAN_COMPILE_X86_ASM
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
144 // ordered per speed fasterst first
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
145 if(gCpuCaps.hasMMX2)
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
146 vo_draw_alpha_yuy2_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
147 else if(gCpuCaps.has3DNow)
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
148 vo_draw_alpha_yuy2_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
149 else if(gCpuCaps.hasMMX)
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
150 vo_draw_alpha_yuy2_MMX(w, h, src, srca, srcstride, dstbase, dststride);
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
151 else
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
152 vo_draw_alpha_yuy2_X86(w, h, src, srca, srcstride, dstbase, dststride);
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
153 #else
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
154 vo_draw_alpha_yuy2_C(w, h, src, srca, srcstride, dstbase, dststride);
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
155 #endif
3153
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
156 #else //RUNTIME_CPUDETECT
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
157 #ifdef HAVE_MMX2
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
158 vo_draw_alpha_yuy2_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
159 #elif defined (HAVE_3DNOW)
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
160 vo_draw_alpha_yuy2_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
161 #elif defined (HAVE_MMX)
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
162 vo_draw_alpha_yuy2_MMX(w, h, src, srca, srcstride, dstbase, dststride);
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
163 #elif defined (ARCH_X86)
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
164 vo_draw_alpha_yuy2_X86(w, h, src, srca, srcstride, dstbase, dststride);
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
165 #else
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
166 vo_draw_alpha_yuy2_C(w, h, src, srca, srcstride, dstbase, dststride);
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
167 #endif
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
168 #endif //!RUNTIME_CPUDETECT
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
169 }
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
170
326
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
171 void vo_draw_alpha_rgb24(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
3153
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
172 #ifdef RUNTIME_CPUDETECT
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
173 #ifdef CAN_COMPILE_X86_ASM
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
174 // ordered per speed fasterst first
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
175 if(gCpuCaps.hasMMX2)
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
176 vo_draw_alpha_rgb24_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
177 else if(gCpuCaps.has3DNow)
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
178 vo_draw_alpha_rgb24_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
179 else if(gCpuCaps.hasMMX)
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
180 vo_draw_alpha_rgb24_MMX(w, h, src, srca, srcstride, dstbase, dststride);
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
181 else
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
182 vo_draw_alpha_rgb24_X86(w, h, src, srca, srcstride, dstbase, dststride);
947
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
183 #else
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
184 vo_draw_alpha_rgb24_C(w, h, src, srca, srcstride, dstbase, dststride);
947
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
185 #endif
3153
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
186 #else //RUNTIME_CPUDETECT
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
187 #ifdef HAVE_MMX2
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
188 vo_draw_alpha_rgb24_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
189 #elif defined (HAVE_3DNOW)
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
190 vo_draw_alpha_rgb24_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
191 #elif defined (HAVE_MMX)
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
192 vo_draw_alpha_rgb24_MMX(w, h, src, srca, srcstride, dstbase, dststride);
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
193 #elif defined (ARCH_X86)
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
194 vo_draw_alpha_rgb24_X86(w, h, src, srca, srcstride, dstbase, dststride);
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
195 #else
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
196 vo_draw_alpha_rgb24_C(w, h, src, srca, srcstride, dstbase, dststride);
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
197 #endif
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
198 #endif //!RUNTIME_CPUDETECT
326
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
199 }
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
200
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
201 void vo_draw_alpha_rgb32(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
3153
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
202 #ifdef RUNTIME_CPUDETECT
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
203 #ifdef CAN_COMPILE_X86_ASM
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
204 // ordered per speed fasterst first
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
205 if(gCpuCaps.hasMMX2)
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
206 vo_draw_alpha_rgb32_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
207 else if(gCpuCaps.has3DNow)
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
208 vo_draw_alpha_rgb32_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
209 else if(gCpuCaps.hasMMX)
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
210 vo_draw_alpha_rgb32_MMX(w, h, src, srca, srcstride, dstbase, dststride);
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
211 else
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
212 vo_draw_alpha_rgb32_X86(w, h, src, srca, srcstride, dstbase, dststride);
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
213 #else
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
214 vo_draw_alpha_rgb32_C(w, h, src, srca, srcstride, dstbase, dststride);
2846
ab51228bf3cf p2/p3 bgr32 version (20%faster)
michael
parents: 2843
diff changeset
215 #endif
3153
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
216 #else //RUNTIME_CPUDETECT
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
217 #ifdef HAVE_MMX2
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
218 vo_draw_alpha_rgb32_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
219 #elif defined (HAVE_3DNOW)
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
220 vo_draw_alpha_rgb32_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
221 #elif defined (HAVE_MMX)
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
222 vo_draw_alpha_rgb32_MMX(w, h, src, srca, srcstride, dstbase, dststride);
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
223 #elif defined (ARCH_X86)
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
224 vo_draw_alpha_rgb32_X86(w, h, src, srca, srcstride, dstbase, dststride);
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
225 #else
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
226 vo_draw_alpha_rgb32_C(w, h, src, srca, srcstride, dstbase, dststride);
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
227 #endif
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
228 #endif //!RUNTIME_CPUDETECT
326
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
229 }
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
230
947
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
231 #ifdef FAST_OSD_TABLE
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
232 static unsigned short fast_osd_15bpp_table[256];
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
233 static unsigned short fast_osd_16bpp_table[256];
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
234 #endif
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
235
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
236 void vo_draw_alpha_init(){
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
237 #ifdef FAST_OSD_TABLE
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
238 int i;
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
239 for(i=0;i<256;i++){
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
240 fast_osd_15bpp_table[i]=((i>>3)<<10)|((i>>3)<<5)|(i>>3);
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
241 fast_osd_16bpp_table[i]=((i>>3)<<11)|((i>>2)<<5)|(i>>3);
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
242 }
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
243 #endif
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
244 //FIXME the optimized stuff is a lie for 15/16bpp as they arent optimized yet
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
245 if(verbose)
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
246 {
3153
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
247 #ifdef RUNTIME_CPUDETECT
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
248 #ifdef CAN_COMPILE_X86_ASM
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
249 // ordered per speed fasterst first
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
250 if(gCpuCaps.hasMMX2)
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
251 printf("Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n");
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
252 else if(gCpuCaps.has3DNow)
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
253 printf("Using MMX (with tiny bit 3DNow) Optimized OnScreenDisplay\n");
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
254 else if(gCpuCaps.hasMMX)
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
255 printf("Using MMX Optimized OnScreenDisplay\n");
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
256 else
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
257 printf("Using X86 Optimized OnScreenDisplay\n");
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
258 #else
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
259 printf("Using Unoptimized OnScreenDisplay\n");
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
260 #endif
3153
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
261 #else //RUNTIME_CPUDETECT
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
262 #ifdef HAVE_MMX2
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
263 printf("Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n");
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
264 #elif defined (HAVE_3DNOW)
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
265 printf("Using MMX (with tiny bit 3DNow) Optimized OnScreenDisplay\n");
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
266 #elif defined (HAVE_MMX)
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
267 printf("Using MMX Optimized OnScreenDisplay\n");
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
268 #elif defined (ARCH_X86)
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
269 printf("Using X86 Optimized OnScreenDisplay\n");
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
270 #else
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
271 printf("Using Unoptimized OnScreenDisplay\n");
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
272 #endif
5b8db331d0c1 optional runtime cpu detect
michael
parents: 3142
diff changeset
273 #endif //!RUNTIME_CPUDETECT
3142
0f6cce3a8059 runtime cpu detection
michael
parents: 2850
diff changeset
274 }
947
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
275 }
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
276
326
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
277 void vo_draw_alpha_rgb15(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
278 int y;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
279 for(y=0;y<h;y++){
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
280 register unsigned short *dst = (unsigned short*) dstbase;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
281 register int x;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
282 for(x=0;x<w;x++){
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
283 if(srca[x]){
947
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
284 #ifdef FAST_OSD
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
285 #ifdef FAST_OSD_TABLE
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
286 dst[x]=fast_osd_15bpp_table[src[x]];
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
287 #else
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
288 register unsigned int a=src[x]>>3;
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
289 dst[x]=(a<<10)|(a<<5)|a;
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
290 #endif
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
291 #else
326
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
292 unsigned char r=dst[x]&0x1F;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
293 unsigned char g=(dst[x]>>5)&0x1F;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
294 unsigned char b=(dst[x]>>10)&0x1F;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
295 r=(((r*srca[x])>>5)+src[x])>>3;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
296 g=(((g*srca[x])>>5)+src[x])>>3;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
297 b=(((b*srca[x])>>5)+src[x])>>3;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
298 dst[x]=(b<<10)|(g<<5)|r;
947
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
299 #endif
326
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
300 }
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
301 }
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
302 src+=srcstride;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
303 srca+=srcstride;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
304 dstbase+=dststride;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
305 }
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
306 return;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
307 }
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
308
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
309 void vo_draw_alpha_rgb16(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
310 int y;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
311 for(y=0;y<h;y++){
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
312 register unsigned short *dst = (unsigned short*) dstbase;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
313 register int x;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
314 for(x=0;x<w;x++){
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
315 if(srca[x]){
947
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
316 #ifdef FAST_OSD
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
317 #ifdef FAST_OSD_TABLE
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
318 dst[x]=fast_osd_16bpp_table[src[x]];
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
319 #else
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
320 dst[x]=((src[x]>>3)<<11)|((src[x]>>2)<<5)|(src[x]>>3);
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
321 #endif
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
322 #else
326
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
323 unsigned char r=dst[x]&0x1F;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
324 unsigned char g=(dst[x]>>5)&0x3F;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
325 unsigned char b=(dst[x]>>11)&0x1F;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
326 r=(((r*srca[x])>>5)+src[x])>>3;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
327 g=(((g*srca[x])>>6)+src[x])>>2;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
328 b=(((b*srca[x])>>5)+src[x])>>3;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
329 dst[x]=(b<<11)|(g<<5)|r;
947
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 622
diff changeset
330 #endif
326
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
331 }
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
332 }
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
333 src+=srcstride;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
334 srca+=srcstride;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
335 dstbase+=dststride;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
336 }
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
337 return;
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
338 }
f6b5c2dbc88e OSD alpha renderers moved to osd.c
arpi_esp
parents:
diff changeset
339