PDA

View Full Version : LSFmod [v1.9 - Update 2009/10/05]


LaTo
11th November 2008, 16:10
################################################################################################
### ###
### LimitedSharpenFaster MOD : function LSFmod() ###
### ###
### Modded Version by LaTo INV. ###
### ###
### v1.9 - 05 October 2009 ###
### ###
################################################################################################
###
###
### +--------------+
### | DEPENDENCIES |
### +--------------+
###
### -> Masktools (v2a36)
### -> Removegrain (v1.0pre)
### -> Warpsharp (2003.11.03) [for Smode=1]
### -> Variableblur (v0.30) [for Smode=2]
###
###
###
### +-------+
### | USAGE |
### +-------+
###
### LSFmod( strength, Smode, Smethod, kernel,
### preblur, secure, source,
### Szrp, Spwr, SdmpLo, SdmpHi,
### Lmode, overshoot, undershoot, overshoot2, undershoot2,
### soft, soothe, keep,
### edgemode, edgemaskHQ,
### ss_x, ss_y, dest_x, dest_y,
### show, screenW, screenH,
### defaults )
###
###
###
### +---------+
### | GENERAL |
### +---------+
###
### strength [int]
### --------------
### Strength of the sharpening
###
### Smode [int: 1,2,3,4,5]
### ----------------------
### Sharpen mode:
### =1 : Unsharp masking (from warpsharp)
### =2 : Unsharp masking (from variableblur)
### =3 : Range sharpening
### =4 : Nonlinear sharpening (original version)
### =5 : Nonlinear sharpening (corrected version)
###
### Smethod [int: 1,2,3]
### --------------------
### Sharpen method: (only used in Smode=3,4,5)
### =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 [string: "ON","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)")
###
###
### secure [bool]
### -------------
### Mode to avoid banding & oil painting (or face wax) effect of sharpening
### (only used in Smode=3,4,5)
###
### 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)
###
###
###
### +-------+
### | DEBUG |
### +-------+
###
### show [bool]
### -----------
### Show debug clip & informations
###
### screenW ; screenH [int]
### -----------------------
### Screen resolution (for show clip)
###
###
###
### +----------+
### | 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 = 3
### - Smethod = Smode==3?2:1
### - kernel = 11
###
### - preblur = "OFF"
### - 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==3?1.50:1.25
### - ss_y = ss_x
### - dest_x = ox
### - dest_y = oy
###
### - show = false
### - screenW = 1280
### - screenH = 1024
###
###
### defaults="slow" : - strength = 100
### ----------------- - Smode = 5
### - Smethod = 3
### - kernel = 11
###
### - preblur = "OFF"
### - 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
###
### - show = false
### - screenW = 1280
### - screenH = 1024
###
###
### defaults="fast" : - strength = 100
### ----------------- - Smode = 3
### - Smethod = 2
### - kernel = 11
###
### - preblur = "OFF"
### - 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
###
### - show = false
### - screenW = 1280
### - screenH = 1024
###
################################################################################################


Update 2009.10.05 : LSFmod v1.9 (http://latoninf.free.fr/d9/LM/LSFmod.v1.9.avsi)


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 (Szrp,Spwr,SdmpLo,SdmpHi)
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


http://latoninf.free.fr/d9/LM/show_mini.png (http://latoninf.free.fr/d9/LM/show.png)

LaTo
11th November 2008, 16:13
A small mod (with new options, improvements...) needed for MCTemporalDenoise v1.0.00... :devil:

Speed comparaison (with v1.9):
LimitedSharpenFaster() = 17.4 fps
LSFmod(defaults="fast") = 16.8 fps
LSFmod(defaults="slow") = 7.6 fps

pitch.fr
11th November 2008, 17:08
w00t, LaTo does it again :D

so atm I'm using LimitedSharpenFaster(ss_x=1.0,ss_y=1.0,strength=40)

an improved(speed-wise? PQ-wise?) LSFmod call would be : LSFmod(Smode=3,ss_x=1.0,ss_y=1.0,strength=40) ?

I dunno what do to with Smethod...

any chance you could use the limitedsupport.dll for realtime speed increase ?

:thanks:

EDIT: w00ps, LSF is 310fps, LSFmod is 113 :(

LaTo
11th November 2008, 17:22
EDIT: w00ps, LSF is 310fps, LSFmod is 113 :(
change Lmode to 1 & soothe to false for speed

pitch.fr
11th November 2008, 19:10
ok, thanks for the tip!

so LSFmod(Smode=3,Lmode=1,ss_x=1.0,ss_y=1.0,strength=40,soothe=false) is 290fps

still a bit slower than the LSF that uses limitedsupport.dll, any chance you could use it ?
I might as well mod your script and call it LSFMod2() :D

is there any point using this LSFMod call over the original one ? you said you "fixed" some stuff if I got it right :confused:

LaTo
11th November 2008, 19:14
still a bit slower than the LSF that uses limitedsupport.dll, any chance you could use it ?
No...


is there any point using this LSFMod call over the original one ? you said you "fixed" some stuff if I got it right :confused:
Look at the changelog ;)

Adub
11th November 2008, 20:08
Very interesting. I will have to play with this. Oh, and I can't wait for Didee to spin by. He may offer some great insight.

pitch.fr
11th November 2008, 21:42
Look at the changelog ;)
well it's not too clear to me :D

the only thing I find annoying is getting jaggies with ss1.0, coz >1.0 it's too soft to my taste...but you can't get it all I guess :rolleyes:

Nightshiver
11th November 2008, 21:53
You say look at the change-log but that doesn't really help explain some of the new features. Such as, just what is smethod and how/why would we use it? Why did you remove smode=4 and only have 3?

Nikos
11th November 2008, 22:18
LaTo, congratulations for the good work.
In the comments write that the "SdmpHi" work in the opposite way than "SdmpLo".
Small number for "SdmpHi" mean big reduction for "big sharpening changes" and usefull numbers are 15~30.

LaTo
12th November 2008, 06:19
In the comments write that the "SdmpHi" work in the opposite way than "SdmpLo".
Small number for "SdmpHi" mean big reduction for "big sharpening changes" and usefull numbers are 15~30.
Yes...
SdmpLo: the higher, the stronger reduction
SdmpHi: the lower, the stronger reduction

You say look at the change-log but that doesn't really help explain some of the new features. Such as, just what is smethod and how/why would we use it? Why did you remove smode=4 and only have 3?
new Smode=3 + Smethod=2 is the old Smode=3
new Smode=4 + Smethod=1 is the old Smode=4

new Smode=5 is the same as Smode=4 but with a fix in the formula (no Szrp shift with SdmpLo&SdmpHi!=0)

new Smethod=3 is the same as Smethod=2 but softer, I like the result...
maybe too soft, so Smethod=5 is the same as Smethod=3 but sharper :D

Smethod=4 is the sharpest...

I will post some screenshot later ;)

LaTo
12th November 2008, 15:47
So, this is some screenshots about Smethod with LSFmod(Smode=1,strength=300,Smethod=X)... (High strength to see better)

Screenshot 1:

