diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2011-01-05 20:35:36 +0000 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2011-01-05 20:35:36 +0000 |
commit | ac05f9030ed4baae317071d0321c91afabaf1080 (patch) | |
tree | 89e2030d2568763b382a1a27756bb6c8134d6926 /libavcodec/ac3enc_float.c | |
parent | 87c1410d11c34670ab2bec1ee97fc18354aa3c8d (diff) | |
download | ffmpeg-ac05f9030ed4baae317071d0321c91afabaf1080.tar.gz |
Convert floating-point MDCT coefficients to 24-bit fixed-point all at once
instead of doing it separately in 2 different functions.
This makes float AC-3 encoding approx. 3-7% faster overall.
Also, the coefficient conversion can now be easily SIMD-optimized.
Originally committed as revision 26232 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ac3enc_float.c')
-rw-r--r-- | libavcodec/ac3enc_float.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavcodec/ac3enc_float.c b/libavcodec/ac3enc_float.c index 82d806bc06..f3246362e7 100644 --- a/libavcodec/ac3enc_float.c +++ b/libavcodec/ac3enc_float.c @@ -102,6 +102,17 @@ static int normalize_samples(AC3EncodeContext *s) } +/** + * Scale MDCT coefficients from float to 24-bit fixed-point. + */ +static void scale_coefficients(AC3EncodeContext *s) +{ + int i; + for (i = 0; i < AC3_MAX_COEFS * AC3_MAX_BLOCKS * s->channels; i++) + s->fixed_coef_buffer[i] = SCALE_FLOAT(s->mdct_coef_buffer[i], 24); +} + + AVCodec ac3_encoder = { "ac3", AVMEDIA_TYPE_AUDIO, |