[FFmpeg-cvslog] r21214 - trunk/libavcodec/ac3.c

reimar subversion
Thu Jan 14 18:50:33 CET 2010


Author: reimar
Date: Thu Jan 14 18:50:33 2010
New Revision: 21214

Log:
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.

Modified:
   trunk/libavcodec/ac3.c

Modified: trunk/libavcodec/ac3.c
==============================================================================
--- trunk/libavcodec/ac3.c	Thu Jan 14 15:02:06 2010	(r21213)
+++ trunk/libavcodec/ac3.c	Thu Jan 14 18:50:33 2010	(r21214)
@@ -112,9 +112,10 @@ void ff_ac3_bit_alloc_calc_psd(int8_t *e
         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]);



More information about the ffmpeg-cvslog mailing list