# HG changeset patch # User superdump # Date 1221096154 0 # Node ID e4edcbbca3f337bb408be0fc38472e0a57f0b23d # Parent d35a71a3db5f626c6a978326c15132d6d51e5d8a 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 diff -r d35a71a3db5f -r e4edcbbca3f3 aac.c --- a/aac.c Thu Sep 11 00:34:39 2008 +0000 +++ b/aac.c Thu Sep 11 01:22:34 2008 +0000 @@ -753,7 +753,9 @@ 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; } }