mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/kbdwin: Use av_bessel_i0()
Old code used about 7 times as many cpu cycles as new Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
0c7a0514e3
commit
4ea87c0f73
|
@ -21,8 +21,6 @@
|
||||||
#include "libavutil/attributes.h"
|
#include "libavutil/attributes.h"
|
||||||
#include "kbdwin.h"
|
#include "kbdwin.h"
|
||||||
|
|
||||||
#define BESSEL_I0_ITER 50 // default: 50 iterations of Bessel I0 approximation
|
|
||||||
|
|
||||||
av_cold void ff_kbd_window_init(float *window, float alpha, int n)
|
av_cold void ff_kbd_window_init(float *window, float alpha, int n)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
@ -34,9 +32,7 @@ av_cold void ff_kbd_window_init(float *window, float alpha, int n)
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
tmp = i * (n - i) * alpha2;
|
tmp = i * (n - i) * alpha2;
|
||||||
bessel = 1.0;
|
bessel = av_bessel_i0(sqrt(tmp) * 2);
|
||||||
for (j = BESSEL_I0_ITER; j > 0; j--)
|
|
||||||
bessel = bessel * tmp / (j * j) + 1;
|
|
||||||
sum += bessel;
|
sum += bessel;
|
||||||
local_window[i] = sum;
|
local_window[i] = sum;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue