FFmpeg
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
audio_convert_init.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
3  *
4  * This file is part of Libav.
5  *
6  * Libav is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * Libav is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with Libav; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "config.h"
22 #include "libavutil/cpu.h"
23 #include "libavutil/x86/cpu.h"
25 
26 /* flat conversions */
27 
28 extern void ff_conv_s16_to_s32_sse2(int16_t *dst, const int32_t *src, int len);
29 
30 extern void ff_conv_s16_to_flt_sse2(float *dst, const int16_t *src, int len);
31 extern void ff_conv_s16_to_flt_sse4(float *dst, const int16_t *src, int len);
32 
33 extern void ff_conv_s32_to_s16_mmx (int16_t *dst, const int32_t *src, int len);
34 extern void ff_conv_s32_to_s16_sse2(int16_t *dst, const int32_t *src, int len);
35 
36 extern void ff_conv_s32_to_flt_sse2(float *dst, const int32_t *src, int len);
37 extern void ff_conv_s32_to_flt_avx (float *dst, const int32_t *src, int len);
38 
39 extern void ff_conv_flt_to_s16_sse2(int16_t *dst, const float *src, int len);
40 
41 extern void ff_conv_flt_to_s32_sse2(int32_t *dst, const float *src, int len);
42 extern void ff_conv_flt_to_s32_avx (int32_t *dst, const float *src, int len);
43 
44 /* interleave conversions */
45 
46 extern void ff_conv_s16p_to_s16_2ch_sse2(int16_t *dst, int16_t *const *src,
47  int len, int channels);
48 extern void ff_conv_s16p_to_s16_2ch_avx (int16_t *dst, int16_t *const *src,
49  int len, int channels);
50 
51 extern void ff_conv_s16p_to_s16_6ch_sse2(int16_t *dst, int16_t *const *src,
52  int len, int channels);
53 extern void ff_conv_s16p_to_s16_6ch_sse2slow(int16_t *dst, int16_t *const *src,
54  int len, int channels);
55 extern void ff_conv_s16p_to_s16_6ch_avx (int16_t *dst, int16_t *const *src,
56  int len, int channels);
57 
58 extern void ff_conv_s16p_to_flt_2ch_sse2(float *dst, int16_t *const *src,
59  int len, int channels);
60 extern void ff_conv_s16p_to_flt_2ch_avx (float *dst, int16_t *const *src,
61  int len, int channels);
62 
63 extern void ff_conv_s16p_to_flt_6ch_sse2 (float *dst, int16_t *const *src,
64  int len, int channels);
65 extern void ff_conv_s16p_to_flt_6ch_ssse3(float *dst, int16_t *const *src,
66  int len, int channels);
67 extern void ff_conv_s16p_to_flt_6ch_avx (float *dst, int16_t *const *src,
68  int len, int channels);
69 
70 extern void ff_conv_fltp_to_s16_2ch_sse2 (int16_t *dst, float *const *src,
71  int len, int channels);
72 extern void ff_conv_fltp_to_s16_2ch_ssse3(int16_t *dst, float *const *src,
73  int len, int channels);
74 
75 extern void ff_conv_fltp_to_s16_6ch_sse (int16_t *dst, float *const *src,
76  int len, int channels);
77 extern void ff_conv_fltp_to_s16_6ch_sse2(int16_t *dst, float *const *src,
78  int len, int channels);
79 extern void ff_conv_fltp_to_s16_6ch_avx (int16_t *dst, float *const *src,
80  int len, int channels);
81 
82 extern void ff_conv_fltp_to_flt_2ch_sse(float *dst, float *const *src, int len,
83  int channels);
84 extern void ff_conv_fltp_to_flt_2ch_avx(float *dst, float *const *src, int len,
85  int channels);
86 
87 extern void ff_conv_fltp_to_flt_6ch_mmx (float *dst, float *const *src, int len,
88  int channels);
89 extern void ff_conv_fltp_to_flt_6ch_sse4(float *dst, float *const *src, int len,
90  int channels);
91 extern void ff_conv_fltp_to_flt_6ch_avx (float *dst, float *const *src, int len,
92  int channels);
93 
94 /* deinterleave conversions */
95 
96 extern void ff_conv_s16_to_s16p_2ch_sse2(int16_t *const *dst, int16_t *src,
97  int len, int channels);
98 extern void ff_conv_s16_to_s16p_2ch_ssse3(int16_t *const *dst, int16_t *src,
99  int len, int channels);
100 extern void ff_conv_s16_to_s16p_2ch_avx (int16_t *const *dst, int16_t *src,
101  int len, int channels);
102 
103 extern void ff_conv_s16_to_s16p_6ch_sse2 (int16_t *const *dst, int16_t *src,
104  int len, int channels);
105 extern void ff_conv_s16_to_s16p_6ch_ssse3(int16_t *const *dst, int16_t *src,
106  int len, int channels);
107 extern void ff_conv_s16_to_s16p_6ch_avx (int16_t *const *dst, int16_t *src,
108  int len, int channels);
109 
110 extern void ff_conv_s16_to_fltp_2ch_sse2(float *const *dst, int16_t *src,
111  int len, int channels);
112 extern void ff_conv_s16_to_fltp_2ch_avx (float *const *dst, int16_t *src,
113  int len, int channels);
114 
115 extern void ff_conv_s16_to_fltp_6ch_sse2 (float *const *dst, int16_t *src,
116  int len, int channels);
117 extern void ff_conv_s16_to_fltp_6ch_ssse3(float *const *dst, int16_t *src,
118  int len, int channels);
119 extern void ff_conv_s16_to_fltp_6ch_sse4 (float *const *dst, int16_t *src,
120  int len, int channels);
121 extern void ff_conv_s16_to_fltp_6ch_avx (float *const *dst, int16_t *src,
122  int len, int channels);
123 
124 extern void ff_conv_flt_to_s16p_2ch_sse2(int16_t *const *dst, float *src,
125  int len, int channels);
126 extern void ff_conv_flt_to_s16p_2ch_avx (int16_t *const *dst, float *src,
127  int len, int channels);
128 
129 extern void ff_conv_flt_to_s16p_6ch_sse2 (int16_t *const *dst, float *src,
130  int len, int channels);
131 extern void ff_conv_flt_to_s16p_6ch_ssse3(int16_t *const *dst, float *src,
132  int len, int channels);
133 extern void ff_conv_flt_to_s16p_6ch_avx (int16_t *const *dst, float *src,
134  int len, int channels);
135 
136 extern void ff_conv_flt_to_fltp_2ch_sse(float *const *dst, float *src, int len,
137  int channels);
138 extern void ff_conv_flt_to_fltp_2ch_avx(float *const *dst, float *src, int len,
139  int channels);
140 
141 extern void ff_conv_flt_to_fltp_6ch_sse2(float *const *dst, float *src, int len,
142  int channels);
143 extern void ff_conv_flt_to_fltp_6ch_avx (float *const *dst, float *src, int len,
144  int channels);
145 
147 {
148  int mm_flags = av_get_cpu_flags();
149 
150  if (EXTERNAL_MMX(mm_flags)) {
152  0, 1, 8, "MMX", ff_conv_s32_to_s16_mmx);
154  6, 1, 4, "MMX", ff_conv_fltp_to_flt_6ch_mmx);
155  }
156  if (EXTERNAL_SSE(mm_flags)) {
158  6, 1, 2, "SSE", ff_conv_fltp_to_s16_6ch_sse);
160  2, 16, 8, "SSE", ff_conv_fltp_to_flt_2ch_sse);
162  2, 16, 4, "SSE", ff_conv_flt_to_fltp_2ch_sse);
163  }
164  if (EXTERNAL_SSE2(mm_flags)) {
165  if (!(mm_flags & AV_CPU_FLAG_SSE2SLOW)) {
167  0, 16, 16, "SSE2", ff_conv_s32_to_s16_sse2);
169  6, 16, 8, "SSE2", ff_conv_s16p_to_s16_6ch_sse2);
171  6, 16, 4, "SSE2", ff_conv_fltp_to_s16_6ch_sse2);
172  } else {
174  6, 1, 4, "SSE2SLOW", ff_conv_s16p_to_s16_6ch_sse2slow);
175  }
177  0, 16, 8, "SSE2", ff_conv_s16_to_s32_sse2);
179  0, 16, 8, "SSE2", ff_conv_s16_to_flt_sse2);
181  0, 16, 8, "SSE2", ff_conv_s32_to_flt_sse2);
183  0, 16, 16, "SSE2", ff_conv_flt_to_s16_sse2);
185  0, 16, 16, "SSE2", ff_conv_flt_to_s32_sse2);
187  2, 16, 16, "SSE2", ff_conv_s16p_to_s16_2ch_sse2);
189  2, 16, 8, "SSE2", ff_conv_s16p_to_flt_2ch_sse2);
191  6, 16, 4, "SSE2", ff_conv_s16p_to_flt_6ch_sse2);
193  2, 16, 4, "SSE2", ff_conv_fltp_to_s16_2ch_sse2);
195  2, 16, 8, "SSE2", ff_conv_s16_to_s16p_2ch_sse2);
197  6, 16, 4, "SSE2", ff_conv_s16_to_s16p_6ch_sse2);
199  2, 16, 8, "SSE2", ff_conv_s16_to_fltp_2ch_sse2);
201  6, 16, 4, "SSE2", ff_conv_s16_to_fltp_6ch_sse2);
203  2, 16, 8, "SSE2", ff_conv_flt_to_s16p_2ch_sse2);
205  6, 16, 4, "SSE2", ff_conv_flt_to_s16p_6ch_sse2);
207  6, 16, 4, "SSE2", ff_conv_flt_to_fltp_6ch_sse2);
208  }
209  if (EXTERNAL_SSSE3(mm_flags)) {
211  6, 16, 4, "SSSE3", ff_conv_s16p_to_flt_6ch_ssse3);
213  2, 16, 4, "SSSE3", ff_conv_fltp_to_s16_2ch_ssse3);
215  2, 16, 8, "SSSE3", ff_conv_s16_to_s16p_2ch_ssse3);
217  6, 16, 4, "SSSE3", ff_conv_s16_to_s16p_6ch_ssse3);
219  6, 16, 4, "SSSE3", ff_conv_s16_to_fltp_6ch_ssse3);
221  6, 16, 4, "SSSE3", ff_conv_flt_to_s16p_6ch_ssse3);
222  }
223  if (EXTERNAL_SSE4(mm_flags)) {
225  0, 16, 8, "SSE4", ff_conv_s16_to_flt_sse4);
227  6, 16, 4, "SSE4", ff_conv_fltp_to_flt_6ch_sse4);
228  }
229  if (EXTERNAL_AVX(mm_flags)) {
231  0, 32, 16, "AVX", ff_conv_s32_to_flt_avx);
233  0, 32, 32, "AVX", ff_conv_flt_to_s32_avx);
235  2, 16, 16, "AVX", ff_conv_s16p_to_s16_2ch_avx);
237  6, 16, 8, "AVX", ff_conv_s16p_to_s16_6ch_avx);
239  2, 16, 8, "AVX", ff_conv_s16p_to_flt_2ch_avx);
241  6, 16, 4, "AVX", ff_conv_s16p_to_flt_6ch_avx);
243  6, 16, 4, "AVX", ff_conv_fltp_to_s16_6ch_avx);
245  6, 16, 4, "AVX", ff_conv_fltp_to_flt_6ch_avx);
247  2, 16, 8, "AVX", ff_conv_s16_to_s16p_2ch_avx);
249  6, 16, 4, "AVX", ff_conv_s16_to_s16p_6ch_avx);
251  2, 16, 8, "AVX", ff_conv_s16_to_fltp_2ch_avx);
253  6, 16, 4, "AVX", ff_conv_s16_to_fltp_6ch_avx);
255  2, 16, 8, "AVX", ff_conv_flt_to_s16p_2ch_avx);
257  6, 16, 4, "AVX", ff_conv_flt_to_s16p_6ch_avx);
259  2, 16, 4, "AVX", ff_conv_flt_to_fltp_2ch_avx);
261  6, 16, 4, "AVX", ff_conv_flt_to_fltp_6ch_avx);
262  }
263 }