Log in

View Full Version : Can AviSynth's BicubicResize look the same as FFmpeg's Bicubic scaler?


orion44
19th June 2021, 07:41
I really like the look of FFmpeg's Bicubic scaler. It looks sharper than AviSynth's BicubicResize,
which looks a bit blurry with default values (BicubicResize(960,720,b=1./3.,c=1./3.)).

Does anyone know what values of b and c should I use so that it would look exactly the same as FFmpeg's bicubic scaler?

Is there a way to find out what exact values FFmpeg's bicubic scaler uses?

Boulder
19th June 2021, 11:35
You could test b=0, c=0.5 or 0.6, they are the most common ones I think. It's true that the default values cause a bit soft image.

StainlessS
19th June 2021, 13:33
From Wiki:- http://avisynth.nl/index.php/Resize

BicubicResize

BicubicResize(clip clip, int target_width, int target_height [, float b, float c,
float src_left, float src_top, float src_width, float src_height ] )

BicubicResize is similar to BilinearResize, except that instead of a linear filtering function it uses the Mitchell-Netravali two-part cubic. The parameters b and c can be used to adjust the properties of the cubic; they are sometimes referred to as "blurring" and "ringing" respectively.

If you are enlarging your video, you will get sharper results with BicubicResize than with BilinearResize. However, if you are shrinking it, you may prefer BilinearResize as it performs some antialiasing.
parameters b and c

float b, c = 1/3

The default for both b and c is 1/3, which were recommended by Mitchell and Netravali for having the most visually pleasing results.

Set for the most numerically accurate filter. This gives, for b=0, the maximum value of 0.5 for c, which is the Catmull-Rom spline and a good suggestion for sharpness.

Larger values of b and c can produce interesting op-art effects – for example, try (b=0, c= -5.0).

As c exceeds 0.6, the filter starts to "ring" or overshoot. You won't get true sharpness – what you'll get is exaggerated edges. Negative values for b (although allowed) give undesirable results, so use b=0 for values of c > 0.5.

With (b=0, c=0.75) the filter is the same as VirtualDub's "Precise Bicubic".

BicubicResize may be the most visually pleasing of the Resize filters for downsizing to half-size or less.doom9
Try the default setting, (b=0, c=0.75) as above, or (b= -0.5, c=0.25). [EDIT: I think "[B]default" here refers to VDub default "Precise Bicubic"]


Links missing from above quote.
Mitchell-Netravali-Filter:- https://de.wikipedia.org/wiki/Mitchell-Netravali-Filter
Spatial anti-aliasing:- https://en.wikipedia.org/wiki/Spatial_anti-aliasing#Examples
Catmull–Rom spline:- https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Catmull.E2.80.93Rom_spline
Ringing artifacts:- https://en.wikipedia.org/wiki/Ringing_artifacts
VirtualDub's "Precise Bicubic":- http://www.virtualdub.org/blog2/entry_095.html
downsizing to half-size or less [suggest see this thread for downsize]:- https://forum.doom9.org/showthread.php?t=172871&page=2

EDIT:
A pretty image at bottom of this page:- https://superuser.com/questions/375718/which-resize-algorithm-to-choose-for-videos
or here:-
https://i.stack.imgur.com/AaIAW.png

EDIT:
Bicubic (by default Catmull-Rom in ffmpeg) <<<<<<========== HERE ======
Here:- https://github.com/HandBrake/HandBrake/issues/1515
So [as Boulder suggests using] ffmpeg uses [presumably in above image as CATROM], b=0.0, c=0.5

butterw2
20th June 2021, 06:35
By default, Avidemux uses the ffmpeg default for resizing.

It is stated as being b=0, c=0.6 so a little sharper than CATROM.