diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2011-08-07 17:47:42 -0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2011-09-05 10:09:44 -0400 |
commit | ae264bb29be3506a489347c6e27a04cded0de621 (patch) | |
tree | 4944f356bc2065d4b85dafd47e7418a719eee077 /libavcodec/ac3enc_fixed.c | |
parent | a0d17b6d45b8550bd8826baa9f8eb4e1a596525a (diff) | |
download | ffmpeg-ae264bb29be3506a489347c6e27a04cded0de621.tar.gz |
ac3enc: Add channel coupling support for the fixed-point AC-3 encoder.
Update FATE references accordingly.
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 951b73d69b..adb735279d 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; |