Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-02-13 22:49:50 +0300
committerMichael Niedermayer <michaelni@gmx.at>2011-02-15 01:58:20 +0300
commit7539a1fee2c4935eb3318d625f881df85f2c9c04 (patch)
tree79b531353a0c98dc0268ac0bc985284042f7236d /libavcodec/ac3enc_fixed.c
parente590448c65b7f9cd1a9bcf39ee6874882034edc9 (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> (cherry picked from commit fbb6b49dabc3398440c6dfa838aa090a7a6ebc0d)
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;
}