mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-04 06:08:26 +02:00
cubic filter instead of truncated sinc
looks much better for upscaling & scaling where src and dst size are quite similar Originally committed as revision 3201 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
305fa26445
commit
fdce4f3132
@ -554,12 +554,18 @@ static void build_filter(int16_t *filter, float factor)
|
|||||||
for(ph=0;ph<NB_PHASES;ph++) {
|
for(ph=0;ph<NB_PHASES;ph++) {
|
||||||
norm = 0;
|
norm = 0;
|
||||||
for(i=0;i<NB_TAPS;i++) {
|
for(i=0;i<NB_TAPS;i++) {
|
||||||
|
#if 1
|
||||||
|
const float d= -0.5; //first order derivative = -0.5
|
||||||
|
x = fabs(((float)(i - FCENTER) - (float)ph / NB_PHASES) * factor);
|
||||||
|
if(x<1.0) y= 1 - 3*x*x + 2*x*x*x + d*( -x*x + x*x*x);
|
||||||
|
else y= d*(-4 + 8*x - 5*x*x + x*x*x);
|
||||||
|
#else
|
||||||
x = M_PI * ((float)(i - FCENTER) - (float)ph / NB_PHASES) * factor;
|
x = M_PI * ((float)(i - FCENTER) - (float)ph / NB_PHASES) * factor;
|
||||||
if (x == 0)
|
if (x == 0)
|
||||||
y = 1.0;
|
y = 1.0;
|
||||||
else
|
else
|
||||||
y = sin(x) / x;
|
y = sin(x) / x;
|
||||||
|
#endif
|
||||||
tab[i] = y;
|
tab[i] = y;
|
||||||
norm += y;
|
norm += y;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user