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_fixed.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_fixed.c')
-rw-r--r-- | libavcodec/ac3enc_fixed.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c index c2e51552bc..0c7f81b7d3 100644 --- a/libavcodec/ac3enc_fixed.c +++ b/libavcodec/ac3enc_fixed.c @@ -29,6 +29,7 @@ #define CONFIG_FFT_FLOAT 0 #undef CONFIG_AC3ENC_FLOAT #include "ac3enc.h" +#include "eac3enc.h" #define AC3ENC_TYPE AC3ENC_TYPE_AC3_FIXED #include "ac3enc_opts_template.c" @@ -112,6 +113,22 @@ static void clip_coefficients(DSPContext *dsp, int32_t *coef, unsigned int len) } +/** + * Calculate a single coupling coordinate. + */ +static CoefType calc_cpl_coord(CoefSumType energy_ch, CoefSumType energy_cpl) +{ + if (energy_cpl <= COEF_MAX) { + return 1048576; + } else { + uint64_t coord = energy_ch / (energy_cpl >> 24); + uint32_t coord32 = FFMIN(coord, 1073741824); + coord32 = ff_sqrt(coord32) << 9; + return FFMIN(coord32, COEF_MAX); + } +} + + static av_cold int ac3_fixed_encode_init(AVCodecContext *avctx) { AC3EncodeContext *s = avctx->priv_data; |