[mupen64plus-audio-sdl] 15/163: Imported Upstream version 1.99.4~hg20100403
Sven Eckelmann
ecsv-guest at moszumanska.debian.org
Thu Nov 26 05:53:02 UTC 2015
This is an automated email from the git hooks/post-receive script.
ecsv-guest pushed a commit to branch armhf_test
in repository mupen64plus-audio-sdl.
commit b1805db615e4e4acc02c393f7fae9bc406b6fa00
Author: Sven Eckelmann <sven.eckelmann at gmx.de>
Date: Sun Apr 4 21:35:16 2010 +0200
Imported Upstream version 1.99.4~hg20100403
---
projects/unix/Makefile | 27 ++++++++++++++++++++-------
src/main.c | 44 ++++++++++++++++++++++++++------------------
2 files changed, 46 insertions(+), 25 deletions(-)
diff --git a/projects/unix/Makefile b/projects/unix/Makefile
index 640407e..e8f5bab 100644
--- a/projects/unix/Makefile
+++ b/projects/unix/Makefile
@@ -44,8 +44,8 @@ ifeq ("$(UNAME)","FreeBSD")
SHARED = -shared
SO_EXTENSION = so
endif
-ifeq ("$(UNAME)","GNU/kFreeBSD")
- OS = FREEBSD
+ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
+ OS = LINUX
SHARED = -shared
SO_EXTENSION = so
endif
@@ -83,13 +83,13 @@ ifeq ("$(CPU)","NONE")
endif
# base CFLAGS, LIBS, and LDFLAGS
-CFLAGS = -ffast-math -funroll-loops -fexpensive-optimizations -fno-strict-aliasing -I../../src
-LDFLAGS = -ldl
+CFLAGS += -ffast-math -funroll-loops -fexpensive-optimizations -fno-strict-aliasing -fvisibility=hidden -I../../src
+LDFLAGS += -ldl
# Since we are building a shared library, we must compile with -fPIC for x86_64 CPUs.
# On 32-bit systems we do not want to use -fPIC because we don't have to and it has a big performance penalty on this arch
ifeq ($(ARCH_DETECTED), 64BITS)
- CFLAGS += -fpic -DPIC -fvisibility=hidden
+ CFLAGS += -fpic -DPIC
endif
# tweak flags for 32-bit build on 64-bit system
ifeq ($(ARCH_DETECTED), 64BITS_32)
@@ -218,6 +218,18 @@ OBJECTS := $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(filter %.c, $(SOURCE)))
OBJDIRS = $(dir $(OBJECTS))
$(shell mkdir -p $(OBJDIRS))
+# build dependency files
+CFLAGS += -MD
+-include $(OBJECTS:.o=.d)
+
+# reduced compile output when running make without V=1
+ifneq ($(findstring $(MAKEFLAGS),s),s)
+ifndef V
+ Q_CC = @echo ' CC '$@;
+ Q_LD = @echo ' LD '$@;
+endif
+endif
+
# build targets
TARGET = mupen64plus-audio-sdl.$(SO_EXTENSION)
@@ -251,15 +263,16 @@ uninstall:
clean:
rm -rf ./_obj/* $(TARGET)
+ rmdir ./_obj
rebuild: clean all
# build rules
$(TARGET): $(OBJECTS)
- $(CC) $(SHARED) $^ $(LDFLAGS) -o $@
+ $(Q_LD)$(CC) $(SHARED) $^ $(LDFLAGS) -o $@
$(STRIP) $@
$(OBJDIR)/%.o: $(SRCDIR)/%.c
- $(CC) -o $@ $(CFLAGS) -c $<
+ $(Q_CC)$(CC) -o $@ $(CFLAGS) -c $<
diff --git a/src/main.c b/src/main.c
index 232f6b6..6419c15 100644
--- a/src/main.c
+++ b/src/main.c
@@ -373,7 +373,9 @@ SRC_DATA src_data;
static int resample(unsigned char *input, int input_avail, int oldsamplerate, unsigned char *output, int output_needed, int newsamplerate)
{
-
+ int *psrc = (int*)input;
+ int *pdest = (int*)output;
+ int i = 0, j = 0;
#ifdef USE_SRC
if(Resample == 2)
{
@@ -400,7 +402,7 @@ static int resample(unsigned char *input, int input_avail, int oldsamplerate, un
if(src_state == NULL)
{
memset(output, 0, output_needed);
- return;
+ return 0;
}
}
src_short_to_float_array ((short *) input, _src, input_avail/2);
@@ -420,24 +422,30 @@ static int resample(unsigned char *input, int input_avail, int oldsamplerate, un
}
#endif
// RESAMPLE == 1
- int *psrc = (int*)input;
- int *pdest = (int*)output;
- int i;
- int j=0;
- int sldf = oldsamplerate;
- int const2 = 2*sldf;
- int dldf = newsamplerate;
- int const1 = const2 - 2*dldf;
- int criteria = const2 - dldf;
- for(i = 0; i < output_needed/4; i++)
- {
- pdest[i] = psrc[j];
- if(criteria >= 0)
+ if (newsamplerate >= oldsamplerate)
+ {
+ int sldf = oldsamplerate;
+ int const2 = 2*sldf;
+ int dldf = newsamplerate;
+ int const1 = const2 - 2*dldf;
+ int criteria = const2 - dldf;
+ for (i = 0; i < output_needed/4; i++)
{
- ++j;
- criteria += const1;
+ pdest[i] = psrc[j];
+ if(criteria >= 0)
+ {
+ ++j;
+ criteria += const1;
+ }
+ else criteria += const2;
}
- else criteria += const2;
+ return j * 4; //number of bytes consumed
+ }
+ // newsamplerate < oldsamplerate, this only happens when speed_factor > 1
+ for (i = 0; i < output_needed/4; i++)
+ {
+ j = i * oldsamplerate / newsamplerate;
+ pdest[i] = psrc[j];
}
return j * 4; //number of bytes consumed
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/mupen64plus-audio-sdl.git
More information about the Pkg-games-commits
mailing list