56 #ifndef AVCODEC_MIPS_AACPSY_MIPS_H
57 #define AVCODEC_MIPS_AACPSY_MIPS_H
61 #if HAVE_INLINE_ASM && HAVE_MIPSFPU && ( PSY_LAME_FIR_LEN == 21 )
62 static void calc_thr_3gpp_mips(
const FFPsyWindowInfo *wi,
const int num_bands,
69 for (g = 0; g < num_bands; g++) {
72 float form_factor = 0.0f;
75 for (i = 0; i < band_sizes[
g]; i+=4) {
78 float *cf = (
float *)&coefs[start+i];
81 "lwc1 %[a], 0(%[cf]) \n\t"
82 "lwc1 %[b], 4(%[cf]) \n\t"
83 "lwc1 %[c], 8(%[cf]) \n\t"
84 "lwc1 %[d], 12(%[cf]) \n\t"
85 "abs.s %[a], %[a] \n\t"
86 "abs.s %[b], %[b] \n\t"
87 "abs.s %[c], %[c] \n\t"
88 "abs.s %[d], %[d] \n\t"
89 "sqrt.s %[ax], %[a] \n\t"
90 "sqrt.s %[bx], %[b] \n\t"
91 "sqrt.s %[cx], %[c] \n\t"
92 "sqrt.s %[dx], %[d] \n\t"
93 "madd.s %[e], %[e], %[a], %[a] \n\t"
94 "madd.s %[e], %[e], %[b], %[b] \n\t"
95 "madd.s %[e], %[e], %[c], %[c] \n\t"
96 "madd.s %[e], %[e], %[d], %[d] \n\t"
97 "add.s %[f], %[f], %[ax] \n\t"
98 "add.s %[f], %[f], %[bx] \n\t"
99 "add.s %[f], %[f], %[cx] \n\t"
100 "add.s %[f], %[f], %[dx] \n\t"
102 : [
a]
"=&f"(
a), [b]
"=&f"(b),
103 [
c]
"=&f"(
c), [d]
"=&f"(d),
104 [e]
"+f"(band->
energy), [f]
"+f"(form_factor),
105 [ax]
"=&f"(ax), [bx]
"=&f"(bx),
106 [cx]
"=&f"(cx), [dx]
"=&f"(dx)
112 Temp = sqrtf((
float)band_sizes[g] / band->
energy);
114 band->
nz_lines = form_factor * sqrtf(Temp);
115 start += band_sizes[
g];
120 static void psy_hp_filter_mips(
const float *firbuf,
float *hpfsmpl,
const float *
psy_fir_coeffs)
122 float sum1, sum2, sum3, sum4;
123 float *fb = (
float*)firbuf;
127 float coeff0 = psy_fir_coeffs[1];
128 float coeff1 = psy_fir_coeffs[3];
129 float coeff2 = psy_fir_coeffs[5];
130 float coeff3 = psy_fir_coeffs[7];
131 float coeff4 = psy_fir_coeffs[9];
135 ".set noreorder \n\t"
137 "li.s $f12, 32768 \n\t"
139 "lwc1 $f0, 40(%[fb]) \n\t"
140 "lwc1 $f1, 4(%[fb]) \n\t"
141 "lwc1 $f2, 80(%[fb]) \n\t"
142 "lwc1 $f3, 44(%[fb]) \n\t"
143 "lwc1 $f4, 8(%[fb]) \n\t"
144 "madd.s %[sum1], $f0, $f1, %[coeff0] \n\t"
145 "lwc1 $f5, 84(%[fb]) \n\t"
146 "lwc1 $f6, 48(%[fb]) \n\t"
147 "madd.s %[sum2], $f3, $f4, %[coeff0] \n\t"
148 "lwc1 $f7, 12(%[fb]) \n\t"
149 "madd.s %[sum1], %[sum1], $f2, %[coeff0] \n\t"
150 "lwc1 $f8, 88(%[fb]) \n\t"
151 "lwc1 $f9, 52(%[fb]) \n\t"
152 "madd.s %[sum2], %[sum2], $f5, %[coeff0] \n\t"
153 "madd.s %[sum3], $f6, $f7, %[coeff0] \n\t"
154 "lwc1 $f10, 16(%[fb]) \n\t"
155 "lwc1 $f11, 92(%[fb]) \n\t"
156 "madd.s %[sum1], %[sum1], $f7, %[coeff1] \n\t"
157 "lwc1 $f1, 72(%[fb]) \n\t"
158 "madd.s %[sum3], %[sum3], $f8, %[coeff0] \n\t"
159 "madd.s %[sum4], $f9, $f10, %[coeff0] \n\t"
160 "madd.s %[sum2], %[sum2], $f10, %[coeff1] \n\t"
161 "madd.s %[sum1], %[sum1], $f1, %[coeff1] \n\t"
162 "lwc1 $f4, 76(%[fb]) \n\t"
163 "lwc1 $f8, 20(%[fb]) \n\t"
164 "madd.s %[sum4], %[sum4], $f11, %[coeff0] \n\t"
165 "lwc1 $f11, 24(%[fb]) \n\t"
166 "madd.s %[sum2], %[sum2], $f4, %[coeff1] \n\t"
167 "madd.s %[sum1], %[sum1], $f8, %[coeff2] \n\t"
168 "madd.s %[sum3], %[sum3], $f8, %[coeff1] \n\t"
169 "madd.s %[sum4], %[sum4], $f11, %[coeff1] \n\t"
170 "lwc1 $f7, 64(%[fb]) \n\t"
171 "madd.s %[sum2], %[sum2], $f11, %[coeff2] \n\t"
172 "lwc1 $f10, 68(%[fb]) \n\t"
173 "madd.s %[sum3], %[sum3], $f2, %[coeff1] \n\t"
174 "madd.s %[sum4], %[sum4], $f5, %[coeff1] \n\t"
175 "madd.s %[sum1], %[sum1], $f7, %[coeff2] \n\t"
176 "madd.s %[sum2], %[sum2], $f10, %[coeff2] \n\t"
177 "lwc1 $f2, 28(%[fb]) \n\t"
178 "lwc1 $f5, 32(%[fb]) \n\t"
179 "lwc1 $f8, 56(%[fb]) \n\t"
180 "lwc1 $f11, 60(%[fb]) \n\t"
181 "madd.s %[sum3], %[sum3], $f2, %[coeff2] \n\t"
182 "madd.s %[sum4], %[sum4], $f5, %[coeff2] \n\t"
183 "madd.s %[sum1], %[sum1], $f2, %[coeff3] \n\t"
184 "madd.s %[sum2], %[sum2], $f5, %[coeff3] \n\t"
185 "madd.s %[sum3], %[sum3], $f1, %[coeff2] \n\t"
186 "madd.s %[sum4], %[sum4], $f4, %[coeff2] \n\t"
187 "madd.s %[sum1], %[sum1], $f8, %[coeff3] \n\t"
188 "madd.s %[sum2], %[sum2], $f11, %[coeff3] \n\t"
189 "lwc1 $f1, 36(%[fb]) \n\t"
191 "madd.s %[sum4], %[sum4], $f0, %[coeff3] \n\t"
192 "madd.s %[sum3], %[sum3], $f1, %[coeff3] \n\t"
193 "madd.s %[sum1], %[sum1], $f1, %[coeff4] \n\t"
194 "madd.s %[sum2], %[sum2], $f0, %[coeff4] \n\t"
195 "madd.s %[sum4], %[sum4], $f10, %[coeff3] \n\t"
196 "madd.s %[sum3], %[sum3], $f7, %[coeff3] \n\t"
197 "madd.s %[sum1], %[sum1], $f6, %[coeff4] \n\t"
198 "madd.s %[sum2], %[sum2], $f9, %[coeff4] \n\t"
199 "madd.s %[sum4], %[sum4], $f6, %[coeff4] \n\t"
200 "madd.s %[sum3], %[sum3], $f3, %[coeff4] \n\t"
201 "mul.s %[sum1], %[sum1], $f12 \n\t"
202 "mul.s %[sum2], %[sum2], $f12 \n\t"
203 "madd.s %[sum4], %[sum4], $f11, %[coeff4] \n\t"
204 "madd.s %[sum3], %[sum3], $f8, %[coeff4] \n\t"
205 "swc1 %[sum1], 0(%[hp]) \n\t"
206 "swc1 %[sum2], 4(%[hp]) \n\t"
207 "mul.s %[sum4], %[sum4], $f12 \n\t"
208 "mul.s %[sum3], %[sum3], $f12 \n\t"
209 "swc1 %[sum4], 12(%[hp]) \n\t"
210 "swc1 %[sum3], 8(%[hp]) \n\t"
211 "bne %[fb], %[fb_end], 1b \n\t"
216 : [sum1]
"=&f"(sum1), [sum2]
"=&f"(sum2),
217 [sum3]
"=&f"(sum3), [sum4]
"=&f"(sum4),
218 [fb]
"+r"(fb), [hp]
"+r"(hp)
219 : [coeff0]
"f"(coeff0), [coeff1]
"f"(coeff1),
220 [coeff2]
"f"(coeff2), [coeff3]
"f"(coeff3),
221 [coeff4]
"f"(coeff4), [fb_end]
"r"(fb_end)
222 :
"$f0",
"$f1",
"$f2",
"$f3",
"$f4",
"$f5",
"$f6",
223 "$f7",
"$f8",
"$f9",
"$f10",
"$f11",
"$f12",
228 #define calc_thr_3gpp calc_thr_3gpp_mips
229 #define psy_hp_filter psy_hp_filter_mips
MIPS assembly defines from sys/asm.h but rewritten for use with C inline assembly (rather than from w...
#define AAC_BLOCK_SIZE_LONG
long block size
float thr
energy threshold
float nz_lines
number of non-zero spectral lines
single/pair channel context for psychoacoustic model
static const float psy_fir_coeffs[]
LAME psy model FIR coefficient table.
int num_windows
number of windows in a frame
AacPsyBand band[128]
bands information
windowing related information
information for single band used by 3GPP TS26.403-inspired psychoacoustic model