[FFmpeg-devel] [PATCH] mpegaudio: simplify failed optimisation attempt

Mans Rullgard mans
Tue May 5 19:18:44 CEST 2009


Total speedup 50% on PPC G4, 13% on ARM.
---
 libavcodec/mpegaudiodec.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index a2158bc..00504c7 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -852,9 +852,9 @@ void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
     OUT_INT *samples2;
 #if FRAC_BITS <= 15
     int32_t tmp[32];
-    int sum, sum2;
+    int sum;
 #else
-    int64_t sum, sum2;
+    int64_t sum;
 #endif
 
     offset = *synth_buf_offset;
@@ -887,18 +887,13 @@ void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
     samples += incr;
     w++;
 
-    /* we calculate two samples at the same time to avoid one memory
-       access per two sample */
     for(j=1;j<16;j++) {
-        sum2 = 0;
-        p = synth_buf + 16 + j;
-        SUM8P2(sum, MACS, sum2, MLSS, w, w2, p);
-        p = synth_buf + 48 - j;
-        SUM8P2(sum, MLSS, sum2, MLSS, w + 32, w2 + 32, p);
-
+        SUM8(MACS, sum, w,      synth_buf + 16 + j);
+        SUM8(MLSS, sum, w + 32, synth_buf + 48 - j);
         *samples = round_sample(&sum);
         samples += incr;
-        sum += sum2;
+        SUM8(MLSS, sum, w2,      synth_buf + 16 + j);
+        SUM8(MLSS, sum, w2 + 32, synth_buf + 48 - j);
         *samples2 = round_sample(&sum);
         samples2 -= incr;
         w++;
-- 
1.6.2.3




More information about the ffmpeg-devel mailing list