aboutsummaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2017-03-30 23:31:39 +0000
committerTakamichi Horikawa <takamichiho@gmail.com>2017-03-30 23:31:39 +0000
commitf47eba7d7d4c6a1d9501e027b63bbab04bb7d417 (patch)
treec6d8ebf4f84b76e9d32d4998d28a69d36fddd4a9 /gtk
parenta86bb48b9f3acb081afa92e5efc50d0192c4f68c (diff)
add NEON optimization
Diffstat (limited to 'gtk')
-rw-r--r--gtk/Makefile.am18
-rw-r--r--gtk/configure.ac7
-rw-r--r--gtk/main.c22
3 files changed, 37 insertions, 10 deletions
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 174f5e9..0a9a95b 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -1,11 +1,12 @@
bin_PROGRAMS=fmplayer
LIBOPNA_SRC=../libopna/opnaadpcm.c \
- ../libopna/opnadrum.c \
- ../libopna/opnafm.c \
- ../libopna/opnassg.c \
- ../libopna/opnatimer.c \
- ../libopna/opna.c
+ ../libopna/opnadrum.c \
+ ../libopna/opnafm.c \
+ ../libopna/opnassg.c \
+ ../libopna/opnassg-sinc-c.c \
+ ../libopna/opnatimer.c \
+ ../libopna/opna.c
FMDRIVER_SRC=../fmdriver/fmdriver_fmp.c \
../fmdriver/fmdriver_pmd.c \
@@ -13,9 +14,16 @@ FMDRIVER_SRC=../fmdriver/fmdriver_fmp.c \
../fmdriver/ppz8.c
FMDSP_SRC=../fmdsp/fmdsp.c \
+ ../fmdsp/fmdsp-vramlookup-c.c \
../fmdsp/font_rom.c \
../fmdsp/font_fmdsp_small.c
+if ENABLE_NEON
+LIBOPNA_SRC+=../libopna/opnassg-sinc-neon.s
+FMDSP_SRC+=../fmdsp/fmdsp-vramlookup-neon.s
+fmplayer_CCASFLAGS=-march=armv8-a -mfpu=crypto-neon-fp-armv8
+endif
+
fmplayer_SOURCES=main.c \
toneview.c \
oscilloview.c \
diff --git a/gtk/configure.ac b/gtk/configure.ac
index 8e13a34..2727888 100644
--- a/gtk/configure.ac
+++ b/gtk/configure.ac
@@ -2,10 +2,17 @@ AC_INIT([fmplayer], [0.1.0])
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
AM_SILENT_RULES([yes])
AC_PROG_CC_C99
+AM_PROG_AS
dnl AM_PATH_SDL2([2.0.5])
PKG_CHECK_MODULES([PORTAUDIO], [portaudio-2.0])
PKG_CHECK_MODULES([GTK3], [gtk+-3.0 cairo])
+AC_ARG_ENABLE([neon], AS_HELP_STRING([--enable-neon], [Enable NEON optimized functions for SSG sinc filtering and fmdsp palette lookup. Tested on Cortex-A53 (Raspberry PI 3)]))
+AM_CONDITIONAL([ENABLE_NEON], [test "x$enable_neon" = "xyes"])
+AS_IF([test "x$enable_neon" = "xyes"], [
+ AC_DEFINE([ENABLE_NEON])
+])
+
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
diff --git a/gtk/main.c b/gtk/main.c
index af0d2db..fc72d62 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -53,6 +53,7 @@ static struct {
void *vram32;
int vram32_stride;
const char *current_uri;
+ bool oscillo_should_update;
struct oscillodata oscillodata_audiothread[LIBOPNA_OSCILLO_TRACK_COUNT];
} g;
@@ -97,17 +98,21 @@ static int pastream_cb(const void *inptr, void *outptr, unsigned long frames,
struct opna_timer *timer = (struct opna_timer *)userdata;
int16_t *buf = (int16_t *)outptr;
memset(outptr, 0, sizeof(int16_t)*frames*2);
- opna_timer_mix_oscillo(timer, buf, frames, g.oscillodata_audiothread);
+ opna_timer_mix_oscillo(timer, buf, frames,
+ g.oscillo_should_update ?
+ g.oscillodata_audiothread : 0);
if (!atomic_flag_test_and_set_explicit(
&toneview_g.flag, memory_order_acquire)) {
tonedata_from_opna(&toneview_g.tonedata, &g.opna);
atomic_flag_clear_explicit(&toneview_g.flag, memory_order_release);
}
- if (!atomic_flag_test_and_set_explicit(
- &oscilloview_g.flag, memory_order_acquire)) {
- memcpy(oscilloview_g.oscillodata, g.oscillodata_audiothread, sizeof(oscilloview_g.oscillodata));
- atomic_flag_clear_explicit(&oscilloview_g.flag, memory_order_release);
+ if (g.oscillo_should_update) {
+ if (!atomic_flag_test_and_set_explicit(
+ &oscilloview_g.flag, memory_order_acquire)) {
+ memcpy(oscilloview_g.oscillodata, g.oscillodata_audiothread, sizeof(oscilloview_g.oscillodata));
+ atomic_flag_clear_explicit(&oscilloview_g.flag, memory_order_release);
+ }
}
return paContinue;
}
@@ -479,7 +484,14 @@ static void drag_data_recv_cb(
gtk_drag_finish(ctx, TRUE, FALSE, time);
}
+void opna_ssg_sinc_calc_neon(unsigned, const int16_t *, int32_t *);
+void fmdsp_vramlookup_neon(uint8_t *, const uint8_t *, const uint8_t *, int);
+
int main(int argc, char **argv) {
+#ifdef ENABLE_NEON
+ opna_ssg_sinc_calc_func = opna_ssg_sinc_calc_neon;
+ fmdsp_vramlookup_func = fmdsp_vramlookup_neon;
+#endif
load_fontrom();
gtk_init(&argc, &argv);
GtkWidget *w = gtk_window_new(GTK_WINDOW_TOPLEVEL);