LSFmod

From Avisynth wiki
Jump to: navigation, search
Abstract
Author LaTo
Version v1.9 - Update 2009/10/05
Download LSFmod.v1.9.avsi
Category Sharpeners
License
Discussion Doom9 Thread

Contents

Description

A LimitedSharpenFaster mod with a lot of new features and optimizations.

Requirements

Required Plugins

Latest versions of the following filters are recommended unless stated otherwise.


Syntax and Parameters

LSFmod (clip input, int "strength", int "Smode", int "Smethod", int "kernel", string "preblur", bool "secure", clip "source", int "Szrp", int "Spwr", int "SdmpLo", int "SdmpHi", int "Lmode", int "overshoot", int "undershoot", int "overshoot2", int "undershoot2", int "soft", bool "soothe", int "keep", int "edgemode", bool "edgemaskHQ", float "ss_x", float "ss_y", int "dest_x", int "dest_y", bool "show", int "screenW", int "screenH", string "defaults")

General

clip  input =
Input clip.
int  strength = 100
Sharpening strength.
int  Smode = 3
Sharpening mode:
  • 1 : Unsharp masking (from WarpSharp)
  • 2 : Unsharp masking (from VariableBlur)
  • 3 : Range sharpening
  • 4 : Nonlinear sharpening (original version)
  • 5 : Nonlinear sharpening (corrected version)
int  Smethod = 2
Sharpening method: (not used for Smode=1&2)
  • 1 : 3x3 Kernel
  • 2 : Min/Max (original)
  • 3 : Min/Max (enhanced)
  • 4 : Min/Max (original) + 3x3 Kernel
  • 5 : Min/Max (enhanced) + 3x3 Kernel
int  Skernel = 11
Kernel used for Smethod=1,4,5
In strength order: + 19 > 12 >> 20 > 11 -

Special

string  preblur = "OFF"
Mode to avoid noise sharpening & ringing (only used in Smode=3,4,5).
"ON" is sufficient to prevent ringing, but to prevent noise sharpening you should set your own denoiser.
  • Usage: LSFmod(preblur="YourFavoriteDenoiser()")
  • Example: LSFmod(preblur="FFT3Dfilter(sigma=4,plane=0)")
bool  secure = true
Mode to avoid banding & oil painting (or face wax) effect of sharpening (only used in Smode=3,4,5).
clip  source = undefined
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

int  Szrp = 16
Zero Point:
  • differences below Szrp are amplified (overdrive sharpening)
  • differences above Szrp are reduced (reduced sharpening)
int  Spwr = 4
Power: exponent for sharpener.
int  SdmpLo = 4
Damp Low: reduce sharpening for small changes (0:disable).
int  SdmpHi = 48
Damp High: reduce sharpening for big changes (0:disable).


Limiting

int  Lmode = 1
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
int  overshoot = strength/100
Limit for pixels that get brighter during sharpening.
int  undershoot = overshoot
Limit for pixels that get darker during sharpening.
int  overshoot2 = overshoot*2
Same as overshoot, only for Lmode=4.
int  undershoot2 = overshoot2
Same as undershoot, only for Lmode=4.


Post-Processing

int  soft = 0
Soften the sharpening effect:
  • 0-100 : amount of softening
  • -1 : old auto calculate
  • -2 : new auto calculate
bool  soothe = true
  • true : Enable soothe temporal stabilization
  • false : Disable soothe temporal stabilization
int  keep = 20
Minimum percent (0-100) of the original sharpening to keep (only with soothe=true).


Edges

int  edgemode = 0
  • -1 : Show edgemask
  • 0 : Sharpening all
  • 1 : Sharpening only edges
  • 2 : Sharpening only not-edges
bool  edgemaskHQ = false
  • true : Original edgemask
  • false : Faster edgemask


Upsampling

float  ss_x = 1.25
float  ss_y = ss_x
Supersampling factor (reduce aliasing on edges).
int  dest_x = Width(input)
int  dest_y = Height(input)
Output resolution after sharpening (avoids an additional resizing step).
If not defined it defaults to the dimensions of the input clip.

Debug

bool  show = false
Show debug clip & information [1].
int  screenW = 1280
int  screenH = 1024
Screen resolution (for show clip).

Settings

String  defaults = "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
"old" "slow" "fast"
strength 100 100 100
Smode 3 5 3
Smethod Smode==3?2:1 3 2
Kernel 11 11 11
preblur "OFF" "OFF" "OFF"
secure false true true
source undefined undefined undefined
Szrp 16 16 16
Spwr 2 4 4
SdmpLo strength/25 4 4
SdmpHi 0 48 48
Lmode 1 4 1
overshoot 1 strength/100 strength/100
undershoot overshoot overshoot overshoot
overshoot2 overshoot*2 overshoot*2 overshoot*2
undershoot2 overshoot2 overshoot2 overshoot2
soft 0 -2 0
soothe false true true
keep 25 20 20
edgemode 0 0 0
edgemaskHQ true true false
ss_x Smode==3?1.50:1.25 1.50 1.25
ss_y ss_x ss_x ss_x
dest_x Width(input) Width(input) Width(input)
dest_y Height(input) Height(input) Height(input)
show false false false
screenW 1280 1280 1280
screenH 1024 1024 1024


Examples

LSFmod with default settings:

AviSource("blah.avi")
LSFmod(strength=100, Smode=3, Smethod=2, kernel=11, 
\      preblur="OFF", secure=true, 
\      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, 
\      show=false, screenW=1280, screenH=1024, defaults="fast")


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


External Links




Back to External Filters

Personal tools