diff options
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 0000000000..dda76cfee6 --- /dev/null +++ b/meta-multimedia/recipes-multimedia/fluidsynth/files/0001-avoid-buffer-overrun-in-fluid_synth_nwrite_float.patch | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | From a13cb63103aa56b5e8bad816c7d13d6e01c0cd9f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: derselbst <tom.mbrt@googlemail.com> | ||
| 3 | Date: Sun, 26 Nov 2017 22:12:12 +0100 | ||
| 4 | Subject: [PATCH 1/2] avoid buffer overrun in fluid_synth_nwrite_float() | ||
| 5 | |||
| 6 | Upstream-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 | |||
| 13 | diff --git a/src/synth/fluid_synth.c b/src/synth/fluid_synth.c | ||
| 14 | index 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 | -- | ||
| 31 | 2.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 0000000000..0e1846e31c --- /dev/null +++ b/meta-multimedia/recipes-multimedia/fluidsynth/files/0002-Use-ARM-NEON-accelaration-for-float-multithreaded-se.patch | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | From 2de7e128fbdf528716b500cf27ed9a4358c931c9 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com> | ||
| 3 | Date: Fri, 24 Nov 2017 00:05:35 +0100 | ||
| 4 | Subject: [PATCH 2/2] Use ARM-NEON accelaration for float-multithreaded setups | ||
| 5 | MIME-Version: 1.0 | ||
| 6 | Content-Type: text/plain; charset=UTF-8 | ||
| 7 | Content-Transfer-Encoding: 8bit | ||
| 8 | |||
| 9 | Upstream-Status: Pending | ||
| 10 | |||
| 11 | Signed-off-by: Andreas Müller <schnitzeltony@gmail.com> | ||
| 12 | --- | ||
| 13 | src/rvoice/fluid_rvoice_mixer.c | 26 ++++++++++++++++++++++++++ | ||
| 14 | 1 file changed, 26 insertions(+) | ||
| 15 | |||
| 16 | diff --git a/src/rvoice/fluid_rvoice_mixer.c b/src/rvoice/fluid_rvoice_mixer.c | ||
| 17 | index 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 | -- | ||
| 75 | 2.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 ef4c6065f6..406bbf7688 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 | ||
| 7 | DEPENDS = "alsa-lib ncurses glib-2.0" | 7 | DEPENDS = "alsa-lib ncurses glib-2.0" |
| 8 | 8 | ||
| 9 | SRC_URI = "git://github.com/FluidSynth/fluidsynth.git;branch=1.1.x" | 9 | SRC_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 | " | ||
| 10 | SRCREV = "12e7afe3a806a6b397f28e0ca4bc6bab9ebe7047" | 14 | SRCREV = "12e7afe3a806a6b397f28e0ca4bc6bab9ebe7047" |
| 11 | S = "${WORKDIR}/git" | 15 | S = "${WORKDIR}/git" |
| 12 | 16 | ||
| 13 | inherit cmake pkgconfig lib_package | 17 | inherit cmake pkgconfig lib_package |
| 14 | 18 | ||
| 15 | EXTRA_OECMAKE = "-DLIB_SUFFIX=${@d.getVar('baselib').replace('lib', '')}" | 19 | EXTRA_OECMAKE = "-Denable-floats=ON -DLIB_SUFFIX=${@d.getVar('baselib').replace('lib', '')}" |
| 16 | 20 | ||
| 17 | PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pulseaudio', d)}" | 21 | PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pulseaudio', d)}" |
| 18 | PACKAGECONFIG[sndfile] = "-Denable-libsndfile-support=ON,-Denable-libsndfile-support=OFF,libsndfile1" | 22 | PACKAGECONFIG[sndfile] = "-Denable-libsndfile-support=ON,-Denable-libsndfile-support=OFF,libsndfile1" |
