diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-09-05 22:10:26 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-09-05 22:29:16 +0200 |
commit | 3c54e7ed4f42d8ed5aece9484190b5294e272c36 (patch) | |
tree | 65e03151a2e17d9ac11aa76cc53b388a3185e3d6 /libavcodec/ac3enc_float.c | |
parent | 27bf599350a869877a1c9304abf9c95991692dd2 (diff) | |
parent | ae264bb29be3506a489347c6e27a04cded0de621 (diff) | |
download | ffmpeg-3c54e7ed4f42d8ed5aece9484190b5294e272c36.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
ac3enc: Add channel coupling support for the fixed-point AC-3 encoder.
ac3enc: scale floating-point coupling channel coefficients in scale_coefficients() rather than in apply_channel_coupling()
ac3enc: fix encoding of stereo ac3 files when rematrixing is disabled.
wavpack: fix wrong return value in wavpack_decode_block()
avconv: fix parsing metadata specifiers.
fate: use +frame+slice named constants instead of '3'
mpeg12: propagate more real return values through chunk decode error return and fix some indentation
wavpack: use context reset in appropriate places
avconv: move mux_preload and mux_max_delay to options context
avconv: move bitstream filters to options context.
avconv: move rate_emu to options context.
avconv: move max_frames to options context.
avconv: move metadata to options context.
avconv: move ts scale to options context.
avconv: move chapter maps to options context.
avconv: move metadata maps to options context.
avconv: move codec_names to options context.
Conflicts:
avconv.c
tests/fate-run.sh
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ac3enc_float.c')
-rw-r--r-- | libavcodec/ac3enc_float.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/libavcodec/ac3enc_float.c b/libavcodec/ac3enc_float.c index b1d1221667..3876a8007b 100644 --- a/libavcodec/ac3enc_float.c +++ b/libavcodec/ac3enc_float.c @@ -104,9 +104,10 @@ static int normalize_samples(AC3EncodeContext *s) static void scale_coefficients(AC3EncodeContext *s) { int chan_size = AC3_MAX_COEFS * s->num_blocks; - s->ac3dsp.float_to_fixed24(s->fixed_coef_buffer + chan_size, - s->mdct_coef_buffer + chan_size, - chan_size * s->channels); + int cpl = s->cpl_on; + s->ac3dsp.float_to_fixed24(s->fixed_coef_buffer + (chan_size * !cpl), + s->mdct_coef_buffer + (chan_size * !cpl), + chan_size * (s->channels + cpl)); } @@ -119,6 +120,18 @@ static void clip_coefficients(DSPContext *dsp, float *coef, unsigned int len) } +/** + * Calculate a single coupling coordinate. + */ +static CoefType calc_cpl_coord(CoefSumType energy_ch, CoefSumType energy_cpl) +{ + float coord = 0.125; + if (energy_cpl > 0) + coord *= sqrtf(energy_ch / energy_cpl); + return FFMIN(coord, COEF_MAX); +} + + #if CONFIG_AC3_ENCODER AVCodec ff_ac3_encoder = { .name = "ac3", |