Mercurial > libavcodec.hg
changeset 7845:e4edcbbca3f3 libavcodec
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
author | superdump |
---|---|
date | Thu, 11 Sep 2008 01:22:34 +0000 |
parents | d35a71a3db5f |
children | a7162bb60138 |
files | aac.c |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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; } }