/src/gstreamer/subprojects/gst-plugins-base/gst-libs/gst/audio/audio-resampler-x86.h
Line | Count | Source |
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 <gst/gstinfo.h> |
21 | | #include <gst/gstcpuid.h> |
22 | | |
23 | | #include "audio-resampler-macros.h" |
24 | | #include "audio-resampler-x86-sse.h" |
25 | | #include "audio-resampler-x86-sse2.h" |
26 | | #include "audio-resampler-x86-sse41.h" |
27 | | |
28 | | static inline void |
29 | | audio_resampler_check_x86 (void) |
30 | 0 | { |
31 | 0 | const gboolean cpuid_sse2 = gst_cpuid_supports_x86_sse2(); |
32 | 0 | const gboolean cpuid_sse4_1 = gst_cpuid_supports_x86_sse4_1(); |
33 | |
|
34 | 0 | GST_LOG ("cpuid: [sse2=%x, sse4_1=%x]", cpuid_sse2, cpuid_sse4_1); |
35 | 0 | if (cpuid_sse2) { |
36 | 0 | #ifdef HAVE_SSE2 |
37 | 0 | GST_INFO ("enable SSE2 optimisations"); |
38 | 0 | resample_gint16_full_1 = resample_gint16_full_1_sse2; |
39 | 0 | resample_gint16_linear_1 = resample_gint16_linear_1_sse2; |
40 | 0 | resample_gint16_cubic_1 = resample_gint16_cubic_1_sse2; |
41 | |
|
42 | 0 | interpolate_gint16_linear = interpolate_gint16_linear_sse2; |
43 | 0 | interpolate_gint16_cubic = interpolate_gint16_cubic_sse2; |
44 | |
|
45 | 0 | resample_gfloat_full_1 = resample_gfloat_full_1_sse; |
46 | 0 | resample_gfloat_linear_1 = resample_gfloat_linear_1_sse; |
47 | 0 | resample_gfloat_cubic_1 = resample_gfloat_cubic_1_sse; |
48 | |
|
49 | 0 | resample_gdouble_full_1 = resample_gdouble_full_1_sse2; |
50 | 0 | resample_gdouble_linear_1 = resample_gdouble_linear_1_sse2; |
51 | 0 | resample_gdouble_cubic_1 = resample_gdouble_cubic_1_sse2; |
52 | |
|
53 | 0 | interpolate_gfloat_linear = interpolate_gfloat_linear_sse; |
54 | 0 | interpolate_gfloat_cubic = interpolate_gfloat_cubic_sse; |
55 | |
|
56 | 0 | interpolate_gdouble_linear = interpolate_gdouble_linear_sse2; |
57 | 0 | interpolate_gdouble_cubic = interpolate_gdouble_cubic_sse2; |
58 | | #else |
59 | | GST_INFO ("SSE2 optimisations not enabled"); |
60 | | #endif |
61 | 0 | } |
62 | 0 | if (cpuid_sse4_1) { |
63 | 0 | #ifdef HAVE_SSE41 |
64 | 0 | GST_INFO ("enable SSE41 optimisations"); |
65 | 0 | resample_gint32_full_1 = resample_gint32_full_1_sse41; |
66 | 0 | resample_gint32_linear_1 = resample_gint32_linear_1_sse41; |
67 | 0 | resample_gint32_cubic_1 = resample_gint32_cubic_1_sse41; |
68 | | #else |
69 | | GST_INFO ("SSE41 optimisations not enabled"); |
70 | | #endif |
71 | 0 | } |
72 | 0 | } |