summaryrefslogtreecommitdiff
path: root/libavcodec/ac3enc_fixed.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-02-13 14:49:50 -0500
committerRonald S. Bultje <rsbultje@gmail.com>2011-02-13 16:49:39 -0500
commitfbb6b49dabc3398440c6dfa838aa090a7a6ebc0d (patch)
tree050f0baf5915823f816682340bde83417541854c /libavcodec/ac3enc_fixed.c
parent1a973feb45826a1998b4286ecfe1fa7a602b8780 (diff)
ac3enc: Add x86-optimized function to speed up log2_tab().
AC3DSPContext.ac3_max_msb_abs_int16() finds the maximum MSB of the absolute value of each element in an array of int16_t. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavcodec/ac3enc_fixed.c')
-rw-r--r--libavcodec/ac3enc_fixed.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c
index 0db41dff2d..3de00ee484 100644
--- a/libavcodec/ac3enc_fixed.c
+++ b/libavcodec/ac3enc_fixed.c
@@ -270,14 +270,9 @@ static void apply_window(DSPContext *dsp, int16_t *output, const int16_t *input,
* @param n number of values in the array
* @return log2(max(abs(tab[])))
*/
-static int log2_tab(int16_t *tab, int n)
+static int log2_tab(AC3EncodeContext *s, int16_t *src, int len)
{
- int i, v;
-
- v = 0;
- for (i = 0; i < n; i++)
- v |= abs(tab[i]);
-
+ int v = s->ac3dsp.ac3_max_msb_abs_int16(src, len);
return av_log2(v);
}
@@ -308,7 +303,7 @@ static void lshift_tab(int16_t *tab, int n, unsigned int lshift)
*/
static int normalize_samples(AC3EncodeContext *s)
{
- int v = 14 - log2_tab(s->windowed_samples, AC3_WINDOW_SIZE);
+ int v = 14 - log2_tab(s, s->windowed_samples, AC3_WINDOW_SIZE);
lshift_tab(s->windowed_samples, AC3_WINDOW_SIZE, v);
return v - 9;
}