]> git.sesse.net Git - ffmpeg/blob - libavcodec/x86/vp8dsp_init.c
lavf: move ff_codec_get_tag() and ff_codec_get_id() definitions to internal.h
[ffmpeg] / libavcodec / x86 / vp8dsp_init.c
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 Libav.
7  *
8  * Libav 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  * Libav 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 Libav; 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/cpu.h"
24 #include "libavutil/mem.h"
25 #include "libavutil/x86/asm.h"
26 #include "libavcodec/vp8dsp.h"
27
28 #if HAVE_YASM
29
30 /*
31  * MC functions
32  */
33 extern void ff_put_vp8_epel4_h4_mmxext(uint8_t *dst, ptrdiff_t dststride,
34                                        uint8_t *src, ptrdiff_t srcstride,
35                                        int height, int mx, int my);
36 extern void ff_put_vp8_epel4_h6_mmxext(uint8_t *dst, ptrdiff_t dststride,
37                                        uint8_t *src, ptrdiff_t srcstride,
38                                        int height, int mx, int my);
39 extern void ff_put_vp8_epel4_v4_mmxext(uint8_t *dst, ptrdiff_t dststride,
40                                        uint8_t *src, ptrdiff_t srcstride,
41                                        int height, int mx, int my);
42 extern void ff_put_vp8_epel4_v6_mmxext(uint8_t *dst, ptrdiff_t dststride,
43                                        uint8_t *src, ptrdiff_t srcstride,
44                                        int height, int mx, int my);
45
46 extern void ff_put_vp8_epel8_h4_sse2  (uint8_t *dst, ptrdiff_t dststride,
47                                        uint8_t *src, ptrdiff_t srcstride,
48                                        int height, int mx, int my);
49 extern void ff_put_vp8_epel8_h6_sse2  (uint8_t *dst, ptrdiff_t dststride,
50                                        uint8_t *src, ptrdiff_t srcstride,
51                                        int height, int mx, int my);
52 extern void ff_put_vp8_epel8_v4_sse2  (uint8_t *dst, ptrdiff_t dststride,
53                                        uint8_t *src, ptrdiff_t srcstride,
54                                        int height, int mx, int my);
55 extern void ff_put_vp8_epel8_v6_sse2  (uint8_t *dst, ptrdiff_t dststride,
56                                        uint8_t *src, ptrdiff_t srcstride,
57                                        int height, int mx, int my);
58
59 extern void ff_put_vp8_epel4_h4_ssse3 (uint8_t *dst, ptrdiff_t dststride,
60                                        uint8_t *src, ptrdiff_t srcstride,
61                                        int height, int mx, int my);
62 extern void ff_put_vp8_epel4_h6_ssse3 (uint8_t *dst, ptrdiff_t dststride,
63                                        uint8_t *src, ptrdiff_t srcstride,
64                                        int height, int mx, int my);
65 extern void ff_put_vp8_epel4_v4_ssse3 (uint8_t *dst, ptrdiff_t dststride,
66                                        uint8_t *src, ptrdiff_t srcstride,
67                                        int height, int mx, int my);
68 extern void ff_put_vp8_epel4_v6_ssse3 (uint8_t *dst, ptrdiff_t dststride,
69                                        uint8_t *src, ptrdiff_t srcstride,
70                                        int height, int mx, int my);
71 extern void ff_put_vp8_epel8_h4_ssse3 (uint8_t *dst, ptrdiff_t dststride,
72                                        uint8_t *src, ptrdiff_t srcstride,
73                                        int height, int mx, int my);
74 extern void ff_put_vp8_epel8_h6_ssse3 (uint8_t *dst, ptrdiff_t dststride,
75                                        uint8_t *src, ptrdiff_t srcstride,
76                                        int height, int mx, int my);
77 extern void ff_put_vp8_epel8_v4_ssse3 (uint8_t *dst, ptrdiff_t dststride,
78                                        uint8_t *src, ptrdiff_t srcstride,
79                                        int height, int mx, int my);
80 extern void ff_put_vp8_epel8_v6_ssse3 (uint8_t *dst, ptrdiff_t dststride,
81                                        uint8_t *src, ptrdiff_t srcstride,
82                                        int height, int mx, int my);
83
84 extern void ff_put_vp8_bilinear4_h_mmxext(uint8_t *dst, ptrdiff_t dststride,
85                                           uint8_t *src, ptrdiff_t srcstride,
86                                           int height, int mx, int my);
87 extern void ff_put_vp8_bilinear8_h_sse2  (uint8_t *dst, ptrdiff_t dststride,
88                                           uint8_t *src, ptrdiff_t srcstride,
89                                           int height, int mx, int my);
90 extern void ff_put_vp8_bilinear4_h_ssse3 (uint8_t *dst, ptrdiff_t dststride,
91                                           uint8_t *src, ptrdiff_t srcstride,
92                                           int height, int mx, int my);
93 extern void ff_put_vp8_bilinear8_h_ssse3 (uint8_t *dst, ptrdiff_t dststride,
94                                           uint8_t *src, ptrdiff_t srcstride,
95                                           int height, int mx, int my);
96
97 extern void ff_put_vp8_bilinear4_v_mmxext(uint8_t *dst, ptrdiff_t dststride,
98                                           uint8_t *src, ptrdiff_t srcstride,
99                                           int height, int mx, int my);
100 extern void ff_put_vp8_bilinear8_v_sse2  (uint8_t *dst, ptrdiff_t dststride,
101                                           uint8_t *src, ptrdiff_t srcstride,
102                                           int height, int mx, int my);
103 extern void ff_put_vp8_bilinear4_v_ssse3 (uint8_t *dst, ptrdiff_t dststride,
104                                           uint8_t *src, ptrdiff_t srcstride,
105                                           int height, int mx, int my);
106 extern void ff_put_vp8_bilinear8_v_ssse3 (uint8_t *dst, ptrdiff_t dststride,
107                                           uint8_t *src, ptrdiff_t srcstride,
108                                           int height, int mx, int my);
109
110
111 extern void ff_put_vp8_pixels8_mmx (uint8_t *dst, ptrdiff_t dststride,
112                                     uint8_t *src, ptrdiff_t srcstride,
113                                     int height, int mx, int my);
114 extern void ff_put_vp8_pixels16_mmx(uint8_t *dst, ptrdiff_t dststride,
115                                     uint8_t *src, ptrdiff_t srcstride,
116                                     int height, int mx, int my);
117 extern void ff_put_vp8_pixels16_sse(uint8_t *dst, ptrdiff_t dststride,
118                                     uint8_t *src, ptrdiff_t srcstride,
119                                     int height, int mx, int my);
120
121 #define TAP_W16(OPT, FILTERTYPE, TAPTYPE) \
122 static void ff_put_vp8_ ## FILTERTYPE ## 16_ ## TAPTYPE ## _ ## OPT( \
123     uint8_t *dst,  ptrdiff_t dststride, uint8_t *src, \
124     ptrdiff_t srcstride, int height, int mx, int my) \
125 { \
126     ff_put_vp8_ ## FILTERTYPE ## 8_ ## TAPTYPE ## _ ## OPT( \
127         dst,     dststride, src,     srcstride, height, mx, my); \
128     ff_put_vp8_ ## FILTERTYPE ## 8_ ## TAPTYPE ## _ ## OPT( \
129         dst + 8, dststride, src + 8, srcstride, height, mx, my); \
130 }
131 #define TAP_W8(OPT, FILTERTYPE, TAPTYPE) \
132 static void ff_put_vp8_ ## FILTERTYPE ## 8_ ## TAPTYPE ## _ ## OPT( \
133     uint8_t *dst,  ptrdiff_t dststride, uint8_t *src, \
134     ptrdiff_t srcstride, int height, int mx, int my) \
135 { \
136     ff_put_vp8_ ## FILTERTYPE ## 4_ ## TAPTYPE ## _ ## OPT( \
137         dst,     dststride, src,     srcstride, height, mx, my); \
138     ff_put_vp8_ ## FILTERTYPE ## 4_ ## TAPTYPE ## _ ## OPT( \
139         dst + 4, dststride, src + 4, srcstride, height, mx, my); \
140 }
141
142 #if ARCH_X86_32
143 TAP_W8 (mmxext, epel, h4)
144 TAP_W8 (mmxext, epel, h6)
145 TAP_W16(mmxext, epel, h6)
146 TAP_W8 (mmxext, epel, v4)
147 TAP_W8 (mmxext, epel, v6)
148 TAP_W16(mmxext, epel, v6)
149 TAP_W8 (mmxext, bilinear, h)
150 TAP_W16(mmxext, bilinear, h)
151 TAP_W8 (mmxext, bilinear, v)
152 TAP_W16(mmxext, bilinear, v)
153 #endif
154
155 TAP_W16(sse2,  epel, h6)
156 TAP_W16(sse2,  epel, v6)
157 TAP_W16(sse2,  bilinear, h)
158 TAP_W16(sse2,  bilinear, v)
159
160 TAP_W16(ssse3, epel, h6)
161 TAP_W16(ssse3, epel, v6)
162 TAP_W16(ssse3, bilinear, h)
163 TAP_W16(ssse3, bilinear, v)
164
165 #define HVTAP(OPT, ALIGN, TAPNUMX, TAPNUMY, SIZE, MAXHEIGHT) \
166 static void ff_put_vp8_epel ## SIZE ## _h ## TAPNUMX ## v ## TAPNUMY ## _ ## OPT( \
167     uint8_t *dst, ptrdiff_t dststride, uint8_t *src, \
168     ptrdiff_t srcstride, int height, int mx, int my) \
169 { \
170     DECLARE_ALIGNED(ALIGN, uint8_t, tmp)[SIZE * (MAXHEIGHT + TAPNUMY - 1)]; \
171     uint8_t *tmpptr = tmp + SIZE * (TAPNUMY / 2 - 1); \
172     src -= srcstride * (TAPNUMY / 2 - 1); \
173     ff_put_vp8_epel ## SIZE ## _h ## TAPNUMX ## _ ## OPT( \
174         tmp, SIZE,      src,    srcstride, height + TAPNUMY - 1, mx, my); \
175     ff_put_vp8_epel ## SIZE ## _v ## TAPNUMY ## _ ## OPT( \
176         dst, dststride, tmpptr, SIZE,      height,               mx, my); \
177 }
178
179 #if ARCH_X86_32
180 #define HVTAPMMX(x, y) \
181 HVTAP(mmxext, 8, x, y,  4,  8) \
182 HVTAP(mmxext, 8, x, y,  8, 16)
183
184 HVTAP(mmxext, 8, 6, 6, 16, 16)
185 #else
186 #define HVTAPMMX(x, y) \
187 HVTAP(mmxext, 8, x, y,  4,  8)
188 #endif
189
190 HVTAPMMX(4, 4)
191 HVTAPMMX(4, 6)
192 HVTAPMMX(6, 4)
193 HVTAPMMX(6, 6)
194
195 #define HVTAPSSE2(x, y, w) \
196 HVTAP(sse2,  16, x, y, w, 16) \
197 HVTAP(ssse3, 16, x, y, w, 16)
198
199 HVTAPSSE2(4, 4, 8)
200 HVTAPSSE2(4, 6, 8)
201 HVTAPSSE2(6, 4, 8)
202 HVTAPSSE2(6, 6, 8)
203 HVTAPSSE2(6, 6, 16)
204
205 HVTAP(ssse3, 16, 4, 4, 4, 8)
206 HVTAP(ssse3, 16, 4, 6, 4, 8)
207 HVTAP(ssse3, 16, 6, 4, 4, 8)
208 HVTAP(ssse3, 16, 6, 6, 4, 8)
209
210 #define HVBILIN(OPT, ALIGN, SIZE, MAXHEIGHT) \
211 static void ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT( \
212     uint8_t *dst, ptrdiff_t dststride, uint8_t *src, \
213     ptrdiff_t srcstride, int height, int mx, int my) \
214 { \
215     DECLARE_ALIGNED(ALIGN, uint8_t, tmp)[SIZE * (MAXHEIGHT + 2)]; \
216     ff_put_vp8_bilinear ## SIZE ## _h_ ## OPT( \
217         tmp, SIZE,      src, srcstride, height + 1, mx, my); \
218     ff_put_vp8_bilinear ## SIZE ## _v_ ## OPT( \
219         dst, dststride, tmp, SIZE,      height,     mx, my); \
220 }
221
222 HVBILIN(mmxext,  8,  4,  8)
223 #if ARCH_X86_32
224 HVBILIN(mmxext,  8,  8, 16)
225 HVBILIN(mmxext,  8, 16, 16)
226 #endif
227 HVBILIN(sse2,  8,  8, 16)
228 HVBILIN(sse2,  8, 16, 16)
229 HVBILIN(ssse3, 8,  4,  8)
230 HVBILIN(ssse3, 8,  8, 16)
231 HVBILIN(ssse3, 8, 16, 16)
232
233 extern void ff_vp8_idct_dc_add_mmx(uint8_t *dst, DCTELEM block[16],
234                                    ptrdiff_t stride);
235 extern void ff_vp8_idct_dc_add_sse4(uint8_t *dst, DCTELEM block[16],
236                                     ptrdiff_t stride);
237 extern void ff_vp8_idct_dc_add4y_mmx(uint8_t *dst, DCTELEM block[4][16],
238                                       ptrdiff_t stride);
239 extern void ff_vp8_idct_dc_add4y_sse2(uint8_t *dst, DCTELEM block[4][16],
240                                       ptrdiff_t stride);
241 extern void ff_vp8_idct_dc_add4uv_mmx(uint8_t *dst, DCTELEM block[2][16],
242                                       ptrdiff_t stride);
243 extern void ff_vp8_luma_dc_wht_mmx(DCTELEM block[4][4][16], DCTELEM dc[16]);
244 extern void ff_vp8_luma_dc_wht_sse(DCTELEM block[4][4][16], DCTELEM dc[16]);
245 extern void ff_vp8_idct_add_mmx(uint8_t *dst, DCTELEM block[16],
246                                 ptrdiff_t stride);
247 extern void ff_vp8_idct_add_sse(uint8_t *dst, DCTELEM block[16],
248                                 ptrdiff_t stride);
249
250 #define DECLARE_LOOP_FILTER(NAME)\
251 extern void ff_vp8_v_loop_filter_simple_ ## NAME(uint8_t *dst, \
252                                                  ptrdiff_t stride, \
253                                                  int flim);\
254 extern void ff_vp8_h_loop_filter_simple_ ## NAME(uint8_t *dst, \
255                                                  ptrdiff_t stride, \
256                                                  int flim);\
257 extern void ff_vp8_v_loop_filter16y_inner_ ## NAME (uint8_t *dst, \
258                                                      ptrdiff_t stride,\
259                                                     int e, int i, int hvt);\
260 extern void ff_vp8_h_loop_filter16y_inner_ ## NAME (uint8_t *dst, \
261                                                     ptrdiff_t stride,\
262                                                     int e, int i, int hvt);\
263 extern void ff_vp8_v_loop_filter8uv_inner_ ## NAME (uint8_t *dstU, \
264                                                     uint8_t *dstV,\
265                                                     ptrdiff_t s, \
266                                                     int e, int i, int hvt);\
267 extern void ff_vp8_h_loop_filter8uv_inner_ ## NAME (uint8_t *dstU, \
268                                                     uint8_t *dstV,\
269                                                     ptrdiff_t s, \
270                                                     int e, int i, int hvt);\
271 extern void ff_vp8_v_loop_filter16y_mbedge_ ## NAME(uint8_t *dst, \
272                                                     ptrdiff_t stride,\
273                                                     int e, int i, int hvt);\
274 extern void ff_vp8_h_loop_filter16y_mbedge_ ## NAME(uint8_t *dst, \
275                                                     ptrdiff_t stride,\
276                                                     int e, int i, int hvt);\
277 extern void ff_vp8_v_loop_filter8uv_mbedge_ ## NAME(uint8_t *dstU, \
278                                                     uint8_t *dstV,\
279                                                     ptrdiff_t s, \
280                                                     int e, int i, int hvt);\
281 extern void ff_vp8_h_loop_filter8uv_mbedge_ ## NAME(uint8_t *dstU, \
282                                                     uint8_t *dstV,\
283                                                     ptrdiff_t s, \
284                                                     int e, int i, int hvt);
285
286 DECLARE_LOOP_FILTER(mmx)
287 DECLARE_LOOP_FILTER(mmxext)
288 DECLARE_LOOP_FILTER(sse2)
289 DECLARE_LOOP_FILTER(ssse3)
290 DECLARE_LOOP_FILTER(sse4)
291
292 #endif /* HAVE_YASM */
293
294 #define VP8_LUMA_MC_FUNC(IDX, SIZE, OPT) \
295     c->put_vp8_epel_pixels_tab[IDX][0][2] = ff_put_vp8_epel ## SIZE ## _h6_ ## OPT; \
296     c->put_vp8_epel_pixels_tab[IDX][2][0] = ff_put_vp8_epel ## SIZE ## _v6_ ## OPT; \
297     c->put_vp8_epel_pixels_tab[IDX][2][2] = ff_put_vp8_epel ## SIZE ## _h6v6_ ## OPT
298
299 #define VP8_MC_FUNC(IDX, SIZE, OPT) \
300     c->put_vp8_epel_pixels_tab[IDX][0][1] = ff_put_vp8_epel ## SIZE ## _h4_ ## OPT; \
301     c->put_vp8_epel_pixels_tab[IDX][1][0] = ff_put_vp8_epel ## SIZE ## _v4_ ## OPT; \
302     c->put_vp8_epel_pixels_tab[IDX][1][1] = ff_put_vp8_epel ## SIZE ## _h4v4_ ## OPT; \
303     c->put_vp8_epel_pixels_tab[IDX][1][2] = ff_put_vp8_epel ## SIZE ## _h6v4_ ## OPT; \
304     c->put_vp8_epel_pixels_tab[IDX][2][1] = ff_put_vp8_epel ## SIZE ## _h4v6_ ## OPT; \
305     VP8_LUMA_MC_FUNC(IDX, SIZE, OPT)
306
307 #define VP8_BILINEAR_MC_FUNC(IDX, SIZE, OPT) \
308     c->put_vp8_bilinear_pixels_tab[IDX][0][1] = ff_put_vp8_bilinear ## SIZE ## _h_ ## OPT; \
309     c->put_vp8_bilinear_pixels_tab[IDX][0][2] = ff_put_vp8_bilinear ## SIZE ## _h_ ## OPT; \
310     c->put_vp8_bilinear_pixels_tab[IDX][1][0] = ff_put_vp8_bilinear ## SIZE ## _v_ ## OPT; \
311     c->put_vp8_bilinear_pixels_tab[IDX][1][1] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \
312     c->put_vp8_bilinear_pixels_tab[IDX][1][2] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \
313     c->put_vp8_bilinear_pixels_tab[IDX][2][0] = ff_put_vp8_bilinear ## SIZE ## _v_ ## OPT; \
314     c->put_vp8_bilinear_pixels_tab[IDX][2][1] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \
315     c->put_vp8_bilinear_pixels_tab[IDX][2][2] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT
316
317
318 av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c)
319 {
320 #if HAVE_YASM
321     int mm_flags = av_get_cpu_flags();
322
323     if (mm_flags & AV_CPU_FLAG_MMX) {
324         c->vp8_idct_dc_add    = ff_vp8_idct_dc_add_mmx;
325         c->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_mmx;
326 #if ARCH_X86_32
327         c->vp8_idct_dc_add4y  = ff_vp8_idct_dc_add4y_mmx;
328         c->vp8_idct_add       = ff_vp8_idct_add_mmx;
329         c->vp8_luma_dc_wht    = ff_vp8_luma_dc_wht_mmx;
330         c->put_vp8_epel_pixels_tab[0][0][0]     =
331         c->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_mmx;
332 #endif
333         c->put_vp8_epel_pixels_tab[1][0][0]     =
334         c->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_mmx;
335
336 #if ARCH_X86_32
337         c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_mmx;
338         c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_mmx;
339
340         c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_mmx;
341         c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_mmx;
342         c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_mmx;
343         c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_mmx;
344
345         c->vp8_v_loop_filter16y       = ff_vp8_v_loop_filter16y_mbedge_mmx;
346         c->vp8_h_loop_filter16y       = ff_vp8_h_loop_filter16y_mbedge_mmx;
347         c->vp8_v_loop_filter8uv       = ff_vp8_v_loop_filter8uv_mbedge_mmx;
348         c->vp8_h_loop_filter8uv       = ff_vp8_h_loop_filter8uv_mbedge_mmx;
349 #endif
350     }
351
352     /* note that 4-tap width=16 functions are missing because w=16
353      * is only used for luma, and luma is always a copy or sixtap. */
354     if (mm_flags & AV_CPU_FLAG_MMXEXT) {
355         VP8_MC_FUNC(2, 4, mmxext);
356         VP8_BILINEAR_MC_FUNC(2, 4, mmxext);
357 #if ARCH_X86_32
358         VP8_LUMA_MC_FUNC(0, 16, mmxext);
359         VP8_MC_FUNC(1, 8, mmxext);
360         VP8_BILINEAR_MC_FUNC(0, 16, mmxext);
361         VP8_BILINEAR_MC_FUNC(1,  8, mmxext);
362
363         c->vp8_v_loop_filter_simple   = ff_vp8_v_loop_filter_simple_mmxext;
364         c->vp8_h_loop_filter_simple   = ff_vp8_h_loop_filter_simple_mmxext;
365
366         c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_mmxext;
367         c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_mmxext;
368         c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_mmxext;
369         c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_mmxext;
370
371         c->vp8_v_loop_filter16y       = ff_vp8_v_loop_filter16y_mbedge_mmxext;
372         c->vp8_h_loop_filter16y       = ff_vp8_h_loop_filter16y_mbedge_mmxext;
373         c->vp8_v_loop_filter8uv       = ff_vp8_v_loop_filter8uv_mbedge_mmxext;
374         c->vp8_h_loop_filter8uv       = ff_vp8_h_loop_filter8uv_mbedge_mmxext;
375 #endif
376     }
377
378     if (mm_flags & AV_CPU_FLAG_SSE) {
379         c->vp8_idct_add                         = ff_vp8_idct_add_sse;
380         c->vp8_luma_dc_wht                      = ff_vp8_luma_dc_wht_sse;
381         c->put_vp8_epel_pixels_tab[0][0][0]     =
382         c->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_sse;
383     }
384
385     if (mm_flags & (AV_CPU_FLAG_SSE2|AV_CPU_FLAG_SSE2SLOW)) {
386         VP8_LUMA_MC_FUNC(0, 16, sse2);
387         VP8_MC_FUNC(1, 8, sse2);
388         VP8_BILINEAR_MC_FUNC(0, 16, sse2);
389         VP8_BILINEAR_MC_FUNC(1, 8, sse2);
390
391         c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_sse2;
392
393 #if ARCH_X86_64 || HAVE_ALIGNED_STACK
394         c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_sse2;
395         c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_sse2;
396
397         c->vp8_v_loop_filter16y       = ff_vp8_v_loop_filter16y_mbedge_sse2;
398         c->vp8_v_loop_filter8uv       = ff_vp8_v_loop_filter8uv_mbedge_sse2;
399 #endif
400     }
401
402     if (mm_flags & AV_CPU_FLAG_SSE2) {
403         c->vp8_idct_dc_add4y          = ff_vp8_idct_dc_add4y_sse2;
404
405         c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_sse2;
406
407 #if ARCH_X86_64 || HAVE_ALIGNED_STACK
408         c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_sse2;
409         c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_sse2;
410
411         c->vp8_h_loop_filter16y       = ff_vp8_h_loop_filter16y_mbedge_sse2;
412         c->vp8_h_loop_filter8uv       = ff_vp8_h_loop_filter8uv_mbedge_sse2;
413 #endif
414     }
415
416     if (mm_flags & AV_CPU_FLAG_SSSE3) {
417         VP8_LUMA_MC_FUNC(0, 16, ssse3);
418         VP8_MC_FUNC(1, 8, ssse3);
419         VP8_MC_FUNC(2, 4, ssse3);
420         VP8_BILINEAR_MC_FUNC(0, 16, ssse3);
421         VP8_BILINEAR_MC_FUNC(1, 8, ssse3);
422         VP8_BILINEAR_MC_FUNC(2, 4, ssse3);
423
424         c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_ssse3;
425         c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_ssse3;
426
427 #if ARCH_X86_64 || HAVE_ALIGNED_STACK
428         c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_ssse3;
429         c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_ssse3;
430         c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_ssse3;
431         c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_ssse3;
432
433         c->vp8_v_loop_filter16y       = ff_vp8_v_loop_filter16y_mbedge_ssse3;
434         c->vp8_h_loop_filter16y       = ff_vp8_h_loop_filter16y_mbedge_ssse3;
435         c->vp8_v_loop_filter8uv       = ff_vp8_v_loop_filter8uv_mbedge_ssse3;
436         c->vp8_h_loop_filter8uv       = ff_vp8_h_loop_filter8uv_mbedge_ssse3;
437 #endif
438     }
439
440     if (mm_flags & AV_CPU_FLAG_SSE4) {
441         c->vp8_idct_dc_add                  = ff_vp8_idct_dc_add_sse4;
442
443         c->vp8_h_loop_filter_simple   = ff_vp8_h_loop_filter_simple_sse4;
444 #if ARCH_X86_64 || HAVE_ALIGNED_STACK
445         c->vp8_h_loop_filter16y       = ff_vp8_h_loop_filter16y_mbedge_sse4;
446         c->vp8_h_loop_filter8uv       = ff_vp8_h_loop_filter8uv_mbedge_sse4;
447 #endif
448     }
449 #endif /* HAVE_YASM */
450 }