LimitedSharpen-Faster-Mod - Avisynth vs. Vapoursynth - The_Tinkerer - 11.04.2019
Using Hybrid 2019.03.13.1 / Win7 SP1
I noticed that the LimitedSharpen-Faster-Mod filter is identical for both Avisynth and Vapoursynth, except for Skernal.
Avisynth appears to be correct and match http://avisynth.nl/index.php/LSFmod:
However, Vapoursynth instead has options 1 - 6:
On Avisynth, the defaults for presets "old", "fast", and "slow" are 11.
On Vaporsynth, the button that applies the preset defaults does not affect the Skernal option 1 - 6. Its initial state is 1.
Is that a bug for this filter on Vaporsynth, or correct behavior?
Also, shouldn't the Skernel field really be disabled/greyed for options other than the 3x3 Kernel options for Smethod?
RE: LimitedSharpen-Faster-Mod - Avisynth vs. Vapoursynth - Selur - 11.04.2019
Vapoursynth uses LSFMod from havsfunc:
################################################################################################
### ###
### LimitedSharpenFaster MOD : function LSFmod() ###
### ###
### Modded Version by LaTo INV. ###
### ###
### v1.9 - 05 October 2009 ###
### ###
################################################################################################
###
### +-----------+
### | CHANGELOG |
### +-----------+
###
### v1.9 : - tweaked settings
### - default preset is now defaults="fast" /!\
###
### v1.8 : - changed preblur to allow more tweaking (bool->string)
### - tweaked settings
### - cleaned the code
### - updated documentation
###
### v1.7 : - changed Smethod=4 to "source"
###
### v1.6 : - added preblur option
### - added new Smethod=4
###
### v1.5 : - fixed LUT expression (thanks to Didée)
### - changed Smethod to Smethod+secure
###
### v1.4 : - changed defaults="new" to defaults="slow" & defaults="fast"
### - added show parameter
### - cleaned a little the code
###
### v1.3 : - changed a little Smethod=3&5 (same effect, but more precise)
### - added new calculation for soft (soft=-2) [default on]
### - added warning about bad settings (no more silent)
### - updated the documentation
###
### v1.2 : - added new Lmode<0 (limit with repair)
### - added 2 new Smode (unsharp masking)
### - changed Smode order: now old Smode3-4 is new Smode3-4 to avoid mistake
###
### v1.1 : - fixed a bug with dest_x!=ox or dest_y!=oy
### - replaced Lfactor by over/undershoot2
###
### v1.0 : - deleted old Smode(1-4), added new Smode(1-3) & Smethod(1-5)
### - added parameters for nonlinear sharpening (S2zp,S2pwr,S2dmpLo,S2dmpHi)
### - corrected the nonlinear formula
### - added new Lmode 2 & 4 + fixed Lmode 0
### - added faster edgemask
### - added soothe temporal stabilization, 2 parameters: soothe & keep
### - replaced lanczosresize by spline36resize
### - moved "strength" parameter (first place)
### - deleted wide, special and exborder
### - changed some code (cosmetic)
### - added "defaults" parameter (to switch between original and modded version)
### - added documentation
###
###
###
### +--------------+
### | DEPENDENCIES |
### +--------------+
###
### -> RGVS
###
###
###
### +---------+
### | GENERAL |
### +---------+
###
### strength [int]
### --------------
### Strength of the sharpening
###
### Smode [int: 1,2]
### ----------------------
### Sharpen mode:
### =1 : Range sharpening
### =2 : Nonlinear sharpening (corrected version)
###
### Smethod [int: 1,2,3]
### --------------------
### Sharpen method:
### =1 : 3x3 kernel
### =2 : Min/Max
### =3 : Min/Max + 3x3 kernel
###
### kernel [int: 11,12,19,20]
### -------------------------
### Kernel used in Smethod=1&3
### In strength order: + 19 > 12 >> 20 > 11 -
###
###
###
### +---------+
### | SPECIAL |
### +---------+
###
### preblur [bool]
### --------------------------------
### Mode to avoid noise sharpening & ringing
###
### secure [bool]
### -------------
### Mode to avoid banding & oil painting (or face wax) effect of sharpening
###
### source [clip]
### -------------
### If source is defined, LSFmod doesn't sharp more a denoised clip than this source clip
### In this mode, you can safely set Lmode=0 & PP=off
### Usage: denoised.LSFmod(source=source)
### Example: last.FFT3DFilter().LSFmod(source=last,Lmode=0,soft=0)
###
###
###
### +----------------------+
### | NONLINEAR SHARPENING |
### +----------------------+
###
### Szrp [int]
### ----------
### Zero Point:
### - differences below Szrp are amplified (overdrive sharpening)
### - differences above Szrp are reduced (reduced sharpening)
###
### Spwr [int]
### ----------
### Power: exponent for sharpener
###
### SdmpLo [int]
### ------------
### Damp Low: reduce sharpening for small changes [0:disable]
###
### SdmpHi [int]
### ------------
### Damp High: reduce sharpening for big changes [0:disable]
###
###
###
### +----------+
### | LIMITING |
### +----------+
###
### Lmode [int: ...,0,1,2,3,4]
### --------------------------
### Limit mode:
### <0 : Limit with repair (ex: Lmode=-1 --> repair(1), Lmode=-5 --> repair(5)...)
### =0 : No limit
### =1 : Limit to over/undershoot
### =2 : Limit to over/undershoot on edges and no limit on not-edges
### =3 : Limit to zero on edges and to over/undershoot on not-edges
### =4 : Limit to over/undershoot on edges and to over/undershoot2 on not-edges
###
### overshoot [int]
### ---------------
### Limit for pixels that get brighter during sharpening
###
### undershoot [int]
### ----------------
### Limit for pixels that get darker during sharpening
###
### overshoot2 [int]
### ----------------
### Same as overshoot, only for Lmode=4
###
### undershoot2 [int]
### -----------------
### Same as undershoot, only for Lmode=4
###
###
###
### +-----------------+
### | POST-PROCESSING |
### +-----------------+
###
### soft [int: -2,-1,0...100]
### -------------------------
### Soft the sharpening effect (-1 = old autocalculate, -2 = new autocalculate)
###
### soothe [bool]
### -------------
### =True : Enable soothe temporal stabilization
### =False : Disable soothe temporal stabilization
###
### keep [int: 0...100]
### -------------------
### Minimum percent of the original sharpening to keep (only with soothe=True)
###
###
###
### +-------+
### | EDGES |
### +-------+
###
### edgemode [int: -1,0,1,2]
### ------------------------
### =-1 : Show edgemask
### = 0 : Sharpening all
### = 1 : Sharpening only edges
### = 2 : Sharpening only not-edges
###
### edgemaskHQ [bool]
### -----------------
### =True : Original edgemask
### =False : Faster edgemask
###
###
###
### +------------+
### | UPSAMPLING |
### +------------+
###
### ss_x ; ss_y [float]
### -------------------
### Supersampling factor (reduce aliasing on edges)
###
### dest_x ; dest_y [int]
### ---------------------
### Output resolution after sharpening (avoid a resizing step)
###
###
###
### +----------+
### | SETTINGS |
### +----------+
###
### defaults [string: "old" or "slow" or "fast"]
### --------------------------------------------
### = "old" : Reset settings to original version (output will be THE SAME AS LSF)
### = "slow" : Enable SLOW modded version settings
### = "fast" : Enable FAST modded version settings
### --> /!\ [default:"fast"]
###
###
### defaults="old" : - strength = 100
### ---------------- - Smode = 1
### - Smethod = Smode==1?2:1
### - kernel = 11
###
### - preblur = false
### - secure = false
### - source = undefined
###
### - Szrp = 16
### - Spwr = 2
### - SdmpLo = strength/25
### - SdmpHi = 0
###
### - Lmode = 1
### - overshoot = 1
### - undershoot = overshoot
### - overshoot2 = overshoot*2
### - undershoot2 = overshoot2
###
### - soft = 0
### - soothe = false
### - keep = 25
###
### - edgemode = 0
### - edgemaskHQ = true
###
### - ss_x = Smode==1?1.50:1.25
### - ss_y = ss_x
### - dest_x = ox
### - dest_y = oy
###
###
### defaults="slow" : - strength = 100
### ----------------- - Smode = 2
### - Smethod = 3
### - kernel = 11
###
### - preblur = false
### - secure = true
### - source = undefined
###
### - Szrp = 16
### - Spwr = 4
### - SdmpLo = 4
### - SdmpHi = 48
###
### - Lmode = 4
### - overshoot = strength/100
### - undershoot = overshoot
### - overshoot2 = overshoot*2
### - undershoot2 = overshoot2
###
### - soft = -2
### - soothe = true
### - keep = 20
###
### - edgemode = 0
### - edgemaskHQ = true
###
### - ss_x = 1.50
### - ss_y = ss_x
### - dest_x = ox
### - dest_y = oy
###
###
### defaults="fast" : - strength = 100
### ----------------- - Smode = 1
### - Smethod = 2
### - kernel = 11
###
### - preblur = false
### - secure = true
### - source = undefined
###
### - Szrp = 16
### - Spwr = 4
### - SdmpLo = 4
### - SdmpHi = 48
###
### - Lmode = 1
### - overshoot = strength/100
### - undershoot = overshoot
### - overshoot2 = overshoot*2
### - undershoot2 = overshoot2
###
### - soft = 0
### - soothe = true
### - keep = 20
###
### - edgemode = 0
### - edgemaskHQ = false
###
### - ss_x = 1.25
### - ss_y = ss_x
### - dest_x = ox
### - dest_y = oy
###
################################################################################################
def LSFmod(input, strength=100, Smode=None, Smethod=None, kernel=11, preblur=False, secure=None, source=None,
Szrp=16, Spwr=None, SdmpLo=None, SdmpHi=None, Lmode=None, overshoot=None, undershoot=None, overshoot2=None, undershoot2=None,
soft=None, soothe=None, keep=None, edgemode=0, edgemaskHQ=None, ss_x=None, ss_y=None, dest_x=None, dest_y=None, defaults='fast')
source: https://github.com/HomeOfVapourSynthEvolution/havsfunc/blob/master/havsfunc.py
Quote:Also, shouldn't the Skernel field really be disabled/greyed for options other than the 3x3 Kernel options for Smethod?
Description above says:
Kernel used in Smethod=1&3
### In strength order: + 19 > 12 >> 20 > 11 -
-> will try look at it once I'm back from work today or at the weekend.
Cu Selur
Ps.: Yes, LSFmod in Avisynth and Vapoursynth differs.
RE: LimitedSharpen-Faster-Mod - Avisynth vs. Vapoursynth - Selur - 11.04.2019
Seems like LSFMod changed a lot in the Vapoursynth version over the years and I didn't notice it.
-> This will take a while
=> send you a link to a dev version for testing
|