Commit 9ea583e1 authored by Måns Rullgård's avatar Måns Rullgård

mpegaudio: use MAC/MLS macros in ff_mpa_synth_filter

Originally committed as revision 14199 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent ffa978f1
...@@ -766,6 +766,8 @@ static inline int round_sample(int *sum) ...@@ -766,6 +766,8 @@ static inline int round_sample(int *sum)
/* signed 16x16 -> 32 multiply */ /* signed 16x16 -> 32 multiply */
#define MULS(ra, rb) MUL16(ra, rb) #define MULS(ra, rb) MUL16(ra, rb)
#define MLSS(rt, ra, rb) MLS16(rt, ra, rb)
#else #else
static inline int round_sample(int64_t *sum) static inline int round_sample(int64_t *sum)
...@@ -781,47 +783,49 @@ static inline int round_sample(int64_t *sum) ...@@ -781,47 +783,49 @@ static inline int round_sample(int64_t *sum)
} }
# define MULS(ra, rb) MUL64(ra, rb) # define MULS(ra, rb) MUL64(ra, rb)
# define MACS(rt, ra, rb) MAC64(rt, ra, rb)
# define MLSS(rt, ra, rb) MLS64(rt, ra, rb)
#endif #endif
#define SUM8(sum, op, w, p) \ #define SUM8(op, sum, w, p) \
{ \ { \
sum op MULS((w)[0 * 64], p[0 * 64]);\ op(sum, (w)[0 * 64], p[0 * 64]); \
sum op MULS((w)[1 * 64], p[1 * 64]);\ op(sum, (w)[1 * 64], p[1 * 64]); \
sum op MULS((w)[2 * 64], p[2 * 64]);\ op(sum, (w)[2 * 64], p[2 * 64]); \
sum op MULS((w)[3 * 64], p[3 * 64]);\ op(sum, (w)[3 * 64], p[3 * 64]); \
sum op MULS((w)[4 * 64], p[4 * 64]);\ op(sum, (w)[4 * 64], p[4 * 64]); \
sum op MULS((w)[5 * 64], p[5 * 64]);\ op(sum, (w)[5 * 64], p[5 * 64]); \
sum op MULS((w)[6 * 64], p[6 * 64]);\ op(sum, (w)[6 * 64], p[6 * 64]); \
sum op MULS((w)[7 * 64], p[7 * 64]);\ op(sum, (w)[7 * 64], p[7 * 64]); \
} }
#define SUM8P2(sum1, op1, sum2, op2, w1, w2, p) \ #define SUM8P2(sum1, op1, sum2, op2, w1, w2, p) \
{ \ { \
int tmp;\ int tmp;\
tmp = p[0 * 64];\ tmp = p[0 * 64];\
sum1 op1 MULS((w1)[0 * 64], tmp);\ op1(sum1, (w1)[0 * 64], tmp);\
sum2 op2 MULS((w2)[0 * 64], tmp);\ op2(sum2, (w2)[0 * 64], tmp);\
tmp = p[1 * 64];\ tmp = p[1 * 64];\
sum1 op1 MULS((w1)[1 * 64], tmp);\ op1(sum1, (w1)[1 * 64], tmp);\
sum2 op2 MULS((w2)[1 * 64], tmp);\ op2(sum2, (w2)[1 * 64], tmp);\
tmp = p[2 * 64];\ tmp = p[2 * 64];\
sum1 op1 MULS((w1)[2 * 64], tmp);\ op1(sum1, (w1)[2 * 64], tmp);\
sum2 op2 MULS((w2)[2 * 64], tmp);\ op2(sum2, (w2)[2 * 64], tmp);\
tmp = p[3 * 64];\ tmp = p[3 * 64];\
sum1 op1 MULS((w1)[3 * 64], tmp);\ op1(sum1, (w1)[3 * 64], tmp);\
sum2 op2 MULS((w2)[3 * 64], tmp);\ op2(sum2, (w2)[3 * 64], tmp);\
tmp = p[4 * 64];\ tmp = p[4 * 64];\
sum1 op1 MULS((w1)[4 * 64], tmp);\ op1(sum1, (w1)[4 * 64], tmp);\
sum2 op2 MULS((w2)[4 * 64], tmp);\ op2(sum2, (w2)[4 * 64], tmp);\
tmp = p[5 * 64];\ tmp = p[5 * 64];\
sum1 op1 MULS((w1)[5 * 64], tmp);\ op1(sum1, (w1)[5 * 64], tmp);\
sum2 op2 MULS((w2)[5 * 64], tmp);\ op2(sum2, (w2)[5 * 64], tmp);\
tmp = p[6 * 64];\ tmp = p[6 * 64];\
sum1 op1 MULS((w1)[6 * 64], tmp);\ op1(sum1, (w1)[6 * 64], tmp);\
sum2 op2 MULS((w2)[6 * 64], tmp);\ op2(sum2, (w2)[6 * 64], tmp);\
tmp = p[7 * 64];\ tmp = p[7 * 64];\
sum1 op1 MULS((w1)[7 * 64], tmp);\ op1(sum1, (w1)[7 * 64], tmp);\
sum2 op2 MULS((w2)[7 * 64], tmp);\ op2(sum2, (w2)[7 * 64], tmp);\
} }
void ff_mpa_synth_init(MPA_INT *window) void ff_mpa_synth_init(MPA_INT *window)
...@@ -885,9 +889,9 @@ void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ...@@ -885,9 +889,9 @@ void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
sum = *dither_state; sum = *dither_state;
p = synth_buf + 16; p = synth_buf + 16;
SUM8(sum, +=, w, p); SUM8(MACS, sum, w, p);
p = synth_buf + 48; p = synth_buf + 48;
SUM8(sum, -=, w + 32, p); SUM8(MLSS, sum, w + 32, p);
*samples = round_sample(&sum); *samples = round_sample(&sum);
samples += incr; samples += incr;
w++; w++;
...@@ -897,9 +901,9 @@ void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ...@@ -897,9 +901,9 @@ void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
for(j=1;j<16;j++) { for(j=1;j<16;j++) {
sum2 = 0; sum2 = 0;
p = synth_buf + 16 + j; p = synth_buf + 16 + j;
SUM8P2(sum, +=, sum2, -=, w, w2, p); SUM8P2(sum, MACS, sum2, MLSS, w, w2, p);
p = synth_buf + 48 - j; p = synth_buf + 48 - j;
SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p); SUM8P2(sum, MLSS, sum2, MLSS, w + 32, w2 + 32, p);
*samples = round_sample(&sum); *samples = round_sample(&sum);
samples += incr; samples += incr;
...@@ -911,7 +915,7 @@ void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ...@@ -911,7 +915,7 @@ void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
} }
p = synth_buf + 32; p = synth_buf + 32;
SUM8(sum, -=, w + 32, p); SUM8(MLSS, sum, w + 32, p);
*samples = round_sample(&sum); *samples = round_sample(&sum);
*dither_state= sum; *dither_state= sum;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment