Mercurial > libavcodec.hg
annotate x86/vp8dsp-init.c @ 12057:560095a27bd0 libavcodec
Remove redundant and harmful explicit filename after @file Doxygen command.
author | diego |
---|---|
date | Fri, 02 Jul 2010 10:59:35 +0000 |
parents | b8f80fe02861 |
children | 8527154f6e81 |
rev | line source |
---|---|
11975 | 1 /* |
2 * VP8 DSP functions x86-optimized | |
3 * Copyright (c) 2010 Ronald S. Bultje <rsbultje@gmail.com> | |
4 * Copyright (c) 2010 Jason Garrett-Glaser <darkshikari@gmail.com> | |
5 * | |
6 * This file is part of FFmpeg. | |
7 * | |
8 * FFmpeg is free software; you can redistribute it and/or | |
9 * modify it under the terms of the GNU Lesser General Public | |
10 * License as published by the Free Software Foundation; either | |
11 * version 2.1 of the License, or (at your option) any later version. | |
12 * | |
13 * FFmpeg is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 * Lesser General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU Lesser General Public | |
19 * License along with FFmpeg; if not, write to the Free Software | |
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
21 */ | |
22 | |
23 #include "libavutil/x86_cpu.h" | |
24 #include "libavcodec/vp8dsp.h" | |
25 | |
11991 | 26 #if HAVE_YASM |
27 | |
11975 | 28 /* |
29 * MC functions | |
30 */ | |
31 extern void ff_put_vp8_epel4_h4_mmxext(uint8_t *dst, int dststride, | |
32 uint8_t *src, int srcstride, | |
33 int height, int mx, int my); | |
34 extern void ff_put_vp8_epel4_h6_mmxext(uint8_t *dst, int dststride, | |
35 uint8_t *src, int srcstride, | |
36 int height, int mx, int my); | |
37 extern void ff_put_vp8_epel4_v4_mmxext(uint8_t *dst, int dststride, | |
38 uint8_t *src, int srcstride, | |
39 int height, int mx, int my); | |
40 extern void ff_put_vp8_epel4_v6_mmxext(uint8_t *dst, int dststride, | |
41 uint8_t *src, int srcstride, | |
42 int height, int mx, int my); | |
43 | |
44 extern void ff_put_vp8_epel8_h4_sse2 (uint8_t *dst, int dststride, | |
45 uint8_t *src, int srcstride, | |
46 int height, int mx, int my); | |
47 extern void ff_put_vp8_epel8_h6_sse2 (uint8_t *dst, int dststride, | |
48 uint8_t *src, int srcstride, | |
49 int height, int mx, int my); | |
50 extern void ff_put_vp8_epel8_v4_sse2 (uint8_t *dst, int dststride, | |
51 uint8_t *src, int srcstride, | |
52 int height, int mx, int my); | |
53 extern void ff_put_vp8_epel8_v6_sse2 (uint8_t *dst, int dststride, | |
54 uint8_t *src, int srcstride, | |
55 int height, int mx, int my); | |
56 | |
12054
b8f80fe02861
SSSE3 versions of width4 VP8 6-tap MC functions
darkshikari
parents:
12042
diff
changeset
|
57 extern void ff_put_vp8_epel4_h4_ssse3 (uint8_t *dst, int dststride, |
b8f80fe02861
SSSE3 versions of width4 VP8 6-tap MC functions
darkshikari
parents:
12042
diff
changeset
|
58 uint8_t *src, int srcstride, |
b8f80fe02861
SSSE3 versions of width4 VP8 6-tap MC functions
darkshikari
parents:
12042
diff
changeset
|
59 int height, int mx, int my); |
b8f80fe02861
SSSE3 versions of width4 VP8 6-tap MC functions
darkshikari
parents:
12042
diff
changeset
|
60 extern void ff_put_vp8_epel4_h6_ssse3 (uint8_t *dst, int dststride, |
b8f80fe02861
SSSE3 versions of width4 VP8 6-tap MC functions
darkshikari
parents:
12042
diff
changeset
|
61 uint8_t *src, int srcstride, |
b8f80fe02861
SSSE3 versions of width4 VP8 6-tap MC functions
darkshikari
parents:
12042
diff
changeset
|
62 int height, int mx, int my); |
b8f80fe02861
SSSE3 versions of width4 VP8 6-tap MC functions
darkshikari
parents:
12042
diff
changeset
|
63 extern void ff_put_vp8_epel4_v4_ssse3 (uint8_t *dst, int dststride, |
b8f80fe02861
SSSE3 versions of width4 VP8 6-tap MC functions
darkshikari
parents:
12042
diff
changeset
|
64 uint8_t *src, int srcstride, |
b8f80fe02861
SSSE3 versions of width4 VP8 6-tap MC functions
darkshikari
parents:
12042
diff
changeset
|
65 int height, int mx, int my); |
b8f80fe02861
SSSE3 versions of width4 VP8 6-tap MC functions
darkshikari
parents:
12042
diff
changeset
|
66 extern void ff_put_vp8_epel4_v6_ssse3 (uint8_t *dst, int dststride, |
b8f80fe02861
SSSE3 versions of width4 VP8 6-tap MC functions
darkshikari
parents:
12042
diff
changeset
|
67 uint8_t *src, int srcstride, |
b8f80fe02861
SSSE3 versions of width4 VP8 6-tap MC functions
darkshikari
parents:
12042
diff
changeset
|
68 int height, int mx, int my); |
11975 | 69 extern void ff_put_vp8_epel8_h4_ssse3 (uint8_t *dst, int dststride, |
70 uint8_t *src, int srcstride, | |
71 int height, int mx, int my); | |
72 extern void ff_put_vp8_epel8_h6_ssse3 (uint8_t *dst, int dststride, | |
73 uint8_t *src, int srcstride, | |
74 int height, int mx, int my); | |
75 extern void ff_put_vp8_epel8_v4_ssse3 (uint8_t *dst, int dststride, | |
76 uint8_t *src, int srcstride, | |
77 int height, int mx, int my); | |
78 extern void ff_put_vp8_epel8_v6_ssse3 (uint8_t *dst, int dststride, | |
79 uint8_t *src, int srcstride, | |
80 int height, int mx, int my); | |
81 | |
11991 | 82 extern void ff_put_vp8_bilinear4_h_mmxext(uint8_t *dst, int dststride, |
83 uint8_t *src, int srcstride, | |
84 int height, int mx, int my); | |
85 extern void ff_put_vp8_bilinear8_h_sse2 (uint8_t *dst, int dststride, | |
86 uint8_t *src, int srcstride, | |
87 int height, int mx, int my); | |
88 | |
89 extern void ff_put_vp8_bilinear4_v_mmxext(uint8_t *dst, int dststride, | |
90 uint8_t *src, int srcstride, | |
91 int height, int mx, int my); | |
92 extern void ff_put_vp8_bilinear8_v_sse2 (uint8_t *dst, int dststride, | |
93 uint8_t *src, int srcstride, | |
94 int height, int mx, int my); | |
95 extern void ff_put_vp8_bilinear8_v_ssse3 (uint8_t *dst, int dststride, | |
96 uint8_t *src, int srcstride, | |
97 int height, int mx, int my); | |
98 extern void ff_put_vp8_bilinear8_h_ssse3 (uint8_t *dst, int dststride, | |
99 uint8_t *src, int srcstride, | |
100 int height, int mx, int my); | |
101 | |
11992 | 102 extern void ff_put_vp8_pixels8_mmx (uint8_t *dst, int dststride, |
103 uint8_t *src, int srcstride, | |
104 int height, int mx, int my); | |
105 extern void ff_put_vp8_pixels16_mmx(uint8_t *dst, int dststride, | |
106 uint8_t *src, int srcstride, | |
107 int height, int mx, int my); | |
108 extern void ff_put_vp8_pixels16_sse(uint8_t *dst, int dststride, | |
109 uint8_t *src, int srcstride, | |
110 int height, int mx, int my); | |
111 | |
11991 | 112 #define TAP_W16(OPT, FILTERTYPE, TAPTYPE) \ |
113 static void ff_put_vp8_ ## FILTERTYPE ## 16_ ## TAPTYPE ## _ ## OPT( \ | |
114 uint8_t *dst, int dststride, uint8_t *src, \ | |
115 int srcstride, int height, int mx, int my) \ | |
11975 | 116 { \ |
11991 | 117 ff_put_vp8_ ## FILTERTYPE ## 8_ ## TAPTYPE ## _ ## OPT( \ |
118 dst, dststride, src, srcstride, height, mx, my); \ | |
119 ff_put_vp8_ ## FILTERTYPE ## 8_ ## TAPTYPE ## _ ## OPT( \ | |
120 dst + 8, dststride, src + 8, srcstride, height, mx, my); \ | |
11975 | 121 } |
11991 | 122 #define TAP_W8(OPT, FILTERTYPE, TAPTYPE) \ |
123 static void ff_put_vp8_ ## FILTERTYPE ## 8_ ## TAPTYPE ## _ ## OPT( \ | |
124 uint8_t *dst, int dststride, uint8_t *src, \ | |
125 int srcstride, int height, int mx, int my) \ | |
11975 | 126 { \ |
11991 | 127 ff_put_vp8_ ## FILTERTYPE ## 4_ ## TAPTYPE ## _ ## OPT( \ |
128 dst, dststride, src, srcstride, height, mx, my); \ | |
129 ff_put_vp8_ ## FILTERTYPE ## 4_ ## TAPTYPE ## _ ## OPT( \ | |
130 dst + 4, dststride, src + 4, srcstride, height, mx, my); \ | |
11975 | 131 } |
132 | |
11991 | 133 TAP_W8 (mmxext, epel, h4) |
134 TAP_W8 (mmxext, epel, h6) | |
135 TAP_W16(mmxext, epel, h6) | |
136 TAP_W8 (mmxext, epel, v4) | |
137 TAP_W8 (mmxext, epel, v6) | |
138 TAP_W16(mmxext, epel, v6) | |
139 TAP_W8 (mmxext, bilinear, h) | |
140 TAP_W16(mmxext, bilinear, h) | |
141 TAP_W8 (mmxext, bilinear, v) | |
142 TAP_W16(mmxext, bilinear, v) | |
11975 | 143 |
11991 | 144 TAP_W16(sse2, epel, h6) |
145 TAP_W16(sse2, epel, v6) | |
146 TAP_W16(sse2, bilinear, h) | |
147 TAP_W16(sse2, bilinear, v) | |
11975 | 148 |
11991 | 149 TAP_W16(ssse3, epel, h6) |
150 TAP_W16(ssse3, epel, v6) | |
151 TAP_W16(ssse3, bilinear, h) | |
152 TAP_W16(ssse3, bilinear, v) | |
11975 | 153 |
154 #define HVTAP(OPT, ALIGN, TAPNUMX, TAPNUMY, SIZE, MAXHEIGHT) \ | |
11991 | 155 static void ff_put_vp8_epel ## SIZE ## _h ## TAPNUMX ## v ## TAPNUMY ## _ ## OPT( \ |
156 uint8_t *dst, int dststride, uint8_t *src, \ | |
157 int srcstride, int height, int mx, int my) \ | |
11975 | 158 { \ |
159 DECLARE_ALIGNED(ALIGN, uint8_t, tmp)[SIZE * (MAXHEIGHT + TAPNUMY - 1)]; \ | |
160 uint8_t *tmpptr = tmp + SIZE * (TAPNUMY / 2 - 1); \ | |
161 src -= srcstride * (TAPNUMY / 2 - 1); \ | |
11991 | 162 ff_put_vp8_epel ## SIZE ## _h ## TAPNUMX ## _ ## OPT( \ |
163 tmp, SIZE, src, srcstride, height + TAPNUMY - 1, mx, my); \ | |
164 ff_put_vp8_epel ## SIZE ## _v ## TAPNUMY ## _ ## OPT( \ | |
165 dst, dststride, tmpptr, SIZE, height, mx, my); \ | |
11975 | 166 } |
167 | |
168 #define HVTAPMMX(x, y) \ | |
169 HVTAP(mmxext, 8, x, y, 4, 8) \ | |
170 HVTAP(mmxext, 8, x, y, 8, 16) | |
171 | |
172 HVTAPMMX(4, 4) | |
173 HVTAPMMX(4, 6) | |
174 HVTAPMMX(6, 4) | |
175 HVTAPMMX(6, 6) | |
176 HVTAP(mmxext, 8, 6, 6, 16, 16) | |
177 | |
178 #define HVTAPSSE2(x, y, w) \ | |
179 HVTAP(sse2, 16, x, y, w, 16) \ | |
180 HVTAP(ssse3, 16, x, y, w, 16) | |
181 | |
182 HVTAPSSE2(4, 4, 8) | |
183 HVTAPSSE2(4, 6, 8) | |
184 HVTAPSSE2(6, 4, 8) | |
185 HVTAPSSE2(6, 6, 8) | |
186 HVTAPSSE2(6, 6, 16) | |
11991 | 187 |
12054
b8f80fe02861
SSSE3 versions of width4 VP8 6-tap MC functions
darkshikari
parents:
12042
diff
changeset
|
188 HVTAP(ssse3, 16, 4, 4, 4, 8) |
b8f80fe02861
SSSE3 versions of width4 VP8 6-tap MC functions
darkshikari
parents:
12042
diff
changeset
|
189 HVTAP(ssse3, 16, 4, 6, 4, 8) |
b8f80fe02861
SSSE3 versions of width4 VP8 6-tap MC functions
darkshikari
parents:
12042
diff
changeset
|
190 HVTAP(ssse3, 16, 6, 4, 4, 8) |
b8f80fe02861
SSSE3 versions of width4 VP8 6-tap MC functions
darkshikari
parents:
12042
diff
changeset
|
191 HVTAP(ssse3, 16, 6, 6, 4, 8) |
b8f80fe02861
SSSE3 versions of width4 VP8 6-tap MC functions
darkshikari
parents:
12042
diff
changeset
|
192 |
11991 | 193 #define HVBILIN(OPT, ALIGN, SIZE, MAXHEIGHT) \ |
194 static void ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT( \ | |
195 uint8_t *dst, int dststride, uint8_t *src, \ | |
196 int srcstride, int height, int mx, int my) \ | |
197 { \ | |
198 DECLARE_ALIGNED(ALIGN, uint8_t, tmp)[SIZE * (MAXHEIGHT + 2)]; \ | |
199 ff_put_vp8_bilinear ## SIZE ## _h_ ## OPT( \ | |
200 tmp, SIZE, src, srcstride, height + 1, mx, my); \ | |
201 ff_put_vp8_bilinear ## SIZE ## _v_ ## OPT( \ | |
202 dst, dststride, tmp, SIZE, height, mx, my); \ | |
203 } | |
204 | |
205 HVBILIN(mmxext, 8, 4, 8) | |
206 HVBILIN(mmxext, 8, 8, 16) | |
207 HVBILIN(mmxext, 8, 16, 16) | |
208 HVBILIN(sse2, 8, 8, 16) | |
209 HVBILIN(sse2, 8, 16, 16) | |
210 HVBILIN(ssse3, 8, 8, 16) | |
211 HVBILIN(ssse3, 8, 16, 16) | |
11975 | 212 |
213 extern void ff_vp8_idct_dc_add_mmx(uint8_t *dst, DCTELEM block[16], int stride); | |
214 extern void ff_vp8_idct_dc_add_sse4(uint8_t *dst, DCTELEM block[16], int stride); | |
12006
d584c7373a64
Add mmxext version of VP8 DC Hadamard transform
darkshikari
parents:
11993
diff
changeset
|
215 extern void ff_vp8_luma_dc_wht_mmxext(DCTELEM block[4][4][16], DCTELEM dc[16]); |
12013 | 216 extern void ff_vp8_idct_add_mmx(uint8_t *dst, DCTELEM block[16], int stride); |
11991 | 217 #endif |
218 | |
219 #define VP8_LUMA_MC_FUNC(IDX, SIZE, OPT) \ | |
220 c->put_vp8_epel_pixels_tab[IDX][0][2] = ff_put_vp8_epel ## SIZE ## _h6_ ## OPT; \ | |
221 c->put_vp8_epel_pixels_tab[IDX][2][0] = ff_put_vp8_epel ## SIZE ## _v6_ ## OPT; \ | |
222 c->put_vp8_epel_pixels_tab[IDX][2][2] = ff_put_vp8_epel ## SIZE ## _h6v6_ ## OPT | |
223 | |
224 #define VP8_MC_FUNC(IDX, SIZE, OPT) \ | |
225 c->put_vp8_epel_pixels_tab[IDX][0][1] = ff_put_vp8_epel ## SIZE ## _h4_ ## OPT; \ | |
226 c->put_vp8_epel_pixels_tab[IDX][1][0] = ff_put_vp8_epel ## SIZE ## _v4_ ## OPT; \ | |
227 c->put_vp8_epel_pixels_tab[IDX][1][1] = ff_put_vp8_epel ## SIZE ## _h4v4_ ## OPT; \ | |
228 c->put_vp8_epel_pixels_tab[IDX][1][2] = ff_put_vp8_epel ## SIZE ## _h6v4_ ## OPT; \ | |
229 c->put_vp8_epel_pixels_tab[IDX][2][1] = ff_put_vp8_epel ## SIZE ## _h4v6_ ## OPT; \ | |
230 VP8_LUMA_MC_FUNC(IDX, SIZE, OPT) | |
231 | |
232 #define VP8_BILINEAR_MC_FUNC(IDX, SIZE, OPT) \ | |
233 c->put_vp8_bilinear_pixels_tab[IDX][0][1] = ff_put_vp8_bilinear ## SIZE ## _h_ ## OPT; \ | |
234 c->put_vp8_bilinear_pixels_tab[IDX][0][2] = ff_put_vp8_bilinear ## SIZE ## _h_ ## OPT; \ | |
235 c->put_vp8_bilinear_pixels_tab[IDX][1][0] = ff_put_vp8_bilinear ## SIZE ## _v_ ## OPT; \ | |
236 c->put_vp8_bilinear_pixels_tab[IDX][1][1] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \ | |
237 c->put_vp8_bilinear_pixels_tab[IDX][1][2] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \ | |
238 c->put_vp8_bilinear_pixels_tab[IDX][2][0] = ff_put_vp8_bilinear ## SIZE ## _v_ ## OPT; \ | |
239 c->put_vp8_bilinear_pixels_tab[IDX][2][1] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \ | |
240 c->put_vp8_bilinear_pixels_tab[IDX][2][2] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT | |
241 | |
11975 | 242 |
243 av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c) | |
244 { | |
245 mm_flags = mm_support(); | |
246 | |
11976 | 247 #if HAVE_YASM |
11975 | 248 if (mm_flags & FF_MM_MMX) { |
249 c->vp8_idct_dc_add = ff_vp8_idct_dc_add_mmx; | |
12013 | 250 c->vp8_idct_add = ff_vp8_idct_add_mmx; |
11992 | 251 c->put_vp8_epel_pixels_tab[0][0][0] = |
252 c->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_mmx; | |
253 c->put_vp8_epel_pixels_tab[1][0][0] = | |
254 c->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_mmx; | |
11975 | 255 } |
256 | |
257 /* note that 4-tap width=16 functions are missing because w=16 | |
258 * is only used for luma, and luma is always a copy or sixtap. */ | |
11993 | 259 if (mm_flags & FF_MM_MMX2) { |
12006
d584c7373a64
Add mmxext version of VP8 DC Hadamard transform
darkshikari
parents:
11993
diff
changeset
|
260 c->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_mmxext; |
11991 | 261 VP8_LUMA_MC_FUNC(0, 16, mmxext); |
262 VP8_MC_FUNC(1, 8, mmxext); | |
12042 | 263 VP8_MC_FUNC(2, 4, mmxext); |
11991 | 264 VP8_BILINEAR_MC_FUNC(0, 16, mmxext); |
265 VP8_BILINEAR_MC_FUNC(1, 8, mmxext); | |
12042 | 266 VP8_BILINEAR_MC_FUNC(2, 4, mmxext); |
11975 | 267 } |
268 | |
11992 | 269 if (mm_flags & FF_MM_SSE) { |
270 c->put_vp8_epel_pixels_tab[0][0][0] = | |
271 c->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_sse; | |
272 } | |
273 | |
11975 | 274 if (mm_flags & FF_MM_SSE2) { |
11991 | 275 VP8_LUMA_MC_FUNC(0, 16, sse2); |
276 VP8_MC_FUNC(1, 8, sse2); | |
277 VP8_BILINEAR_MC_FUNC(0, 16, sse2); | |
278 VP8_BILINEAR_MC_FUNC(1, 8, sse2); | |
11975 | 279 } |
280 | |
281 if (mm_flags & FF_MM_SSSE3) { | |
11991 | 282 VP8_LUMA_MC_FUNC(0, 16, ssse3); |
283 VP8_MC_FUNC(1, 8, ssse3); | |
12054
b8f80fe02861
SSSE3 versions of width4 VP8 6-tap MC functions
darkshikari
parents:
12042
diff
changeset
|
284 VP8_MC_FUNC(2, 4, ssse3); |
11991 | 285 VP8_BILINEAR_MC_FUNC(0, 16, ssse3); |
286 VP8_BILINEAR_MC_FUNC(1, 8, ssse3); | |
11975 | 287 } |
288 | |
289 if (mm_flags & FF_MM_SSE4) { | |
290 c->vp8_idct_dc_add = ff_vp8_idct_dc_add_sse4; | |
291 } | |
11976 | 292 #endif |
11975 | 293 } |