|
|
| davexnet |
| Posted: Mar 30 2011, 07:16 PM |
 |
|
Member
 
Group: Members
Posts: 16
Member No.: 25734
Joined: 25-June 09

|
Hello all, the Avisynth "resize" info states that : "With b = 0 and c = 0.75 the filter is exactly the same as VirtualDub's "precise bicubic,"
However resizing something in AVisynth such as Video = Video.BicubicResize(708,320,b=0,c=0.5) or Video = Video.BicubicResize(708,320,b=0,c=0.75)
I find both of the Avisynth statements above give a sharper result than the default Virtualdub option.
What is Virtualdubs a=-0.75 really equivalent to? (Is that really -0.75 ie. a negative value ?)
Thanks for any info. |
 |
| IanB |
| Posted: Mar 31 2011, 12:18 AM |
 |
|

Avisynth Team Member
  
Group: Members
Posts: 121
Member No.: 22295
Joined: 23-October 07

|
From Virtuldub resample_kernels.cpp| CODE | /////////////////////////////////////////////////////////////////////////// // // VDResamplerCubicFilter // ///////////////////////////////////////////////////////////////////////////
VDResamplerCubicFilter::VDResamplerCubicFilter(double twofc, double A) : mScale(twofc) , mA0( 1.0 ) , mA2(-3.0-A) , mA3( 2.0+A) , mB0(-4.0*A) , mB1( 8.0*A) , mB2(-5.0*A) , mB3( A) , mTaps((int)ceil(2.0 / twofc)*2) { }
int VDResamplerCubicFilter::GetFilterWidth() const { return mTaps; }
void VDResamplerCubicFilter::GenerateFilter(float *dst, double offset) const { double pos = -((double)((mTaps>>1)-1) + offset) * mScale;
for(unsigned i=0; i<mTaps; ++i) { double t = fabs(pos); double v = 0;
if (t < 1.0) v = mA0 + (t*t)*(mA2 + t*mA3); else if (t < 2.0) v = mB0 + t*(mB1 + t*(mB2 + t*mB3));
*dst++ = (float)v; pos += mScale; } } |
From Avisynth resample_functions.cpp| CODE | /********************************* *** Mitchell-Netravali filter *** *********************************/
MitchellNetravaliFilter::MitchellNetravaliFilter (double b=1./3., double c=1./3.) { p0 = ( 6. - 2.*b ) / 6.; p2 = ( -18. + 12.*b + 6.*c ) / 6.; p3 = ( 12. - 9.*b - 6.*c ) / 6.; q0 = ( 8.*b + 24.*c ) / 6.; q1 = ( - 12.*b - 48.*c ) / 6.; q2 = ( 6.*b + 30.*c ) / 6.; q3 = ( - b - 6.*c ) / 6.; }
double MitchellNetravaliFilter::f (double x) { x = fabs(x); return (x<1) ? (p0+x*x*(p2+x*p3)) : (x<2) ? (q0+x*(q1+x*(q2+x*q3))) : 0.0; }
|
Given A= -0.75 you plug it into the VDub spline coefficients then solve for the matching Avs coefficients.
| CODE | mA0 = ( 1.0 ) = ( 1.0 ) = +1.00 = p0 => b = 0 mA2 = (-3.0-A) = (-3.0- -0.75) = -2.25 = p2 => c = 0.75 mA3 = ( 2.0+A) = ( 2.0+ -0.75) = +1.25 = p3 => c = 0.75 mB0 = (-4.0*A) = (-4.0* -0.75) = +3.00 = q0 if b=0 => c = 0.75 mB1 = ( 8.0*A) = ( 8.0* -0.75) = -6.00 = q1 if b=0 => c = 0.75 mB2 = (-5.0*A) = (-5.0* -0.75) = +3.75 = q2 if b=0 => c = 0.75 mB3 = ( A) = ( -0.75) = -0.75 = q3 if b=0 => c = 0.75 |
However what may be different is the span (taps) of the filter kernel. |
 |
|