Mercurial > libavcodec.hg
comparison resample2.c @ 10778:002cd0505064 libavcodec
Stop the approximation in bessel() once it does no longer improve.
This is faster.
| author | michael |
|---|---|
| date | Wed, 06 Jan 2010 22:40:52 +0000 |
| parents | fff66291d84d |
| children | 5cc6cb5167d8 |
comparison
equal
deleted
inserted
replaced
| 10777:c4e157b47af5 | 10778:002cd0505064 |
|---|---|
| 74 /** | 74 /** |
| 75 * 0th order modified bessel function of the first kind. | 75 * 0th order modified bessel function of the first kind. |
| 76 */ | 76 */ |
| 77 static double bessel(double x){ | 77 static double bessel(double x){ |
| 78 double v=1; | 78 double v=1; |
| 79 double lastv=0; | |
| 79 double t=1; | 80 double t=1; |
| 80 int i; | 81 int i; |
| 81 | 82 |
| 82 x= x*x/4; | 83 x= x*x/4; |
| 83 for(i=1; i<50; i++){ | 84 for(i=1; v != lastv; i++){ |
| 85 lastv=v; | |
| 84 t *= x/(i*i); | 86 t *= x/(i*i); |
| 85 v += t; | 87 v += t; |
| 86 } | 88 } |
| 87 return v; | 89 return v; |
| 88 } | 90 } |
