summaryrefslogtreecommitdiff
path: root/libavcodec/ac3dsp.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/ac3dsp.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/ac3dsp.c')
-rw-r--r--libavcodec/ac3dsp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c
index f688e6a72b..da3a123e9b 100644
--- a/libavcodec/ac3dsp.c
+++ b/libavcodec/ac3dsp.c
@@ -42,9 +42,18 @@ static void ac3_exponent_min_c(uint8_t *exp, int num_reuse_blocks, int nb_coefs)
}
}
+static int ac3_max_msb_abs_int16_c(const int16_t *src, int len)
+{
+ int i, v = 0;
+ for (i = 0; i < len; i++)
+ v |= abs(src[i]);
+ return v;
+}
+
av_cold void ff_ac3dsp_init(AC3DSPContext *c)
{
c->ac3_exponent_min = ac3_exponent_min_c;
+ c->ac3_max_msb_abs_int16 = ac3_max_msb_abs_int16_c;
if (HAVE_MMX)
ff_ac3dsp_init_x86(c);