1 /* GStreamer
2 * Copyright (C) <2016> Wim Taymans <wim.taymans@gmail.com>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #include "audio-resampler-macros.h"
21 #include "audio-resampler-x86-sse.h"
22 #include "audio-resampler-x86-sse2.h"
23 #include "audio-resampler-x86-sse41.h"
24
25 static void
audio_resampler_check_x86(const gchar * option)26 audio_resampler_check_x86 (const gchar *option)
27 {
28 if (!strcmp (option, "sse")) {
29 #if defined (HAVE_XMMINTRIN_H) && HAVE_SSE
30 GST_DEBUG ("enable SSE optimisations");
31 resample_gfloat_full_1 = resample_gfloat_full_1_sse;
32 resample_gfloat_linear_1 = resample_gfloat_linear_1_sse;
33 resample_gfloat_cubic_1 = resample_gfloat_cubic_1_sse;
34
35 interpolate_gfloat_linear = interpolate_gfloat_linear_sse;
36 interpolate_gfloat_cubic = interpolate_gfloat_cubic_sse;
37 #else
38 GST_DEBUG ("SSE optimisations not enabled");
39 #endif
40 } else if (!strcmp (option, "sse2")) {
41 #if defined (HAVE_EMMINTRIN_H) && HAVE_SSE2
42 GST_DEBUG ("enable SSE2 optimisations");
43 resample_gint16_full_1 = resample_gint16_full_1_sse2;
44 resample_gint16_linear_1 = resample_gint16_linear_1_sse2;
45 resample_gint16_cubic_1 = resample_gint16_cubic_1_sse2;
46
47 interpolate_gint16_linear = interpolate_gint16_linear_sse2;
48 interpolate_gint16_cubic = interpolate_gint16_cubic_sse2;
49
50 resample_gdouble_full_1 = resample_gdouble_full_1_sse2;
51 resample_gdouble_linear_1 = resample_gdouble_linear_1_sse2;
52 resample_gdouble_cubic_1 = resample_gdouble_cubic_1_sse2;
53
54 interpolate_gdouble_linear = interpolate_gdouble_linear_sse2;
55 interpolate_gdouble_cubic = interpolate_gdouble_cubic_sse2;
56 #else
57 GST_DEBUG ("SSE2 optimisations not enabled");
58 #endif
59 } else if (!strcmp (option, "sse41")) {
60 #if defined (__x86_64__) && \
61 defined (HAVE_SMMINTRIN_H) && defined (HAVE_EMMINTRIN_H) && \
62 HAVE_SSE41
63 GST_DEBUG ("enable SSE41 optimisations");
64 resample_gint32_full_1 = resample_gint32_full_1_sse41;
65 resample_gint32_linear_1 = resample_gint32_linear_1_sse41;
66 resample_gint32_cubic_1 = resample_gint32_cubic_1_sse41;
67 #else
68 GST_DEBUG ("SSE41 optimisations not enabled");
69 #endif
70 }
71 }
72