changeset 10879:7d46c481d045 libavcodec

Change code so it uses 2 adds instead of one FFABS. About 1% faster ff_ac3_bit_alloc_calc_psd on Intel Atom, overall speedup not measurable though. Should have a bigger effect on systems without cmov or with very slow cmov.
author reimar
date Thu, 14 Jan 2010 17:50:33 +0000
parents a8620b001ed3
children 1184d065c26a
files ac3.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ac3.c	Thu Jan 14 01:32:49 2010 +0000
+++ b/ac3.c	Thu Jan 14 17:50:33 2010 +0000
@@ -112,9 +112,10 @@
         int v = psd[bin++];
         int band_end = FFMIN(band_start_tab[band+1], end);
         for (; bin < band_end; bin++) {
+            int max = FFMAX(v, psd[bin]);
             /* logadd */
-            int adr = FFMIN(FFABS(v - psd[bin]) >> 1, 255);
-            v = FFMAX(v, psd[bin]) + ff_ac3_log_add_tab[adr];
+            int adr = FFMIN(max - ((v + psd[bin] + 1) >> 1), 255);
+            v = max + ff_ac3_log_add_tab[adr];
         }
         band_psd[band++] = v;
     } while (end > band_start_tab[band]);