Mercurial > libavcodec.hg
comparison aac.c @ 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 | 209a9ad96a6c |
children | 77030651ddd0 |
comparison
equal
deleted
inserted
replaced
7844:d35a71a3db5f | 7845:e4edcbbca3f3 |
---|---|
751 } | 751 } |
752 | 752 |
753 if (pulse_present) { | 753 if (pulse_present) { |
754 for(i = 0; i < pulse->num_pulse; i++){ | 754 for(i = 0; i < pulse->num_pulse; i++){ |
755 float co = coef_base[ pulse->pos[i] ]; | 755 float co = coef_base[ pulse->pos[i] ]; |
756 float ico = co / sqrtf(sqrtf(fabsf(co))) + pulse->amp[i]; | 756 float ico = -pulse->amp[i]; |
757 if (co) | |
758 ico = co / sqrtf(sqrtf(fabsf(co))) + (co > 0 ? -ico : ico); | |
757 coef_base[ pulse->pos[i] ] = cbrtf(fabsf(ico)) * ico; | 759 coef_base[ pulse->pos[i] ] = cbrtf(fabsf(ico)) * ico; |
758 } | 760 } |
759 } | 761 } |
760 return 0; | 762 return 0; |
761 } | 763 } |