diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-06-28 02:29:39 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-06-28 02:30:04 +0200 |
commit | 7b7c47c8f70e51d3835a6153c3e467e59acf8a8b (patch) | |
tree | ecb00d3a1688c44780d275b2b3209c355f548e0a /libavcodec/ac3enc_fixed.c | |
parent | 65eae2a7a2a14926c9f9683544e99982ba565f93 (diff) | |
parent | 8683c6a638f2e323d11b520c5e130b46b1eb1eda (diff) | |
download | ffmpeg-7b7c47c8f70e51d3835a6153c3e467e59acf8a8b.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
ac3enc: move ff_ac3_encode_frame() to ac3enc_template.c
ac3enc: merge log2_tab() into normalize_samples()
ac3enc: Remove bit allocation fallbacks.
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ac3enc_fixed.c')
-rw-r--r-- | libavcodec/ac3enc_fixed.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c index f4d447e3b2..b18960993d 100644 --- a/libavcodec/ac3enc_fixed.c +++ b/libavcodec/ac3enc_fixed.c @@ -63,36 +63,23 @@ av_cold int AC3_NAME(mdct_init)(AVCodecContext *avctx, AC3MDCTContext *mdct, /** * Apply KBD window to input samples prior to MDCT. */ -void AC3_NAME(apply_window)(DSPContext *dsp, int16_t *output, - const int16_t *input, const int16_t *window, - unsigned int len) +static void apply_window(DSPContext *dsp, int16_t *output, const int16_t *input, + const int16_t *window, unsigned int len) { dsp->apply_window_int16(output, input, window, len); } /** - * 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. * * @return exponent shift */ -int AC3_NAME(normalize_samples)(AC3EncodeContext *s) +static int 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 */ @@ -103,7 +90,7 @@ int AC3_NAME(normalize_samples)(AC3EncodeContext *s) /** * Scale MDCT coefficients to 25-bit signed fixed-point. */ -void AC3_NAME(scale_coefficients)(AC3EncodeContext *s) +static void scale_coefficients(AC3EncodeContext *s) { int blk, ch; @@ -131,7 +118,7 @@ AVCodec ff_ac3_fixed_encoder = { CODEC_ID_AC3, sizeof(AC3EncodeContext), ac3_fixed_encode_init, - ff_ac3_encode_frame, + ff_ac3_fixed_encode_frame, ff_ac3_encode_close, NULL, .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, |