From 528af4819f162ee2980effe04709075b494f5f43 Mon Sep 17 00:00:00 2001 From: simonb Date: Tue, 12 Oct 1999 04:43:11 +0000 Subject: Add fixed-point support used by the arm32. XXX: Uses strongarm C-compiler options to use 32x32=64 int multiply. --- audio/mpg123/Makefile | 4 +- audio/mpg123/patches/patch-aa | 71 ++-- audio/mpg123/patches/patch-ad | 75 ++++ audio/mpg123/patches/patch-ae | 16 + audio/mpg123/patches/patch-ag | 123 +++++++ audio/mpg123/patches/patch-ah | 22 ++ audio/mpg123/patches/patch-ai | 780 ++++++++++++++++++++++++++++++++++++++++++ audio/mpg123/patches/patch-aj | 42 +++ audio/mpg123/patches/patch-ak | 40 +++ 9 files changed, 1149 insertions(+), 24 deletions(-) create mode 100644 audio/mpg123/patches/patch-ad create mode 100644 audio/mpg123/patches/patch-ae create mode 100644 audio/mpg123/patches/patch-ag create mode 100644 audio/mpg123/patches/patch-ah create mode 100644 audio/mpg123/patches/patch-ai create mode 100644 audio/mpg123/patches/patch-aj create mode 100644 audio/mpg123/patches/patch-ak (limited to 'audio/mpg123') diff --git a/audio/mpg123/Makefile b/audio/mpg123/Makefile index ade28a6a22d..3be1f026fc0 100644 --- a/audio/mpg123/Makefile +++ b/audio/mpg123/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.17 1999/09/27 08:27:47 agc Exp $ +# $NetBSD: Makefile,v 1.18 1999/10/12 04:43:11 simonb Exp $ # DISTNAME= mpg123-0.59r @@ -18,6 +18,8 @@ ALL_TARGET= netbsd-i386-elf .else ALL_TARGET= netbsd-i386 .endif +.elif (${MACHINE_ARCH} == "arm32") +ALL_TARGET= netbsd-arm32 .elif (${MACHINE_ARCH} == "m68k") ALL_TARGET= netbsd-m68k .else diff --git a/audio/mpg123/patches/patch-aa b/audio/mpg123/patches/patch-aa index f8971cb0ea9..94786db6203 100644 --- a/audio/mpg123/patches/patch-aa +++ b/audio/mpg123/patches/patch-aa @@ -1,48 +1,73 @@ -$NetBSD: patch-aa,v 1.11 1999/07/10 10:39:03 tron Exp $ +$NetBSD: patch-aa,v 1.12 1999/10/12 04:43:12 simonb Exp $ ---- Makefile.orig Tue Jan 26 06:35:18 1999 -+++ Makefile Wed Jun 23 19:45:35 1999 -@@ -34,6 +34,9 @@ - @echo "make aix IBM AIX (tested: 4.2)" +--- Makefile.orig Wed Jun 16 06:39:06 1999 ++++ Makefile Tue Oct 12 13:57:53 1999 +@@ -39,6 +39,10 @@ + @echo "make aix-tk3play IBM AIX" @echo "make os2 IBM OS/2" @echo "make netbsd NetBSD" ++ @echo "make netbsd-arm32 NetBSD for strongarm" + @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 bsdos BSDI BSD/OS" + @echo "make bsdos4 BSDI BSD/OS 4.0" @echo "make bsdos-nas BSDI BSD/OS with NAS support" - @echo "make mint MiNT on Atari" -@@ -365,6 +368,33 @@ - -funroll-all-loops -ffast-math -DROT_I386 \ - -DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DNETBSD' \ +@@ -362,6 +366,34 @@ + -funroll-all-loops -finline-functions' \ mpg123-make -+ + +netbsd-i386-elf: + $(MAKE) CC=cc LDFLAGS= \ + OBJECTS='decode_i386.o dct64_i386.o decode_i586.o \ -+ audio_sun.o' \ ++ audio_sun.o term.o' \ + CFLAGS='-Wall -ansi -pedantic -O4 -m486 -fomit-frame-pointer \ + -funroll-all-loops -ffast-math -DROT_I386 \ + -DI386_ASSEM -DPENTIUM_OPT -DREAL_IS_FLOAT -DUSE_MMAP \ -+ -DREAD_MMAP -DNETBSD' \ ++ -DREAD_MMAP -DNETBSD -DTERM_CONTROL' \ + mpg123-make + -+netbsd-profile: -+ $(MAKE) CC=cc LDFLAGS='-pg -static'\ -+ OBJECTS='decode.o dct64.o audio_sun.o' \ -+ CFLAGS='-Wall -ansi -pedantic -O3 -pg \ -+ -funroll-all-loops -ffast-math \ -+ -DREAL_IS_FLOAT -DUSE_MMAP -DNETBSD -DM68K_ASSEM' \ -+ mpg123-make -+ +netbsd-m68k: + $(MAKE) CC=cc LDFLAGS= \ -+ OBJECTS='decode.o dct64.o audio_sun.o' \ ++ OBJECTS='decode.o dct64.o audio_sun.o term.o' \ + CFLAGS='-Wall -ansi -pedantic -O3 -fomit-frame-pointer \ + -ffast-math -DREAL_IS_FLOAT \ -+ -DUSE_MMAP -DNETBSD -DM68K_ASSEM' \ ++ -DUSE_MMAP -DNETBSD -DM68K_ASSEM -DTERM_CONTROL' \ ++ mpg123-make ++ ++netbsd-arm32: ++ $(MAKE) CC=cc LDFLAGS= \ ++ OBJECTS='decode.o dct64.o audio_sun.o term.o' \ ++ CFLAGS='-Wall -O6 -fomit-frame-pointer \ ++ -funroll-all-loops -finline-functions -ffast-math \ ++ -march=armv4 -mtune=strongarm -mcpu=strongarm \ ++ -DREAL_IS_FIXED -DUSE_MMAP -DREAD_MMAP -DTERM_CONTROL \ ++ -DNETBSD' \ + mpg123-make + + solaris-gcc-esd: + $(MAKE) CC=gcc LDFLAGS='-lsocket -lnsl' \ + AUDIO_LIB='-lesd -lresolv' \ +@@ -481,18 +513,18 @@ + + netbsd: + $(MAKE) CC=cc LDFLAGS= \ +- OBJECTS='decode.o dct64.o audio_sun.o' \ ++ OBJECTS='decode.o dct64.o audio_sun.o term.o' \ + CFLAGS='-Wall -ansi -pedantic -O3 -fomit-frame-pointer \ + -funroll-all-loops -ffast-math \ +- -DREAL_IS_FLOAT -DUSE_MMAP -DNETBSD' \ ++ -DREAL_IS_FLOAT -DUSE_MMAP -DTERM_CONTROL -DNETBSD' \ + mpg123-make + + netbsd-i386: + $(MAKE) CC=cc LDFLAGS= \ +- OBJECTS='decode_i386.o dct64_i386.o audio_sun.o' \ ++ OBJECTS='decode_i386.o dct64_i386.o audio_sun.o term.o' \ + CFLAGS='-Wall -ansi -pedantic -O4 -m486 -fomit-frame-pointer \ + -funroll-all-loops -ffast-math -DROT_I386 \ +- -DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DNETBSD' \ ++ -DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DTERM_CONTROL -DNETBSD' \ + mpg123-make bsdos: - $(MAKE) CC=shlicc2 LDFLAGS= \ diff --git a/audio/mpg123/patches/patch-ad b/audio/mpg123/patches/patch-ad new file mode 100644 index 00000000000..60e5bfc511d --- /dev/null +++ b/audio/mpg123/patches/patch-ad @@ -0,0 +1,75 @@ +$NetBSD: patch-ad,v 1.3 1999/10/12 04:43:12 simonb Exp $ + +--- dct64.c.orig Sat Sep 20 21:16:04 1997 ++++ dct64.c Thu Aug 12 23:28:33 1999 +@@ -29,7 +29,7 @@ + for(i=15;i>=0;i--) + *bs++ = (*b1++ + *--b2); + for(i=15;i>=0;i--) +- *bs++ = (*--b2 - *b1++) * *--costab; ++ *bs++ = REAL_MUL((*--b2 - *b1++), *--costab); + + b1 = bufs; + costab = pnts[1]+8; +@@ -39,13 +39,13 @@ + for(i=7;i>=0;i--) + *bs++ = (*b1++ + *--b2); + for(i=7;i>=0;i--) +- *bs++ = (*--b2 - *b1++) * *--costab; ++ *bs++ = REAL_MUL((*--b2 - *b1++), *--costab); + b2 += 32; + costab += 8; + for(i=7;i>=0;i--) + *bs++ = (*b1++ + *--b2); + for(i=7;i>=0;i--) +- *bs++ = (*b1++ - *--b2) * *--costab; ++ *bs++ = REAL_MUL((*b1++ - *--b2), *--costab); + b2 += 32; + } + +@@ -58,12 +58,12 @@ + for(i=3;i>=0;i--) + *bs++ = (*b1++ + *--b2); + for(i=3;i>=0;i--) +- *bs++ = (*--b2 - *b1++) * costab[i]; ++ *bs++ = REAL_MUL((*--b2 - *b1++), costab[i]); + b2 += 16; + for(i=3;i>=0;i--) + *bs++ = (*b1++ + *--b2); + for(i=3;i>=0;i--) +- *bs++ = (*b1++ - *--b2) * costab[i]; ++ *bs++ = REAL_MUL((*b1++ - *--b2), costab[i]); + b2 += 16; + } + +@@ -75,13 +75,13 @@ + { + *bs++ = (*b1++ + *--b2); + *bs++ = (*b1++ + *--b2); +- *bs++ = (*--b2 - *b1++) * costab[1]; +- *bs++ = (*--b2 - *b1++) * costab[0]; ++ *bs++ = REAL_MUL((*--b2 - *b1++), costab[1]); ++ *bs++ = REAL_MUL((*--b2 - *b1++), costab[0]); + b2 += 8; + *bs++ = (*b1++ + *--b2); + *bs++ = (*b1++ + *--b2); +- *bs++ = (*b1++ - *--b2) * costab[1]; +- *bs++ = (*b1++ - *--b2) * costab[0]; ++ *bs++ = REAL_MUL((*b1++ - *--b2), costab[1]); ++ *bs++ = REAL_MUL((*b1++ - *--b2), costab[0]); + b2 += 8; + } + bs = bufs; +@@ -92,10 +92,10 @@ + real v0,v1; + v0=*b1++; v1 = *b1++; + *bs++ = (v0 + v1); +- *bs++ = (v0 - v1) * (*costab); ++ *bs++ = REAL_MUL((v0 - v1), (*costab)); + v0=*b1++; v1 = *b1++; + *bs++ = (v0 + v1); +- *bs++ = (v1 - v0) * (*costab); ++ *bs++ = REAL_MUL((v1 - v0), (*costab)); + } + + } diff --git a/audio/mpg123/patches/patch-ae b/audio/mpg123/patches/patch-ae new file mode 100644 index 00000000000..b7b340d3663 --- /dev/null +++ b/audio/mpg123/patches/patch-ae @@ -0,0 +1,16 @@ +$NetBSD: patch-ae,v 1.5 1999/10/12 04:43:13 simonb Exp $ + +--- dct64_i486.c.orig Thu Nov 19 21:42:36 1998 ++++ dct64_i486.c Mon Aug 16 01:49:16 1999 +@@ -47,7 +47,11 @@ + #define SETOUT(out,n,expr) out[FIR_BUFFER_SIZE*(n)]=(expr) + #define MUL(a,b) (((a)*(b)) >> 15) + #define MULL(a,b) (((long long)(a)*(long long)(b)) >> 15) ++#ifdef REAL_IS_FIXED ++#define TOINT(a) ((a) * 32768 / (int)REAL_FACTOR) ++#else + #define TOINT(a) ((int)((a)*32768.0)) ++#endif + + void dct64_1_486(int *out0,int *out1,int *b1,int *b2) + { diff --git a/audio/mpg123/patches/patch-ag b/audio/mpg123/patches/patch-ag new file mode 100644 index 00000000000..fc0ebd58545 --- /dev/null +++ b/audio/mpg123/patches/patch-ag @@ -0,0 +1,123 @@ +$NetBSD: patch-ag,v 1.3 1999/10/12 04:43:13 simonb Exp $ + +--- decode.c.orig Tue Jan 26 23:47:05 1999 ++++ decode.c Tue Oct 12 01:19:18 1999 +@@ -13,9 +13,9 @@ + #include "mpg123.h" + + #define WRITE_SAMPLE(samples,sum,clip) \ +- if( (sum) > 32767.0) { *(samples) = 0x7fff; (clip)++; } \ +- else if( (sum) < -32768.0) { *(samples) = -0x8000; (clip)++; } \ +- else { *(samples) = sum; } ++ if( (sum) > REAL_PLUS_32767) { *(samples) = 0x7fff; (clip)++; } \ ++ else if( (sum) < REAL_MINUS_32768) { *(samples) = -0x8000; (clip)++; } \ ++ else { *(samples) = REAL_TO_SHORT(sum); } + + int synth_1to1_8bit(real *bandPtr,int channel,unsigned char *samples,int *pnt) + { +@@ -156,36 +156,36 @@ + for (j=16;j;j--,window+=0x10,samples+=step) + { + real sum; +- sum = *window++ * *b0++; +- sum -= *window++ * *b0++; +- sum += *window++ * *b0++; +- sum -= *window++ * *b0++; +- sum += *window++ * *b0++; +- sum -= *window++ * *b0++; +- sum += *window++ * *b0++; +- sum -= *window++ * *b0++; +- sum += *window++ * *b0++; +- sum -= *window++ * *b0++; +- sum += *window++ * *b0++; +- sum -= *window++ * *b0++; +- sum += *window++ * *b0++; +- sum -= *window++ * *b0++; +- sum += *window++ * *b0++; +- sum -= *window++ * *b0++; ++ sum = REAL_MUL(*window++, *b0++); ++ sum -= REAL_MUL(*window++, *b0++); ++ sum += REAL_MUL(*window++, *b0++); ++ sum -= REAL_MUL(*window++, *b0++); ++ sum += REAL_MUL(*window++, *b0++); ++ sum -= REAL_MUL(*window++, *b0++); ++ sum += REAL_MUL(*window++, *b0++); ++ sum -= REAL_MUL(*window++, *b0++); ++ sum += REAL_MUL(*window++, *b0++); ++ sum -= REAL_MUL(*window++, *b0++); ++ sum += REAL_MUL(*window++, *b0++); ++ sum -= REAL_MUL(*window++, *b0++); ++ sum += REAL_MUL(*window++, *b0++); ++ sum -= REAL_MUL(*window++, *b0++); ++ sum += REAL_MUL(*window++, *b0++); ++ sum -= REAL_MUL(*window++, *b0++); + + WRITE_SAMPLE(samples,sum,clip); + } + + { + real sum; +- sum = window[0x0] * b0[0x0]; +- sum += window[0x2] * b0[0x2]; +- sum += window[0x4] * b0[0x4]; +- sum += window[0x6] * b0[0x6]; +- sum += window[0x8] * b0[0x8]; +- sum += window[0xA] * b0[0xA]; +- sum += window[0xC] * b0[0xC]; +- sum += window[0xE] * b0[0xE]; ++ sum = REAL_MUL(window[0x0], b0[0x0]); ++ sum += REAL_MUL(window[0x2], b0[0x2]); ++ sum += REAL_MUL(window[0x4], b0[0x4]); ++ sum += REAL_MUL(window[0x6], b0[0x6]); ++ sum += REAL_MUL(window[0x8], b0[0x8]); ++ sum += REAL_MUL(window[0xA], b0[0xA]); ++ sum += REAL_MUL(window[0xC], b0[0xC]); ++ sum += REAL_MUL(window[0xE], b0[0xE]); + WRITE_SAMPLE(samples,sum,clip); + b0-=0x10,window-=0x20,samples+=step; + } +@@ -194,22 +194,22 @@ + for (j=15;j;j--,b0-=0x20,window-=0x10,samples+=step) + { + real sum; +- sum = -*(--window) * *b0++; +- sum -= *(--window) * *b0++; +- sum -= *(--window) * *b0++; +- sum -= *(--window) * *b0++; +- sum -= *(--window) * *b0++; +- sum -= *(--window) * *b0++; +- sum -= *(--window) * *b0++; +- sum -= *(--window) * *b0++; +- sum -= *(--window) * *b0++; +- sum -= *(--window) * *b0++; +- sum -= *(--window) * *b0++; +- sum -= *(--window) * *b0++; +- sum -= *(--window) * *b0++; +- sum -= *(--window) * *b0++; +- sum -= *(--window) * *b0++; +- sum -= *(--window) * *b0++; ++ sum = -REAL_MUL(*(--window), *b0++); ++ sum -= REAL_MUL(*(--window), *b0++); ++ sum -= REAL_MUL(*(--window), *b0++); ++ sum -= REAL_MUL(*(--window), *b0++); ++ sum -= REAL_MUL(*(--window), *b0++); ++ sum -= REAL_MUL(*(--window), *b0++); ++ sum -= REAL_MUL(*(--window), *b0++); ++ sum -= REAL_MUL(*(--window), *b0++); ++ sum -= REAL_MUL(*(--window), *b0++); ++ sum -= REAL_MUL(*(--window), *b0++); ++ sum -= REAL_MUL(*(--window), *b0++); ++ sum -= REAL_MUL(*(--window), *b0++); ++ sum -= REAL_MUL(*(--window), *b0++); ++ sum -= REAL_MUL(*(--window), *b0++); ++ sum -= REAL_MUL(*(--window), *b0++); ++ sum -= REAL_MUL(*(--window), *b0++); + + WRITE_SAMPLE(samples,sum,clip); + } +@@ -219,5 +219,3 @@ + + return clip; + } +- +- diff --git a/audio/mpg123/patches/patch-ah b/audio/mpg123/patches/patch-ah new file mode 100644 index 00000000000..755dc0f59f4 --- /dev/null +++ b/audio/mpg123/patches/patch-ah @@ -0,0 +1,22 @@ +$NetBSD: patch-ah,v 1.3 1999/10/12 04:43:14 simonb Exp $ + +--- equalizer.c.orig Tue Feb 2 03:47:35 1999 ++++ equalizer.c Mon Aug 16 02:08:31 1999 +@@ -13,7 +13,7 @@ + + if(equalfile) { + for(i=0;i<32;i++) +- bandPtr[i] *= equalizer[channel][i]; ++ bandPtr[i] = REAL_MUL(bandPtr[i], equalizer[channel][i]); + } + + /* if(param.equalizer & 0x2) { +@@ -28,7 +28,7 @@ + { + int i; + for(i=0;i<576;i++) { +- bandPtr[i] *= equalizerband[channel][i]; ++ bandPtr[i] = REAL_MUL(bandPtr[i], equalizerband[channel][i]); + } + } + diff --git a/audio/mpg123/patches/patch-ai b/audio/mpg123/patches/patch-ai new file mode 100644 index 00000000000..cd7d6d41f65 --- /dev/null +++ b/audio/mpg123/patches/patch-ai @@ -0,0 +1,780 @@ +$NetBSD: patch-ai,v 1.1 1999/10/12 04:43:14 simonb Exp $ + +--- layer3.c.orig Thu Apr 22 01:25:18 1999 ++++ layer3.c Mon Aug 16 02:02:01 1999 +@@ -109,54 +109,54 @@ + int i,j,k,l; + + for(i=-256;i<118+4;i++) +- gainpow2[i+256] = pow((double)2.0,-0.25 * (double) (i+210) ); ++ gainpow2[i+256] = DOUBLE_TO_REAL(pow((double)2.0,-0.25 * (double) (i+210) )); + + for(i=0;i<8207;i++) +- ispow[i] = pow((double)i,(double)4.0/3.0); ++ ispow[i] = DOUBLE_TO_REAL(pow((double)i,(double)4.0/3.0)); + + for (i=0;i<8;i++) { + static double Ci[8]={-0.6,-0.535,-0.33,-0.185,-0.095,-0.041,-0.0142,-0.0037}; + double sq=sqrt(1.0+Ci[i]*Ci[i]); +- aa_cs[i] = 1.0/sq; +- aa_ca[i] = Ci[i]/sq; ++ aa_cs[i] = DOUBLE_TO_REAL(1.0/sq); ++ aa_ca[i] = DOUBLE_TO_REAL(Ci[i]/sq); + } + + for(i=0;i<18;i++) { +- win[0][i] = win[1][i] = 0.5 * sin( M_PI / 72.0 * (double) (2*(i+0) +1) ) / cos ( M_PI * (double) (2*(i+0) +19) / 72.0 ); +- win[0][i+18] = win[3][i+18] = 0.5 * sin( M_PI / 72.0 * (double) (2*(i+18)+1) ) / cos ( M_PI * (double) (2*(i+18)+19) / 72.0 ); ++ win[0][i] = win[1][i] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 72.0 * (double) (2*(i+0) +1) ) / cos ( M_PI * (double) (2*(i+0) +19) / 72.0 )); ++ win[0][i+18] = win[3][i+18] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 72.0 * (double) (2*(i+18)+1) ) / cos ( M_PI * (double) (2*(i+18)+19) / 72.0 )); + } + for(i=0;i<6;i++) { +- win[1][i+18] = 0.5 / cos ( M_PI * (double) (2*(i+18)+19) / 72.0 ); +- win[3][i+12] = 0.5 / cos ( M_PI * (double) (2*(i+12)+19) / 72.0 ); +- win[1][i+24] = 0.5 * sin( M_PI / 24.0 * (double) (2*i+13) ) / cos ( M_PI * (double) (2*(i+24)+19) / 72.0 ); +- win[1][i+30] = win[3][i] = 0.0; +- win[3][i+6 ] = 0.5 * sin( M_PI / 24.0 * (double) (2*i+1) ) / cos ( M_PI * (double) (2*(i+6 )+19) / 72.0 ); ++ win[1][i+18] = DOUBLE_TO_REAL(0.5 / cos ( M_PI * (double) (2*(i+18)+19) / 72.0 )); ++ win[3][i+12] = DOUBLE_TO_REAL(0.5 / cos ( M_PI * (double) (2*(i+12)+19) / 72.0 )); ++ win[1][i+24] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 24.0 * (double) (2*i+13) ) / cos ( M_PI * (double) (2*(i+24)+19) / 72.0 )); ++ win[1][i+30] = win[3][i] = DOUBLE_TO_REAL(0.0); ++ win[3][i+6 ] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 24.0 * (double) (2*i+1) ) / cos ( M_PI * (double) (2*(i+6 )+19) / 72.0 )); + } + + for(i=0;i<9;i++) +- COS9[i] = cos( M_PI / 18.0 * (double) i); ++ COS9[i] = DOUBLE_TO_REAL(cos( M_PI / 18.0 * (double) i)); + + for(i=0;i<9;i++) +- tfcos36[i] = 0.5 / cos ( M_PI * (double) (i*2+1) / 36.0 ); ++ tfcos36[i] = DOUBLE_TO_REAL(0.5 / cos ( M_PI * (double) (i*2+1) / 36.0 )); + for(i=0;i<3;i++) +- tfcos12[i] = 0.5 / cos ( M_PI * (double) (i*2+1) / 12.0 ); ++ tfcos12[i] = DOUBLE_TO_REAL(0.5 / cos ( M_PI * (double) (i*2+1) / 12.0 )); + +- COS6_1 = cos( M_PI / 6.0 * (double) 1); +- COS6_2 = cos( M_PI / 6.0 * (double) 2); ++ COS6_1 = DOUBLE_TO_REAL(cos( M_PI / 6.0 * (double) 1)); ++ COS6_2 = DOUBLE_TO_REAL(cos( M_PI / 6.0 * (double) 2)); + + #ifdef NEW_DCT9 +- cos9[0] = cos(1.0*M_PI/9.0); +- cos9[1] = cos(5.0*M_PI/9.0); +- cos9[2] = cos(7.0*M_PI/9.0); +- cos18[0] = cos(1.0*M_PI/18.0); +- cos18[1] = cos(11.0*M_PI/18.0); +- cos18[2] = cos(13.0*M_PI/18.0); ++ cos9[0] = DOUBLE_TO_REAL(cos(1.0*M_PI/9.0)); ++ cos9[1] = DOUBLE_TO_REAL(cos(5.0*M_PI/9.0)); ++ cos9[2] = DOUBLE_TO_REAL(cos(7.0*M_PI/9.0)); ++ cos18[0] = DOUBLE_TO_REAL(cos(1.0*M_PI/18.0)); ++ cos18[1] = DOUBLE_TO_REAL(cos(11.0*M_PI/18.0)); ++ cos18[2] = DOUBLE_TO_REAL(cos(13.0*M_PI/18.0)); + #endif + + for(i=0;i<12;i++) { +- win[2][i] = 0.5 * sin( M_PI / 24.0 * (double) (2*i+1) ) / cos ( M_PI * (double) (2*i+7) / 24.0 ); ++ win[2][i] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 24.0 * (double) (2*i+1) ) / cos ( M_PI * (double) (2*i+7) / 24.0 )); + for(j=0;j<6;j++) +- COS1[i][j] = cos( M_PI / 24.0 * (double) ((2*i+7)*(2*j+1)) ); ++ COS1[i][j] = DOUBLE_TO_REAL(cos( M_PI / 24.0 * (double) ((2*i+7)*(2*j+1)) )); + } + + for(j=0;j<4;j++) { +@@ -169,10 +169,10 @@ + + for(i=0;i<16;i++) { + double t = tan( (double) i * M_PI / 12.0 ); +- tan1_1[i] = t / (1.0+t); +- tan2_1[i] = 1.0 / (1.0 + t); +- tan1_2[i] = M_SQRT2 * t / (1.0+t); +- tan2_2[i] = M_SQRT2 / (1.0 + t); ++ tan1_1[i] = DOUBLE_TO_REAL(t / (1.0+t)); ++ tan2_1[i] = DOUBLE_TO_REAL(1.0 / (1.0 + t)); ++ tan1_2[i] = DOUBLE_TO_REAL(M_SQRT2 * t / (1.0+t)); ++ tan2_2[i] = DOUBLE_TO_REAL(M_SQRT2 / (1.0 + t)); + + for(j=0;j<2;j++) { + double base = pow(2.0,-0.25*(j+1.0)); +@@ -183,10 +183,10 @@ + else + p2 = pow(base,i*0.5); + } +- pow1_1[j][i] = p1; +- pow2_1[j][i] = p2; +- pow1_2[j][i] = M_SQRT2 * p1; +- pow2_2[j][i] = M_SQRT2 * p2; ++ pow1_1[j][i] = DOUBLE_TO_REAL(p1); ++ pow2_1[j][i] = DOUBLE_TO_REAL(p2); ++ pow1_2[j][i] = DOUBLE_TO_REAL(M_SQRT2 * p1); ++ pow2_2[j][i] = DOUBLE_TO_REAL(M_SQRT2 * p2); + } + } + +@@ -713,22 +713,22 @@ + num -= h->linbits+1; + mask <<= h->linbits; + if(mask < 0) +- *xrpnt = -ispow[x] * v; ++ *xrpnt = REAL_MUL(-ispow[x], v); + else +- *xrpnt = ispow[x] * v; ++ *xrpnt = REAL_MUL(ispow[x], v); + mask <<= 1; + } + else if(x) { + max[lwin] = cb; + if(mask < 0) +- *xrpnt = -ispow[x] * v; ++ *xrpnt = REAL_MUL(-ispow[x], v); + else +- *xrpnt = ispow[x] * v; ++ *xrpnt = REAL_MUL(ispow[x], v); + num--; + mask <<= 1; + } + else +- *xrpnt = 0.0; ++ *xrpnt = DOUBLE_TO_REAL(0.0); + xrpnt += step; + if(y == 15 && h->linbits) { + max[lwin] = cb; +@@ -737,22 +737,22 @@ + num -= h->linbits+1; + mask <<= h->linbits; + if(mask < 0) +- *xrpnt = -ispow[y] * v; ++ *xrpnt = REAL_MUL(-ispow[y], v); + else +- *xrpnt = ispow[y] * v; ++ *xrpnt = REAL_MUL(ispow[y], v); + mask <<= 1; + } + else if(y) { + max[lwin] = cb; + if(mask < 0) +- *xrpnt = -ispow[y] * v; ++ *xrpnt = REAL_MUL(-ispow[y], v); + else +- *xrpnt = ispow[y] * v; ++ *xrpnt = REAL_MUL(ispow[y], v); + num--; + mask <<= 1; + } + else +- *xrpnt = 0.0; ++ *xrpnt = DOUBLE_TO_REAL(0.0); + xrpnt += step; + } + } +@@ -804,7 +804,7 @@ + mask <<= 1; + } + else +- *xrpnt = 0.0; ++ *xrpnt = DOUBLE_TO_REAL(0.0); + xrpnt += step; + } + } +@@ -812,8 +812,8 @@ + if(lwin < 3) { /* short band? */ + while(1) { + for(;mc > 0;mc--) { +- *xrpnt = 0.0; xrpnt += 3; /* short band -> step=3 */ +- *xrpnt = 0.0; xrpnt += 3; ++ *xrpnt = DOUBLE_TO_REAL(0.0); xrpnt += 3; /* short band -> step=3 */ ++ *xrpnt = DOUBLE_TO_REAL(0.0); xrpnt += 3; + } + if(m >= me) + break; +@@ -887,22 +887,22 @@ + num -= h->linbits+1; + mask <<= h->linbits; + if(mask < 0) +- *xrpnt++ = -ispow[x] * v; ++ *xrpnt++ = REAL_MUL(-ispow[x], v); + else +- *xrpnt++ = ispow[x] * v; ++ *xrpnt++ = REAL_MUL(ispow[x], v); + mask <<= 1; + } + else if(x) { + max = cb; + if(mask < 0) +- *xrpnt++ = -ispow[x] * v; ++ *xrpnt++ = REAL_MUL(-ispow[x], v); + else +- *xrpnt++ = ispow[x] * v; ++ *xrpnt++ = REAL_MUL(ispow[x], v); + num--; + mask <<= 1; + } + else +- *xrpnt++ = 0.0; ++ *xrpnt++ = DOUBLE_TO_REAL(0.0); + + if (y == 15 && h->linbits) { + max = cb; +@@ -911,22 +911,22 @@ + num -= h->linbits+1; + mask <<= h->linbits; + if(mask < 0) +- *xrpnt++ = -ispow[y] * v; ++ *xrpnt++ = REAL_MUL(-ispow[y], v); + else +- *xrpnt++ = ispow[y] * v; ++ *xrpnt++ = REAL_MUL(ispow[y], v); + mask <<= 1; + } + else if(y) { + max = cb; + if(mask < 0) +- *xrpnt++ = -ispow[y] * v; ++ *xrpnt++ = REAL_MUL(-ispow[y], v); + else +- *xrpnt++ = ispow[y] * v; ++ *xrpnt++ = REAL_MUL(ispow[y], v); + num--; + mask <<= 1; + } + else +- *xrpnt++ = 0.0; ++ *xrpnt++ = DOUBLE_TO_REAL(0.0); + } + } + +@@ -974,7 +974,7 @@ + mask <<= 1; + } + else +- *xrpnt++ = 0.0; ++ *xrpnt++ = DOUBLE_TO_REAL(0.0); + } + } + +@@ -987,7 +987,7 @@ + num = 0; + + while(xrpnt < &xr[SBLIMIT][0]) +- *xrpnt++ = 0.0; ++ *xrpnt++ = DOUBLE_TO_REAL(0.0); + + while( part2remain > 16 ) { + getbits(16); /* Dismiss stuffing Bits */ +@@ -1065,8 +1065,8 @@ + t1 = tab1[is_p]; t2 = tab2[is_p]; + for (; sb > 0; sb--,idx+=3) { + real v = xr[0][idx]; +- xr[0][idx] = v * t1; +- xr[1][idx] = v * t2; ++ xr[0][idx] = REAL_MUL(v, t1); ++ xr[1][idx] = REAL_MUL(v, t2); + } + } + } +@@ -1087,8 +1087,8 @@ + t1 = tab1[is_p]; t2 = tab2[is_p]; + for ( ; sb > 0; sb--,idx+=3 ) { + real v = xr[0][idx]; +- xr[0][idx] = v * t1; +- xr[1][idx] = v * t2; ++ xr[0][idx] = REAL_MUL(v, t1); ++ xr[1][idx] = REAL_MUL(v, t2); + } + } + } /* end for(lwin; .. ; . ) */ +@@ -1108,8 +1108,8 @@ + t1 = tab1[is_p]; t2 = tab2[is_p]; + for ( ; sb > 0; sb--,idx++) { + real v = xr[0][idx]; +- xr[0][idx] = v * t1; +- xr[1][idx] = v * t2; ++ xr[0][idx] = REAL_MUL(v, t1); ++ xr[1][idx] = REAL_MUL(v, t2); + } + } + else +@@ -1128,8 +1128,8 @@ + t1 = tab1[is_p]; t2 = tab2[is_p]; + for ( ; sb > 0; sb--,idx++) { + real v = xr[0][idx]; +- xr[0][idx] = v * t1; +- xr[1][idx] = v * t2; ++ xr[0][idx] = REAL_MUL(v, t1); ++ xr[1][idx] = REAL_MUL(v, t2); + } + } + else +@@ -1143,8 +1143,8 @@ + + for ( sb = bi->longDiff[21]; sb > 0; sb--,idx++ ) { + real v = xr[0][idx]; +- xr[0][idx] = v * t1; +- xr[1][idx] = v * t2; ++ xr[0][idx] = REAL_MUL(v, t1); ++ xr[1][idx] = REAL_MUL(v, t2); + } + } + } /* ... */ +@@ -1177,8 +1177,8 @@ + for(ss=7;ss>=0;ss--) + { /* upper and lower butterfly inputs */ + register real bu = *--xr2,bd = *xr1; +- *xr2 = (bu * (*cs) ) - (bd * (*ca) ); +- *xr1++ = (bd * (*cs++) ) + (bu * (*ca++) ); ++ *xr2 = REAL_MUL(bu, *cs) - REAL_MUL(bd, *ca); ++ *xr1++ = REAL_MUL(bd, *cs++) + REAL_MUL(bu, *ca++); + } + } + } +@@ -1252,8 +1252,8 @@ + { + real t0, t1, t2; + +- t0 = COS6_2 * (in[8] + in[16] - in[4]); +- t1 = COS6_2 * in[12]; ++ t0 = REAL_MUL(COS6_2, (in[8] + in[16] - in[4])); ++ t1 = REAL_MUL(COS6_2, in[12]); + + t3 = in[0]; + t2 = t3 - t1 - t1; +@@ -1261,16 +1261,16 @@ + tmp[4] = t2 + t0 + t0; + t3 += t1; + +- t2 = COS6_1 * (in[10] + in[14] - in[2]); ++ t2 = REAL_MUL(COS6_1, (in[10] + in[14] - in[2])); + tmp[1] -= t2; + tmp[7] += t2; + } + { + real t0, t1, t2; + +- t0 = cos9[0] * (in[4] + in[8] ); +- t1 = cos9[1] * (in[8] - in[16]); +- t2 = cos9[2] * (in[4] + in[16]); ++ t0 = REAL_MUL(cos9[0], (in[4] + in[8] )); ++ t1 = REAL_MUL(cos9[1], (in[8] - in[16])); ++ t2 = REAL_MUL(cos9[2], (in[4] + in[16])); + + tmp[2] = tmp[6] = t3 - t0 - t2; + tmp[0] = tmp[8] = t3 + t0 + t1; +@@ -1280,9 +1280,9 @@ + { + real t1, t2, t3; + +- t1 = cos18[0] * (in[2] + in[10]); +- t2 = cos18[1] * (in[10] - in[14]); +- t3 = COS6_1 * in[6]; ++ t1 = REAL_MUL(cos18[0], (in[2] + in[10])); ++ t2 = REAL_MUL(cos18[1], (in[10] - in[14])); ++ t3 = REAL_MUL(COS6_1, in[6]); + + { + real t0 = t1 + t2 + t3; +@@ -1293,7 +1293,7 @@ + t2 -= t3; + t1 -= t3; + +- t3 = cos18[2] * (in[2] + in[14]); ++ t3 = REAL_MUL(cos18[2], (in[2] + in[14])); + + t1 += t3; + tmp[3] += t1; +@@ -1308,35 +1308,35 @@ + { + real t0, t1, t2, t3, t4, t5, t6, t7; + +- t1 = COS6_2 * in[12]; +- t2 = COS6_2 * (in[8] + in[16] - in[4]); ++ t1 = REAL_MUL(COS6_2, in[12]); ++ t2 = REAL_MUL(COS6_2, (in[8] + in[16] - in[4])); + + t3 = in[0] + t1; + t4 = in[0] - t1 - t1; + t5 = t4 - t2; + tmp[4] = t4 + t2 + t2; + +- t0 = cos9[0] * (in[4] + in[8]); +- t1 = cos9[1] * (in[8] - in[16]); ++ t0 = REAL_MUL(cos9[0], (in[4] + in[8])); ++ t1 = REAL_MUL(cos9[1], (in[8] - in[16])); + +- t2 = cos9[2] * (in[4] + in[16]); ++ t2 = REAL_MUL(cos9[2], (in[4] + in[16])); + + t6 = t3 - t0 - t2; + t0 += t3 + t1; + t3 += t2 - t1; + +- t2 = cos18[0] * (in[2] + in[10]); +- t4 = cos18[1] * (in[10] - in[14]); +- t7 = COS6_1 * in[6]; ++ t2 = REAL_MUL(cos18[0], (in[2] + in[10])); ++ t4 = REAL_MUL(cos18[1], (in[10] - in[14])); ++ t7 = REAL_MUL(COS6_1, in[6]); + + t1 = t2 + t4 + t7; + tmp[0] = t0 + t1; + tmp[8] = t0 - t1; +- t1 = cos18[2] * (in[2] + in[14]); ++ t1 = REAL_MUL(cos18[2], (in[2] + in[14])); + t2 += t1 - t7; + + tmp[3] = t3 + t2; +- t0 = COS6_1 * (in[10] + in[14] - in[2]); ++ t0 = REAL_MUL(COS6_1, (in[10] + in[14] - in[2])); + tmp[5] = t3 - t2; + + t4 -= t1 + t7; +@@ -1351,53 +1351,53 @@ + { + real t0, t1, t2, t3, t4, t5, t6, t7; + +- t1 = COS6_2 * in[13]; +- t2 = COS6_2 * (in[9] + in[17] - in[5]); ++ t1 = REAL_MUL(COS6_2, in[13]); ++ t2 = REAL_MUL(COS6_2, (in[9] + in[17] - in[5])); + + t3 = in[1] + t1; + t4 = in[1] - t1 - t1; + t5 = t4 - t2; + +- t0 = cos9[0] * (in[5] + in[9]); +- t1 = cos9[1] * (in[9] - in[17]); ++ t0 = REAL_MUL(cos9[0], (in[5] + in[9])); ++ t1 = REAL_MUL(cos9[1], (in[9] - in[17])); + +- tmp[13] = (t4 + t2 + t2) * tfcos36[17-13]; +- t2 = cos9[2] * (in[5] + in[17]); ++ tmp[13] = REAL_MUL((t4 + t2 + t2), tfcos36[17-13]); ++ t2 = REAL_MUL(cos9[2], (in[5] + in[17])); + + t6 = t3 - t0 - t2; + t0 += t3 + t1; + t3 += t2 - t1; + +- t2 = cos18[0] * (in[3] + in[11]); +- t4 = cos18[1] * (in[11] - in[15]); +- t7 = COS6_1 * in[7]; ++ t2 = REAL_MUL(cos18[0], (in[3] + in[11])); ++ t4 = REAL_MUL(cos18[1], (in[11] - in[15])); ++ t7 = REAL_MUL(COS6_1, in[7]); + + t1 = t2 + t4 + t7; +- tmp[17] = (t0 + t1) * tfcos36[17-17]; +- tmp[9] = (t0 - t1) * tfcos36[17-9]; +- t1 = cos18[2] * (in[3] + in[15]); ++ tmp[17] = REAL_MUL((t0 + t1), tfcos36[17-17]); ++ tmp[9] = REAL_MUL((t0 - t1), tfcos36[17-9]); ++ t1 = REAL_MUL(cos18[2], (in[3] + in[15])); + t2 += t1 - t7; + +- tmp[14] = (t3 + t2) * tfcos36[17-14]; +- t0 = COS6_1 * (in[11] + in[15] - in[3]); +- tmp[12] = (t3 - t2) * tfcos36[17-12]; ++ tmp[14] = REAL_MUL((t3 + t2), tfcos36[17-14]); ++ t0 = REAL_MUL(COS6_1, (in[11] + in[15] - in[3])); ++ tmp[12] = REAL_MUL((t3 - t2), tfcos36[17-12]); + + t4 -= t1 + t7; + +- tmp[16] = (t5 - t0) * tfcos36[17-16]; +- tmp[10] = (t5 + t0) * tfcos36[17-10]; +- tmp[15] = (t6 + t4) * tfcos36[17-15]; +- tmp[11] = (t6 - t4) * tfcos36[17-11]; ++ tmp[16] = REAL_MUL((t5 - t0), tfcos36[17-16]); ++ tmp[10] = REAL_MUL((t5 + t0), tfcos36[17-10]); ++ tmp[15] = REAL_MUL((t6 + t4), tfcos36[17-15]); ++ tmp[11] = REAL_MUL((t6 - t4), tfcos36[17-11]); + } + + #define MACRO(v) { \ + real tmpval; \ + tmpval = tmp[(v)] + tmp[17-(v)]; \ +- out2[9+(v)] = tmpval * w[27+(v)]; \ +- out2[8-(v)] = tmpval * w[26-(v)]; \ ++ out2[9+(v)] = REAL_MUL(tmpval, w[27+(v)]); \ ++ out2[8-(v)] = REAL_MUL(tmpval, w[26-(v)]); \ + tmpval = tmp[(v)] - tmp[17-(v)]; \ +- ts[SBLIMIT*(8-(v))] = out1[8-(v)] + tmpval * w[8-(v)]; \ +- ts[SBLIMIT*(9+(v))] = out1[9+(v)] + tmpval * w[9+(v)]; } ++ ts[SBLIMIT*(8-(v))] = out1[8-(v)] + REAL_MUL(tmpval, w[8-(v)]); \ ++ ts[SBLIMIT*(9+(v))] = out1[9+(v)] + REAL_MUL(tmpval, w[9+(v)]); } + + { + register real *out2 = o2; +@@ -1422,20 +1422,20 @@ + + #define MACRO0(v) { \ + real tmp; \ +- out2[9+(v)] = (tmp = sum0 + sum1) * w[27+(v)]; \ +- out2[8-(v)] = tmp * w[26-(v)]; } \ ++ out2[9+(v)] = REAL_MUL((tmp = sum0 + sum1), w[27+(v)]); \ ++ out2[8-(v)] = REAL_MUL(tmp, w[26-(v)]); } \ + sum0 -= sum1; \ +- ts[SBLIMIT*(8-(v))] = out1[8-(v)] + sum0 * w[8-(v)]; \ +- ts[SBLIMIT*(9+(v))] = out1[9+(v)] + sum0 * w[9+(v)]; ++ ts[SBLIMIT*(8-(v))] = out1[8-(v)] + REAL_MUL(sum0, w[8-(v)]); \ ++ ts[SBLIMIT*(9+(v))] = out1[9+(v)] + REAL_MUL(sum0, w[9+(v)]); + #define MACRO1(v) { \ + real sum0,sum1; \ + sum0 = tmp1a + tmp2a; \ +- sum1 = (tmp1b + tmp2b) * tfcos36[(v)]; \ ++ sum1 = REAL_MUL((tmp1b + tmp2b), tfcos36[(v)]); \ + MACRO0(v); } + #define MACRO2(v) { \ + real sum0,sum1; \ + sum0 = tmp2a - tmp1a; \ +- sum1 = (tmp2b - tmp1b) * tfcos36[(v)]; \ ++ sum1 = REAL_MUL((tmp2b - tmp1b), tfcos36[(v)]); \ + MACRO0(v); } + + register const real *c = COS9; +@@ -1446,17 +1446,17 @@ + + real ta33,ta66,tb33,tb66; + +- ta33 = in[2*3+0] * c[3]; +- ta66 = in[2*6+0] * c[6] + in[2*0+0]; +- tb33 = in[2*3+1] * c[3]; +- tb66 = in[2*6+1] * c[6] + in[2*0+1]; ++ ta33 = REAL_MUL(in[2*3+0], c[3]); ++ ta66 = REAL_MUL(in[2*6+0], c[6]); ++ tb33 = REAL_MUL(in[2*3+1], c[3]); ++ tb66 = REAL_MUL(in[2*6+1], c[6]); + + { + real tmp1a,tmp2a,tmp1b,tmp2b; +- tmp1a = in[2*1+0] * c[1] + ta33 + in[2*5+0] * c[5] + in[2*7+0] * c[7]; +- tmp1b = in[2*1+1] * c[1] + tb33 + in[2*5+1] * c[5] + in[2*7+1] * c[7]; +- tmp2a = in[2*2+0] * c[2] + in[2*4+0] * c[4] + ta66 + in[2*8+0] * c[8]; +- tmp2b = in[2*2+1] * c[2] + in[2*4+1] * c[4] + tb66 + in[2*8+1] * c[8]; ++ tmp1a = REAL_MUL(in[2*1+0], c[1]) + ta33 + REAL_MUL(in[2*5+0], c[5]) + REAL_MUL(in[2*7+0], c[7]); ++ tmp1b = REAL_MUL(in[2*1+1], c[1]) + tb33 + REAL_MUL(in[2*5+1], c[5]) + REAL_MUL(in[2*7+1], c[7]); ++ tmp2a = REAL_MUL(in[2*2+0], c[2]) + REAL_MUL(in[2*4+0], c[4]) + ta66 + REAL_MUL(in[2*8+0], c[8]); ++ tmp2b = REAL_MUL(in[2*2+1], c[2]) + REAL_MUL(in[2*4+1], c[4]) + tb66 + REAL_MUL(in[2*8+1], c[8]); + + MACRO1(0); + MACRO2(8); +@@ -1464,10 +1464,10 @@ + + { + real tmp1a,tmp2a,tmp1b,tmp2b; +- tmp1a = ( in[2*1+0] - in[2*5+0] - in[2*7+0] ) * c[3]; +- tmp1b = ( in[2*1+1] - in[2*5+1] - in[2*7+1] ) * c[3]; +- tmp2a = ( in[2*2+0] - in[2*4+0] - in[2*8+0] ) * c[6] - in[2*6+0] + in[2*0+0]; +- tmp2b = ( in[2*2+1] - in[2*4+1] - in[2*8+1] ) * c[6] - in[2*6+1] + in[2*0+1]; ++ tmp1a = REAL_MUL(( in[2*1+0] - in[2*5+0] - in[2*7+0] ), c[3]); ++ tmp1b = REAL_MUL(( in[2*1+1] - in[2*5+1] - in[2*7+1] ), c[3]); ++ tmp2a = REAL_MUL(( in[2*2+0] - in[2*4+0] - in[2*8+0] ), c[6]) - in[2*6+0] + in[2*0+0]; ++ tmp2b = REAL_MUL(( in[2*2+1] - in[2*4+1] - in[2*8+1] ), c[6]) - in[2*6+1] + in[2*0+1]; + + MACRO1(1); + MACRO2(7); +@@ -1475,10 +1475,10 @@ + + { + real tmp1a,tmp2a,tmp1b,tmp2b; +- tmp1a = in[2*1+0] * c[5] - ta33 - in[2*5+0] * c[7] + in[2*7+0] * c[1]; +- tmp1b = in[2*1+1] * c[5] - tb33 - in[2*5+1] * c[7] + in[2*7+1] * c[1]; +- tmp2a = - in[2*2+0] * c[8] - in[2*4+0] * c[2] + ta66 + in[2*8+0] * c[4]; +- tmp2b = - in[2*2+1] * c[8] - in[2*4+1] * c[2] + tb66 + in[2*8+1] * c[4]; ++ tmp1a = REAL_MUL(in[2*1+0], c[5]) - ta33 - REAL_MUL(in[2*5+0], c[7]) + REAL_MUL(in[2*7+0], c[1]); ++ tmp1b = REAL_MUL(in[2*1+1], c[5]) - tb33 - REAL_MUL(in[2*5+1], c[7]) + REAL_MUL(in[2*7+1], c[1]); ++ tmp2a = - REAL_MUL(in[2*2+0], c[8]) - REAL_MUL(in[2*4+0], c[2]) + ta66 + REAL_MUL(in[2*8+0], c[4]); ++ tmp2b = - REAL_MUL(in[2*2+1], c[8]) - REAL_MUL(in[2*4+1], c[2]) + tb66 + REAL_MUL(in[2*8+1], c[4]); + + MACRO1(2); + MACRO2(6); +@@ -1486,10 +1486,10 @@ + + { + real tmp1a,tmp2a,tmp1b,tmp2b; +- tmp1a = in[2*1+0] * c[7] - ta33 + in[2*5+0] * c[1] - in[2*7+0] * c[5]; +- tmp1b = in[2*1+1] * c[7] - tb33 + in[2*5+1] * c[1] - in[2*7+1] * c[5]; +- tmp2a = - in[2*2+0] * c[4] + in[2*4+0] * c[8] + ta66 - in[2*8+0] * c[2]; +- tmp2b = - in[2*2+1] * c[4] + in[2*4+1] * c[8] + tb66 - in[2*8+1] * c[2]; ++ tmp1a = REAL_MUL(in[2*1+0], c[7]) - ta33 + REAL_MUL(in[2*5+0], c[1]) - REAL_MUL(in[2*7+0], c[5]); ++ tmp1b = REAL_MUL(in[2*1+1], c[7]) - tb33 + REAL_MUL(in[2*5+1], c[1]) - REAL_MUL(in[2*7+1], c[5]); ++ tmp2a = - REAL_MUL(in[2*2+0], c[4]) + REAL_MUL(in[2*4+0], c[8]) + ta66 - REAL_MUL(in[2*8+0], c[2]); ++ tmp2b = - REAL_MUL(in[2*2+1], c[4]) + REAL_MUL(in[2*4+1], c[8]) + tb66 - REAL_MUL(in[2*8+1], c[2]); + + MACRO1(3); + MACRO2(5); +@@ -1498,7 +1498,7 @@ + { + real sum0,sum1; + sum0 = in[2*0+0] - in[2*2+0] + in[2*4+0] - in[2*6+0] + in[2*8+0]; +- sum1 = (in[2*0+1] - in[2*2+1] + in[2*4+1] - in[2*6+1] + in[2*8+1] ) * tfcos36[4]; ++ sum1 = REAL_MUL((in[2*0+1] - in[2*2+1] + in[2*4+1] - in[2*6+1] + in[2*8+1] ), tfcos36[4]); + MACRO0(4); + } + } +@@ -1522,19 +1522,19 @@ + \ + in5 += in3; in3 += in1; \ + \ +- in2 *= COS6_1; \ +- in3 *= COS6_1; \ ++ in2 = REAL_MUL(in2, COS6_1); \ ++ in3 = REAL_MUL(in3, COS6_1); \ + + #define DCT12_PART2 \ +- in0 += in4 * COS6_2; \ ++ in0 += REAL_MUL(in4, COS6_2); \ + \ + in4 = in0 + in2; \ + in0 -= in2; \ + \ +- in1 += in5 * COS6_2; \ ++ in1 += REAL_MUL(in5, COS6_2); \ + \ +- in5 = (in1 + in3) * tfcos12[0]; \ +- in1 = (in1 - in3) * tfcos12[2]; \ ++ in5 = REAL_MUL((in1 + in3), tfcos12[0]); \ ++ in1 = REAL_MUL((in1 - in3), tfcos12[2]); \ + \ + in3 = in4 + in5; \ + in4 -= in5; \ +@@ -1554,27 +1554,27 @@ + { + real tmp0,tmp1 = (in0 - in4); + { +- real tmp2 = (in1 - in5) * tfcos12[1]; ++ real tmp2 = REAL_MUL((in1 - in5), tfcos12[1]); + tmp0 = tmp1 + tmp2; + tmp1 -= tmp2; + } +- ts[(17-1)*SBLIMIT] = out1[17-1] + tmp0 * wi[11-1]; +- ts[(12+1)*SBLIMIT] = out1[12+1] + tmp0 * wi[6+1]; +- ts[(6 +1)*SBLIMIT] = out1[6 +1] + tmp1 * wi[1]; +- ts[(11-1)*SBLIMIT] = out1[11-1] + tmp1 * wi[5-1]; ++ ts[(17-1)*SBLIMIT] = out1[17-1] + REAL_MUL(tmp0, wi[11-1]); ++ ts[(12+1)*SBLIMIT] = out1[12+1] + REAL_MUL(tmp0, wi[6+1]); ++ ts[(6 +1)*SBLIMIT] = out1[6 +1] + REAL_MUL(tmp1, wi[1]); ++ ts[(11-1)*SBLIMIT] = out1[11-1] + REAL_MUL(tmp1, wi[5-1]); + } + + DCT12_PART2 + +- ts[(17-0)*SBLIMIT] = out1[17-0] + in2 * wi[11-0]; +- ts[(12+0)*SBLIMIT] = out1[12+0] + in2 * wi[6+0]; +- ts[(12+2)*SBLIMIT] = out1[12+2] + in3 * wi[6+2]; +- ts[(17-2)*SBLIMIT] = out1[17-2] + in3 * wi[11-2]; +- +- ts[(6+0)*SBLIMIT] = out1[6+0] + in0 * wi[0]; +- ts[(11-0)*SBLIMIT] = out1[11-0] + in0 * wi[5-0]; +- ts[(6+2)*SBLIMIT] = out1[6+2] + in4 * wi[2]; +- ts[(11-2)*SBLIMIT] = out1[11-2] + in4 * wi[5-2]; ++ ts[(17-0)*SBLIMIT] = out1[17-0] + REAL_MUL(in2, wi[11-0]); ++ ts[(12+0)*SBLIMIT] = out1[12+0] + REAL_MUL(in2, wi[6+0]); ++ ts[(12+2)*SBLIMIT] = out1[12+2] + REAL_MUL(in3, wi[6+2]); ++ ts[(17-2)*SBLIMIT] = out1[17-2] + REAL_MUL(in3, wi[11-2]); ++ ++ ts[(6 +0)*SBLIMIT] = out1[6+0] + REAL_MUL(in0, wi[0]); ++ ts[(11-0)*SBLIMIT] = out1[11-0] + REAL_MUL(in0, wi[5-0]); ++ ts[(6 +2)*SBLIMIT] = out1[6+2] + REAL_MUL(in4, wi[2]); ++ ts[(11-2)*SBLIMIT] = out1[11-2] + REAL_MUL(in4, wi[5-2]); + } + + in++; +@@ -1588,27 +1588,27 @@ + { + real tmp0,tmp1 = (in0 - in4); + { +- real tmp2 = (in1 - in5) * tfcos12[1]; ++ real tmp2 = REAL_MUL((in1 - in5), tfcos12[1]); + tmp0 = tmp1 + tmp2; + tmp1 -= tmp2; + } +- out2[5-1] = tmp0 * wi[11-1]; +- out2[0+1] = tmp0 * wi[6+1]; +- ts[(12+1)*SBLIMIT] += tmp1 * wi[1]; +- ts[(17-1)*SBLIMIT] += tmp1 * wi[5-1]; ++ out2[5-1] = REAL_MUL(tmp0, wi[11-1]); ++ out2[0+1] = REAL_MUL(tmp0, wi[6+1]); ++ ts[(12+1)*SBLIMIT] += REAL_MUL(tmp1, wi[1]); ++ ts[(17-1)*SBLIMIT] += REAL_MUL(tmp1, wi[5-1]); + } + + DCT12_PART2 + +- out2[5-0] = in2 * wi[11-0]; +- out2[0+0] = in2 * wi[6+0]; +- out2[0+2] = in3 * wi[6+2]; +- out2[5-2] = in3 * wi[11-2]; +- +- ts[(12+0)*SBLIMIT] += in0 * wi[0]; +- ts[(17-0)*SBLIMIT] += in0 * wi[5-0]; +- ts[(12+2)*SBLIMIT] += in4 * wi[2]; +- ts[(17-2)*SBLIMIT] += in4 * wi[5-2]; ++ out2[5-0] = REAL_MUL(in2, wi[11-0]); ++ out2[0+0] = REAL_MUL(in2, wi[6+0]); ++ out2[0+2] = REAL_MUL(in3, wi[6+2]); ++ out2[5-2] = REAL_MUL(in3, wi[11-2]); ++ ++ ts[(12+0)*SBLIMIT] += REAL_MUL(in0, wi[0]); ++ ts[(17-0)*SBLIMIT] += REAL_MUL(in0, wi[5-0]); ++ ts[(12+2)*SBLIMIT] += REAL_MUL(in4, wi[2]); ++ ts[(17-2)*SBLIMIT] += REAL_MUL(in4, wi[5-2]); + } + + in++; +@@ -1623,27 +1623,27 @@ + { + real tmp0,tmp1 = (in0 - in4); + { +- real tmp2 = (in1 - in5) * tfcos12[1]; ++ real tmp2 = REAL_MUL((in1 - in5), tfcos12[1]); + tmp0 = tmp1 + tmp2; + tmp1 -= tmp2; + } +- out2[11-1] = tmp0 * wi[11-1]; +- out2[6 +1] = tmp0 * wi[6+1]; +- out2[0+1] += tmp1 * wi[1]; +- out2[5-1] += tmp1 * wi[5-1]; ++ out2[11-1] = REAL_MUL(tmp0, wi[11-1]); ++ out2[6 +1] = REAL_MUL(tmp0, wi[6+1]); ++ out2[0+1] += REAL_MUL(tmp1, wi[1]); ++ out2[5-1] += REAL_MUL(tmp1, wi[5-1]); + } + + DCT12_PART2 + +- out2[11-0] = in2 * wi[11-0]; +- out2[6 +0] = in2 * wi[6+0]; +- out2[6 +2] = in3 * wi[6+2]; +- out2[11-2] = in3 * wi[11-2]; +- +- out2[0+0] += in0 * wi[0]; +- out2[5-0] += in0 * wi[5-0]; +- out2[0+2] += in4 * wi[2]; +- out2[5-2] += in4 * wi[5-2]; ++ out2[11-0] = REAL_MUL(in2, wi[11-0]); ++ out2[6 +0] = REAL_MUL(in2, wi[6+0]); ++ out2[6 +2] = REAL_MUL(in3, wi[6+2]); ++ out2[11-2] = REAL_MUL(in3, wi[11-2]); ++ ++ out2[0+0] += REAL_MUL(in0, wi[0]); ++ out2[5-0] += REAL_MUL(in0, wi[5-0]); ++ out2[0+2] += REAL_MUL(in4, wi[2]); ++ out2[5-2] += REAL_MUL(in4, wi[5-2]); + } + } + +@@ -1693,7 +1693,7 @@ + int i; + for(i=0;i> REAL_RADIX) ++# define REAL_MUL(x, y) (((long long)(x) * (long long)(y)) >> REAL_RADIX) ++ + #else + # define real double ++#endif ++ ++#ifndef DOUBLE_TO_REAL ++# define DOUBLE_TO_REAL(x) (x) ++#endif ++#ifndef REAL_TO_SHORT ++# define REAL_TO_SHORT(x) (x) ++#endif ++#ifndef REAL_PLUS_32767 ++# define REAL_PLUS_32767 32767.0 ++#endif ++#ifndef REAL_MINUS_32768 ++# define REAL_MINUS_32768 -32768.0 ++#endif ++#ifndef REAL_MUL ++# define REAL_MUL(x, y) ((x) * (y)) + #endif + + #ifdef __GNUC__ diff --git a/audio/mpg123/patches/patch-ak b/audio/mpg123/patches/patch-ak new file mode 100644 index 00000000000..1442e5fbb80 --- /dev/null +++ b/audio/mpg123/patches/patch-ak @@ -0,0 +1,40 @@ +$NetBSD: patch-ak,v 1.1 1999/10/12 04:43:15 simonb Exp $ + +--- tabinit.c.orig Mon Feb 15 23:55:11 1999 ++++ tabinit.c Thu Aug 12 17:31:33 1999 +@@ -56,7 +56,7 @@ + kr=0x10>>i; divv=0x40>>i; + costab = pnts[i]; + for(k=0;k