Mercurial > audlegacy
annotate Plugins/Input/mpg123/decode.c @ 1113:f7563194112d trunk
[svn] - further tuning optimisations
author | nenolod |
---|---|
date | Tue, 30 May 2006 22:09:36 -0700 |
parents | b5ae09a6c2f1 |
children |
rev | line source |
---|---|
61 | 1 /* |
2 * Mpeg Layer-1,2,3 audio decoder | |
3 * ------------------------------ | |
4 * copyright (c) 1995,1996,1997 by Michael Hipp, All rights reserved. | |
5 * See also 'README' | |
6 * | |
7 */ | |
8 | |
9 #include <stdlib.h> | |
10 #include <math.h> | |
11 #include <string.h> | |
12 | |
13 #include "mpg123.h" | |
14 | |
15 #define WRITE_SAMPLE(samples,sum,clip) \ | |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
16 if( (sum) > REAL_PLUS_32767) { *(samples) = 0x7fff; (clip)++; } \ |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
17 else if( (sum) < REAL_MINUS_32768) { *(samples) = -0x8000; (clip)++; } \ |
151 | 18 else { *(samples) = sum; } |
61 | 19 |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
970
diff
changeset
|
20 int mpgdec_synth_1to1_8bit(mpgdec_real *bandPtr,int channel,unsigned char *samples,int *pnt) |
61 | 21 { |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
22 short samples_tmp[64]; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
23 short *tmp1 = samples_tmp + channel; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
24 int i,ret; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
25 int pnt1=0; |
61 | 26 |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
970
diff
changeset
|
27 ret = mpgdec_synth_1to1(bandPtr,channel,(unsigned char *) samples_tmp,&pnt1); |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
28 samples += channel + *pnt; |
61 | 29 |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
30 for(i=0;i<32;i++) { |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
970
diff
changeset
|
31 *samples = mpgdec_conv16to8[*tmp1>>AUSHIFT]; |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
32 samples += 2; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
33 tmp1 += 2; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
34 } |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
35 *pnt += 64; |
61 | 36 |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
37 return ret; |
61 | 38 } |
39 | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
970
diff
changeset
|
40 int mpgdec_synth_1to1_8bit_mono(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) |
61 | 41 { |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
42 short samples_tmp[64]; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
43 short *tmp1 = samples_tmp; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
44 int i,ret; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
45 int pnt1 = 0; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
46 |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
970
diff
changeset
|
47 ret = mpgdec_synth_1to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
48 samples += *pnt; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
49 |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
50 for(i=0;i<32;i++) { |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
970
diff
changeset
|
51 *samples++ = mpgdec_conv16to8[*tmp1>>AUSHIFT]; |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
52 tmp1 += 2; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
53 } |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
54 *pnt += 32; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
55 |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
56 return ret; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
57 } |
61 | 58 |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
970
diff
changeset
|
59 int mpgdec_synth_1to1_8bit_mono2stereo(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
60 { |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
61 short samples_tmp[64]; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
62 short *tmp1 = samples_tmp; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
63 int i,ret; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
64 int pnt1 = 0; |
61 | 65 |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
970
diff
changeset
|
66 ret = mpgdec_synth_1to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
67 samples += *pnt; |
61 | 68 |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
69 for(i=0;i<32;i++) { |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
970
diff
changeset
|
70 *samples++ = mpgdec_conv16to8[*tmp1>>AUSHIFT]; |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
970
diff
changeset
|
71 *samples++ = mpgdec_conv16to8[*tmp1>>AUSHIFT]; |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
72 tmp1 += 2; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
73 } |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
74 *pnt += 64; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
75 |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
76 return ret; |
61 | 77 } |
78 | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
970
diff
changeset
|
79 int mpgdec_synth_1to1_mono(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) |
61 | 80 { |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
81 short samples_tmp[64]; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
82 short *tmp1 = samples_tmp; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
83 int i,ret; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
84 int pnt1 = 0; |
61 | 85 |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
970
diff
changeset
|
86 ret = mpgdec_synth_1to1(bandPtr,0,(unsigned char *) samples_tmp,&pnt1); |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
87 samples += *pnt; |
61 | 88 |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
89 for(i=0;i<32;i++) { |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
90 *( (short *)samples) = *tmp1; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
91 samples += 2; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
92 tmp1 += 2; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
93 } |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
94 *pnt += 64; |
61 | 95 |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
96 return ret; |
61 | 97 } |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
98 |
61 | 99 |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
970
diff
changeset
|
100 int mpgdec_synth_1to1_mono2stereo(mpgdec_real *bandPtr,unsigned char *samples,int *pnt) |
61 | 101 { |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
102 int i,ret; |
61 | 103 |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
970
diff
changeset
|
104 ret = mpgdec_synth_1to1(bandPtr,0,samples,pnt); |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
105 samples = samples + *pnt - 128; |
61 | 106 |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
107 for(i=0;i<32;i++) { |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
108 ((short *)samples)[1] = ((short *)samples)[0]; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
109 samples+=4; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
110 } |
61 | 111 |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
112 return ret; |
61 | 113 } |
114 | |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
115 |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
970
diff
changeset
|
116 int mpgdec_synth_1to1(mpgdec_real *bandPtr,int channel,unsigned char *out,int *pnt) |
61 | 117 { |
970
0f294f2b0a9b
[svn] - integer-mode decoding accuracy improvements
nenolod
parents:
151
diff
changeset
|
118 static mpgdec_real buffs[2][2][0x110]; |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
119 static const int step = 2; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
120 static int bo = 1; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
121 short *samples = (short *) (out+*pnt); |
61 | 122 |
970
0f294f2b0a9b
[svn] - integer-mode decoding accuracy improvements
nenolod
parents:
151
diff
changeset
|
123 mpgdec_real *b0,(*buf)[0x110]; |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
124 int clip = 0; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
125 int bo1; |
61 | 126 |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
127 if(!channel) { |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
128 bo--; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
129 bo &= 0xf; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
130 buf = buffs[0]; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
131 } |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
132 else { |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
133 samples++; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
134 buf = buffs[1]; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
135 } |
61 | 136 |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
137 if(bo & 0x1) { |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
138 b0 = buf[0]; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
139 bo1 = bo; |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
970
diff
changeset
|
140 mpgdec_dct64(buf[1]+((bo+1)&0xf),buf[0]+bo,bandPtr); |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
141 } |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
142 else { |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
143 b0 = buf[1]; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
144 bo1 = bo+1; |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
970
diff
changeset
|
145 mpgdec_dct64(buf[0]+bo,buf[1]+bo+1,bandPtr); |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
146 } |
61 | 147 |
148 | |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
149 { |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
150 register int j; |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
970
diff
changeset
|
151 mpgdec_real *window = mpgdec_decwin + 16 - bo1; |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
152 |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
153 for (j=16;j;j--,window+=0x10,samples+=step) |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
154 { |
970
0f294f2b0a9b
[svn] - integer-mode decoding accuracy improvements
nenolod
parents:
151
diff
changeset
|
155 mpgdec_real sum; |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
156 sum = REAL_MUL(*window++, *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
157 sum -= REAL_MUL(*window++, *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
158 sum += REAL_MUL(*window++, *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
159 sum -= REAL_MUL(*window++, *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
160 sum += REAL_MUL(*window++, *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
161 sum -= REAL_MUL(*window++, *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
162 sum += REAL_MUL(*window++, *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
163 sum -= REAL_MUL(*window++, *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
164 sum += REAL_MUL(*window++, *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
165 sum -= REAL_MUL(*window++, *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
166 sum += REAL_MUL(*window++, *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
167 sum -= REAL_MUL(*window++, *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
168 sum += REAL_MUL(*window++, *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
169 sum -= REAL_MUL(*window++, *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
170 sum += REAL_MUL(*window++, *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
171 sum -= REAL_MUL(*window++, *b0++); |
61 | 172 |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
173 WRITE_SAMPLE(samples,sum,clip); |
61 | 174 } |
175 | |
176 { | |
970
0f294f2b0a9b
[svn] - integer-mode decoding accuracy improvements
nenolod
parents:
151
diff
changeset
|
177 mpgdec_real sum; |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
178 sum = REAL_MUL(window[0x0], b0[0x0]); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
179 sum += REAL_MUL(window[0x2], b0[0x2]); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
180 sum += REAL_MUL(window[0x4], b0[0x4]); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
181 sum += REAL_MUL(window[0x6], b0[0x6]); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
182 sum += REAL_MUL(window[0x8], b0[0x8]); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
183 sum += REAL_MUL(window[0xA], b0[0xA]); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
184 sum += REAL_MUL(window[0xC], b0[0xC]); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
185 sum += REAL_MUL(window[0xE], b0[0xE]); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
186 WRITE_SAMPLE(samples,sum,clip); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
187 b0-=0x10,window-=0x20,samples+=step; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
188 } |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
189 window += bo1<<1; |
61 | 190 |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
191 for (j=15;j;j--,b0-=0x20,window-=0x10,samples+=step) |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
192 { |
970
0f294f2b0a9b
[svn] - integer-mode decoding accuracy improvements
nenolod
parents:
151
diff
changeset
|
193 mpgdec_real sum; |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
194 sum = -REAL_MUL(*(--window), *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
195 sum -= REAL_MUL(*(--window), *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
196 sum -= REAL_MUL(*(--window), *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
197 sum -= REAL_MUL(*(--window), *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
198 sum -= REAL_MUL(*(--window), *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
199 sum -= REAL_MUL(*(--window), *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
200 sum -= REAL_MUL(*(--window), *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
201 sum -= REAL_MUL(*(--window), *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
202 sum -= REAL_MUL(*(--window), *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
203 sum -= REAL_MUL(*(--window), *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
204 sum -= REAL_MUL(*(--window), *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
205 sum -= REAL_MUL(*(--window), *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
206 sum -= REAL_MUL(*(--window), *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
207 sum -= REAL_MUL(*(--window), *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
208 sum -= REAL_MUL(*(--window), *b0++); |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
209 sum -= REAL_MUL(*(--window), *b0++); |
61 | 210 |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
211 WRITE_SAMPLE(samples,sum,clip); |
61 | 212 } |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
213 } |
61 | 214 |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
215 *pnt += 128; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
216 |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
217 return clip; |
61 | 218 } |