annotate Plugins/Input/mpg123/layer1.c @ 479:0b9507985f0d trunk

[svn] Use the VFS subsystem and delete the unused demo source.
author chainsaw
date Sat, 21 Jan 2006 06:32:50 -0800
parents 05d824e30afd
children 0f294f2b0a9b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
127
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
1 /*
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
2 * Mpeg Layer-1 audio decoder
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
3 * --------------------------
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
4 * copyright (c) 1995 by Michael Hipp, All rights reserved. See also 'README'
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
5 * near unoptimzed ...
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
6 *
127
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
7 * may have a few bugs after last optimization ...
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
8 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
9 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
10
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
11 #include "audacious/output.h"
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
12 #include "mpg123.h"
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
13 #include "getbits.h"
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
14
127
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
15 void I_step_one(unsigned int balloc[], unsigned int scale_index[2][SBLIMIT],struct frame *fr)
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
16 {
127
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
17 unsigned int *ba=balloc;
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
18 unsigned int *sca = (unsigned int *) scale_index;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
19
127
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
20 if(fr->stereo) {
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
21 int i;
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
22 int jsbound = fr->jsbound;
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
23 for (i=0;i<jsbound;i++) {
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
24 *ba++ = mpg123_getbits(&bsi,4);
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
25 *ba++ = mpg123_getbits(&bsi,4);
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
26 }
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
27 for (i=jsbound;i<SBLIMIT;i++)
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
28 *ba++ = mpg123_getbits(&bsi,4);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
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 ba = balloc;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
31
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 for (i=0;i<jsbound;i++) {
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
33 if ((*ba++))
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
34 *sca++ = mpg123_getbits(&bsi,6);
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
35 if ((*ba++))
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
36 *sca++ = mpg123_getbits(&bsi,6);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
37 }
127
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
38 for (i=jsbound;i<SBLIMIT;i++)
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
39 if ((*ba++)) {
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
40 *sca++ = mpg123_getbits(&bsi,6);
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
41 *sca++ = mpg123_getbits(&bsi,6);
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
42 }
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
43 }
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
44 else {
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 i;
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
46 for (i=0;i<SBLIMIT;i++)
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
47 *ba++ = mpg123_getbits(&bsi,4);
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
48 ba = balloc;
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
49 for (i=0;i<SBLIMIT;i++)
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
50 if ((*ba++))
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
51 *sca++ = mpg123_getbits(&bsi,6);
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
52 }
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
53 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
54
127
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
55 void I_step_two(real fraction[2][SBLIMIT],unsigned int balloc[2*SBLIMIT],
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
56 unsigned int scale_index[2][SBLIMIT],struct frame *fr)
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
57 {
127
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
58 int i,n;
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
59 int smpb[2*SBLIMIT]; /* values: 0-65535 */
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
60 int *sample;
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
61 register unsigned int *ba;
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
62 register unsigned int *sca = (unsigned int *) scale_index;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
63
127
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
64 if(fr->stereo) {
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
65 int jsbound = fr->jsbound;
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
66 register real *f0 = fraction[0];
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
67 register real *f1 = fraction[1];
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
68 ba = balloc;
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 (sample=smpb,i=0;i<jsbound;i++) {
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
70 if ((n = *ba++))
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
71 *sample++ = mpg123_getbits(&bsi,n+1);
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
72 if ((n = *ba++))
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
73 *sample++ = mpg123_getbits(&bsi,n+1);
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
74 }
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
75 for (i=jsbound;i<SBLIMIT;i++)
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
76 if ((n = *ba++))
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
77 *sample++ = mpg123_getbits(&bsi,n+1);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
78
127
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
79 ba = balloc;
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
80 for (sample=smpb,i=0;i<jsbound;i++) {
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
81 if((n=*ba++))
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
82 *f0++ = (real) ( ((-1)<<n) + (*sample++) + 1) * mpg123_muls[n+1][*sca++];
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
83 else
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
84 *f0++ = 0.0;
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
85 if((n=*ba++))
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
86 *f1++ = (real) ( ((-1)<<n) + (*sample++) + 1) * mpg123_muls[n+1][*sca++];
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
87 else
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
88 *f1++ = 0.0;
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
89 }
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
90 for (i=jsbound;i<SBLIMIT;i++) {
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
91 if ((n=*ba++)) {
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
92 real samp = ( ((-1)<<n) + (*sample++) + 1);
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
93 *f0++ = samp * mpg123_muls[n+1][*sca++];
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
94 *f1++ = samp * mpg123_muls[n+1][*sca++];
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
95 }
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
96 else
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
97 *f0++ = *f1++ = 0.0;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
98 }
127
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
99 for(i=fr->down_sample_sblimit;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
100 fraction[0][i] = fraction[1][i] = 0.0;
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
101 }
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
102 else {
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
103 register real *f0 = fraction[0];
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
104 ba = balloc;
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
105 for (sample=smpb,i=0;i<SBLIMIT;i++)
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
106 if ((n = *ba++))
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
107 *sample++ = mpg123_getbits(&bsi,n+1);
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
108 ba = balloc;
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
109 for (sample=smpb,i=0;i<SBLIMIT;i++) {
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
110 if((n=*ba++))
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
111 *f0++ = (real) ( ((-1)<<n) + (*sample++) + 1) * mpg123_muls[n+1][*sca++];
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
112 else
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
113 *f0++ = 0.0;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
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 for(i=fr->down_sample_sblimit;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
116 fraction[0][i] = 0.0;
05d824e30afd [svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents: 61
diff changeset
117 }
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
118 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
119
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
120 int
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
121 mpg123_do_layer1(struct frame *fr)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
122 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
123 int i, stereo = fr->stereo;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
124 unsigned int balloc[2 * SBLIMIT];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
125 unsigned int scale_index[2][SBLIMIT];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
126 real fraction[2][SBLIMIT];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
127 int single = fr->single;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
128
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
129 fr->jsbound =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
130 (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext << 2) + 4 : 32;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
131
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
132 if (stereo == 1 || single == 3)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
133 single = 0;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
134
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
135 I_step_one(balloc, scale_index, fr);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
136
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
137 for (i = 0; i < SCALE_BLOCK; i++) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
138 I_step_two(fraction, balloc, scale_index, fr);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
139
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
140 if (single >= 0) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
141 (fr->synth_mono) ((real *) fraction[single], mpg123_pcm_sample,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
142 &mpg123_pcm_point);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
143 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
144 else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
145 int p1 = mpg123_pcm_point;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
146
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
147 (fr->synth) ((real *) fraction[0], 0, mpg123_pcm_sample, &p1);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
148 (fr->synth) ((real *) fraction[1], 1, mpg123_pcm_sample,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
149 &mpg123_pcm_point);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
150 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
151 if (mpg123_info->output_audio && mpg123_info->jump_to_time == -1) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
152 produce_audio(mpg123_ip.output->written_time(),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
153 mpg123_cfg.resolution ==
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
154 16 ? FMT_S16_NE : FMT_U8,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
155 mpg123_cfg.channels ==
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
156 2 ? fr->stereo : 1, mpg123_pcm_point,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
157 mpg123_pcm_sample, &mpg123_info->going);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
158 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
159
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
160 mpg123_pcm_point = 0;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
161 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
162
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
163 return 1;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
164 }