summaryrefslogtreecommitdiffstats
path: root/meta-multimedia
diff options
context:
space:
mode:
authorAndreas Müller <schnitzeltony@gmail.com>2017-12-01 12:08:10 +0100
committerArmin Kuster <akuster808@gmail.com>2017-12-11 07:58:56 -0800
commitda778f933ccf34d01dfe8ca273c2191acfb36ef3 (patch)
tree80ee785896568c2fd6d8b64012090a9ad21446aa /meta-multimedia
parentc0b74f42e00c84ba8419bc28de564cfa5c8d7987 (diff)
downloadmeta-openembedded-da778f933ccf34d01dfe8ca273c2191acfb36ef3.tar.gz
fluidsynth: performance improvements
* Use floats instead of double for sound calculations. This improves performance notable and was default for version 1.1.6 using autotools. * Fix buffer overrun when using floats * Make use of ARM NEON for multithreading enabled Performance and sound correctnes was tested with qtractor and a reworked version of fluidsynth-dssi [1-2]. Tests were performed for single- and multithreading enabled. [1] https://github.com/schnitzeltony/fluidsynth-dssi/commit/bad09c6f5c5508c5f5330aa5188510f975e50c50 [2] https://github.com/schnitzeltony/meta-qt5-extra/blob/master/recipes-misc/recipes-multimedia/fluidsynth/fluidsynth-dssi_1.0.0.bb Signed-off-by: Andreas Müller <schnitzeltony@gmail.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'meta-multimedia')
-rw-r--r--meta-multimedia/recipes-multimedia/fluidsynth/files/0001-avoid-buffer-overrun-in-fluid_synth_nwrite_float.patch32
-rw-r--r--meta-multimedia/recipes-multimedia/fluidsynth/files/0002-Use-ARM-NEON-accelaration-for-float-multithreaded-se.patch76
-rw-r--r--meta-multimedia/recipes-multimedia/fluidsynth/fluidsynth_1.1.8.bb8
3 files changed, 114 insertions, 2 deletions
diff --git a/meta-multimedia/recipes-multimedia/fluidsynth/files/0001-avoid-buffer-overrun-in-fluid_synth_nwrite_float.patch b/meta-multimedia/recipes-multimedia/fluidsynth/files/0001-avoid-buffer-overrun-in-fluid_synth_nwrite_float.patch
new file mode 100644
index 000000000..dda76cfee
--- /dev/null
+++ b/meta-multimedia/recipes-multimedia/fluidsynth/files/0001-avoid-buffer-overrun-in-fluid_synth_nwrite_float.patch
@@ -0,0 +1,32 @@
1From a13cb63103aa56b5e8bad816c7d13d6e01c0cd9f Mon Sep 17 00:00:00 2001
2From: derselbst <tom.mbrt@googlemail.com>
3Date: Sun, 26 Nov 2017 22:12:12 +0100
4Subject: [PATCH 1/2] avoid buffer overrun in fluid_synth_nwrite_float()
5
6Upstream-Status: Backport [1]
7
8[1] https://github.com/FluidSynth/fluidsynth/commit/a13cb63103aa56b5e8bad816c7d13d6e01c0cd9f
9---
10 src/synth/fluid_synth.c | 4 ++--
11 1 file changed, 2 insertions(+), 2 deletions(-)
12
13diff --git a/src/synth/fluid_synth.c b/src/synth/fluid_synth.c
14index 266d759..14f6b21 100644
15--- a/src/synth/fluid_synth.c
16+++ b/src/synth/fluid_synth.c
17@@ -2752,10 +2752,10 @@ fluid_synth_nwrite_float(fluid_synth_t* synth, int len,
18 {
19 #ifdef WITH_FLOAT
20 if(fx_left != NULL)
21- FLUID_MEMCPY(fx_left[i + count], fx_left_in[i], bytes);
22+ FLUID_MEMCPY(fx_left[i] + count, fx_left_in[i], bytes);
23
24 if(fx_right != NULL)
25- FLUID_MEMCPY(fx_right[i + count], fx_right_in[i], bytes);
26+ FLUID_MEMCPY(fx_right[i] + count, fx_right_in[i], bytes);
27 #else //WITH_FLOAT
28 int j;
29 if(fx_left != NULL) {
30--
312.9.5
32
diff --git a/meta-multimedia/recipes-multimedia/fluidsynth/files/0002-Use-ARM-NEON-accelaration-for-float-multithreaded-se.patch b/meta-multimedia/recipes-multimedia/fluidsynth/files/0002-Use-ARM-NEON-accelaration-for-float-multithreaded-se.patch
new file mode 100644
index 000000000..0e1846e31
--- /dev/null
+++ b/meta-multimedia/recipes-multimedia/fluidsynth/files/0002-Use-ARM-NEON-accelaration-for-float-multithreaded-se.patch
@@ -0,0 +1,76 @@
1From 2de7e128fbdf528716b500cf27ed9a4358c931c9 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
3Date: Fri, 24 Nov 2017 00:05:35 +0100
4Subject: [PATCH 2/2] Use ARM-NEON accelaration for float-multithreaded setups
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Upstream-Status: Pending
10
11Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
12---
13 src/rvoice/fluid_rvoice_mixer.c | 26 ++++++++++++++++++++++++++
14 1 file changed, 26 insertions(+)
15
16diff --git a/src/rvoice/fluid_rvoice_mixer.c b/src/rvoice/fluid_rvoice_mixer.c
17index 9616518..dbf8057 100644
18--- a/src/rvoice/fluid_rvoice_mixer.c
19+++ b/src/rvoice/fluid_rvoice_mixer.c
20@@ -27,6 +27,10 @@
21 #include "fluid_ladspa.h"
22 #include "fluid_synth.h"
23
24+#if defined(__ARM_NEON__)
25+#include "arm_neon.h"
26+#endif
27+
28
29 #define ENABLE_MIXER_THREADS 1
30
31@@ -794,20 +798,42 @@ fluid_mixer_buffers_mix(fluid_mixer_buffers_t* dest, fluid_mixer_buffers_t* src)
32 if (minbuf > src->buf_count)
33 minbuf = src->buf_count;
34 for (i=0; i < minbuf; i++) {
35+#if defined(__ARM_NEON__) && defined(WITH_FLOAT)
36+ for (j=0; j < scount; j+=4) {
37+ float32x4_t vleft = vld1q_f32(&dest->left_buf[i][j]);
38+ float32x4_t vright = vld1q_f32(&dest->right_buf[i][j]);
39+ vleft = vaddq_f32(vleft, vld1q_f32(&src->left_buf[i][j]));
40+ vright = vaddq_f32(vright, vld1q_f32(&src->right_buf[i][j]));
41+ vst1q_f32(&dest->left_buf[i][j], vleft);
42+ vst1q_f32(&dest->right_buf[i][j], vright);
43+ }
44+#else
45 for (j=0; j < scount; j++) {
46 dest->left_buf[i][j] += src->left_buf[i][j];
47 dest->right_buf[i][j] += src->right_buf[i][j];
48 }
49+#endif
50 }
51
52 minbuf = dest->fx_buf_count;
53 if (minbuf > src->fx_buf_count)
54 minbuf = src->fx_buf_count;
55 for (i=0; i < minbuf; i++) {
56+#if defined(__ARM_NEON__) && defined(WITH_FLOAT)
57+ for (j=0; j < scount; j+=4) {
58+ float32x4_t vleft = vld1q_f32(&dest->fx_left_buf[i][j]);
59+ float32x4_t vright = vld1q_f32(&dest->fx_right_buf[i][j]);
60+ vleft = vaddq_f32(vleft, vld1q_f32(&src->fx_left_buf[i][j]));
61+ vright = vaddq_f32(vright, vld1q_f32(&src->fx_right_buf[i][j]));
62+ vst1q_f32(&dest->fx_left_buf[i][j], vleft);
63+ vst1q_f32(&dest->fx_right_buf[i][j], vright);
64+ }
65+#else
66 for (j=0; j < scount; j++) {
67 dest->fx_left_buf[i][j] += src->fx_left_buf[i][j];
68 dest->fx_right_buf[i][j] += src->fx_right_buf[i][j];
69 }
70+#endif
71 }
72 }
73
74--
752.9.5
76
diff --git a/meta-multimedia/recipes-multimedia/fluidsynth/fluidsynth_1.1.8.bb b/meta-multimedia/recipes-multimedia/fluidsynth/fluidsynth_1.1.8.bb
index ef4c6065f..406bbf768 100644
--- a/meta-multimedia/recipes-multimedia/fluidsynth/fluidsynth_1.1.8.bb
+++ b/meta-multimedia/recipes-multimedia/fluidsynth/fluidsynth_1.1.8.bb
@@ -6,13 +6,17 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=fc178bcd425090939a8b634d1d6a9594"
6 6
7DEPENDS = "alsa-lib ncurses glib-2.0" 7DEPENDS = "alsa-lib ncurses glib-2.0"
8 8
9SRC_URI = "git://github.com/FluidSynth/fluidsynth.git;branch=1.1.x" 9SRC_URI = " \
10 git://github.com/FluidSynth/fluidsynth.git;branch=1.1.x \
11 file://0001-avoid-buffer-overrun-in-fluid_synth_nwrite_float.patch \
12 file://0002-Use-ARM-NEON-accelaration-for-float-multithreaded-se.patch \
13"
10SRCREV = "12e7afe3a806a6b397f28e0ca4bc6bab9ebe7047" 14SRCREV = "12e7afe3a806a6b397f28e0ca4bc6bab9ebe7047"
11S = "${WORKDIR}/git" 15S = "${WORKDIR}/git"
12 16
13inherit cmake pkgconfig lib_package 17inherit cmake pkgconfig lib_package
14 18
15EXTRA_OECMAKE = "-DLIB_SUFFIX=${@d.getVar('baselib').replace('lib', '')}" 19EXTRA_OECMAKE = "-Denable-floats=ON -DLIB_SUFFIX=${@d.getVar('baselib').replace('lib', '')}"
16 20
17PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pulseaudio', d)}" 21PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pulseaudio', d)}"
18PACKAGECONFIG[sndfile] = "-Denable-libsndfile-support=ON,-Denable-libsndfile-support=OFF,libsndfile1" 22PACKAGECONFIG[sndfile] = "-Denable-libsndfile-support=ON,-Denable-libsndfile-support=OFF,libsndfile1"