Mercurial > mplayer.hg
annotate libaf/af_resample_template.c @ 36534:9222b4fbe1c8
mkv: replace a missed "return 0" by "goto err_out".
Fixes a memory leak in this error case.
author | reimar |
---|---|
date | Sun, 19 Jan 2014 11:32:51 +0000 |
parents | 0f1b5b68af32 |
children |
rev | line source |
---|---|
28229
72d0b1444141
Replace informal license notices by standard license header
diego
parents:
28201
diff
changeset
|
1 /* |
72d0b1444141
Replace informal license notices by standard license header
diego
parents:
28201
diff
changeset
|
2 * Copyright (C) 2002 Anders Johansson ajh@atri.curtin.edu.au |
72d0b1444141
Replace informal license notices by standard license header
diego
parents:
28201
diff
changeset
|
3 * |
72d0b1444141
Replace informal license notices by standard license header
diego
parents:
28201
diff
changeset
|
4 * This file is part of MPlayer. |
72d0b1444141
Replace informal license notices by standard license header
diego
parents:
28201
diff
changeset
|
5 * |
72d0b1444141
Replace informal license notices by standard license header
diego
parents:
28201
diff
changeset
|
6 * MPlayer is free software; you can redistribute it and/or modify |
72d0b1444141
Replace informal license notices by standard license header
diego
parents:
28201
diff
changeset
|
7 * it under the terms of the GNU General Public License as published by |
72d0b1444141
Replace informal license notices by standard license header
diego
parents:
28201
diff
changeset
|
8 * the Free Software Foundation; either version 2 of the License, or |
72d0b1444141
Replace informal license notices by standard license header
diego
parents:
28201
diff
changeset
|
9 * (at your option) any later version. |
72d0b1444141
Replace informal license notices by standard license header
diego
parents:
28201
diff
changeset
|
10 * |
72d0b1444141
Replace informal license notices by standard license header
diego
parents:
28201
diff
changeset
|
11 * MPlayer is distributed in the hope that it will be useful, |
72d0b1444141
Replace informal license notices by standard license header
diego
parents:
28201
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
72d0b1444141
Replace informal license notices by standard license header
diego
parents:
28201
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
72d0b1444141
Replace informal license notices by standard license header
diego
parents:
28201
diff
changeset
|
14 * GNU General Public License for more details. |
72d0b1444141
Replace informal license notices by standard license header
diego
parents:
28201
diff
changeset
|
15 * |
72d0b1444141
Replace informal license notices by standard license header
diego
parents:
28201
diff
changeset
|
16 * You should have received a copy of the GNU General Public License along |
72d0b1444141
Replace informal license notices by standard license header
diego
parents:
28201
diff
changeset
|
17 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
72d0b1444141
Replace informal license notices by standard license header
diego
parents:
28201
diff
changeset
|
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
72d0b1444141
Replace informal license notices by standard license header
diego
parents:
28201
diff
changeset
|
19 */ |
28201
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
20 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
21 /* This file contains the resampling engine, the sample format is |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
22 controlled by the FORMAT parameter, the filter length by the L |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
23 parameter and the resampling type by UP and DN. This file should |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28230
diff
changeset
|
24 only be included by af_resample.c |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28230
diff
changeset
|
25 */ |
28201
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
26 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
27 #undef L |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
28 #undef SHIFT |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
29 #undef FORMAT |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
30 #undef FIR |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
31 #undef ADDQUE |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
32 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
33 /* The length Lxx definition selects the length of each poly phase |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
34 component. Valid definitions are L8 and L16 where the number |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
35 defines the nuber of taps. This definition affects the |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
36 computational complexity, the performance and the memory usage. |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
37 */ |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
38 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
39 /* The FORMAT_x parameter selects the sample format type currently |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
40 float and int16 are supported. Thes two formats are selected by |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
41 defining eiter FORMAT_F or FORMAT_I. The advantage of using float |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
42 is that the amplitude and therefore the SNR isn't affected by the |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
43 filtering, the disadvantage is that it is a lot slower. |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
44 */ |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
45 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
46 #if defined(FORMAT_I) |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
47 #define SHIFT >>16 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
48 #define FORMAT int16_t |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28230
diff
changeset
|
49 #else |
28201
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
50 #define SHIFT |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
51 #define FORMAT float |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
52 #endif |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
53 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
54 // Short filter |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28230
diff
changeset
|
55 #if defined(L8) |
28201
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
56 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
57 #define L 8 // Filter length |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28230
diff
changeset
|
58 // Unrolled loop to speed up execution |
28201
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
59 #define FIR(x,w,y) \ |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
60 (y[0]) = ( w[0]*x[0]+w[1]*x[1]+w[2]*x[2]+w[3]*x[3] \ |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
61 + w[4]*x[4]+w[5]*x[5]+w[6]*x[6]+w[7]*x[7] ) SHIFT |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
62 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
63 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
64 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
65 #else /* L8/L16 */ |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
66 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
67 #define L 16 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28230
diff
changeset
|
68 // Unrolled loop to speed up execution |
28201
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
69 #define FIR(x,w,y) \ |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
70 y[0] = ( w[0] *x[0] +w[1] *x[1] +w[2] *x[2] +w[3] *x[3] \ |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
71 + w[4] *x[4] +w[5] *x[5] +w[6] *x[6] +w[7] *x[7] \ |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
72 + w[8] *x[8] +w[9] *x[9] +w[10]*x[10]+w[11]*x[11] \ |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
73 + w[12]*x[12]+w[13]*x[13]+w[14]*x[14]+w[15]*x[15] ) SHIFT |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
74 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
75 #endif /* L8/L16 */ |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
76 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28230
diff
changeset
|
77 // Macro to add data to circular que |
28201
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
78 #define ADDQUE(xi,xq,in)\ |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
79 xq[xi]=xq[(xi)+L]=*(in);\ |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
80 xi=((xi)-1)&(L-1); |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
81 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
82 #if defined(UP) |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
83 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
84 uint32_t ci = l->nch; // Index for channels |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
85 uint32_t nch = l->nch; // Number of channels |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28230
diff
changeset
|
86 uint32_t inc = s->up/s->dn; |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28230
diff
changeset
|
87 uint32_t level = s->up%s->dn; |
28201
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
88 uint32_t up = s->up; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
89 uint32_t dn = s->dn; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
90 uint32_t ns = c->len/l->bps; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
91 register FORMAT* w = s->w; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
92 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
93 register uint32_t wi = 0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28230
diff
changeset
|
94 register uint32_t xi = 0; |
28201
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
95 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
96 // Index current channel |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
97 while(ci--){ |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
98 // Temporary pointers |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
99 register FORMAT* x = s->xq[ci]; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
100 register FORMAT* in = ((FORMAT*)c->audio)+ci; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
101 register FORMAT* out = ((FORMAT*)l->audio)+ci; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
102 FORMAT* end = in+ns; // Block loop end |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
103 wi = s->wi; xi = s->xi; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
104 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
105 while(in < end){ |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
106 register uint32_t i = inc; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
107 if(wi<level) i++; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
108 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
109 ADDQUE(xi,x,in); |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
110 in+=nch; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
111 while(i--){ |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
112 // Run the FIR filter |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
113 FIR((&x[xi]),(&w[wi*L]),out); |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
114 len++; out+=nch; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
115 // Update wi to point at the correct polyphase component |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
116 wi=(wi+dn)%up; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
117 } |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
118 } |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
119 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
120 } |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
121 // Save values that needs to be kept for next time |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
122 s->wi = wi; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
123 s->xi = xi; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
124 #endif /* UP */ |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
125 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
126 #if defined(DN) /* DN */ |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
127 uint32_t ci = l->nch; // Index for channels |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
128 uint32_t nch = l->nch; // Number of channels |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28230
diff
changeset
|
129 uint32_t inc = s->dn/s->up; |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28230
diff
changeset
|
130 uint32_t level = s->dn%s->up; |
28201
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
131 uint32_t up = s->up; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
132 uint32_t dn = s->dn; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
133 uint32_t ns = c->len/l->bps; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
134 FORMAT* w = s->w; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
135 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
136 register int32_t i = 0; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
137 register uint32_t wi = 0; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
138 register uint32_t xi = 0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28230
diff
changeset
|
139 |
28201
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
140 // Index current channel |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
141 while(ci--){ |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
142 // Temporary pointers |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
143 register FORMAT* x = s->xq[ci]; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
144 register FORMAT* in = ((FORMAT*)c->audio)+ci; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
145 register FORMAT* out = ((FORMAT*)l->audio)+ci; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
146 register FORMAT* end = in+ns; // Block loop end |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
147 i = s->i; wi = s->wi; xi = s->xi; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
148 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
149 while(in < end){ |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
150 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
151 ADDQUE(xi,x,in); |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
152 in+=nch; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
153 if((--i)<=0){ |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
154 // Run the FIR filter |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
155 FIR((&x[xi]),(&w[wi*L]),out); |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
156 len++; out+=nch; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
157 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
158 // Update wi to point at the correct polyphase component |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28230
diff
changeset
|
159 wi=(wi+dn)%up; |
28201
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
160 |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
161 // Insert i number of new samples in queue |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
162 i = inc; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
163 if(wi<level) i++; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
164 } |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
165 } |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
166 } |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
167 // Save values that needs to be kept for next time |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
168 s->wi = wi; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
169 s->xi = xi; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
170 s->i = i; |
4ff973912251
Rename libaf/af_resample.h to libaf/af_resample_template.c, it is used as
diego
parents:
diff
changeset
|
171 #endif /* DN */ |