pkgsrc/audio/mpg123/patches/patch-ag
simonb b55ba7a0d1 Add fixed-point support used by the arm32.
XXX: Uses strongarm C-compiler options to use 32x32=64 int multiply.
1999-10-12 04:43:11 +00:00

123 lines
4.1 KiB
Text

$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;
}
-
-