Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/minimp3/patches/0001-msvc-arm.patch
9912 views
1
diff --git a/thirdparty/minimp3/minimp3.h b/thirdparty/minimp3/minimp3.h
2
index 3220ae1a85..49708b9846 100644
3
--- a/thirdparty/minimp3/minimp3.h
4
+++ b/thirdparty/minimp3/minimp3.h
5
@@ -1566,7 +1566,16 @@ static void mp3d_synth(float *xl, mp3d_sample_t *dstl, int nch, float *lins)
6
7
#else /* MINIMP3_FLOAT_OUTPUT */
8
9
+#if defined(_MSC_VER) && (defined(_M_ARM64) || defined(_M_ARM64EC) || defined(_M_ARM))
10
+ static f4 g_scale;
11
+ g_scale = vsetq_lane_f32(1.0f/32768.0f, g_scale, 0);
12
+ g_scale = vsetq_lane_f32(1.0f/32768.0f, g_scale, 1);
13
+ g_scale = vsetq_lane_f32(1.0f/32768.0f, g_scale, 2);
14
+ g_scale = vsetq_lane_f32(1.0f/32768.0f, g_scale, 3);
15
+#else
16
static const f4 g_scale = { 1.0f/32768.0f, 1.0f/32768.0f, 1.0f/32768.0f, 1.0f/32768.0f };
17
+#endif
18
+
19
a = VMUL(a, g_scale);
20
b = VMUL(b, g_scale);
21
#if HAVE_SSE
22
@@ -1813,7 +1822,17 @@ void mp3dec_f32_to_s16(const float *in, int16_t *out, int num_samples)
23
int aligned_count = num_samples & ~7;
24
for(; i < aligned_count; i += 8)
25
{
26
+
27
+#if defined(_MSC_VER) && (defined(_M_ARM64) || defined(_M_ARM64EC) || defined(_M_ARM))
28
+ static f4 g_scale;
29
+ g_scale = vsetq_lane_f32(32768.0f, g_scale, 0);
30
+ g_scale = vsetq_lane_f32(32768.0f, g_scale, 1);
31
+ g_scale = vsetq_lane_f32(32768.0f, g_scale, 2);
32
+ g_scale = vsetq_lane_f32(32768.0f, g_scale, 3);
33
+#else
34
static const f4 g_scale = { 32768.0f, 32768.0f, 32768.0f, 32768.0f };
35
+#endif
36
+
37
f4 a = VMUL(VLD(&in[i ]), g_scale);
38
f4 b = VMUL(VLD(&in[i+4]), g_scale);
39
#if HAVE_SSE
40
41