Integrate ARM 64bit fixedpoint patch submitted by Tim Deegan in pkg/16479.

This feature is enabled by MPG123_ARM_FIXED64.

mpg123/Makefile.common contains common stuff of mpg123 and mpg123-esound.
This commit is contained in:
kent 2002-06-23 08:45:09 +00:00
parent 8563318b2d
commit e80e55f014
7 changed files with 188 additions and 133 deletions

View file

@ -1,63 +1,10 @@
# $NetBSD: Makefile,v 1.1 2002/06/22 17:56:38 kent Exp $
# $NetBSD: Makefile,v 1.2 2002/06/23 08:45:09 kent Exp $
DISTNAME= mpg123-0.59r
PKGNAME= mpg123-esound-0.59.18
CATEGORIES= audio
MASTER_SITES= http://www.mpg123.de/mpg123/ \
http://www-ti.informatik.uni-tuebingen.de/~hippm/mpg123/
PATCH_SITES= ftp://ftp.kame.net/pub/kame/misc/
PATCHFILES= mpg123-059r-v6-20000713b.diff.gz
MAINTAINER= packages@netbsd.org
HOMEPAGE= http://www.mpg123.de/
PKGNAME= mpg123-esound-${MPG123_VERSION}
COMMENT= Command-line player for mpeg layer 1, 2 and 3 audio with EsounD
BUILD_DEFS+= USE_INET6
DIST_SUBDIR= mpg123
PATCHDIR= ../mpg123/patches
FILESDIR= ../mpg123/files
USE_BUILDLINK_ONLY= # defined
# for OBJECT_FMT
.include "../../mk/bsd.prefs.mk"
.if (${MACHINE_ARCH} == "i386")
.if (${OBJECT_FMT} == "ELF")
ALL_TARGET= netbsd-i386-elf-esd
.else
ALL_TARGET= netbsd-i386-esd
.endif
.elif (${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "arm32")
ALL_TARGET= netbsd-arm-esd
.elif (${MACHINE_ARCH} == "m68k")
ALL_TARGET= netbsd-m68k-esd
.else
ALL_TARGET= ${LOWER_OPSYS}-esd
.endif
.if ${OPSYS} == "SunOS"
ALL_TARGET= solaris-gcc-esd
.endif
.if defined(USE_INET6) && ${USE_INET6} == "YES"
CPPFLAGS+= -DINET6
.endif
MAKE_FLAGS+= PREFIX="${PREFIX}"
pre-patch:
${LN} -s . ${WRKSRC}/mpg123
post-patch:
${RM} -f ${WRKSRC}/mpg123
${CP} ${FILESDIR}/decode_i586_.s ${WRKSRC}/
cd ${WRKSRC} ; ${MV} decode_i586.s decode_i586.s.orig ;\
${SED} \
-e 's@^/@#/@g' \
<decode_i586.s.orig >decode_i586.s
TARGET_SUFFIX= -esd
.include "../mpg123/Makefile.common"
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/mpg123 ${PREFIX}/bin/mpg123-esound

View file

@ -1,10 +1,10 @@
$NetBSD: distinfo,v 1.3 2002/06/22 19:03:11 kent Exp $
$NetBSD: distinfo,v 1.4 2002/06/23 08:45:09 kent Exp $
SHA1 (mpg123/mpg123-0.59r.tar.gz) = c32fe242f4506d218bd19a51a4034da9fdc79493
Size (mpg123/mpg123-0.59r.tar.gz) = 159028 bytes
SHA1 (mpg123/mpg123-059r-v6-20000713b.diff.gz) = fab11489b6a1ab79d6c29787161f1c05e492dc0b
Size (mpg123/mpg123-059r-v6-20000713b.diff.gz) = 5600 bytes
SHA1 (patch-aa) = 5f5310e52c8a7b17bc675d6d3b21ea629f644b40
SHA1 (patch-aa) = ac0daa7156f6125e8988431fba52964696af4b61
SHA1 (patch-ab) = ffc387d93f0f2832e49796c80be26e908defa3a7
SHA1 (patch-ac) = 06a5037e27ddd4cc34e5348c09e702f9740173c5
SHA1 (patch-ad) = e9b2b874a95a67139c7d48e74492eb64dfa815f0
@ -13,7 +13,7 @@ SHA1 (patch-af) = 309075bc6fd4b689b711f0ae84f2e5c829609452
SHA1 (patch-ag) = c27b6a441573939dc23268a6937905d038d6a66b
SHA1 (patch-ah) = e1419bc6d25360d0825041028b6b3f485bcf5f43
SHA1 (patch-ai) = 021c5bb2baa56327d486bf134b537ac5c6aa8fba
SHA1 (patch-aj) = 910b2834c34e617c492a3c72e4d2185d3eb53ecc
SHA1 (patch-aj) = b828a5e35a03b307d46cd07356624d19b9d56777
SHA1 (patch-ak) = b30898cff26859eca0d23ea8cfdd461920b978a8
SHA1 (patch-al) = 88dec640d40e6a3f1828096a4ff7b5a4dbd0a222
SHA1 (patch-am) = 661c1f95f65145f4e08706eb3f6fe975118a2822

View file

@ -1,62 +1,10 @@
# $NetBSD: Makefile,v 1.33 2002/05/25 06:31:28 rh Exp $
# $NetBSD: Makefile,v 1.34 2002/06/23 08:45:09 kent Exp $
DISTNAME= mpg123-0.59r
PKGNAME= mpg123-0.59.18
PKGNAME= mpg123-${MPG123_VERSION}
PKGREVISION= 2
CATEGORIES= audio
MASTER_SITES= http://www.mpg123.de/mpg123/ \
http://www-ti.informatik.uni-tuebingen.de/~hippm/mpg123/
PATCH_SITES= ftp://ftp.kame.net/pub/kame/misc/
PATCHFILES= mpg123-059r-v6-20000713b.diff.gz
MAINTAINER= packages@netbsd.org
HOMEPAGE= http://www.mpg123.de/
COMMENT= Command-line player for mpeg layer 1, 2 and 3 audio
CONFLICTS+= mpg123-nas-[0-9]*
BUILD_DEFS+= USE_INET6
DIST_SUBDIR= mpg123
USE_BUILDLINK_ONLY= # defined
# for OBJECT_FMT
.include "../../mk/bsd.prefs.mk"
.if (${MACHINE_ARCH} == "i386")
.if (${OBJECT_FMT} == "ELF")
ALL_TARGET= netbsd-i386-elf
.else
ALL_TARGET= netbsd-i386
.endif
.elif (${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "arm32")
ALL_TARGET= netbsd-arm
.elif (${MACHINE_ARCH} == "m68k")
ALL_TARGET= netbsd-m68k
.else
ALL_TARGET= ${LOWER_OPSYS}
.endif
.if ${OPSYS} == "SunOS"
ALL_TARGET= solaris-gcc
.endif
.if defined(USE_INET6) && ${USE_INET6} == "YES"
CPPFLAGS+= -DINET6
.endif
MAKE_FLAGS+= PREFIX="${PREFIX}"
pre-patch:
${LN} -s . ${WRKSRC}/mpg123
post-patch:
${RM} -f ${WRKSRC}/mpg123
${CP} ${FILESDIR}/decode_i586_.s ${WRKSRC}/
cd ${WRKSRC} ; ${MV} decode_i586.s decode_i586.s.orig ;\
${SED} \
-e 's@^/@#/@g' \
<decode_i586.s.orig >decode_i586.s
.include "Makefile.common"
.include "../../mk/bsd.pkg.mk"

View file

@ -0,0 +1,60 @@
# $NetBSD: Makefile.common,v 1.1 2002/06/23 08:45:09 kent Exp $ -*- Makefile -*-
DISTNAME= mpg123-0.59r
MPG123_VERSION= 0.59.18
CATEGORIES= audio
MASTER_SITES= http://www.mpg123.de/mpg123/ \
http://www-ti.informatik.uni-tuebingen.de/~hippm/mpg123/
PATCH_SITES= ftp://ftp.kame.net/pub/kame/misc/
PATCHFILES= mpg123-059r-v6-20000713b.diff.gz
MAINTAINER= packages@netbsd.org
HOMEPAGE= http://www.mpg123.de/
BUILD_DEFS+= USE_INET6
DIST_SUBDIR= mpg123
PATCHDIR= ../mpg123/patches
FILESDIR= ../mpg123/files
USE_BUILDLINK_ONLY= # defined
# for OBJECT_FMT
.include "../../mk/bsd.prefs.mk"
.if (${MACHINE_ARCH} == "i386")
.if (${OBJECT_FMT} == "ELF")
ALL_TARGET= netbsd-i386-elf${TARGET_SUFFIX}
.else
ALL_TARGET= netbsd-i386${TARGET_SUFFIX}
.endif
.elif (${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "arm32")
.if defined(MPG123_ARM_FIXED64) && ${MPG123_ARM_FIXED64} == "YES"
ALL_TARGET= netbsd-arm-64${TARGET_SUFFIX}
.else
ALL_TARGET= netbsd-arm${TARGET_SUFFIX}
.endif
.elif (${MACHINE_ARCH} == "m68k")
ALL_TARGET= netbsd-m68k${TARGET_SUFFIX}
.else
ALL_TARGET= ${LOWER_OPSYS}${TARGET_SUFFIX}
.endif
.if ${OPSYS} == "SunOS"
ALL_TARGET= solaris-gcc${TARGET_SUFFIX}
.endif
.if defined(USE_INET6) && ${USE_INET6} == "YES"
CPPFLAGS+= -DINET6
.endif
MAKE_FLAGS+= PREFIX="${PREFIX}"
pre-patch:
${LN} -s . ${WRKSRC}/mpg123
post-patch:
${RM} -f ${WRKSRC}/mpg123
${CP} ${FILESDIR}/decode_i586_.s ${WRKSRC}/
cd ${WRKSRC} ; ${MV} decode_i586.s decode_i586.s.orig ;\
${SED} \
-e 's@^/@#/@g' \
<decode_i586.s.orig >decode_i586.s

View file

@ -1,10 +1,10 @@
$NetBSD: distinfo,v 1.11 2002/06/22 19:03:11 kent Exp $
$NetBSD: distinfo,v 1.12 2002/06/23 08:45:09 kent Exp $
SHA1 (mpg123/mpg123-0.59r.tar.gz) = c32fe242f4506d218bd19a51a4034da9fdc79493
Size (mpg123/mpg123-0.59r.tar.gz) = 159028 bytes
SHA1 (mpg123/mpg123-059r-v6-20000713b.diff.gz) = fab11489b6a1ab79d6c29787161f1c05e492dc0b
Size (mpg123/mpg123-059r-v6-20000713b.diff.gz) = 5600 bytes
SHA1 (patch-aa) = 5f5310e52c8a7b17bc675d6d3b21ea629f644b40
SHA1 (patch-aa) = ac0daa7156f6125e8988431fba52964696af4b61
SHA1 (patch-ab) = ffc387d93f0f2832e49796c80be26e908defa3a7
SHA1 (patch-ac) = 06a5037e27ddd4cc34e5348c09e702f9740173c5
SHA1 (patch-ad) = e9b2b874a95a67139c7d48e74492eb64dfa815f0
@ -13,7 +13,7 @@ SHA1 (patch-af) = 309075bc6fd4b689b711f0ae84f2e5c829609452
SHA1 (patch-ag) = c27b6a441573939dc23268a6937905d038d6a66b
SHA1 (patch-ah) = e1419bc6d25360d0825041028b6b3f485bcf5f43
SHA1 (patch-ai) = 021c5bb2baa56327d486bf134b537ac5c6aa8fba
SHA1 (patch-aj) = 910b2834c34e617c492a3c72e4d2185d3eb53ecc
SHA1 (patch-aj) = b828a5e35a03b307d46cd07356624d19b9d56777
SHA1 (patch-ak) = b30898cff26859eca0d23ea8cfdd461920b978a8
SHA1 (patch-al) = 88dec640d40e6a3f1828096a4ff7b5a4dbd0a222
SHA1 (patch-am) = 661c1f95f65145f4e08706eb3f6fe975118a2822

View file

@ -1,24 +1,26 @@
$NetBSD: patch-aa,v 1.20 2002/06/22 19:03:11 kent Exp $
$NetBSD: patch-aa,v 1.21 2002/06/23 08:45:09 kent Exp $
--- Makefile.orig Sun Jun 23 03:50:48 2002
--- Makefile.orig Sun Jun 23 16:56:17 2002
+++ Makefile
@@ -54,6 +54,15 @@
@@ -54,6 +54,17 @@
@echo "make aix-tk3play IBM AIX"
@echo "make os2 IBM OS/2"
@echo "make netbsd NetBSD"
+ @echo "make netbsd-arm NetBSD for strongarm"
+ @echo "make netbsd-arm NetBSD for strongarm (32bit fixedpoint)"
+ @echo "make netbsd-arm-64 NetBSD for strongarm (64bit fixedpoint)"
+ @echo "make netbsd-i386 NetBSD optimized for i386"
+ @echo "make netbsd-i386-elf NetBSD optimized for i386, ELF format"
+ @echo "make netbsd-m68k NetBSD optimized for m68k"
+ @echo "make netbsd-esd NetBSD with EsounD"
+ @echo "make netbsd-arm-esd NetBSD for strongarm with EsounD"
+ @echo "make netbsd-arm-esd NetBSD for strongarm (32bit fixedpoint) with EsounD"
+ @echo "make netbsd-arm-64-esd NetBSD for strongarm (64bit fixedpoint) with EsounD"
+ @echo "make netbsd-i386-esd NetBSD optimized for i386 with EsounD"
+ @echo "make netbsd-i386-elf-esd NetBSD optimized for i386, ELF format with EsounD"
+ @echo "make netbsd-m68k-esd NetBSD optimized for m68k with EsounD"
+ @echo "make netbsd-m68k-esd NetBSD optimized for m68k with EsounD"
@echo "make bsdos BSDI BSD/OS"
@echo "make bsdos4 BSDI BSD/OS 4.0"
@echo "make bsdos-nas BSDI BSD/OS with NAS support"
@@ -496,18 +505,100 @@
@@ -496,18 +507,120 @@
netbsd:
$(MAKE) CC=cc LDFLAGS= \
@ -46,8 +48,7 @@ $NetBSD: patch-aa,v 1.20 2002/06/22 19:03:11 kent Exp $
+ OBJECTS='decode_i386.o dct64_i386.o decode_i586.o \
+ audio_sun.o term.o' \
+ CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O4 -fomit-frame-pointer \
-funroll-all-loops -ffast-math -DROT_I386 \
- -DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DNETBSD' \
+ -funroll-all-loops -ffast-math -DROT_I386 \
+ -DI386_ASSEM -DPENTIUM_OPT -DREAL_IS_FLOAT -DUSE_MMAP \
+ -DREAD_MMAP -DNETBSD -DTERM_CONTROL' \
+ mpg123-make
@ -70,6 +71,16 @@ $NetBSD: patch-aa,v 1.20 2002/06/22 19:03:11 kent Exp $
+ -DNETBSD' \
+ mpg123-make
+
+netbsd-arm-64:
+ $(MAKE) CC=cc LDFLAGS= \
+ OBJECTS='decode.o dct64.o audio_sun.o term.o' \
+ CFLAGS='$(CFLAGS) -Wall -O6 -fomit-frame-pointer \
+ -funroll-all-loops -finline-functions -ffast-math \
+ -march=armv4 -mtune=strongarm110 -mcpu=strongarm110 \
+ -DREAL_IS_FIXED_ARMV4 -DUSE_MMAP -DREAD_MMAP \
+ -DTERM_CONTROL -DNETBSD' \
+ mpg123-make
+
+netbsd-esd:
+ $(MAKE) CC=cc LDFLAGS= \
+ AUDIO_LIB="`$(ESD_CONFIG) --libs`" \
@ -91,13 +102,13 @@ $NetBSD: patch-aa,v 1.20 2002/06/22 19:03:11 kent Exp $
+ mpg123-make
+
+netbsd-i386-elf-esd:
+ echo GETBITS: $(GETBITS)
+ $(MAKE) CC=cc LDFLAGS= \
+ AUDIO_LIB="`$(ESD_CONFIG) --libs`" \
+ OBJECTS='decode_i386.o dct64_i386.o decode_i586.o \
+ audio_esd.o term.o' \
+ CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O4 -fomit-frame-pointer \
+ -funroll-all-loops -ffast-math -DROT_I386 \
-funroll-all-loops -ffast-math -DROT_I386 \
- -DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DNETBSD' \
+ -DI386_ASSEM -DPENTIUM_OPT -DREAL_IS_FLOAT -DUSE_MMAP \
+ -DREAD_MMAP -DNETBSD -DTERM_CONTROL \
+ `$(ESD_CONFIG) --cflags`' \
@ -122,6 +133,17 @@ $NetBSD: patch-aa,v 1.20 2002/06/22 19:03:11 kent Exp $
+ -march=armv4 -mtune=strongarm -mcpu=strongarm \
+ -DREAL_IS_FIXED -DUSE_MMAP -DREAD_MMAP -DTERM_CONTROL \
+ -DNETBSD `$(ESD_CONFIG) --cflags`' \
+ mpg123-make
+
+netbsd-arm-64-esd:
+ $(MAKE) CC=cc LDFLAGS= \
+ AUDIO_LIB="`$(ESD_CONFIG) --libs`" \
+ OBJECTS='decode.o dct64.o audio_esd.o term.o' \
+ CFLAGS='$(CFLAGS) -Wall -O6 -fomit-frame-pointer \
+ -funroll-all-loops -finline-functions -ffast-math \
+ -march=armv4 -mtune=strongarm110 -mcpu=strongarm110 \
+ -DREAL_IS_FIXED_ARMV4 -DUSE_MMAP -DREAD_MMAP \
+ -DTERM_CONTROL -DNETBSD `$(ESD_CONFIG) --cflags`' \
mpg123-make
bsdos:

View file

@ -1,8 +1,8 @@
$NetBSD: patch-aj,v 1.1 1999/10/12 04:43:15 simonb Exp $
$NetBSD: patch-aj,v 1.2 2002/06/23 08:45:09 kent Exp $
--- mpg123.h.orig Sat May 29 00:51:58 1999
+++ mpg123.h Tue Oct 12 01:17:16 1999
@@ -56,8 +56,37 @@
--- mpg123.h.orig Fri May 28 23:51:58 1999
+++ mpg123.h
@@ -56,8 +56,115 @@
# define real float
#elif defined(REAL_IS_LONG_DOUBLE)
# define real long double
@ -18,6 +18,84 @@ $NetBSD: patch-aj,v 1.1 1999/10/12 04:43:15 simonb Exp $
+# define DOUBLE_TO_REAL(x) ((int)((x) * REAL_FACTOR))
+# define REAL_TO_SHORT(x) ((x) >> REAL_RADIX)
+# define REAL_MUL(x, y) (((long long)(x) * (long long)(y)) >> REAL_RADIX)
+
+#elif defined(REAL_IS_FIXED_ARMV4)
+# define REAL_IS_FIXED
+# define real long long
+
+# define REAL_RADIX 32
+# define REAL_FACTOR (4294967296.0)
+
+# define REAL_PLUS_32767 ( 32767LL << REAL_RADIX )
+# define REAL_MINUS_32768 ( -32768LL << REAL_RADIX )
+
+# define DOUBLE_TO_REAL(x) ((long long)((x) * REAL_FACTOR))
+# define REAL_TO_SHORT(x) ((x) >> REAL_RADIX)
+
+/*
+ * "Reals" are signed, 15 bits before the point, 32 bits after.
+ * Multiplication is done like so:
+ *
+ * if |x| < 2^8, shift x >> 7, else shift x >>15
+ * if |y| < 2^8, shift y >> 7, else shift y >>15
+ * multiply x * y (just avoids clipping MSB)
+ * shift the result >> 2, 10 or 18 bits, to make a total shift of 32 bits
+ *
+ * I'd do it in C, but gcc optimises it rather poorly (2K stack
+ * frames, anyone?). Hence the bit of (ARMv4) asm magic below.
+ * (Unfortunately, the CLZ opcode, which would make for a much neater
+ * solution to this, doesn't appear until ARMv5)
+ *
+ * (tjd April 2002)
+ */
+
+# define REAL_MUL(x, y) real_mul((x),(y))
+
+static __inline__ long long real_mul(long long x, long long y) {
+ const register long long _x asm("r0") = (x);
+ const register long long _y asm("r2") = (y);
+ register long long rv asm("r0");
+ __asm__ __volatile__ (
+"@ we'll need to shift the result at least >> 2\n"
+" mov r4, #2\n"
+"@ both args >> 7,\n"
+" mov r0, r0, lsr #7\n"
+" mov r2, r2, lsr #7\n"
+" orr r0, r0, r1, lsl #25\n"
+" orr r2, r2, r3, lsl #25\n"
+" mov r1, r1, asr #7\n"
+" mov r3, r3, asr #7\n"
+"@ check if x needs further shiftage\n"
+" cmp r1, #0\n"
+" cmnne r1, #1\n"
+" addeq r4, r4, #8\n"
+"@ shift x if needed\n"
+" movne r0, r0, lsr #8\n"
+" orrne r0, r0, r1, lsl #24\n"
+" movne r1, r1, asr #8\n"
+"@ check if y needs further shiftage\n"
+" cmp r3, #0\n"
+" cmnne r3, #1\n"
+" addeq r4, r4, #8\n"
+"@ shift y if needed\n"
+" movne r2, r2, lsr #8\n"
+" orrne r2, r2, r3, lsl #24\n"
+" movne r3, r3, asr #8\n"
+"@ multiply (ignoring overflow)\n"
+" mul r3, r0, r3\n"
+" mla r3, r1, r2, r3\n"
+" umull r0, r1, r2, r0\n"
+" add r1, r1, r3\n"
+"@ shift the result the appropriate amount\n"
+" rsb r3, r4, #32\n"
+" mov r0, r0, lsr r4\n"
+" orr r0, r0, r1, lsl r3\n"
+" mov r1, r1, asr r4\n"
+ : "=r" (rv)
+ : "0" (_x), "r" (_y)
+ : "r1", "r3", "r4", "cc");
+ return rv;
+}
+
#else
# define real double