30 #define RENAME(n) n##_float
39 #define MACS(rt, ra, rb) rt+=(ra)*(rb)
40 #define MULS(ra, rb) ((ra)*(rb))
41 #define MULH3(x, y, s) ((s)*(y)*(x))
42 #define MLSS(rt, ra, rb) rt-=(ra)*(rb)
43 #define MULLx(x, y, s) ((y)*(x))
44 #define FIXHR(x) ((float)(x))
45 #define FIXR(x) ((float)(x))
46 #define SHR(a,b) ((a)*(1.0f/(1<<(b))))
50 #define RENAME(n) n##_fixed
51 #define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 15)
58 return av_clip_int16(sum1);
61 # define MULS(ra, rb) MUL64(ra, rb)
62 # define MACS(rt, ra, rb) MAC64(rt, ra, rb)
63 # define MLSS(rt, ra, rb) MLS64(rt, ra, rb)
64 # define MULH3(x, y, s) MULH((s)*(x), y)
65 # define MULLx(x, y, s) MULL(x,y,s)
66 # define SHR(a,b) ((a)>>(b))
67 # define FIXR(a) ((int)((a) * FRAC_ONE + 0.5))
68 # define FIXHR(a) ((int)((a) * (1LL<<32) + 0.5))
79 #define SUM8(op, sum, w, p) \
81 op(sum, (w)[0 * 64], (p)[0 * 64]); \
82 op(sum, (w)[1 * 64], (p)[1 * 64]); \
83 op(sum, (w)[2 * 64], (p)[2 * 64]); \
84 op(sum, (w)[3 * 64], (p)[3 * 64]); \
85 op(sum, (w)[4 * 64], (p)[4 * 64]); \
86 op(sum, (w)[5 * 64], (p)[5 * 64]); \
87 op(sum, (w)[6 * 64], (p)[6 * 64]); \
88 op(sum, (w)[7 * 64], (p)[7 * 64]); \
91 #define SUM8P2(sum1, op1, sum2, op2, w1, w2, p) \
95 op1(sum1, (w1)[0 * 64], tmp);\
96 op2(sum2, (w2)[0 * 64], tmp);\
98 op1(sum1, (w1)[1 * 64], tmp);\
99 op2(sum2, (w2)[1 * 64], tmp);\
101 op1(sum1, (w1)[2 * 64], tmp);\
102 op2(sum2, (w2)[2 * 64], tmp);\
104 op1(sum1, (w1)[3 * 64], tmp);\
105 op2(sum2, (w2)[3 * 64], tmp);\
107 op1(sum1, (w1)[4 * 64], tmp);\
108 op2(sum2, (w2)[4 * 64], tmp);\
110 op1(sum1, (w1)[5 * 64], tmp);\
111 op2(sum2, (w2)[5 * 64], tmp);\
113 op1(sum1, (w1)[6 * 64], tmp);\
114 op2(sum2, (w2)[6 * 64], tmp);\
116 op1(sum1, (w1)[7 * 64], tmp);\
117 op2(sum2, (w2)[7 * 64], tmp);\
124 register const MPA_INT *w, *w2, *p;
134 memcpy(synth_buf + 512, synth_buf, 32 *
sizeof(*synth_buf));
136 samples2 = samples + 31 * incr;
153 p = synth_buf + 16 + j;
155 p = synth_buf + 48 - j;
176 int *synth_buf_offset,
177 MPA_INT *window,
int *dither_state,
184 offset = *synth_buf_offset;
185 synth_buf = synth_buf_ptr +
offset;
187 s->RENAME(
dct32)(synth_buf, sb_samples);
190 offset = (offset - 32) & 511;
191 *synth_buf_offset =
offset;
215 for(j=0; j < 16; j++)
216 window[512+16*i+j] = window[64*i+32-j];
219 for(j=0; j < 16; j++)
220 window[512+128+16*i+j] = window[64*i+48-j];
227 for (i = 0; i < 36; i++) {
228 for (j = 0; j < 4; j++) {
231 if (j == 2 && i % 3 != 1)
234 d = sin(
M_PI * (i + 0.5) / 36.0);
237 else if (i >= 24) d = sin(
M_PI * (i - 18 + 0.5) / 12.0);
238 else if (i >= 18) d = 1;
241 else if (i < 12) d = sin(
M_PI * (i - 6 + 0.5) / 12.0);
242 else if (i < 18) d = 1;
258 for (j = 0; j < 4; j++) {
260 RENAME(ff_mdct_win)[j + 4][i ] =
RENAME(ff_mdct_win)[j][i ];
261 RENAME(ff_mdct_win)[j + 4][i + 1] = -
RENAME(ff_mdct_win)[j][i + 1];
266 #define C1 FIXHR(0.98480775301220805936/2)
267 #define C2 FIXHR(0.93969262078590838405/2)
268 #define C3 FIXHR(0.86602540378443864676/2)
269 #define C4 FIXHR(0.76604444311897803520/2)
270 #define C5 FIXHR(0.64278760968653932632/2)
271 #define C6 FIXHR(0.5/2)
272 #define C7 FIXHR(0.34202014332566873304/2)
273 #define C8 FIXHR(0.17364817766693034885/2)
277 FIXR(0.50190991877167369479),
278 FIXR(0.51763809020504152469),
279 FIXR(0.55168895948124587824),
280 FIXR(0.61038729438072803416),
281 FIXR(0.70710678118654752439),
282 FIXR(0.87172339781054900991),
283 FIXR(1.18310079157624925896),
284 FIXR(1.93185165257813657349),
285 FIXR(5.73685662283492756461),
290 FIXHR(0.50190991877167369479/2),
291 FIXHR(0.51763809020504152469/2),
292 FIXHR(0.55168895948124587824/2),
293 FIXHR(0.61038729438072803416/2),
294 FIXHR(0.70710678118654752439/2),
295 FIXHR(0.87172339781054900991/2),
296 FIXHR(1.18310079157624925896/4),
297 FIXHR(1.93185165257813657349/4),
308 for (i = 17; i >= 1; i--)
310 for (i = 17; i >= 3; i -= 2)
313 for (j = 0; j < 2; j++) {
317 t2 = in1[2*4] + in1[2*8] - in1[2*2];
319 t3 = in1[2*0] +
SHR(in1[2*6],1);
320 t1 = in1[2*0] - in1[2*6];
321 tmp1[ 6] = t1 -
SHR(t2,1);
324 t0 =
MULH3(in1[2*2] + in1[2*4] ,
C2, 2);
325 t1 =
MULH3(in1[2*4] - in1[2*8] , -2*
C8, 1);
326 t2 =
MULH3(in1[2*2] + in1[2*8] , -
C4, 2);
328 tmp1[10] = t3 - t0 -
t2;
329 tmp1[ 2] = t3 + t0 +
t1;
330 tmp1[14] = t3 + t2 -
t1;
332 tmp1[ 4] =
MULH3(in1[2*5] + in1[2*7] - in1[2*1], -
C3, 2);
333 t2 =
MULH3(in1[2*1] + in1[2*5],
C1, 2);
334 t3 =
MULH3(in1[2*5] - in1[2*7], -2*
C7, 1);
337 t1 =
MULH3(in1[2*1] + in1[2*7], -
C5, 2);
339 tmp1[ 0] = t2 + t3 +
t0;
340 tmp1[12] = t2 + t1 -
t0;
341 tmp1[ 8] = t3 - t1 -
t0;
345 for (j = 0; j < 4; j++) {
353 s1 =
MULH3(t3 + t2, icos36h[ j], 2);
358 out[(9 + j) *
SBLIMIT] =
MULH3(t1, win[ 9 + j], 1) + buf[4*(9 + j)];
359 out[(8 - j) *
SBLIMIT] =
MULH3(t1, win[ 8 - j], 1) + buf[4*(8 - j)];
365 out[(9 + 8 - j) *
SBLIMIT] =
MULH3(t1, win[ 9 + 8 - j], 1) + buf[4*(9 + 8 - j)];
366 out[ j *
SBLIMIT] =
MULH3(t1, win[ j], 1) + buf[4*( j)];
373 s1 =
MULH3(tmp[17], icos36h[4], 2);
376 out[(9 + 4) *
SBLIMIT] =
MULH3(t1, win[ 9 + 4], 1) + buf[4*(9 + 4)];
377 out[(8 - 4) *
SBLIMIT] =
MULH3(t1, win[ 8 - 4], 1) + buf[4*(8 - 4)];
383 int count,
int switch_point,
int block_type)
386 for (j=0 ; j < count; j++) {
390 int win_idx = (switch_point && j < 2) ? 0 : block_type;
396 buf += ((j&3) != 3 ? 1 : (72-3));