2 * VP9 SIMD optimizations
4 * Copyright (c) 2013 Ronald S. Bultje <rsbultje gmail com>
6 * This file is part of FFmpeg.
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.
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.
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
23 #include "libavutil/attributes.h"
24 #include "libavutil/cpu.h"
25 #include "libavutil/mem.h"
26 #include "libavutil/x86/cpu.h"
27 #include "libavcodec/vp9dsp.h"
28 #include "libavcodec/x86/vp9dsp_init.h"
32 decl_fpel_func(put, 8, , mmx);
33 decl_fpel_func(avg, 8, _16, mmxext);
34 decl_fpel_func(put, 16, , sse);
35 decl_fpel_func(put, 32, , sse);
36 decl_fpel_func(put, 64, , sse);
37 decl_fpel_func(put, 128, , sse);
38 decl_fpel_func(avg, 16, _16, sse2);
39 decl_fpel_func(avg, 32, _16, sse2);
40 decl_fpel_func(avg, 64, _16, sse2);
41 decl_fpel_func(avg, 128, _16, sse2);
42 decl_fpel_func(put, 32, , avx);
43 decl_fpel_func(put, 64, , avx);
44 decl_fpel_func(put, 128, , avx);
45 decl_fpel_func(avg, 32, _16, avx2);
46 decl_fpel_func(avg, 64, _16, avx2);
47 decl_fpel_func(avg, 128, _16, avx2);
49 #endif /* HAVE_YASM */
51 av_cold void ff_vp9dsp_init_16bpp_x86(VP9DSPContext *dsp)
54 int cpu_flags = av_get_cpu_flags();
56 if (EXTERNAL_MMX(cpu_flags)) {
57 init_fpel_func(4, 0, 8, put, , mmx);
60 if (EXTERNAL_MMXEXT(cpu_flags)) {
61 init_fpel_func(4, 1, 8, avg, _16, mmxext);
64 if (EXTERNAL_SSE(cpu_flags)) {
65 init_fpel_func(3, 0, 16, put, , sse);
66 init_fpel_func(2, 0, 32, put, , sse);
67 init_fpel_func(1, 0, 64, put, , sse);
68 init_fpel_func(0, 0, 128, put, , sse);
71 if (EXTERNAL_SSE2(cpu_flags)) {
72 init_fpel_func(3, 1, 16, avg, _16, sse2);
73 init_fpel_func(2, 1, 32, avg, _16, sse2);
74 init_fpel_func(1, 1, 64, avg, _16, sse2);
75 init_fpel_func(0, 1, 128, avg, _16, sse2);
78 if (EXTERNAL_AVX_FAST(cpu_flags)) {
79 init_fpel_func(2, 0, 32, put, , avx);
80 init_fpel_func(1, 0, 64, put, , avx);
81 init_fpel_func(0, 0, 128, put, , avx);
84 if (EXTERNAL_AVX2(cpu_flags)) {
85 init_fpel_func(2, 1, 32, avg, _16, avx2);
86 init_fpel_func(1, 1, 64, avg, _16, avx2);
87 init_fpel_func(0, 1, 128, avg, _16, avx2);
90 #endif /* HAVE_YASM */