Smethod=1 (http://latoninf.free.fr/d9/LM/m1a.png)
Smethod=2 (http://latoninf.free.fr/d9/LM/m2a.png)
Smethod=3 (http://latoninf.free.fr/d9/LM/m3a.png)
Smethod=4 (http://latoninf.free.fr/d9/LM/m4a.png)
Smethod=5 (http://latoninf.free.fr/d9/LM/m5a.png)


Screenshot 2:

Smethod=1 (http://latoninf.free.fr/d9/LM/m1b.png)
Smethod=2 (http://latoninf.free.fr/d9/LM/m2b.png)
Smethod=3 (http://latoninf.free.fr/d9/LM/m3b.png)
Smethod=4 (http://latoninf.free.fr/d9/LM/m4b.png)
Smethod=5 (http://latoninf.free.fr/d9/LM/m5b.png)


In order of strength:
- 1 < 3 < 5 < 2 < 4 +

In order of speed:
- 5 < 4 < 3 < 2 < 1 +

In order of quality:
- 4 < 2 < 1 < 3 < 5 +

By default in Limitedsharpenfaster:
With Smode=3, similar as Smethod=2 is used... (It's sharp but produce some ugly artefacts... look at the sky in the screenshot1 & in the back of the chair in the screenshot2)
With Smode=4, similar as Smethod=1 is used... (It's too soft, especially with a default power at 2 and an "auto SdmpLo" changing with strength)

By default in LSFmod:
With Smode=1, Smethod=5 is used... (It need a sharp Smethod because this Smode is linear sharpening)
With Smode=2&3, Smethod=3 is used... (This Smethod is soft but it's compensated by the Spwr parameter of nonlinear sharpening)


Rmq: You can change Skernel to 19, it will be sharper... but there are little artefacts

LaTo
12th November 2008, 19:15
About the difference between Smode4 & Smode5 :


http://latoninf.free.fr/d9/LM/smode4.png

http://latoninf.free.fr/d9/LM/smode5.png

In the original version, when SdmpLo or SdmpHi != 0 the curves don't pass through Szrp...

So, in the corrected version, all curves pass through Szrp...

It's not very important, but I'm a perfectionnist :D



EDIT: Oups I forgot the 1/Spwr when I made these graph! It isn't a problem, the principle remains the same... I will correct these graph when I have time :)

EDIT2: Now all is ok, curves are fixed ;)

pitch.fr
12th November 2008, 20:57
in the corrected version, all curves pass through Szrp...
It's not very important, but I'm a perfectionnist :D
ORLY ? :D

all this stuff doesn't make much sense to me, I think I'll stick to the original LSF that uses limitedsupport.dll :thanks:

Nikos
12th November 2008, 22:24
LaTo
1. There is something wrong in your graphs. The bellow graph is from Didee:

http://users.chan.sch.gr/nikos_ch/files/pictures/SeeSaw.jpg

Light blue shows "Szp=16, Spower=4, SdampLo=0.01, SdampHi=255".
Dark blue shows "Szp=16, Spower=2, SdampLo=3, SdampHi=255"
Dark green shows "Szp=16, Spower=4, SdampLo=4, SdampHi=24"


2. From the original SeeSaw function:
Sstr = default( Sstr, 1.5 )
Szp = default( Szp, 16 ) # or 16+2
Szp = Szp / pow(Sstr, 1.0/4.0) / pow( (ssx+ssy)/2.0, 1.0/2.0 )

SdampLo = default( SdampLo, 5) # Spower+1
SdampLo = SdampLo / pow(Sstr, 1.0/4.0) / pow( (ssx+ssy)/2.0, 1.0/2.0 )


from your LSFmod:
strength = default( strength, Select(num, 100 , 100 ) )
Szrp = default( Szrp, Select(num, 16 , 16 ) )
strength = float(strength)/100.0
Szrp = Szrp == 0 ? 1 : Szrp

SdmpLo = default( SdmpLo, Select(num, strength/25 , 4 ) )



If you want explain the differents.

LaTo
13th November 2008, 06:11
LaTo
1. There is something wrong in your graphs. The bellow graph is from Didee:
I know... Look a little:
EDIT: Oups I forgot the 1/Spwr when I made these graph! It isn't a problem, the principle remains the same... I will correct these graph when I have time :)
:D

Nikos
13th November 2008, 17:19
LaTo one more comment.
I prefer separate overshoot value for edges and non edges instead of Lfactor,
but this is just my opinion, your mod is nice.
Thanks to Didee for the wonderful ideas.

Edit
Another comment.
### SOFT

sharpdiff = mt_makediff(tmp,last,U=1,V=1)
sharpdiff = mt_lutxy(sharpdiff,sharpdiff.removegrain(19,-1),
\ "x 128 - abs y 128 - abs > y "+string(soft)+" * x "+string(100-soft)+" * + 100 / x ?",U=1,V=1)

soft==0 ? last : mt_makediff(tmp,sharpdiff,U=1,V=1)

(ss_x > 1.0 || ss_y > 1.0) || (dest_x != ox || dest_y != oy) ? spline36resize(dest_x,dest_y) : last


### SOOTHE

diff = mt_makediff(clp,last,U=1,V=1)
diff2 = diff.temporalsoften(1,255,0,32,2)
diff3 = mt_lutxy(diff,diff2,"x 128 - y 128 - * 0 < x 128 - 100 / "+string(keep)+
\ " * 128 + x 128 - abs y 128 - abs > x "+string(keep)+" * y 100 "+string(keep)+" - * + 100 / x ? ?",U=1,V=1)

soothe ? mt_makediff(clp,diff3,U=2,V=2) : last.mergechroma(clp)

return edgemode!=-1 ? last : edge.spline36resize(dest_x,dest_y).greyscale()
}
If (dest_x != ox || dest_y != oy) then last and clp have different dimensions.

LaTo
13th November 2008, 20:12
If (dest_x != ox || dest_y != oy) then last and clp have different dimensions.
Thanks for the report, I will fix this (and graph) tomorrow ;)

LaTo
14th November 2008, 17:30
v1.1:
fixed a bug with dest_x!=ox or dest_y!=oy
replaced Lfactor by over/undershoot2

:)

LaTo
15th November 2008, 09:42
The new lsfmod is pretty much identical in detail compared to my lsf, when both plugins use dfault settings.
Yes on your "artificial" test, but on real content it's not the same deal, I haven't time to post screenshot... Test by yourself ;)

Adub
16th November 2008, 06:23
The pictures you included in your first link, labled lato lsf and my lsf, are exactly the same. I even ran a checksum on them.

LaTo
16th November 2008, 09:05
________ ffdshow LSF ________

Codecs tab
Set Mpeg2 to Libmpeg2, and check "DVD decoding".
Set Avisynth to Avisynth, Raw video to All supported

Subtitles tab, Unchecked
Uncheck "Decode closed captions"
Uncheck "Accept embedded subs"
Uncheck "Accept SSA, ASS, ASS2 Subtitle (experimental)
Vobsub subpage, uncheck Vobsub Enable.

Avisynth tab checked
YV12 checked,
Add FFdshow Video source checked,
3:2 Pulldown box: Ignore Pulldown checked,
Uncheck Buffer back/Ahead

MT("LimitedSharpenFaster()",2)

Resize & aspect tab checked
specify:
1920x1080 16:9 aspect ratio)
Process Pixel aspect ratio internally checked
No aspect ratio correction checked
spline
Luma Sharpen: 0.00
Luma Gaussian Blur: 0.50
Accurate rounding checked

Queue & Output tab
Queue output samples checked

Output tab
rgb32 checked
high quality yv12 to rgb conversion checked

rgb conversion tab
ycbcr: itu-bt 601
contrast: standard

pictures:
1.) mine
2.) lato's
3.) no lsf, but the rest of the config is the same.

Instead of posting a big unuseful FFDshow config, it's maybe better to put the source in the .zip...



In case your wondering on how t get rid of those jaggies. it's a product of the lsf sharpening strength.
About half the sharpness strength gets rid of them.
On my version of lsf anyway, I dunno about yours.
I tried with and without supersampling and it's doesn't matter, it's purely about how lsf sharpens that matters for more or less jaggies.
No, it's a product of your settings!
I haven't any jaggies when I apply sharpening on your simply resize + blur image...

On top of that:
The pictures you included in your first link, labled lato lsf and my lsf, are exactly the same. I even ran a checksum on them.
I have also tested...

Please, don't fill this subject with subjective difference between identical pictures from settings 1,2,3,...n. Thanks.

LaTo
16th November 2008, 10:51
I wasn't sure if the clip should use pulldown or force film, so I included both.
link (http://rapidshare.com/files/164258881/clips.zip.html)

It's the frame right after the horse scene.

Thanks... So, screenshots from your source:

Source (http://img519.imageshack.us/img519/9246/sourceng9.png)
JeremyDuncan (http://img518.imageshack.us/img518/6864/jeremyduncanra9.png)
LSFmod (http://img208.imageshack.us/img208/7864/lsfmoduf3.png)

No jaggies on LSFmod...

LaTo
16th November 2008, 11:29
Are you sure you have the newest lsf I made? And your using the default parameters on both your and my lsf versions?
Yes...

LaTo
17th November 2008, 19:26
I did not have the same results as you, LaTo.
I will link to some comparison pictures and you can tell me what you think:
link for LaTo (http://files.filefront.com/pictures+for+latozip/;12374039;/fileinfo.html)

If these conflicting results mean anything. To me it means for me the plugins act one way, and for you they act another.
Since I play mine in realtime that may be the difference.
I'm not calling you a lier, but there's something funny going on, maybe a bug somewhere?
You're doing something wrong... these 2 screenshots are 100% the same!!! :rolleyes:
A bug? Yes, on your side :p

Adub
17th November 2008, 19:46
This is just getting stupid. Jeremy Duncan, when you try to argue a point, don't screw yourself from the very beginning.

This is twice that you have tested, and come back complaining that you have different results. And then you present pictures as evidence, but it turns out that is the same picture with different names. Your credibility is now racing downhill my friend.

Jeremy Duncan
17th November 2008, 22:17
I would think that if I made a mistake, it would be by screen capture method would be wrong.
I usually press the "alt" "print screen" button, then paste into ms paint.
There could be a possibility that I use the same screen for both captures from user error...

However, the last picture comparison I took was from using the mpc screen capture utility, where it let's me choose to save the image on screen as either jpg or bmp.
I saved the shots as bmp.
I don't think there's much room for error there.

I try one version of lsf, then put that version on my desktop, then put the other version in the avisynth plugins folder as a avsi.
I tried to play lsf in ffdshow by putting the lsf plugin on my desktop and it didn't work, it had to be in the avisynth plugins folder.

Maybe we have different supporting plugins, and that's making the difference?
If your going to start name calling I don't have to reply.

In the end of the day it doesn't matter what you think, I have to believe myself, and I believe that I did these screenshots, all these screenshots, fairly.
I don't know you from a good or bad person, so it doesn't matter what you think, but I have to live with myself.
I did not post fraudulent screenshots.

Adub
17th November 2008, 23:20
Different plugins won't make a difference. Not in this case at least. What is possible is that you are loading the same script twice. Check to make sure that the two different scripts you used are actually different. Then, make sure that there are no other lsf based scripts in your plugins folder, as you could be calling a separate function all together.

Oh, another thought is that you may just be calling Limitedsharpenfaster() twice, and not changing it to LSFmod() on the second test. I don't know, as I do not have your script.

I have tested this on my machine as well, and I can confirm with LaTo. There must be some small mistake in your filtering chain on your end. We just have to keep working to find it.

And when you say "different plugins", how different are we talking? What versions are you using of masktools and removegrain?

Jeremy Duncan
19th November 2008, 00:42
Oh, another thought is that you may just be calling Limitedsharpenfaster() twice, and not changing it to LSFmod() on the second test.

That's exactly what I was doing. I tried calling lato's version lsfmod in ffdshow and I found the difference you two are talking about:
link to new pictures (http://files.filefront.com/pictureszip/;12394064;/fileinfo.html)

At any one time I only have one limitedsharpen version in the avisynth plugins folder.
When I try difference versions I put the other lsf plugin on the desktop, but for some reason that didn't work as without calling it lsfmod in ffdshow the same lsf plugin was used.
But if I try and only have one lsf on the pc and put the plugin on the desktop, it doesn't work, the lsf config...? :)

Edit,

I thought LaTo might want to see his results in the artificial test. Curiosity you know. So I took them and will post the link.
I will also post the link to the test disk I used for the artifical test.
I used the progressive one for ntsc.
artificial test results (http://files.filefront.com/artificial+testzip/;12394210;/fileinfo.html)
artificial test iso (http://forum.doom9.org/showthread.php?p=1184326#post1184326)

LaTo
19th November 2008, 19:28
Edit,

I thought LaTo might want to see his results in the artificial test. Curiosity you know. So I took them and will post the link.
I will also post the link to the test disk I used for the artifical test.
I used the progressive one for ntsc.
artificial test results (http://files.filefront.com/artificial+testzip/;12394210;/fileinfo.html)
artificial test iso (http://forum.doom9.org/showthread.php?p=1184326#post1184326)
Again, you haven't include the source in your zip (only a link with not the same resolution).
Reproductibility zero :rolleyes:

You use the default LSFmod on an artifical (=artefact & noise free) test:
The default is SdmpHi=25 which is a trick to not over-enhance some stuff, it can't reproduce some detail of your test. Your test is more or less unuseful in these conditions...
If you really want to compare on this test you should set SdmpHi=0!

On top of that, using ss_x=ss_y=1.0 on this sort of test is an advantage... But it's clearly bad on real footage (aliasing, nervous picture, ...)

So, below is my comparaison. :D


Artificial test:

Source (http://latoninf.free.fr/d9/LM/compare/A_SOURCE.png)
LimitedSharpenFaster() @ default (http://latoninf.free.fr/d9/LM/compare/A_LSF.png)
LSFmod() @ default (http://latoninf.free.fr/d9/LM/compare/A_LSFMOD.png)
LSFmod(SdmpHi=0,ss_x=1.0,ss_y=1.0) (http://latoninf.free.fr/d9/LM/compare/A_TUNED.png)
JeremyDuncan() @ default (http://latoninf.free.fr/d9/LM/compare/A_JD.png)



Real video test:

Screenshot1:
Source (http://latoninf.free.fr/d9/LM/compare/S1_SOURCE.png)
LimitedSharpenFaster() @ default (http://latoninf.free.fr/d9/LM/compare/S1_LSF.png)
LSFmod() @ default (http://latoninf.free.fr/d9/LM/compare/S1_LSFMOD.png)
LSFmod(SdmpHi=0,ss_x=1.0,ss_y=1.0) (http://latoninf.free.fr/d9/LM/compare/S1_TUNED.png)
JeremyDuncan() @ default (http://latoninf.free.fr/d9/LM/compare/S1_JD.png)

Screenshot2:
Source (http://latoninf.free.fr/d9/LM/compare/S2_SOURCE.png)
LimitedSharpenFaster() @ default (http://latoninf.free.fr/d9/LM/compare/S2_LSF.png)
LSFmod() @ default (http://latoninf.free.fr/d9/LM/compare/S2_LSFMOD.png)
LSFmod(SdmpHi=0,ss_x=1.0,ss_y=1.0) (http://latoninf.free.fr/d9/LM/compare/S2_TUNED.png)
JeremyDuncan() @ default (http://latoninf.free.fr/d9/LM/compare/S2_JD.png)



It's magical :p

Jeremy Duncan
19th November 2008, 23:44
Again, you haven't include the source in your zip (only a link with not the same resolution).
Reproductibility zero :rolleyes:

It's the source. It's just resized.
Do you see that large bar, to the Left of the moving pattern?
Well, if you Enlarge the picture through resizing, it becomes a measure of the quality of the picture.
If you don't resize the picture, then the pattern on that bar is way too small to be used as a measure of quality.

Do you see the ffdshow configuration I made above.
I used Spline resize Below or After lsfmod and resized the picture to 1080p.

There's so many tiny things in the artificial test that are indicators of quality that are Missed if you don't resize the picture.

A hint.
This is a artificial test that measures plugins like lsfmod and resizing, not just lsfmod or my lsf version.

Your picture of the artificial test is meaningless unless you use spline resize and resize the picture to 1080p.

I'm not being mean. If I made a mistake like that I would be happy if somebody mentioned it to me instead of keeping quiet.
:helpful:

LaTo
20th November 2008, 17:31
It's the source. It's just resized.
Yes, but how? lanczos? spline? bicubic? bilinear? As I said, your test wasn't reproducible.

Do you see that large bar, to the Left of the moving pattern?
Well, if you Enlarge the picture through resizing, it becomes a measure of the quality of the picture.
If you don't resize the picture, then the pattern on that bar is way too small to be used as a measure of quality.

Do you see the ffdshow configuration I made above.
I used Spline resize Below or After lsfmod and resized the picture to 1080p.

There's so many tiny things in the artificial test that are indicators of quality that are Missed if you don't resize the picture.

A hint.
This is a artificial test that measures plugins like lsfmod and resizing, not just lsfmod or my lsf version.

Your picture of the artificial test is meaningless unless you use spline resize and resize the picture to 1080p.
Yes, yes, yes...
If you believe that your test is a quality's measure or that ss_x=ss_y=1.0 isn't a bad idea and doesn't produce aliasing... why not, it's your opinion! :rolleyes:
But, please stop posting in this thread about this... Thanks!

Jeremy Duncan
20th November 2008, 20:08
Yes, but how? lanczos? spline? bicubic? bilinear? As I said, your test wasn't reproducible.

With ffdshow spline.

But it's not about reproducing the same picture.

Here, try this and just look at the results.
lsfmod()
spline64resize(1920, 1080)

limitedsharpenfaster()
spline64resize(1920, 1080)

(The second code is with my lsf version.)

take a screenshot of both pictures, compare.

The point is I could have used a different resize method than ffdshow spline and got comparable results.
One reason is that sine I used the ntsc artificial test, your use of supersampling messes with the picture.

Nevermind, I will do it for you.
link to new pictures with said avisynth code for LaTo (http://www.megaupload.com/?d=4T2CNDFO)

The pictures are edited of course, a snip has been taken out of the top and bottom to make it a lower resolution than 1080p.
This was done in ms paint.
The resolution was 1080p, I cut a bit from the top and bottom to make it 1550x910, but I didn't mess with the resolution.

LaTo
23rd November 2008, 19:08
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

pitch.fr
23rd November 2008, 19:54
LaTo, my dear friend with your great scripts :)

I'll try not to thread crap like Jeremy :D

atm I'm using this on HD content :

1)unsharp masking in ffdshow set to 6(to get some very slight EE), then
2)LimitedSharpenFaster(ss_x=1.0,ss_y=1.0,strength=40)

any idea what I could try in your modded LSF to make it look even better(and not use 500% more CPU :D ) ?

before I chose these settings, I ran many tests....and with ss1.0 I do get jaggies on 720p videos but with >1.0 it's a bit too blurry to my taste.

I also tried to raise >40, but then some ugly posterization pointed its face..

I never really managed to get the overshoot stuff working..

thanks for any advice!

Jeremy Duncan
24th November 2008, 12:28
lsfmod(strength=50, Smode=3, ss_x=1.00)
spline64resize(1920, 1080)

This is using the 1.2 version.
Notice there is no supersampling.
Notice also smode is 3, not 5.
And the strength is half the default.

I calibrated it as much as I could. :helpful:

LaTo
25th November 2008, 19:28
LaTo, my dear friend with your great scripts :)

I'll try not to thread crap like Jeremy :D

atm I'm using this on HD content :

1)unsharp masking in ffdshow set to 6(to get some very slight EE), then
2)LimitedSharpenFaster(ss_x=1.0,ss_y=1.0,strength=40)

any idea what I could try in your modded LSF to make it look even better(and not use 500% more CPU :D ) ?

before I chose these settings, I ran many tests....and with ss1.0 I do get jaggies on 720p videos but with >1.0 it's a bit too blurry to my taste.

I also tried to raise >40, but then some ugly posterization pointed its face..

I never really managed to get the overshoot stuff working..

thanks for any advice!
If you want speed, add Lmode=1 & soothe=false.
Choice between Smode=3 or Smode=5 is simply a personal taste, test by yourself ;)

This one should do the job
LSFmod(strength=XX,Lmode=1,soothe=false,Smode=5) # ajust strength and try Smode 3 & 5

LaTo
27th November 2008, 16:30
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

:cool:

Archimedes
27th November 2008, 21:26
I get some strange results with the default settings now.
Example: LSFmod(100) produces sharper results than LSFmod(400). With soft = 0 it works.

LaTo
27th November 2008, 21:43
I get some strange results with the default settings now.
Example: LSFmod(100) produces sharper results than LSFmod(400). With soft = 0 it works.
Try to re-download v1.3... (I have added a sqrt() to the calculation)
And post a sample please, because I can't reproduce this...

Archimedes
27th November 2008, 23:09
Try to re-download v1.3... (I have added a sqrt() to the calculation)
That was it. Thanks.

halsboss
28th November 2008, 13:42
Thanks !


In order of strength:
- 1 < 3 < 5 < 2 < 4 +

In order of speed:
- 5 < 4 < 3 < 2 < 1 +

In order of quality:
- 4 < 2 < 1 < 3 < 5 +


Is this still the case after the mods (smodes changed, didn't they ?) ?

Also, does that mean smode=5 is (was?) mid strength but the slowest and highest quality ? I'd thought smode=5 was now a modded smode=4 for v1.3.

Also, is the same plugin set required or are there additional/newer plugins etc required ? A quick peruse of post #1 and didn't readily spot it.

LaTo
28th November 2008, 18:33
Is this still the case after the mods (smodes changed, didn't they ?) ?

Also, does that mean smode=5 is (was?) mid strength but the slowest and highest quality ? I'd thought smode=5 was now a modded smode=4 for v1.3.
Smode != Smethod... Be careful ;)

Also, is the same plugin set required or are there additional/newer plugins etc required ? A quick peruse of post #1 and didn't readily spot it.
I have added filters required into the first post and into the script...

McCauley
7th January 2009, 17:43
Hi LaTo,

thanks for this superb modification of LSF!

May i make a few requests?

Presets for realtime DVD playback would nice. I have something like that in mind:
LSFmod(DVD=true, AR=2.35:1 displaysize=720)
So it automatically crops off 1/6 from the top and the bottom, sets the resolution to 1280:544 and sharpens it.
Equivalent settings for 16:9 and 4:3 content.

Also MoComped sharpening/soothing would be nice for those who don't mind a little bit slower encoding, but want to save a few bits.

Regards and thanks in advance
McCauley

Adub
7th January 2009, 19:15
I doubt he is going to implement such a request as a) every dvd is different and every person watching a dvd is different. Just save your favorite settings to a script and import it when ever you want. b) If you want mocomp, look at mctemporaldenoisePP.

McCauley
7th January 2009, 23:28
Hi Merlin,

b) I doubt he is going to implement such a request as a) every dvd is different and every person watching a dvd is different. Just save your favorite settings to a script and import it when ever you want.
There are basically 3 kinds of DVDs: 4:3, 16:9, 21:9, not that much. Of course they differ in height or width for about 3.8 lines, but who cares...
Maybe an additional preset, with detail enhancement (higher overshoot2 and perhaps something else) and the thing would be fine. Of course you can still tweak every value according to your needs.

b) If you want mocomp, look at mctemporaldenoisePP.

I had that idea too, BUT it hasn't all the parameters i need - of course i could fiddle in the missing ones, but if i would do that, i could also try to modify LSFmod, the work to do would be the same.
Also if you want to resize, you have to supersize, do a motion search on a 2400x1360 clip for a full hd vid, sharpen with ss_x=1, profit from the MC'ed soothe, and then resize to for example to 720p or whatever. Or have i gotten it wrong?!

Regards
McCauley

Sagekilla
8th January 2009, 02:59
I think the point Merlin was trying to get across was that there's no point in doing presets. It's -extremely- trivial to set up LSF for use with a DVD with an AR of 4:3, 16:9, or 2.35:1 as is.

4:3 - LSF(width=720,height=540)
16:9 - LSF(width=848,height=480)
2.35:1 - LSF(width=848,height=352)

Not hard at all. And as Merlin said, if you want a specific preset, just write it out as a custom line or function:


# DVD Preset
# LimitedSharpenFaster(...)
# Blu-ray Preset
# LimitedSharpenFaster(...)
# All others
# LimitedSharpenFaster()


Adding in presets just complicates things and discourages the user from playing around with the settings to find the best result they like.

LaTo
8th January 2009, 17:19
Presets for realtime DVD playback would nice. I have something like that in mind:
LSFmod(DVD=true, AR=2.35:1 displaysize=720)
So it automatically crops off 1/6 from the top and the bottom, sets the resolution to 1280:544 and sharpens it.
Equivalent settings for 16:9 and 4:3 content.
Sorry, I will not implement this... (for the reasons given by Merlin7777 & Sagekilla)

Also MoComped sharpening/soothing would be nice for those who don't mind a little bit slower encoding, but want to save a few bits.
It was already on my todo list, but I haven't time right now (study... :devil:)

rkalwaitis
25th January 2009, 23:33
Lato,

I find this a very useful script, but unlike you other scripts I can not compare my efforts with the show true or false option. What is the chance of maybe adding that? I do like seeing the original and the filtered side by side. Just something to think about. If I were smart enough I would do it myself.

Thanks, K

Sagekilla
26th January 2009, 00:23
A very, very easy way to do that would be (AvsP + VDM optional, both make it infinitely easier):


a = last
b = a.LSFMod()

Interleave(a,b)

rkalwaitis
26th January 2009, 18:33
Sagekilla,

If I interleave them doesnt that defeat the purpose of seeing the original input and the filtered output in seperate panes? That was the beauty of the other show commands from other Lato scripts. I tried to play around with it a bit and the little script I worked on would show both input and output, but they were not in synch. In other words the input played much closer to real time than the output. I wanted to see the same frames and the same time as in MCTemporalDenoise show option. I keep playing with it. I get an input and output view with VD (as you know), but I run scripts with avisynth and the input is filtered already for the output to change I need to filter the avs file with a vd filter. So it really does my no good. I like to open the avs files in media player and then I can see the unfiltered input and filtered output. I can see what I actually changed.

lastly since you a x264aholic I would be interest in perhaps you sharing the settings you use for your products when you use MCTemporaldenoise.

Thanks

rkalwaitis
26th January 2009, 18:35
Sagekilla,
Primarily Motion Estimation settings.
thanks

LaTo
26th January 2009, 20:57
Lato,

I find this a very useful script, but unlike you other scripts I can not compare my efforts with the show true or false option. What is the chance of maybe adding that? I do like seeing the original and the filtered side by side. Just something to think about. If I were smart enough I would do it myself.

Thanks, K

Yes, It's on my todo list for v1.4.
But when? Maybe in 1 week, 1 month... I don't know :p

Sagekilla
26th January 2009, 21:10
@rkalwaitis: The idea of interleaving the original frame and the processed frame is that you could flip back and forth in a program like AvsP or VirtualDub(Mod) and see exactly what the filter did.

Also, the x264 is a bit off topic, check your pms ;)

rkalwaitis
26th January 2009, 21:30
Im gonna check out the Avsp and the Mod version of VirtualDub. You guys are teaching me too much.

Thanks Lato, ill watch for it. Good stuff!!!!

Blue_MiSfit
28th January 2009, 01:41
If you want to do side-by-side comparison it's very easy. AvsP is my weapon of choice!


a=last
lsfmod()
stackhorizontal(a,last)


volia :)

~MiSfit

rkalwaitis
29th January 2009, 15:37
Thanks Misfit, That was simple enough even I got it.

dansus
30th January 2009, 13:04
Hi, im getting error at 0k in megui with 1.3.

Ive updated all dependencies and seemingly no clue why its failing, any ideas?

LaTo
30th January 2009, 16:00
Hi, im getting error at 0k in megui with 1.3.

Ive updated all dependencies and seemingly no clue why its failing, any ideas?

Post your script and the exact error message...

LaTo
31st January 2009, 21:14
v1.4:
changed defaults="new" to defaults="slow" & defaults="fast"
added show parameter
cleaned a little the code

:cool:

MadRat
31st January 2009, 23:54
My favorite sharpener is FFT3DFilter. Has there been a unbiased, objective comparison between LSFmod and FFT3DFilter?

rkalwaitis
1st February 2009, 00:12
Thanks for the show option Lato, you rock.

K

Jeremy Duncan
1st February 2009, 03:29
My favorite sharpener is FFT3DFilter. Has there been a unbiased, objective comparison between LSFmod and FFT3DFilter?

I made a test disk especially for just that kind of reasoning, MadRat.

In the test disk is a moving pattern, and in that moving pattern is a hidden image that is revealed by enhancing the image quality.

The disk was intended to be used with a resizer to enlarge the picture, as well as with a plugin like seesaw or lsfmod or fft3dfilter.

here is the test disk.
progressive ntsc test disk (http://www.megaupload.com/?d=PHYV5OKP)

MadRat
1st February 2009, 06:27
I made a test disk especially for just that kind of reasoning, MadRat.

In the test disk is a moving pattern, and in that moving pattern is a hidden image that is revealed by enhancing the image quality.

The disk was intended to be used with a resizer to enlarge the picture, as well as with a plugin like seesaw or lsfmod or fft3dfilter.

here is the test disk.
progressive ntsc test disk (http://www.megaupload.com/?d=PHYV5OKP)

Thank you, and I did download it but I was asking if there was a way of actually measuring, for example on a graph, the amount of sharpening as well as the negatives like banding, noise enhancement and haloing.

Jeremy Duncan
1st February 2009, 06:44
Thank you, and I did download it but I was asking if there was a way of actually measuring, for example on a graph, the amount of sharpening as well as the negatives like banding, noise enhancement and haloing.

The test disk shows haloing or no haloing dependant on the script.

Been a while since I looked at banding or noise stuff, so I can't quite say if the disk will show results for those, but it might. :)

The test disk is not a graph, but the hidden pattern on the moving part is a clear indicator of the quality of the plugin and the setting used with the plugin, as you will not get a clear look at the hidden pattern without a quality plugin and quality settings.

lych_necross
1st February 2009, 07:26
@LaTo,

I just tried v1.4 with the defaults="fast" settings, and it looks great. I love using it for realtime processing.

mikeytown2
1st February 2009, 11:10
@MadRat
U can play around with this if you want graphs
http://forum.doom9.org/showthread.php?t=144638

rkalwaitis
3rd February 2009, 19:01
Lato,

This rocks. Just a quick question. Can utilizing to much sharpening add a grainy appearance?

LSFmod(smode=5,smethod=5,defaults="fast", soft=-2,edgemaskHQ=true)......This is what I tried.

Sagekilla
4th February 2009, 01:54
Sharpening the details too much could also sharpen the grain inherent in film content. So yes, excessive sharpening and amplify grain beyond it's normal appearance.

DegrainMedian
4th February 2009, 07:32
Thanks for sharing ...

rkalwaitis
4th February 2009, 18:35
Thanks Sagekilla,

That is what Im doing then. Im oversharpening which causes a grainy appearance. I have the same problem with seesaw spresso combo. Ill relook at what Im doing.

k

EuropeanMan
4th February 2009, 18:53
^ are you denoising before sharpening...if you need grain in your print...try adding it afterwards?

EuropeanMan
4th February 2009, 18:55
I made a test disk especially for just that kind of reasoning, MadRat.

In the test disk is a moving pattern, and in that moving pattern is a hidden image that is revealed by enhancing the image quality.

The disk was intended to be used with a resizer to enlarge the picture, as well as with a plugin like seesaw or lsfmod or fft3dfilter.

here is the test disk.
progressive ntsc test disk (http://www.megaupload.com/?d=PHYV5OKP)

downloaded your test pattern...will be interesting to see what I can come up with...haven't tried sharpening through fft3d yet...thanks for this.

i also would be interested if anyone has posted object results from testing fft3d vs. lsf vs. seesaw

leeperry
4th February 2009, 19:30
anyone has posted object results from testing fft3d vs. lsf vs. seesaw
I would personally love to see some examples where LSFmod looks better than LSF.
I've tried a lot of stuff, I can't spot any difference...and I'm using a very fast build of LSF, so I would only be willing to drop it if there were any visible improvement :p

rkalwaitis
4th February 2009, 19:32
European Man. Seesaw is faster than FFT3d. I try to use it in this way. Depending upon the settings and the source you can get very good results.

a = last
b = a.FluxSmoothT(11)
SeeSaw(a, b, NRlimit=2, NRlimit2=1, Sstr=1.4, Slimit=7, Spower=2, Sdamplo=8, SdampHi=10, Szp=10, bias=1, sootheT=30)
SPresso(limit=2, limitC=2, bias=100, biasC=100, RGmode=4, RGmodeC=4)

This is off course to taste. Sstr=1.4 ive noticed controls the grainy look. The lower the number the less obvious grain. I max out my Spresso bias'. But 80-up seem to give nice results. RGmodes and remove grain.....you know the drill.

I will try denoising after sharpening. Let you know what It comes out with.

thanks k

LaTo
4th February 2009, 20:09
I would personally love to see some examples where LSFmod looks better than LSF.
Easy :p

Source [685kb] (http://latoninf.free.fr/d9/LM/compare/3src.png)
LimitedSharpenFaster(strength=200) [820kb] (http://latoninf.free.fr/d9/LM/compare/3lsf.png)
LSFmod(defaults="slow",strength=200) [721kb] (http://latoninf.free.fr/d9/LM/compare/3slow.png)
LSFmod(defaults="fast",strength=200) [720kb] (http://latoninf.free.fr/d9/LM/compare/3fast.png)

It's not a revolution, but LSFmod is better than LSF for me...

leeperry
4th February 2009, 20:24
hummm interesting :D

LSF does crazy banding in the bottom right, LSFmod does not....but you used extreme strength, I use ss1.0 strength=40 in ffdshow as LSF does ugly posterizing if I go >40 :o

rkalwaitis
4th February 2009, 20:28
I agree LSFMod is better than LSF.

Sagekilla
4th February 2009, 22:30
If you look at the roof of the house, it looks like LSFMod managed to enhance the details there better than LSF did.

krieger2005
5th February 2009, 09:42
But LSFMod (slow) add also more halos (see the tree trunk at the left side at the bottom).

LaTo
8th February 2009, 21:07
v1.5:
fixed LUT expression (thanks to Didée)
changed Smethod to Smethod+secure

;)

McCauley
11th February 2009, 14:07
Hi LaTo,

thanks for your constant updates.
Any ETA for the MoComped sharpening/soothing? Looking forward to it.

Regards
McCauley

LaTo
14th February 2009, 18:30
v1.6:
added preblur option
added new Smethod=4

canuckerfan
18th February 2009, 21:27
i'm a little confused about the default settings for this script. I understand the 3 different templates you have set (old, slow, and fast). but what are the defaults for each individual parametre? and can I make changes to a parametre once a template has been activated (ex: LSFMod(defaults="slow", strength=65)?

LaTo
19th February 2009, 21:24
v1.7:
changed Smethod=4 to "source"

LaTo
20th February 2009, 15:32
Another use of the source clip:

You can set an "inverse-degrained clip" as a source clip and bypass Lmode&PP...
Effects are really not bad and it's very fast! I use this script in realtime with 1080p :cool:

LSFmod(source=mt_adddiff(last,mt_makediff(last,last.removegrain(17,-1),U=1,V=1),U=1,V=1),
\ strength=100,Smode=3,Smethod=1,preblur="OFF",secure=false,Lmode=0,soothe=false)

Source (http://latoninf.free.fr/d9/LM/compare/0src.png)
Code above (http://latoninf.free.fr/d9/LM/compare/0special.png)

:)

(You can adjust strength to your taste, try also removegrain(4,-1) which is stronger but some halos are left)

badshah
20th February 2009, 18:21
where is the download link

LaTo
20th February 2009, 18:33
where is the download link

In the first post :rolleyes:

LaTo
21st February 2009, 09:15
Just a quick question. Can utilizing to much sharpening add a grainy appearance?
Yes, but you can try to avoid this with preblur=true

...but you used extreme strength, I use ss1.0 strength=40 in ffdshow as LSF does ugly posterizing if I go >40 :o
Can you show a screenshot with this "ugly posterizing" (and the source) ? :thanks:

leeperry
21st February 2009, 11:20
Can you show a screenshot with this "ugly posterizing" (and the source)?
well, it's very subtle....you can use any HD source, then this in MT :
LimitedSharpenFaster(ss_x=1.0,ss_y=1.0,strength=40)
and it will look good, but if you go >40 it will exhibit very ugly posterizing :o
I've tried it all overshoot/blur etc etc, never managed to overcome this issue....so I'm using very little unsharp masking(set to 3) in ffdshow, then LSF on top of it@ss1.0/40 :)

BTW, I also tried your LSFMod 1.6 but it's really slow compared to the original LSF(even further w/ the LimitedSupport_09Jan06B.dll modded version).....and even this was mad slow in the VDUB benchmark :

LSFmod(ss_x=1.0,ss_y=1.0,Lmode=1,soothe=false,Smode=5,strength=40)

I believe it was much faster with <1.4 builds :o

LaTo
21st February 2009, 11:58
well, it's very subtle....you can use any HD source, then this in MT :
LimitedSharpenFaster(ss_x=1.0,ss_y=1.0,strength=40)
and it will look good, but if you go >40 it will exhibit very ugly posterizing :o
I've tried it all overshoot/blur etc etc, never managed to overcome this issue....so I'm using very little unsharp masking(set to 3) in ffdshow, then LSF on top of it@ss1.0/40 :)

BTW, I also tried your LSFMod 1.6 but it's really slow compared to the original LSF(even further w/ the LimitedSupport_09Jan06B.dll modded version).....and even this was mad slow in the VDUB benchmark :

LSFmod(ss_x=1.0,ss_y=1.0,Lmode=1,soothe=false,Smode=5,strength=40)

I believe it was much faster with <1.4 builds :o

If you want exactly the same settings as LSF (so the same speed), simply: LSFmod(defaults="old")

Try secure=true on your clip with your settings:
LSFmod(defaults="old",ss_x=1.0,ss_y=1.0,secure=true,strength=40)

This should fix the "posterizing" problem (even with strength>40)...
If not, post a sample please, because I can't reproduce the issue on my side ;)

leeperry
21st February 2009, 12:32
well it gives a "wax museum" look to faces @ss1.0>40 :D

ok I'll try and report back, thanks for your help

rfmmars
22nd February 2009, 08:27
Using a 720p .Mkv file in AVSp I had servre color fringing. Using the Std. LSF funtion I did not. Also the speed was 50% slower for version 1.7


LSFmod(SdmpHi=1,ss_x=2.0,ss_y=2.0,strength=[<"Sharpness (400)", 0, 1000, 185>])

Had same results with LSFmod()


http://img9.imageshack.us/img9/6914/lsfmodcolorproblem.th.jpg (http://img9.imageshack.us/my.php?image=lsfmodcolorproblem.jpg)

Richard

LaTo
22nd February 2009, 09:24
Using a 720p .Mkv file in AVSp I had servre color fringing.
I haven't this issue in my side, please post a sample... (1-2sec is okay)

Also the speed was 50% slower for version 1.7
You should use defaults="fast" if you want speed

rfmmars
22nd February 2009, 19:16
I haven't this issue in my side, please post a sample... (1-2sec is okay)


You should use defaults="fast" if you want speed

What interesting is it isn't on each frame, in fact you can go back and forth and then to the problem frame again and the the color is fine, but again going back and forth again to that frame, the color error may be the same, less or greater. The problem appears every 7 or 8 frames, and lasts 1 to 3 frames.

I have two tabs in AVSp with identical scripts except one has the standard LSF checked and the other with your version 1.7 checked. I haven't seen this problem in your other releases.

I will post a small clip as soon as possible.

Richard

rfmmars
22nd February 2009, 20:45
It looks like a memory problem on my end. Today when I was making a sample clip to upload, the problem wasn't there. Yesterday it happen at the end of a long computer session, I should have rebooted before posting a non exiting problem, well maybe 1.7 does use more memnory since the LSF std didn't have that problem, but now LSFmod.1.7 looks great now.

I changed Defults to "fast" and yes it ran much much faster.

Sorry for all the trouble.

Richard

canuckerfan
22nd February 2009, 20:56
i'm a little confused about the default settings for this script. I understand the 3 different templates you have set (old, slow, and fast). but what are the defaults for each individual parametre? and can I make changes to a parametre once a template has been activated (ex: LSFMod(defaults="slow", strength=65)?
i'm still a little confused about this... could someone please clarify?

LaTo
23rd February 2009, 06:21
I understand the 3 different templates you have set (old, slow, and fast). but what are the defaults for each individual parametre?
You should read the first post or the readme at the beginning of the script (in the SETTINGS part).
By default, LSFmod uses defaults="slow".

and can I make changes to a parametre once a template has been activated (ex: LSFMod(defaults="slow", strength=65)?
Yes, you can change everything...
ex: LSFMod(defaults="slow", Lmode=1, Soothe=false, strength=200)

McCauley
11th March 2009, 01:33
Hi LaTo,

have you had a look at this (http://forum.doom9.org/showthread.php?p=1256206#post1256206)?
If used as upsizer the result is sharper, but i havent found good sources to test detail retention and haloing behaviour.
Perhaps it is worth a look.

Regards
McCauley

PS: Still waiting for the m'c'ed sharpening. :devil:

@Tron@
13th March 2009, 06:57
Thanks for updates. Its relly great !

Manaka
17th April 2009, 19:37
I can't use LFSmod, AvsP report that "there is no function named repair". Help me guys!

Keiyakusha
17th April 2009, 19:50
Manaka

### +--------------+
### | DEPENDENCIES |
### +--------------+
###
### -> Masktools (v2a35)
### -> Removegrain (v1.0pre)
### -> Warpsharp (2003.11.03) [for Smode=1]
### -> Variableblur (v0.30) [for Smode=2]

BigDid
17th April 2009, 20:02
I can't use LFSmod, AvsP report that "there is no function named repair". Help me guys!
Hi and welcome to the forum,

Repair is part of removegrain package.
As indicated by previous poster (from 1st post 1st page this thread) you need the "Removegrain (v1.0pre)"

If you have difficulty finding it you may (not sure) get it from a link for animeivtc:
http://forum.doom9.org/showthread.php?p=1144440#post1144440

Did

Nikos
3rd May 2009, 02:49
Hi LaTo, i have a question.
Until ver. 1.5 the default value for SdmpHi was 24, the same as the original SeeSaw function and according to Didée the useful range is 15-30.
SdampHi = default( SdampHi, 24 ) # further reduces sharpening for big sharpening changes. Try 15~30. "0" disables.
From ver 1.6 the default value for SdmpHi is 128.

Why such a big change?

Thanks again for your excellent work.

LaTo
12th June 2009, 18:18
v1.8:
changed preblur to allow more tweaking (bool->string)
tweaked settings
cleaned the code
updated documentation


Nikos> I don't know, just a mistake... it's corrected ;)

Gengero
8th July 2009, 17:22
THX LaTo for your last update, n' THX for your help today :p

travolter
21st July 2009, 01:04
congrats pal!! its an amazing script!!!

I cannt live without it and also without framerate doubling

These 2 are the perfect combo for HD videos ;)



currently I use this one for realtime processing:

LSFmod(defaults="old",ss_x=1.0,ss_y=1.0,secure=true,strength=40)

PLz can you give me a settings example for do Deringing into your scrpit? I hate the stupid halo in some videos

LaTo
21st July 2009, 07:14
PLz can you give me a settings example for do Deringing into your scrpit? I hate the stupid halo in some videos
Ringing and haloing aren't the same!

LSFmod has a function to AVOID these stuff when sharpening, but it can't kill them if they are already in the source before processing.


If you want to avoid ringing:
LSFmod(preblur="ON") or LSFmod(preblur="MinBlur()")

But you can set what you want in this script, for example if you want to prevent halo sharpening:
LSFmod(preblur="dehalo_alpha()")

If you doesn't want to sharp the noise in a video:
LSFmod(preblur="dfttest()")

[...]
They are just examples, try and look by yourself...

If someone find a good and useful *combo* for preblur, please post it here!

travolter
21st July 2009, 12:42
Ringing and haloing aren't the same!

LSFmod has a function to AVOID these stuff when sharpening, but it can't kill them if they are already in the source before processing.

oh thanks pal! I understand much better how LSFmod works.

I need to find a deringing filter to apply before LSFmod.. cause I notice that many videos can increase in quality just removing ringing effect.
ANyone know/use some deringing script that consume few CPU to apply in real time?

Thanks for the settings that you posted.. Ill do experiments with them.

EDIT.-
These settings (preblur="ON") (preblur="dehalo_alpha()") are very cpu hungry for realtime.. anyway I dont notice so much difference when using low quality videos (things from youtube)

About BLUR and remove ringing... currently I use the Gaussian Blur sliders thats appear into FFDshow resize tab (remember that Im using FFDshow and avisynth scripts for live playing... no encoding) the problem is that they apply Blur to all the image so I lose definition.. and if I sharp later with LFSmod.. the result is not so good that without Blur

LaTo
21st July 2009, 13:12
About BLUR and remove ringing... currently I use the Gaussian Blur sliders thats appear into FFDshow resize tab (remember that Im using FFDshow and avisynth scripts for live playing... no encoding) the problem is that they apply Blur to all the image so I lose definition.. and if I sharp later with LFSmod.. the result is not so good that without Blur

You should look at MCTemporalDenoisePP(edgeclean=true) or HQDering()

travolter
21st July 2009, 14:24
MCTemporalDenoisePP(edgeclean=true) or HQDering() are powerful scripts.. but they are not fast enough to work in realtime (neither with MT)

some less CPU hungry scripts are needed or.. wait some years for much better CPUs ;)

rkalwaitis
22nd July 2009, 08:13
Nice to know about the ringing and halos Lato.

Adub
23rd July 2009, 21:25
Actually, I've gotten HQDering() to work in realtime before. What kind of machine are you running?

D'zzy
1st August 2009, 16:44
### +--------------+
### | DEPENDENCIES |
### +--------------+
###
### -> Masktools (v2a35)
### -> Removegrain (v1.0pre)
### -> Warpsharp (2003.11.03) [for Smode=1]
### -> Variableblur (v0.30) [for Smode=2]

LSF is already very impressive to me, LSFmod (seen from LaTo's samples), for my personal taste, looks even better!
Thanks very much LaTo, I'm gonna try this nice script! Just in case, my question here:

Are Masktools-v2a36 and Variableblur-v0.4 OK ? Or the versions are strictly required?
Also, If I never use Smode=1 or 2, I don't have to load Warpsharp or Variableblur, right?

LaTo
1st August 2009, 16:49
Are Masktools-v2a36 and Variableblur-v0.4 OK ? Or the versions are strictly required?
It should be OK ;)

D'zzy
1st August 2009, 16:53
It should be OK ;)

Nice!
Also, Another newbie question:
If I never use Smode=1 or 2, I don't have to load Warpsharp or Variableblur, right?

LaTo
2nd August 2009, 18:28
Nice!
Also, Another newbie question:
If I never use Smode=1 or 2, I don't have to load Warpsharp or Variableblur, right?
right!

colargol7
9th August 2009, 19:20
Hi

Thanks for the mod, LaTo :)

As you are french, you may help me with french DVB-T HD.
What parameters would you advise if I want to resize a 1080i TV show into 720p with x264?

LSFmod(ss_x=1.0, ss_y=1.0, dest_x=1280, dest_y=720, Smode=3, strength=60)I tried with that but I'm not sure it's the best choice. It's really hard to make conclusions.
Should I use higher "strength" param?
I never used sharpen before :confused:
Thanks

LaTo
9th August 2009, 20:35
Hi

Thanks for the mod, LaTo :)

As you are french, you may help me with french DVB-T HD.
What parameters would you advise if I want to resize a 1080i TV show into 720p with x264?

LSFmod(ss_x=1.0, ss_y=1.0, dest_x=1280, dest_y=720, Smode=3, strength=60)I tried with that but I'm not sure it's the best choice. It's really hard to make conclusions.
Should I use higher "strength" param?
I never used sharpen before :confused:
Thanks

ss_x=1.0 & ss_y=1.0 aren't good for aliasing... Don't change this unless you want realtime.

Smode=3 or Smode=5 is a taste's choice, test and pick the best for you.
The same for strength.

If it is slow, try defaults="fast".

colargol7
9th August 2009, 20:56
Ok thanks you very much! ;-)
I'll try Smode=5...

actarusfleed
9th August 2009, 23:28
Hi to all,
I'm a new HTPC entusiast.
I want to try this sharpener but i do not find any Installation guide with the links of the files to download.

Can you help me please?

thank you,
Francesco.

leon1789
4th October 2009, 16:25
Source (http://latoninf.free.fr/d9/LM/SRC.png)
LimitedSharpenFaster(strength=300) (http://latoninf.free.fr/d9/LM/LSF.png)
LSFmod(defaults="slow",strength=300) (http://latoninf.free.fr/d9/LM/SLOW.png)
LSFmod(defaults="fast",strength=300) (http://latoninf.free.fr/d9/LM/FAST.png)

It's not a revolution, but LSFmod is better than LSF for me...

I try it with SoftSharpen(preset="film",sharp=38,AA=30,dering=0,deban=1.2) : http://img121.imageshack.us/img121/1816/frame3ss.th.png (http://img121.imageshack.us/i/frame3ss.png/)

I try it with SoftSharpen(preset="film",sharp=38,AA=30,dering=0) : http://img200.imageshack.us/img200/9898/frame3ssdeban.th.png (http://img200.imageshack.us/i/frame3ssdeban.png/)


LSFmod(source=mt_adddiff(last,mt_makediff(last,last.removegrain(17,-1),U=1,V=1),U=1,V=1)
\ ,Smethod=1,soothe=false,Lmode=0,soft=0)

Source (http://latoninf.free.fr/d9/LM/orig.png)
Code above (http://latoninf.free.fr/d9/LM/shrp.png)
:)


An other attempt with SoftSharpen(sharp=26,AA=17,derin=0,denois=0) : http://img504.imageshack.us/img504/1755/origss.th.png (http://img504.imageshack.us/i/origss.png/)

Please, what do you think about these two screenshots ? (for instance compressibility, ringing, aliasing, halos... details on the roof of the house :()

LaTo
4th October 2009, 16:35
SoftSharpen destroy too much the picture :eek:

Sorry but, I think that it's very ugly!
Maybe bad settings... Maybe not :p

And compressibility isn't much better:

Screenshot 1 : 790kb vs 622kb (-21%)
Screenshot 2 : 3092kb vs 2606kb (-16%)

:)

McCauley
4th October 2009, 17:56
Hi LaTo,

i asked before, but since Softsharpen was mentioned in this thread i'll ask again: :)
Softsharpen features Sharpening only for the static parts, it would be nice to see this integrated in LSFmod too.
Any chance for that?

Regards
McCauley

LaTo
4th October 2009, 18:19
Hi LaTo,

i asked before, but since Softsharpen was mentioned in this thread i'll ask again: :)
Softsharpen features Sharpening only for the static parts, it would be nice to see this integrated in LSFmod too.
Any chance for that?

Regards
McCauley

Arf, adapt=true in MCTD...

I think that using MVTools to build only a motion mask is a bit "too much" :rolleyes:

But a little workaround:
LSFmod(keep=10,edgemode=1)

keep=10, less sharpening in motion area
edgemode=1, less sharpening in flat area

;)



If you really want your stuff, it's easy :

source = last
sharpened = source.LSFmod(strength=200,soothe=false)
denoised = source.FFT3Dfilter(sigma=2,plane=0,bt=1)

super = source.MSuper(chroma=false)
back = super.MAnalyse(isb=true, delta=1,chroma=false)
forward = super.MAnalyse(isb=false,delta=1,chroma=false)

mask_b = source.MMask(back)
mask_f = source.MMask(forward)
mask = mt_lutxy(mask_b,mask_f,"x y +",U=1,V=1)

mt_merge(sharpened,denoised,mask,U=2,V=2)
# OR if you don't want to denoise:
# mt_merge(sharpened,source,mask,U=2,V=2)


It works well! :)

edit: Updated the code

leon1789
5th October 2009, 06:55
SoftSharpen destroy too much the picture :eek:

Sorry but, I think that it's very ugly!
Maybe bad settings... Maybe not :p

And compressibility isn't much better:

Screenshot 1 : 790kb vs 622kb (-21%)
Screenshot 2 : 3092kb vs 2606kb (-16%)

:)

...so I change the setting (with quite smaller constants for the second frame) and the result in post #122... :)

LaTo
5th October 2009, 11:28
v1.9:
- tweaked settings
- default preset is now defaults="fast" /!\


...so I change the setting (with quite smaller constants for the second frame) and the result in post #122... :)

Ok, so I have updated these screenshots with LSFmod v1.9:

Source [685kb] (http://latoninf.free.fr/d9/LM/compare/3src.png)
LimitedSharpenFaster(strength=200) [820kb] (http://latoninf.free.fr/d9/LM/compare/3lsf.png)
LSFmod(defaults="slow",strength=200) [721kb] (http://latoninf.free.fr/d9/LM/compare/3slow.png)
LSFmod(defaults="fast",strength=200) [720kb] (http://latoninf.free.fr/d9/LM/compare/3fast.png)

Screenshot1: SoftSharpen() 616kb - LSFmod() 720kb = -14%
Screenshot2: SoftSharpen() 2842kb - LSFmod() 3092kb = -8%

Around 10% gain, but I really doesn't like the result of SoftSharpen...

MatLz
5th October 2009, 12:21
(Concurrence?)
It's not a race guys!
;)

MadRat
5th October 2009, 14:30
So to mod LFSmod back to having the default set to "slow" like it used to be change the line


defaults = default(defaults,"fast")


to


defaults = default(defaults,"slow")


Is that correct?

MatLz
5th October 2009, 14:51
@MadRat
I think that's correct.

LaTo
5th October 2009, 15:44
So to mod LFSmod back to having the default set to "slow" like it used to be change the line


defaults = default(defaults,"fast")


to


defaults = default(defaults,"slow")


Is that correct?
Yes :)



Speed comparaison:
LimitedSharpenFaster() = 17.4 fps
LSFmod(defaults="fast") = 16.8 fps
LSFmod(defaults="slow") = 7.6 fps



Some screenshots:

1. Source [583kb] (http://latoninf.free.fr/d9/LM/compare/1src.png)
1. LimitedSharpenFaster(strength=200) [713kb] (http://latoninf.free.fr/d9/LM/compare/1lsf.png)
1. LSFmod(defaults="slow",strength=200) [622kb] (http://latoninf.free.fr/d9/LM/compare/1slow.png)
1. LSFmod(defaults="fast",strength=200) [616kb] (http://latoninf.free.fr/d9/LM/compare/1fast.png)

2. Source [838kb] (http://latoninf.free.fr/d9/LM/compare/2src.png)
2. LimitedSharpenFaster(strength=200) [1010kb] (http://latoninf.free.fr/d9/LM/compare/2lsf.png)
2. LSFmod(defaults="slow",strength=200) [909kb] (http://latoninf.free.fr/d9/LM/compare/2slow.png)
2. LSFmod(defaults="fast",strength=200) [904kb] (http://latoninf.free.fr/d9/LM/compare/2fast.png)

3. Source [685kb] (http://latoninf.free.fr/d9/LM/compare/3src.png)
3. LimitedSharpenFaster(strength=200) [820kb] (http://latoninf.free.fr/d9/LM/compare/3lsf.png)
3. LSFmod(defaults="slow",strength=200) [721kb] (http://latoninf.free.fr/d9/LM/compare/3slow.png)
3. LSFmod(defaults="fast",strength=200) [720kb] (http://latoninf.free.fr/d9/LM/compare/3fast.png)

4. Source [448kb] (http://latoninf.free.fr/d9/LM/compare/4src.png)
4. LimitedSharpenFaster(strength=200) [555kb] (http://latoninf.free.fr/d9/LM/compare/4lsf.png)
4. LSFmod(defaults="slow",strength=200) [482kb] (http://latoninf.free.fr/d9/LM/compare/4slow.png)
4. LSFmod(defaults="fast",strength=200) [475kb] (http://latoninf.free.fr/d9/LM/compare/4fast.png)


:devil:

Keiyakusha
16th October 2009, 20:24
Hi. Is there any benefits in using first line instead of second?

1: LSFmod(defaults="slow",edgemode=1,dest_x=768,dest_y=432)
2: Spline36resize(768,432).LSFmod(defaults="slow",edgemode=1)

canuckerfan
16th October 2009, 20:49
Hi. Is there any benefits in using first line instead of second?

1: LSFmod(defaults="slow",edgemode=1,dest_x=768,dest_y=432)
2: Spline36resize(768,432).LSFmod(defaults="slow",edgemode=1)
I believe the first line sharpens then resizes all from LSFmod. The second line Resizes externally and then sharpens. So the calls are reversed.

However, in terms of speed the first line will be faster. LSFmod already resizes, thus saving you a step in your filter chain if your resize internally from LSFmod. Someone correct me if I'm wrong.

LaTo
17th October 2009, 09:49
However, in terms of speed the first line will be faster. LSFmod already resizes, thus saving you a step in your filter chain if your resize internally from LSFmod. Someone correct me if I'm wrong.

Yes but, LSFmod works on a higher resolution in the first line... So, it will be slower...


Simply:
Spline36resize(768,432).LSFmod(defaults="slow",edgemode=1)

is faster than:
LSFmod(defaults="slow",edgemode=1,dest_x=768,dest_y=432)

is faster than:
LSFmod(defaults="slow",edgemode=1).Spline36resize(768,432)


You need to test the speed, it depends on your source's resolution ;)

travolter
19th October 2009, 12:11
hi!

I use

-----------------------------------
a= last
b=a.Spresso()
SeeSaw(a,b)
LimitedSharpenFaster(strength=11)
LimitedSharpenFaster(strength=11)
-----------------------------------

and gives nice sharpenning.

My cpu cannt handle 1080 movies with these scripts realtime

So I need to resize before but all the resizers (ffdshow, avisynth (spline ones) kill much details of image.


Exist any resizer than dont remove the detail of the image? or any player that do resize before ffdshow/avisynth?

Im trying also with

LimitedSharpenFaster(dest_x=1280,dest_y=720,strength=60)

but it seems to apply the resize after the sharpenning?

There is any way to apply the resize before the sharpenning in LSF?

rkalwaitis
19th October 2009, 12:26
Lato,

I think I read somewhere to help avoid sharpening noise and reduce ringing it is whise to use lsfmod(preblur "your denoiser). To use this handy tip, do you need to know the specifics of the denoiser, or say for example with mctemporal denoise, could I put lsfmod(preblur "mctemporaldenoise(my settings)"? Or perhaps im just simply trying to overdo it Thanks K.

I know never mind as always use SEARCH!

leon1789
21st October 2009, 18:05
Speed comparaison:

Some screenshots:


Hi LaTo :)

Please, let's have a look here http://forum.doom9.org/showthread.php?p=1336664#post1336664 (LSFMod 1.9 vs SoftSharpen 7.6)

Don't hesitate to write what you find ugly in the softsharpen's results. :)

LaTo
25th November 2009, 18:41
Lato,

I think I read somewhere to help avoid sharpening noise and reduce ringing it is whise to use lsfmod(preblur "your denoiser). To use this handy tip, do you need to know the specifics of the denoiser, or say for example with mctemporal denoise, could I put lsfmod(preblur "mctemporaldenoise(my settings)"? Or perhaps im just simply trying to overdo it Thanks K.

I know never mind as always use SEARCH!

Yes, LSFmod can avoid sharpening noise... But something like FFT3Dfilter is enough, no need of MCTD for this :D

Simply, apply FFT3Dfilter directly to the source:
FFT3Dfilter(sigma=xx)
You need to choose the sigma which remove most of noise without blurring too much the details...


When it's good, remove this line and add this one:
LSFmod(preblur="FFT3Dfilter(sigma=xx)")

You can tweak a little the sigma value directly in LSFmod, just compare and pick the best...


preblur is really useful on grainy source, it help to save much bitrate and avoid to make noise stronger ;)

mastrboy
3rd December 2009, 02:26
how is LSFmod's compatibility with SetMTMode() ?

Using LimitedSharpenFaster and SetMTMode(2,0) it used 99% cpu on i7-860, can't seem to get LSFmod to use more than a average of 70%, the FPS is about the same though..

mastrboy
3rd December 2009, 02:41
thanks for the quick reply, i'll test it out, and check quality with soothe=false vs =true to see if it's worth it...

Edit:
Worked great, can't see any difference in quality even if i resize it 2x, did not check compression difference though..

Again thanks :)

Keiyakusha
3rd December 2009, 21:49
Just out of curiosity... something cool is planned for 2.0? ^_^

LaTo
4th December 2009, 07:30
Just out of curiosity... something cool is planned for 2.0? ^_^

The only thing on my todo list is to optimize all the different process with MVTools, but... lack of time :mad:

LSFmod is mature and bug-free, v2.0 will need some searching & thinking to do it in the best way...

MatLz
4th December 2009, 08:06
Hi!
Why not a mode with adaptive radii and masks expansions depending on resolution?
For animes it will be usefull.

Keiyakusha
19th December 2009, 02:56
After sharpening some pixels is pushed beyond TV limit. How do I avoid that?

Keiyakusha
25th December 2009, 02:30
Sorry for bump but I still want to know. Should I limit levels by myself or I missing something in LSFmod settings?

LaTo
25th December 2009, 11:41
Sorry for bump but I still want to know. Should I limit levels by myself or I missing something in LSFmod settings?

Yes, simply use Limiter() after.



Happy Christmas everyone!

Gamestar
7th January 2010, 02:12
hey i was wondering if im doing anything wrong. i'm not seeing any results from the filtering. my input and output looks the same. here's what my script looks like.

AVCSource("C:\Users\~\Documents\Test Encodes\00000.dga")
#deinterlace
#crop
LanczosResize(1280,720) # Lanczos (Sharp)
Undot() # Minimal Noise
LSFmod(defaults="slow")

jmartinr
7th January 2010, 12:41
The script looks OK to me. Do some debugging by varying the settings or the script.

Gamestar
7th January 2010, 20:18
i dont know that the problem is. i think anytime i put in a value for any script. it wont work.

for example. i tried out LimitedSharpenFaster(strength=200)

it doesn't do anything. i then tried out LimitedSharpenFaster()

that actually sharpen the video.

rkalwaitis
14th January 2010, 22:58
Neuron or maybe Lato once showed me how to show the difference between two clips. So you could see what your filtering does. It is not two pictures but black background with grey shading showing the changes. I think it was like this.

orig=YourSourceFilter("file")
denoised=orig.YourDenoiser()
subtract(orig,denoised)

Then maybe you can see what was changed in a different way. May more change than one thinks.

Jeremy Duncan
16th January 2010, 22:24
Didée may I ask you a question about lsfmod. I read the original thread you made for limitedsharpenfaster: link (http://forum.doom9.org/showthread.php?t=84196), then you describe how limitedsharpen is different:

"Traditional sharpeners like sharpen() or UnsharpMask() compare each pixel against the average of its neighborhood, and emphasize the difference between them. The results (something like "per-pixel contrast enhancement") are good as long as the strength is kept low enough. But artefacts will arise very soon.
XSharpen, being a non-linear sharpener, replaces each pixel with either its darkest or brightest neighbor, depending on which is nearer in range. By the nature of the method, XSharpen produces edges with maximal possible aliasing (jaggyness). So one has either to reduce the percentage, thereby weakening the overall effect, or to work with big supersampling, which makes it both extremely slow and less effective. "

"Now, LimitedSharpen() doesn't re-invent the wheel. It just tries to take the best of both worlds.

Shortly, LimitedSharpen() applies one out of three different sharpeners (two domain sharpeners or a windowed range sharpener) to the source, but will limit the oversharpening (either "hard" or "soft") IF it exceeds a defined "overshoot"."

Does LaTo's lsfmod still follow this idea of what you said was limitedsharpen or is the lsfmod something new and different?
I ask because I use limitedsharpenfaster.

Didée
16th January 2010, 23:19
Didée may I ask you a question about lsfmod. No. :D

Does LaTo's lsfmod still follow this idea of what you said
Yes. Some refinements, more options, additional doodads & bells 'n whistels, but still the same principle. If it wasn't, it would have gotten a different name.

Nephilis
18th January 2010, 14:02
how can avoid this ==> mt_lutxy(Clp,"x y < x 1 + x y > x 1 - x ? ?",U=1,V=1)
the banding & oil painting (or face wax) effect of sharpening? What's the logic that processes? Is it some kind of limiting ? :)

Actually how can i learn using masktools to make my little own scripts?

Didée
18th January 2010, 14:37
Short explanation: limited precision of 8-bit colorspaces.
Pixels can only have integer values. If the sharpener "should" turn a pixel to 5.51, it will be 6. If it "should" turn it to 6.49, it will be 6. Error margin is 0.999... . Especially in "flat gradients", this error margin can mean that the actual error is as big as 100% (!). Hence, the trick is "whatever change you calculated, reduce that change by 1". This eliminates most of the ugly sideffects in sensitive areas, and has only very little reduced-sharpening effect on prominent detail.

Nephilis
18th January 2010, 16:11
Thank you Didée. A perfect explanation for a newbie..

rkalwaitis
30th January 2010, 11:51
Lato

I have a very soft source in which the edges are weak at best throughout. I have attached two jpgs to show the issue. The jpgs have not been processed in any way. I was hoping that perhaps LSFMod or MctemporalDenoise could help me remedy this. I tried MCTemporalDenoise to clean it up and it does a great job of getting rid of the noise. But I am needing a bit of assistance in what I should be tweaking to get my edges sharper. Is it the strength setting for sharp in MCTemporalDenoise. My people look like claymation. Please point me in the correct directionl. I know its hard to enhance or fix something that is not there, any recommendations are welcomed.

The color leaves a lot to be desired as well, but that can be fixed later.:thanks:
Here are two jpgs showing my problem.

Didée
30th January 2010, 12:35
General blabla until the images appear ...

For excessively soft sources, LSF (or any of its variations, spin-offs, or reinvent-the-wheel-itations) is simply the wrong tool. For very soft input signal, the "limiting" part is counterproductive. Very soft sources also need enhancement of signal peaks (making the signal amplitude larger), which is exactly what the limiting part of LSF prohibits.

SeeSaw actually tries something in the direction of signal enhancement (AFAIK the principle is not integrated in LSFmod, LaTo only transplanted the nonlinear sharpen from SeeSaw to LSFmod, but not the peak enhancement), but it may be too weak anyway ... it uses a basic 3x3 Median for enhancement, which often is too small a window. A 5x5 Median would catch much more signal, but is also harder to control.

Reuf Toc
30th January 2010, 15:22
You can try SuperSlowSharpen() (http://forum.doom9.org/showthread.php?t=132330) from mp4guy but I've never tried it so I don't know if the result is stable, and given the name of this function I suppose it's very slow...
Sorry for the off topic

rkalwaitis
30th January 2010, 19:58
IIP will that help out if tweaked properly?

LaTo
30th January 2010, 21:06
IIP will that help out if tweaked properly?

Have you tried this?
http://forum.doom9.org/showthread.php?p=1252395#post1252395

Adjust strength to your taste, and play with "preblur" to minimize artefacts...

rkalwaitis
30th January 2010, 22:07
Thanks Lato

10L23r
1st February 2010, 21:46
General blabla until the images appear ...

For excessively soft sources, LSF (or any of its variations, spin-offs, or reinvent-the-wheel-itations) is simply the wrong tool. For very soft input signal, the "limiting" part is counterproductive. Very soft sources also need enhancement of signal peaks (making the signal amplitude larger), which is exactly what the limiting part of LSF prohibits.

SeeSaw actually tries something in the direction of signal enhancement (AFAIK the principle is not integrated in LSFmod, LaTo only transplanted the nonlinear sharpen from SeeSaw to LSFmod, but not the peak enhancement), but it may be too weak anyway ... it uses a basic 3x3 Median for enhancement, which often is too small a window. A 5x5 Median would catch much more signal, but is also harder to control.

Probably a stupid question but if you upsize an image... what filter should be used (to sharpen the upscaled image)?

hydra3333
13th February 2010, 02:27
I have been using LimitedSharpenFaster for years with settings (smode=4,strength=100).

I note that LSFmod is referred to regularly nowadays. I wonder if I should I move to it ... what has caused others to move to it ? Better result for equivalent cpu/elapsed-time bang or something ?

For my "usual" LimitedSharpenFaster usage, what would be roughly equivalent LSFmod settings to provide a similar or improved result (denoised PAL DV source) ?

Most importantly is it compatible with tsp's MT version of avisynth with SetMTode(mode=2) ?

LaTo
13th February 2010, 09:19
I have been using LimitedSharpenFaster for years with settings (smode=4,strength=100).

I note that LSFmod is referred to regularly nowadays. I wonder if I should I move to it ... what has caused others to move to it ? Better result for equivalent cpu/elapsed-time bang or something ?
Modifications are in the changelog (first post).

For my "usual" LimitedSharpenFaster usage, what would be roughly equivalent LSFmod settings to provide a similar or improved result (denoised PAL DV source) ?
LSFmod(defaults="old") will output exactly the same image as LimitedSharpenFaster()

So look at the change between defaults="old" and "slow"/"fast".

Most importantly is it compatible with tsp's MT version of avisynth with SetMTode(mode=2) ?
It should, no problem reported... if not, try with soothe=false in LSFmod()

Tuik
19th February 2010, 21:32
I am experiencing problems loading the plugin "VariableBlur".

I have that plugin on my AviSynth plugin's folder but when i load the script to VDM I always get the error "Unable to load Variableblur".

How can i fix that?

Thanks for the help!

LaTo
20th February 2010, 11:22
I am experiencing problems loading the plugin "VariableBlur".

I have that plugin on my AviSynth plugin's folder but when i load the script to VDM I always get the error "Unable to load Variableblur".

How can i fix that?

Thanks for the help!

I don't know how to fix that.

But if you don't use Smode=1 or Smode=2, you don't need VariableBlur.

kool
25th February 2010, 16:15
Is it good idea to sharpen the 1080p and 720p when the source is blu-ray? or it is just personal taste. if "yes" what is the recommended settings.

osgZach
10th March 2010, 20:07
I'm guessing this likely has something to do with WarpSharp/aWarpSharp, but I really like calling LSFmod w/defaults as it gives a pretty good overall sharpening effect on the picture, without getting too nasty.

However I have always had an issue with it doing something to the edges of the picture. I believe its just the top and right sides that it happens to, as far as I can tell. But right on the edge it does some "funny stuff" where some kind of artifact (I can't describe it) appears the entire length of both edges, and it stands out a lot when viewing, resulting in the need to crop 2 - 4 pixels depending.

Is this an inherent side effect that can't be avoided, or is there a way to get results very close to the defaults, without having this artifact show up?

If nothing can really be done.. can anyone recommend a safer (same performance or better) filter, and some settings to get similar results from the default LSFMod settings ?

I'm not looking for huge sharpening gains or anything like that. Just a very minor, overall clarity / "crispness" boost to the picture as a whole..

GDAce
8th June 2010, 07:42
why there is difference in parameters on avisynth page and here?

is it for updated or older version...?

spider1
12th June 2010, 09:19
Running this lsfmod filters and the process takes twice as long as other filters when using DVDRB. Any suggestion or changing lsfmod setting in order to run lsfmod faster.
This is what I use:
c:i:ColorMatrix(mode="Rec.601->Rec.709",interlaced=true,threads=4)
c:ColorMatrix(mode="Rec.601->Rec.709",threads=4)
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\lsfmod\FFT3DFilter.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\lsfmod\mt_masktools.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\lsfmod\RemoveGrain.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\lsfmod\Repair.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\lsfmod\RSharpen.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\lsfmod\VariableBlur.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\lsfmod\WarpSharp.dll")
Import("C:\Program Files (x86)\AviSynth 2.5\lsfmod\LSFMod.avs")
fft3dfilter(sigma=1.5, bt=5, bw=32, bh=32, ow=16, oh=16, sharpen=0.4)

Gavino
12th June 2010, 09:32
Running this lsfmod filters and the process takes twice as long as other filters when using DVDRB. ...
This is what I use:
...
Import("C:\Program Files (x86)\AviSynth 2.5\lsfmod\LSFMod.avs")
fft3dfilter(sigma=1.5, bt=5, bw=32, bh=32, ow=16, oh=16, sharpen=0.4)
If that really is your script, you are not even calling LSFMod (the Import just makes the function available), so the slowness comes from fft3dfilter.

spider1
12th June 2010, 17:19
If that really is your script, you are not even calling LSFMod (the Import just makes the function available), so the slowness comes from fft3dfilter.

I don't know much about this and seldom use it, your suggestions or ideas to help out is much appreaciated..

foxyshadis
12th June 2010, 21:36
If you have a good video card, get fft3dgpu and just replace the call to fft3dfilter with fft3dgpu. You should get an automatic speedup without any effort, if your gpu is good, plus it takes load off your cpu that can be used elsewhere. You will probably want to get Multithreaded (MT) Avisynth so that your script isn't sitting, waiting on the gpu. Use ow=8 and oh=8 to get a bit more speed.

Then you can actually use it: Put LSFmod(smode=5) at the bottom of your script. You can tweak it later, but you have to actually use it first! It'll take even longer though.

Then you just have to accept that these filters are slow. A lot of people have to upgrade their systems to use serious filtering. Plus, are you sure you really want to use a lot of sharpening on a DVD? It could introduce a lot more noise and blocking in the output, make sure you check the output (on a real TV if that's what you'll be playing it on).

spider1
12th June 2010, 23:45
If you have a good video card, get fft3dgpu and just replace the call to fft3dfilter with fft3dgpu. You should get an automatic speedup without any effort, if your gpu is good, plus it takes load off your cpu that can be used elsewhere. You will probably want to get Multithreaded (MT) Avisynth so that your script isn't sitting, waiting on the gpu. Use ow=8 and oh=8 to get a bit more speed.

Then you can actually use it: Put LSFmod(smode=5) at the bottom of your script. You can tweak it later, but you have to actually use it first! It'll take even longer though.

Then you just have to accept that these filters are slow. A lot of people have to upgrade their systems to use serious filtering. Plus, are you sure you really want to use a lot of sharpening on a DVD? It could introduce a lot more noise and blocking in the output, make sure you check the output (on a real TV if that's what you'll be playing it on).

Thanks for the advice foxyshadis. I'll try to replace fft3dfilter with fft3dgpu and you're probably right when I preview the output source, I see quite a few sharp scence and the picture kind of distored too. I've tried to set MT like this "SetMTMode(2,8)"at the begining of the script and this function MT("""LSFmod(SdmpHi=0,ss_x=1.0,ss_y=1.0)""") at the bottom, but seems like avisynth can't not load..:confused:. In term of upgrading system, currently I'm running quad 9550 with Nvidia Gforce 9800 GX2.

foxyshadis
13th June 2010, 19:34
Thanks for the advice foxyshadis. I'll try to replace fft3dfilter with fft3dgpu and you're probably right when I preview the output source, I see quite a few sharp scence and the picture kind of distored too. I've tried to set MT like this "SetMTMode(2,8)"at the begining of the script and this function MT("""LSFmod(SdmpHi=0,ss_x=1.0,ss_y=1.0)""") at the bottom, but seems like avisynth can't not load..:confused:. In term of upgrading system, currently I'm running quad 9550 with Nvidia Gforce 9800 GX2.

You have to actually install Avisynth with MT (http://forum.doom9.org/showthread.php?t=148117) first. A 9800 GX2 should have enough power and memory to not distort it, odd.

spider1
14th June 2010, 04:57
You have to actually install Avisynth with MT (http://forum.doom9.org/showthread.php?t=148117) first. A 9800 GX2 should have enough power and memory to not distort it, odd.

@ foxyshadis: I have to install avisynth 2.5.8 in order to get MT mode to work... I don't think Avisynth 2.5.7 does not work..

Gavino
14th June 2010, 09:57
I have to install avisynth 2.5.8 in order to get MT mode to work... I don't think Avisynth 2.5.7 does not work..
The 'official' MT release is derived from Avisynth 2.5.7. Download from here (http://www.avisynth.org/tsp/MT_07.zip).
The archive includes a modified 2.5.7 avisynth.dll which must be placed in your windows\system32 directory.
For more details, see
http://avisynth.org/mediawiki/MT
http://avisynth.org/mediawiki/MT_support_page

Beak
26th September 2010, 14:34
@Didee

If lsfmod uses a 3X3 median like See Saw, does that mean it is of limited use on Bluray sources as well?

Didée
26th September 2010, 15:30
Sure. LSFmod largely is LSF with SeeSaw implanted. Parameters plenty, invention little.

Beak
26th September 2010, 16:15
OK. Time to do some direct comparisons. I hate to be burning up CPU cycles for no good reason.

Didée
26th September 2010, 16:58
Well, it's not that either of these scripts would result in "no change" on HD sources. The edge sharpening will always work, and the limited-noisereduction of SeeSaw will also work. It's just the additional enhancement of SeeSaw (or corresponding LSFmod mode) that might deliver less additional enhancement.

The principle of LSF is that a sharpened pixel should not exceed the min/max of the neighborhood, in order to avoid creation of halos. This makes sense on "broad" edges. However on "small" detail, the overshoot is a wished effect - at least one half of it. Say there is a very thin line, supposed to be white, but in fact it's some medium grey. LSF will not allow the grey line to become more white-ish, because of the limiting. A not-limited sharpener will make the line more white-ish, but may cause a dark halo around the line. That's where SeeSaw's combination of kernel-sharpening and median-sharpening kicks in: it allows enhancement of the line, but won't create a halo around it. (Given that the source doesn't have halos already from the start.)
On HD sources, the problem often is that the 3x3 median doesn't "catch" small detail, because "small detail" on HD often doesn't correspond to 1-pixel-features, but rather to 2-pixel-features. (Very simplified.)
In case that the 3x3 median does not catch, then the "SeeSaw sharpening" will simply collapse to "LSF sharpening". It's basically the same operation, just that the additional headroom happens to be zero.

Beak
18th October 2010, 02:58
Can someone tell me which makes more sense?

Is it better to use
FFT3dGPU(sigma=1.5, bt=3, bw=32, bh=32, ow=16, oh=16)
MT("""LSFmod(smode=5)""", threads=4, overlap=8)

Or to use FFT3dGpu in the preblur function?

Thanks for any help.

LaTo
18th October 2010, 07:22
Can someone tell me which makes more sense?

Is it better to use
FFT3dGPU(sigma=1.5, bt=3, bw=32, bh=32, ow=16, oh=16)
MT("""LSFmod(smode=5)""", threads=4, overlap=8)

Or to use FFT3dGpu in the preblur function?

Thanks for any help.

If you want to denoise before sharpening, use it like this.
But if you doesn't want to denoise, use it in preblur function (it will prevent noise sharpening & artefacts)

mastrboy
18th October 2010, 21:48
On HD sources, the problem often is that the 3x3 median doesn't "catch" small detail, because "small detail" on HD often doesn't correspond to 1-pixel-features, but rather to 2-pixel-features. (Very simplified.)

Then is there any parameters that can be tweaked to make LSFmod more HD friendly? or is that up to the dependencies: ?

### -> Masktools (v2a36)
### -> Removegrain (v1.0pre) (isn't there a hd version of this?)
### -> Warpsharp (2003.11.03) [for Smode=1]
### -> Variableblur (v0.30) [for Smode=2]

Nephilis
19th October 2010, 16:36
Then is there any parameters that can be tweaked to make LSFmod more HD friendly? or is that up to the dependencies: ?


AFAIK there is a boolean "wide" parameter in LSF for this. But in LSFMod this parameter is removed by the author.

Boulotaur2024
12th May 2012, 14:44
Sorry for bumping this old thread but talking about the "wide" parameter I took the liberty of reincorporating it back into LSFMod (why remove it anyway ?) copying it from Didée's LimitedSharpenFaster.avs, with very few modifications.
I wanted to make sure everything was ok. Here are the lines that were added/copied :

dark_limit1 = tmp.mt_inpand(U=1,V=1)
bright_limit1 = tmp.mt_expand(U=1,V=1)
dark_limit = (wide==false) ? dark_limit1 : dark_limit1 .removegrain(17,-1).mt_inpand(U=1,V=1)
bright_limit = (wide==false) ? bright_limit1 : bright_limit1.removegrain(17,-1).mt_expand(U=1,V=1)

And here is the full modified script :
http://pastebin.com/fy0RvQGB

Can anyone (Didée ?) confirm these modifications will allow LSFMod to perform 5X5 median (my eyes might be misleading) ?
I really need a sharpening tool that is effective on 1080p hence my effort to plunge into avisynth scripting although I'm not much of a coder.

Gser
13th May 2012, 00:27
Sorry for bumping this old thread but talking about the "wide" parameter I took the liberty of reincorporating it back into LSFMod (why remove it anyway ?) copying it from Didée's LimitedSharpenFaster.avs, with very few modifications.
I wanted to make sure everything was ok. Here are the lines that were added/copied :

dark_limit1 = tmp.mt_inpand(U=1,V=1)
bright_limit1 = tmp.mt_expand(U=1,V=1)
dark_limit = (wide==false) ? dark_limit1 : dark_limit1 .removegrain(17,-1).mt_inpand(U=1,V=1)
bright_limit = (wide==false) ? bright_limit1 : bright_limit1.removegrain(17,-1).mt_expand(U=1,V=1)

And here is the full modified script :
http://pastebin.com/fy0RvQGB

Can anyone (Didée ?) confirm these modifications will allow LSFMod to perform 5X5 median (my eyes might be misleading) ?
I really need a sharpening tool that is effective on 1080p hence my effort to plunge into avisynth scripting although I'm not much of a coder.

When making changes to the script, update the version number and add a comment about what changes you have made and why you have made them if it is unclear.

Boulotaur2024
18th May 2012, 09:42
I will, upon confirmation that these changes actually do something useful... But I guess Didée's not around these days...
(Yes this is a subtle bump)

gioppatta
4th July 2012, 11:34
...for have a really strong sharpen?

Pat357
16th October 2012, 20:58
I ported LSFmod v1.9 to VapourSynth:
http://www.mediafire.com/?89rrd81111qgnqv


Thanks a lot for this nice contribution !

I've tried to run the script, but I got this :


>>> clip = LSFmod(clip, strength=123, show=True, defaults='slow', core=core)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python33\lib\site-packages\LSFmod.py", line 739, in LSFmod
show, screenW, screenH)
File "C:\Python33\lib\site-packages\LSFmod.py", line 722, in LSFM_Show
debug = core.std.StackHorizontal(e, core.std.StackVertical(core.avs.Subtitle(i, "Input",text_color=16777215,size=20.0,x=40,y=20), core.avs.Subtitle(o, "Output",text_color=16777215,size=20.0,x=40,y=20)))
File "vapoursynthpp.pyx", line 1003, in vapoursynth.Function.__call__ (src\cython\vapoursynthpp.c:
15286)
vapoursynth.Error: 'StackVertical: Too many unnamed arguments specified'
>>>


Any idea ?

Myrsloik
17th October 2012, 01:20
Thanks a lot for this nice contribution !

I've tried to run the script, but I got this :


>>> clip = LSFmod(clip, strength=123, show=True, defaults='slow', core=core)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python33\lib\site-packages\LSFmod.py", line 739, in LSFmod
show, screenW, screenH)
File "C:\Python33\lib\site-packages\LSFmod.py", line 722, in LSFM_Show
debug = core.std.StackHorizontal(e, core.std.StackVertical(core.avs.Subtitle(i, "Input",text_color=16777215,size=20.0,x=40,y=20), core.avs.Subtitle(o, "Output",text_color=16777215,size=20.0,x=40,y=20)))
File "vapoursynthpp.pyx", line 1003, in vapoursynth.Function.__call__ (src\cython\vapoursynthpp.c:
15286)
vapoursynth.Error: 'StackVertical: Too many unnamed arguments specified'
>>>


Any idea ?

The argument is a list of clips,not separate arguments as in avisynth for the stack functions.

Stackvertical([e, thatlongthing]) is what you wanted to write.

Also, nice job on porting it to vs. Here are a few things I noticed, all arguments default to none, even the ones that always have the same default value. I think you should also raise a ValueError exception instead when the input arguments are out of range instead of having asserts everywhere.

Myrsloik
18th October 2012, 01:32
Oops! I was too sleepy that I uploaded an old file. :eek:
Link updated.


I also was thinking should I set the default values for the ones always have the same value directly in function def. For the out of range check, I don't quite understand what you mean. Is something like assert Smode >= 1 and Smode <= 5, "LSFmod: 'Smode' have not a correct value! [1,2,3,4,5]" not good or sufficient? :thanks:

I suppose the assert method works too. What I do think could be a problem is your strict type checking of every input argument. If vs accepts ints for bool-ish arguments then why don't you when you simply pass it along?


There's another reason to use exceptions instead of assert. If the python script is executed in an optimized way then all asserts will be ignored and you won't get the expected behavior.

Pat357
19th October 2012, 03:28
After upping the number of threads to 4 or 6 (vs.core(threads=6)) I get crashes sometimes with the LSFMod .py.
Based on the Win 7 reporting, it seems that masktools is always involved.
With threads=1 or 2, no crashes anymore but then LSFMod becomes slow....
Is there anything that can be done in the vapousynth multi-threading to avoid such crashes ?
I don't get such crashes in Avisynth 2.6 MT, even if I use SetMTmode=6 or or 8....

1. Crash in Python.exe module :

Faulting application name: python.exe, version: 0.0.0.0, time stamp: 0x5066b7a2
Faulting module name: mt_masktools-25.dll, version: 2.0.48.0, time stamp: 0x4d1e0f42
Exception code: 0xc0000005
Fault offset: 0x0006d3d9
Faulting process id: 0x1374
Faulting application start time: 0x01cdad8d7ada88fd
Faulting application path: c:\Python33\python.exe
Faulting module path: k:\programs\AviSynth 2.5\special filters\masktools-v2.0a48\mt_masktools-25.dll

2. Crash in pfmhost.exe

Faulting application name: pfmhost.exe, version: 1.0.0.166, time stamp: 0x50326d57
Faulting module name: mt_masktools-25.dll, version: 2.0.48.0, time stamp: 0x4d1e0f42
Exception code: 0xc0000005
Fault offset: 0x0006d397
Faulting process id: 0x91c
Faulting application start time: 0x01cdad81b15df984
Faulting application path: C:\Windows\syswow64\pfmhost.exe
Faulting module path: k:\programs\AviSynth 2.5\special filters\masktools-v2.0a48\mt_masktools-25.dll

System : i7-970 Hexacore, 24 GB RAM, W7 SP1 (auto updated)
Avisynth 2.60 MT SEt, Vapoursynth r13

x265
31st January 2013, 07:22
What value should i set for smethod on DVD encodes?

AGKnotUser
6th August 2013, 01:16
This is probably a stupid question bit I'll ask anyway. Can I use variableblur ver. 0.70 instead of ver. 0.40? Thanks.

LaTo
8th August 2013, 17:19
This is probably a stupid question bit I'll ask anyway. Can I use variableblur ver. 0.70 instead of ver. 0.40? Thanks.
Variable Blur is only used for Smode=2, and to me Smode=1&2 are useless in most clips.

However v0.70 should work if no change has been made in the interface, just try and tell us if it works or not :)

AGKnotUser
16th August 2013, 21:50
Thank you for the reply. I'm using the "slow" preset with "preblur" (hqdn3d as the denoiser). I'll look at the script to see if variableblur is called in that situation.

Edit: just looked at the script and smode 2 is not called for with the "slow" preset.

CarlPig
7th October 2013, 22:38
What does this mean:

Cache: Filter returned invaild response to CACHE_GETCHILD_CACHE_MODE. 487505472
(LSFmod.v1.9.avsi, line 484)

aldix
7th October 2013, 22:51
You need masktools patch for recent MT avisynth build, if memory serves. Search for it on Google/forums.

OtonVM
7th October 2013, 23:43
You need masktools patch for recent MT avisynth build, if memory serves. Search for it on Google/forums.

This + don't forget a SetMTMode line. I had this problem right now :)

Budtz
18th January 2014, 18:17
I Use this sharpening algorithem. I use at script that includes the line :"ffdshow_source()". my understanding is that checking "Add ffdshow video source" does the same thing as this line in the script.

what would happen if i include the line as well as check "Add ffdshow video source" at the same time? seems this is more stable wich is strange.

Do these two acually do the same thing? if so why not just have one of them?

MysteryX
3rd July 2015, 14:47
I tried adding LSFmod sharpening to my script and am getting horribly slow performance. With AviSynth 2.6 MT, with 4 threads, CPU runs at 14%, and with 8 threads, CPU runs at 28%. Then there are also periods where CPU runs properly at 90-100%. What is causing this performance problem and how can I solve this?

I'm using the 2.6 version of MaskTools2 here, is this the right version?
http://avisynth.nl/index.php/MaskTools2

SetMTMode(3,0)
PluginPath = "C:\GitHub\NaturalGroundingPlayer\NaturalGroundingPlayer\bin\Debug\Encoder\"
AviSource("F:\NaturalGrounding\Temp\Preview.avi", audio=false, pixel_type="YV12")
SetMTMode(2)
LoadPlugin(PluginPath+"ColorMatrix.dll")
ColorMatrix(mode="Rec.601->Rec.709")
Crop(0, 0, -10, -0)
LoadPlugin(PluginPath+"FFT3DFilter.dll")
fft3dfilter(sigma=3, bt=5, bw=48, bh=48, ow=24, oh=24, sharpen=0.1, ncpu=8)
LoadPlugin(PluginPath+"masktools2.dll")
LoadPlugin(PluginPath+"RgTools.dll")
Import(PluginPath+"LSFmod.avsi")
LoadPlugin(PluginPath+"nnedi3.dll")
LoadPlugin(PluginPath+"eedi3.dll")
eedi3_rpow2 (2)
LSFmod(strength=10, defaults="slow")
nnedi3_rpow2 (2)
Spline36Resize(940, 720, 0, 4, -0, -4)
LoadPlugin(PluginPath+"svpflow1.dll")
LoadPlugin(PluginPath+"svpflow2.dll")
Import(PluginPath+"InterFrame2.avsi")
InterFrame(Cores=8, Tuning="Smooth", NewNum=60000, NewDen=1001, GPU=true)
LSFmod(strength=30, defaults="slow")
Distributor()

Groucho2004
3rd July 2015, 15:49
I tried adding LSFmod sharpening to my script and am getting horribly slow performance. With AviSynth 2.6 MT, with 4 threads, CPU runs at 14%, and with 8 threads, CPU runs at 28%. Then there are also periods where CPU runs properly at 90-100%. What is causing this performance problem and how can I solve this?

I'm using the 2.6 version of MaskTools2 here, is this the right version?
http://avisynth.nl/index.php/MaskTools2

Just gave that script a go with a SD (720 x 400) source, (non-MT AVS):
Without the 2 LSFMod calls:
[Runtime info]
Frames processed: 238 (0 - 237)
FPS (min | max | average): 1.335 | 66288 | 5.887
Memory usage (phys | virt): 511 | 556 MB
Thread count: 38
CPU usage (average): 81%
Time (elapsed): 00:00:40.426


With the 2 LSFMod calls:
[Runtime info]
Frames processed: 238 (0 - 237)
FPS (min | max | average): 0.854 | 132.5 | 4.669
Memory usage (phys | virt): 662 | 708 MB
Thread count: 38
CPU usage (average): 68%
Time (elapsed): 00:00:50.970


Look at the CPU utilization, you don't need AVS MT. The main CPU hogs are eedi3 and nnedi3 which are already internally multi-threaded.

Multi-threading internally multi-threaded filters and putting "Distributor()" at the end probably creates a few hundred threads which makes the whole setup very inefficient and consumes lots of memory (most likely too much for a 32 Bit address space).

Use AVSMeter from my signature to test your script. Start with a single threaded setup and add filters one by one.

I won't comment on how much sense that script makes, I find it rather bizarre how you're mixing filters but that's just me.

Edit - The script I used for this test:
ColorMatrix(mode="Rec.601->Rec.709")
Crop(0, 0, -10, -0)
fft3dfilter(sigma=3, bt=5, bw=48, bh=48, ow=24, oh=24, sharpen=0.1, ncpu=8)
eedi3_rpow2 (2)
LSFmod(strength=10, defaults="slow")
nnedi3_rpow2 (2)
Spline36Resize(940, 720, 0, 4, -0, -4)
InterFrame(Cores=1, Tuning="Smooth", NewNum=60000, NewDen=1001, GPU=true)
LSFmod(strength=30, defaults="slow")

Nevilne
3rd July 2015, 15:51
maybe he wants to warm up his room

MysteryX
3rd July 2015, 19:32
Hah! With 8 threads, it's actually running 684 threads (in Windows Task Manager).

As for how much sense the script makes, it does give a great output.

Source video (288p VCD) (https://www.spiritualselftransformation.com/files/media-encoder-old.mpg)
Output (720p) (https://www.spiritualselftransformation.com/files/media-encoder-new.mkv)
(this is without LSFmod)

Groucho2004
3rd July 2015, 19:41
Hah! With 8 threads, it's actually running 684 threads (in Windows Task Manager).
I rest my case. :D

MysteryX
3rd July 2015, 20:41
I rest my case. :D
Yet, without MT, it runs at about 60% CPU.

If I set MT to 2 threads and for filters taking CPU argument, set it to 1, I get this message repeating in the console.
Cache::getFrame: dgb1

Setting MT to 2 threads and CPU parameters to 2 runs at 70-80% with 94 threads.

Setting MT and CPU parameters to 4 works fine CPU 95-100% with 226 threads.

Replacing FF3DFilter sharpening with LSFmod, however, lowers CPU usage to 65-70%.

Groucho2004
3rd July 2015, 21:34
If I set MT to 2 threads and for filters taking CPU argument, set it to 1, I get this message repeating in the console.
Cache::getFrame: dgb1
Yes, I had the same problem when I tried your script with MT. I gave up on it because of this and, more importantly, it was still slower than single threaded Avisynth.

Setting MT to 2 threads and CPU parameters to 2 runs at 70-80% with 94 threads.

Setting MT and CPU parameters to 4 works fine CPU 95-100% with 226 threads.
It's a common misconception that high CPU usage equals high performance. I assure you, in your examples you're just producing heat.

Use AVSMeter and compare the speed.

MysteryX
3rd July 2015, 22:07
For my standard script, I'm getting 6.8fps with MT=4 and 5.4 with MT off.

If I instead use LSFmod, I get 6.0fps with MT=4 and 5.6 with MT off.

And from what I've seen, if I keep it running, there will be LONG phases where it runs on a single core and leave CPU usage at 14%. The script won't be done after a whole night.

MysteryX
4th July 2015, 09:37
OK I did further testing with AVSMeter. The errors were being thrown by InterFrame. The CPU argument must be the same as the MT thread count for it to work best. As for FF3DFilter, its CPU count must also be set to that same value for optimal performance. Otherwise it probably creates a bottleneck on whichever filter has the lowest thread count.

With all thread values set to 2, I get nearly the same performance as with all values set to 3 in terms of fps, but with 10% lower CPU usage! That's gives 94 threads. CPU usage is then only 75% but x264.exe further brings it up. I'm encoding a file right now and the CPU runs between 80-100%. That's good.

But that's without LSFmod. Whenever I add LSFmod into the mix, it creates a bottleneck.

Groucho2004
4th July 2015, 10:14
The errors were being thrown by InterFrame.
Yes, it's one of the svpflow*.dll plugins. Instead using "ThrowError()" in the plugin so a client application could catch and handle it, the developer decided to print the error directly to the console. It may not even be an error, maybe just some leftover debug code.

MysteryX
4th July 2015, 20:15
AVSMeter crashes on this script :)

PluginPath = "C:\GitHub\NaturalGroundingPlayer\NaturalGroundingPlayer\bin\Debug\Encoder\"
AviSource("F:\NaturalGrounding\Temp\Preview.avi", audio=false, pixel_type="YV12")
LoadPlugin(PluginPath+"eedi3.dll")
eedi3_rpow2 (2)
Spline36Resize(768, 576)


I've done more testing. EEDI3 has good internal multi-threading, and what works best is MT with 2 threads when using EEDI3. Perhaps EEDI3 alone would even work best on a single thread.

When using NNEDI3(2) or NNEDI3(4), however, it still benefits from 8 threads. The full script with NNEDI(4) runs at
- MT=1: 14.7fps with 46 threads and 16% CPU usage
- MT=4: 21.0fps with 160 threads and 54% CPU usage
- MT=6: 21.0fps with 259 threads and 56% CPU usage
- MT=8: 22.5fps with 352 threads and 64% CPU usage

LSFmod without the slow preset isn't as much of a bottleneck. Still, setting high values seems to make the image look much more artificial than when setting high values with FF3DFilter.

Groucho2004
4th July 2015, 21:15
AVSMeter crashes on this script :)
Define crash. No error message? What happens when you load the script in VirtualDub?

MysteryX
4th July 2015, 21:28
"AVSMeter - AviSynth Script Testing has stopped working. Windows can check online for a solution to the problem."

The script plays fine in MPC-HC

Yes, it's one of the svpflow*.dll plugins. Instead using "ThrowError()" in the plugin so a client application could catch and handle it, the developer decided to print the error directly to the console. It may not even be an error, maybe just some leftover debug code.
He said it's forgotten debug code.

Groucho2004
4th July 2015, 21:52
"AVSMeter - AviSynth Script Testing has stopped working. Windows can check online for a solution to the problem."
I think it's some race condition in eedi3's OpenMP code. It doesn't crash when you set "threads = 1" in the eedi3 call.

MysteryX
5th July 2015, 02:57
WOW! You're a genius. Setting Threads=1 on EEDI3 and NNEDI3, with 16 cores, almost doubles the overall performance!! Just got to test what is the optimal amount of cores to use.

12 cores gives 11fps with 207 threads and 62% CPU.

16 cores gives 13fps with 339 threads and 83% CPU.

That's compared to the 6fps I was previously getting.

16 cores by replacing 2x FF3DFilter with 2x LSFmod (without slow preset) gives 8.3fps with 338 threads and 64% CPU. It still causes a bottleneck.

The script that took 1h10 on last run is now running in 30 minutes. BUT, memory usage is 1710MB... getting dangerously close to 2GB.

Groucho2004
5th July 2015, 07:43
Setting Threads=1 on EEDI3 and NNEDI3, with 16 cores, almost doubles the overall performance!! Just got to test what is the optimal amount of cores to use.
I thought I covered that in my first reply to you (although I did not explicitly tell you to add "threads = 1" to these two filters):
Multi-threading internally multi-threaded filters and putting "Distributor()" at the end probably creates a few hundred threads which makes the whole setup very inefficient and consumes lots of memory (most likely too much for a 32 Bit address space).

BUT, memory usage is 1710MB... getting dangerously close to 2GB.
On 64 bit Windows you have up to 4GB for Avisynth. You can pipe the script to x264.
Have a look at this thread (http://forum.doom9.org/showthread.php?t=172300), the guy had very similar problems.

MysteryX
5th July 2015, 18:18
I didn't know about the Treads parameter of EEDI3/NNEDI3. So you're saying avs2yuv.exe is required to access up to 4GB? Otherwise what is the limit, 2GB?

Unfortunately the script froze in the middle with 25% CPU usage and it never completed after the whole night. Not sure if it's because of too high memory usage or what.

Setting 8 threads for MT, 4 for EEDI3 and 2 for NNEDI3 gives me 9.4fps with 281 threads and 83% CPU usage. Not the 13fps, but perhaps this one won't freeze.

Could the memory usage getting too high have caused that freeze?

Edit: Oh! I can use the 64-bit version of x264!! This will bring an additional performance bonus.

MysteryX
5th July 2015, 18:58
I'm getting this error with Avs2YUV
raw [error]: raw input requires a resolution.

Here's my command
avs2yuv.exe "Job1_Script.avs" -o - | x264-64bit.exe - --preset veryslow --crf 24 -o "Job1_Output.264"

Groucho2004
5th July 2015, 19:01
So you're saying avs2yuv.exe is required to access up to 4GB?No. Piping the script to the encoder means that Avisynth and x264 have their own address space of 4GB each (64 Bit x264 could obviously address much more memory).

You can feed the script directly to x264 but then Avisynth and x264 have to share an address space of 4GB.

Note that the above scenarios only apply 64 Bit OS and applications that were built with the LARGE_ADDRESS_AWARE linker flag, i.e. avs2yuv.
On 32 Bit Windows the user address space is limited to 2 GB. There are ways around that as well but this is not really relevant.

Unfortunately the script froze in the middle with 25% CPU usage and it never completed after the whole night. Not sure if it's because of too high memory usage or what.

Setting 8 threads for MT, 4 for EEDI3 and 2 for NNEDI3 gives me 9.4fps with 281 threads and 83% CPU usage. Not the 13fps, but perhaps this one won't freeze.

Could the memory usage getting too high have caused that freeze?
Yes. You can also try to play with SetMemoryMax().

Groucho2004
5th July 2015, 19:03
I'm getting this error with Avs2YUV
raw [error]: raw input requires a resolution.

Here's my command
avs2yuv.exe "Job1_Script.avs" -o - | x264-64bit.exe - --preset veryslow --crf 24 -o "Job1_Output.264"
The command line is not complete. The de-muxer has to be specified (--demuxer y4m).

MysteryX
5th July 2015, 20:37
Piping seems to considerably lower the performance, nullifying any advantage of switching to the 64-bit x264. I also lose the estimated time left as it doesn't know the total amount of frames.

Is the SetMemoryMax command necessary? Not sure what to set it to. It seems to lower the performance when I specify it.

It seems to work best when I use symmetrical thread values: 1, 2, 4, 8 or 16. Whenever I start using values like 3 or 6, I get lower performance.

I'll try with MT=8, EEDI3 with 4 threads and NNEDI3 with 4 threads. It seems to be what works best. While encoding with x264, I get 6.3fps, 326 threads, 1374MB memory and CPU between 95-100%.

Groucho2004
5th July 2015, 21:37
Piping seems to considerably lower the performance, nullifying any advantage of switching to the 64-bit x264.
When you pipe with avs2yuv, you have to put the Distributor() call at the end of the script.

I also lose the estimated time left as it doesn't know the total amount of frames.
You have to specify the number of frames on the x264 command line.

Is the SetMemoryMax command necessary? Not sure what to set it to. It seems to lower the performance when I specify it.
Anything between 600 and 3000. It's trial and error with AVS MT.


You should start reading the documentation of the tools you use. Spoon-feeding you all the information becomes tiresome.

MysteryX
5th July 2015, 21:49
When you pipe with avs2yuv, you have to put the Distributor() call at the end of the script.
It's there.

Edit: OK after doing more tests, performance may be the same after all. Found a way to hack around and extract the total frames count to pass it to x264. It's a hack but it works.

Edit2: After running the script, it still freezes at some point with 25-30% CPU usage. It's not because of memory usage.

SubJunk
30th May 2016, 07:44
Using soothe=false fixed the crashing for me

sys32768
12th February 2019, 20:55
I cannot seem to get any results from this mod. I can get it to run but cannot get a before/after result. Can someone using it please tell me the version of AVISYNTH/VDUB and plugins you're using to I can mimic it?

manolito
13th February 2019, 11:12
Here is an All-In-One package of LSFMod 1.9 which works for me under AVS 2.60 (or 2.61 Alpha) and the latest AVS+ 32-bit. Extract all files from the archive into the "Avisynth\Plugins" folder.

https://www.sendspace.com/file/dp73mb

Cheers
manolito

LeXXuz
4th July 2020, 12:04
Just out of curiousity.
What are the screenW and screenH parameters for?
And why are the (always?) set to 1280 by 1024 :confused:

StainlessS
4th July 2020, 14:39
Just out of curiousity.
What are the screenW and screenH parameters for?
And why are the (always?) set to 1280 by 1024 :confused:


### +-------+
### | DEBUG |
### +-------+
###
### show [bool]
### -----------
### Show debug clip & informations
###
### screenW ; screenH [int]
### -----------------------
### Screen resolution (for show clip)


Affects only debug, show info mode.

LeXXuz
14th July 2020, 12:52
Aw... man I should've guessed. :D Thanks StainlessS. :)

Treaties Of Warp
25th July 2020, 04:47
BUMP!

At some point, Smethod=5 was removed from LSFmod.avsi (http://latoninf.free.fr/d9/LM/LSFmod.v1.9.avsi):


449 Assert( ( Smethod >= 1 && Smethod <= 4 ) ? true : false, chr(10) + "'Smethod' have not a correct value! [1,2,3,4]" + chr(10))


According to the AviSynth Wiki (http://avisynth.nl/index.php/LSFmod#Syntax_and_Parameters), these should be the values for Smethod:


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

Are these Smethods still the same? Is it correct that Smethod=5 should be removed?

kuchikirukia
1st January 2022, 09:05
Should LSFMod really upscale by default for antialiasing? It introduces blurring, which seems to defeat the purpose.
If you're sharpening so much that it's aliasing, then you could set the supersampling. But it doesn't seem like such a lossy operation should be the default.

coolgit
20th October 2022, 23:12
Script error: Invalid arguments to function 'LSFM_Show'.
\StaxRip-v2.13.0-x64\Apps\Plugins\AVS\LSFmod\LSFmod.avsi, line 746)

FranceBB
21st October 2022, 11:00
Script error: Invalid arguments to function 'LSFM_Show'.
\StaxRip-v2.13.0-x64\Apps\Plugins\AVS\LSFmod\LSFmod.avsi, line 746)

we're gonna need a bit more info than that...

kedautinh12
21st October 2022, 11:44
You can try LSFplus
https://github.com/Dogway/Avisynth-Scripts/blob/master/MIX%20mods/LSFplus.avsi

Depen:
https://github.com/Dogway/Avisynth-Scripts/blob/1ee0b658c7532cd9189c73c7f9904d8dafe31f6f/MIX%20mods/LSFplus.avsi#L214

coolgit
21st October 2022, 13:55
we're gonna need a bit more info than that...

It happens when show=true.

Dogway
21st October 2022, 16:56
Change "int "undershoot2"" to "float "undershoot2"" in LSFM_Show()

coolgit
21st October 2022, 17:20
Change "int "undershoot2"" to "float "undershoot2"" in LSFM_Show()

That worked, thanks.

FranceBB
21st October 2022, 18:28
Thanks Dogway, as always! :)
We reported it to the maintainer on GitHub (https://github.com/realfinder/AVS-Stuff/issues/165) too, including your fix. ;)