Log in

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


Pages : [1] 2 3 4 5

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)