aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-08-07 17:12:49 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-08-10 17:09:24 -0400
commit069083a419fc1a267ee997817c4e368fa67ca154 (patch)
tree0921fbf60e2668a12f0ebe317f24a19f51e55125 /libavcodec
parentd271d5b2152cafe540f3ab71d3be6ce8636d2fd6 (diff)
downloadffmpeg-069083a419fc1a267ee997817c4e368fa67ca154.tar.gz
ac3enc: clip coupling coordinates during calculation
This is faster than using the clip_coefficients() function. Also, clipping the coordinates before determining reuse is better since it will compare coordinates that are closer to their final encoded values.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/ac3enc_template.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c
index 7a6d72ff48..943a55a133 100644
--- a/libavcodec/ac3enc_template.c
+++ b/libavcodec/ac3enc_template.c
@@ -126,7 +126,7 @@ static inline float calc_cpl_coord(float energy_ch, float energy_cpl)
float coord = 0.125;
if (energy_cpl > 0)
coord *= sqrtf(energy_ch / energy_cpl);
- return coord;
+ return FFMIN(coord, COEF_MAX);
}
@@ -291,7 +291,6 @@ static void apply_channel_coupling(AC3EncodeContext *s)
if (!block->cpl_in_use)
continue;
- clip_coefficients(&s->dsp, cpl_coords[blk][1], s->fbw_channels * 16);
s->ac3dsp.float_to_fixed24(fixed_cpl_coords[blk][1],
cpl_coords[blk][1],
s->fbw_channels * 16);