summaryrefslogtreecommitdiff
path: root/libavcodec/aac.c
diff options
context:
space:
mode:
authorRobert Swain <robert.swain@gmail.com>2008-09-11 01:22:34 +0000
committerRobert Swain <robert.swain@gmail.com>2008-09-11 01:22:34 +0000
commitfebcbd65fa3d00cfdfbfabd1c2a8fb8e659e1ca1 (patch)
tree01960d9d11d592e4433a88a95ee157f87a25569c /libavcodec/aac.c
parent67ce33162aa93bee1a5f9e8d6f00060329fa67da (diff)
Correct pulse amplitude application - a negative or 0 coefficient implies the
pulse is subtracted, else it is added. Also avoid a divide by 0. Based on a patch by Alex Converse (alex converse gmail com) Fixes part of issue632 Originally committed as revision 15294 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/aac.c')
-rw-r--r--libavcodec/aac.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/aac.c b/libavcodec/aac.c
index c59a663bec..cc069ed7c6 100644
--- a/libavcodec/aac.c
+++ b/libavcodec/aac.c
@@ -753,7 +753,9 @@ static int decode_spectrum_and_dequant(AACContext * ac, float coef[1024], GetBit
if (pulse_present) {
for(i = 0; i < pulse->num_pulse; i++){
float co = coef_base[ pulse->pos[i] ];
- float ico = co / sqrtf(sqrtf(fabsf(co))) + pulse->amp[i];
+ float ico = -pulse->amp[i];
+ if (co)
+ ico = co / sqrtf(sqrtf(fabsf(co))) + (co > 0 ? -ico : ico);
coef_base[ pulse->pos[i] ] = cbrtf(fabsf(ico)) * ico;
}
}