summaryrefslogtreecommitdiff
path: root/libavcodec/ac3enc_fixed.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-06-27 07:46:27 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-06-27 12:59:39 -0400
commit668afae438ec8502517abb1c001b984c649e5e95 (patch)
treeca57f2d24c41a96ca2bfb1b736d28b17d5f45cda /libavcodec/ac3enc_fixed.c
parent7dcdf974d02caee206b38d0946b2fc1fab082aa3 (diff)
ac3enc: merge log2_tab() into normalize_samples()
Diffstat (limited to 'libavcodec/ac3enc_fixed.c')
-rw-r--r--libavcodec/ac3enc_fixed.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c
index 0620a6ac1a..32ff405247 100644
--- a/libavcodec/ac3enc_fixed.c
+++ b/libavcodec/ac3enc_fixed.c
@@ -72,19 +72,6 @@ void AC3_NAME(apply_window)(DSPContext *dsp, int16_t *output,
/**
- * Calculate the log2() of the maximum absolute value in an array.
- * @param tab input array
- * @param n number of values in the array
- * @return log2(max(abs(tab[])))
- */
-static int log2_tab(AC3EncodeContext *s, int16_t *src, int len)
-{
- int v = s->ac3dsp.ac3_max_msb_abs_int16(src, len);
- return av_log2(v);
-}
-
-
-/**
* Normalize the input samples to use the maximum available precision.
* This assumes signed 16-bit input samples.
*
@@ -92,7 +79,8 @@ static int log2_tab(AC3EncodeContext *s, int16_t *src, int len)
*/
int AC3_NAME(normalize_samples)(AC3EncodeContext *s)
{
- int v = 14 - log2_tab(s, s->windowed_samples, AC3_WINDOW_SIZE);
+ int v = s->ac3dsp.ac3_max_msb_abs_int16(s->windowed_samples, AC3_WINDOW_SIZE);
+ v = 14 - av_log2(v);
if (v > 0)
s->ac3dsp.ac3_lshift_int16(s->windowed_samples, AC3_WINDOW_SIZE, v);
/* +6 to right-shift from 31-bit to 25-bit */