From 7634ad2e2c1725c4c9571fa385b4ab822d8cd117 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Tue, 29 Nov 2016 01:59:50 +0000 Subject: [PATCH] Changed some optimizations for Raspi. --- src/Makefile | 33 ++++++++++++++++++++++++++++++--- src/dexed.cpp | 6 +++++- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/Makefile b/src/Makefile index 32a8acb..e0d0f0f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -8,15 +8,42 @@ LDFLAGS=-L/usr/local/lib -llvtk_plugin2 ifeq ($(ARCH),) ARCH := $(shell uname -m) endif +machine = $(shell sh -c 'uname -m 2>/dev/null || echo unknown') -ifneq ($(findstring armv7,$(ARCH)),) - CXXFLAGS += -mfpu=neon -march=armv7-a -marm +# Raspberry Pi B+, Zero, etc +ifneq (,$(findstring armv6l,$(machine))) + CPU = -mcpu=arm1176jzf-s + FPU = -mfpu=vfp +endif + +# Raspberry Pi 2 and 3 +ifneq (,$(findstring armv7l,$(machine))) + model = $(shell sh -c 'cat /sys/firmware/devicetree/base/model 2>/dev/null || echo unknown') +ifneq (,$(findstring 3,$(model))) + CPU = -mcpu=cortex-a53 + FPU = -mfpu=neon-fp-armv8 +else + CPU = -mcpu=cortex-a7 -mthumb + FPU = -mfpu=neon-vfpv4 +endif + FPU += -mneon-for-64bits +endif + +# ARM A64 +ifneq (,$(findstring aarch64,$(machine))) + CPU = -mcpu=cortex-a53 + PLATFORM += -mabi=lp64 -mcmodel=tiny +endif + +ifneq ($(findstring arm,$(ARCH)),) + CXXFLAGS += -DRASPI endif ifeq ($(DEBUG), 1) CXXFLAGS += -DDEBUG $(CFLAGS) else - CXXFLAGS += -Ofast $(CFLAGS) + #CXXFLAGS += -Ofast $(CFLAGS) -DRASPI + CXXFLAGS += -Ofast $(CFLAGS) $(CPU) $(FPU) endif all: $(BUNDLE) Makefile diff --git a/src/dexed.cpp b/src/dexed.cpp index 19bac00..0cc74e9 100644 --- a/src/dexed.cpp +++ b/src/dexed.cpp @@ -372,8 +372,12 @@ void Dexed::GetSamples(uint32_t n_samples, float* buffer) voices[note].dx7_note->compute(audiobuf.get(), lfovalue, lfodelay, &controllers); for (uint32_t j=0; j < N; ++j) { int32_t val = audiobuf.get()[j]; - +#ifndef RASPI val = val >> 4; +#else + //val*=2; + val=val<<2; // hope this is an arithmetic shift! +#endif int32_t clip_val = val < -(1 << 24) ? 0x8000 : val >= (1 << 24) ? 0x7fff : val >> 9; float f = float(clip_val) / float(0x8000); if(f>1.0)