Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 10th May 2007, 21:19   #1  |  Link
Dr.Khron
Registered User
 
Dr.Khron's Avatar
 
Join Date: Oct 2006
Location: Gotham City, USA
Posts: 389
LimitedSharpenFaster vs. VMToon for Animated sources

Until recently, I was never able to get VMToon to work, so I used LimitedSharpenFaster on all of my animated content. For some DVDs, I tweak the strength up or down a little, but in general, the default settings are best (way to go Manao, GREAT tool!!!). I really like how it seems to sharpen different details in different ways, if that makes any sense.

However, I recently got VMToon working properly. I had the wrong version of WarpSharp! DOH!

Anyway, in a head to head competition, I think that VMtoon does a SLIGHTLY better job across the board for animated content. And not just the outline darkening, which LSF doesn't do, but in the sharpening itself. At default settings, VMToon provides slightly LESS sharpening then LSF, but the sharpening it does seems like its better tweaked for animation. So, I started swaping out LSF for VMToon in all my AVS scripts...
But then I discovered why its called LimitedSharpenFASTER!

With all other parts of the AVS script being equal, I get about 14 FPS using LSF, and only 3 FPS using VMToon! (this is the FPS for the huffy creation, IE the pre-rendering job in MeGUI) This works out to an extra 2.3 hours for a 22 minute episode! (an extra 4.6 hours without the pre-render job)

So...
What is the difference in sharpening routines? (I mean, they are both part of MaskTools, and they must have something in common)

Why is LSF SO much faster then VMToon?

Anyone ever tried combining LSF with a line darkener as a replacement for VMToon?
Dr.Khron is offline   Reply With Quote
Old 11th May 2007, 05:32   #2  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,386
I always use vmtoon's line darkening and disable everything else. imo the sharpening method is misguided and tries to brute force recreate LSF+Warpsharp, which is what I use. This is how I call it:
vmtoon(sharpen=false,thinning=0,strength=35,luma_cap=203,threshold=8)
using avsp to tweak the darkening.

I find warpsharp has a more pleasant and much more tweakable 'thinning' effect, and oversampled xsharpen isn't really that great of a sharpener. (The entire reason vmtoon is so slow is that it feeds the equivalent of 16xFSAA into xsharpen, whereas LSF defaults to around 2x.) However, the darkening part is a little nicer than fastlinedarken's, so it's still useful.

Of course others may like its specific effects more, I'm not denigrating mf's work to create it.
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order. ~ Ed Howdershelt

Last edited by foxyshadis; 11th May 2007 at 05:34.
foxyshadis is offline   Reply With Quote
Old 11th May 2007, 13:07   #3  |  Link
Dr.Khron
Registered User
 
Dr.Khron's Avatar
 
Join Date: Oct 2006
Location: Gotham City, USA
Posts: 389
Ah, thank you for your thoughtful response.

As for which sharpening tecnique looks the best, I've only used a few sources since I switched to using VMToon, so its not like I've seen everything yet.

Even though I fooled around with VMToon without the line darkening (to compare sharpening routines), I havn't yet tried to turn off the sharpening (to use VMToon as just a line darkener). I'll give that a shot. From what I've seen so far, I'm confident that the combination with LSF and VMToon's line darkening is going to look really good.

EDIT:
Oh yeah, whats your script look like for combining LSF with Warsharp?
Dr.Khron is offline   Reply With Quote
Old 11th May 2007, 16:10   #4  |  Link
check
phjbdpcrjlj2sb3h
 
check's Avatar
 
Join Date: Sep 2005
Location: Western Australia
Posts: 1,692
have you tried using fasterlinedarken() for line darkening? It's significantly faster and gives very similar results when that's all you want.
check is offline   Reply With Quote
Old 11th May 2007, 17:06   #5  |  Link
Terranigma
*Space Reserved*
 
Terranigma's Avatar
 
Join Date: May 2006
Posts: 953
Quote:
Originally Posted by check View Post
have you tried using fasterlinedarken() for line darkening? It's significantly faster and gives very similar results when that's all you want.
Where would one find fasterlinedarken? Google yielded no results, and doom9 only leads to this thread. =P
Terranigma is offline   Reply With Quote
Old 11th May 2007, 17:25   #6  |  Link
Dr.Khron
Registered User
 
Dr.Khron's Avatar
 
Join Date: Oct 2006
Location: Gotham City, USA
Posts: 389
yah, I second that... Yahoo and google no help, and none of the filter collection websites seem to have it either.
Maybe its part of MaskTools, or WarpSharp?
(I'm at work, so I can't check right now)


The AMV beta guide seems to imply that VMToon uses FasterLineDarken:

Quote:
vmToon: Those of you who read the previous version of this guide may remember two functions by the names of FastLineDarken and MFToon. Now imagine if those two functions got together and gave birth to a new function that combines their abilities into something far better, and you have vmToon!
That would suggest that using VMToon with the sharpening turned off is equivelent to using FasterLineDarken...
Dr.Khron is offline   Reply With Quote
Old 11th May 2007, 17:35   #7  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,390
Reading carefully, one can notice that the name is not FasterLineDarken.
It's just FastLineDarken, without "er" in it.

P.S. Sorting search results in ascending order (instead of default descending) often is quite useful. The oldest post/threads mentioning your target usually are those where the target first saw the light of the world.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)

Last edited by Didée; 11th May 2007 at 17:38.
Didée is offline   Reply With Quote
Old 11th May 2007, 17:56   #8  |  Link
Terranigma
*Space Reserved*
 
Terranigma's Avatar
 
Join Date: May 2006
Posts: 953
I've seen mention of fasterlinedarken somewhere else. I'm guessing that the following is fasterlinedarken; a faster version of fastlinedarken (which is the what check's talking about)
Code:
#############################
# FastLineDarken 1.3 MT MOD #
#############################
#
# Written by Vectrangle, last update 12 Sept 04
#
#  * requires masktools 1.5.1 -- http://jourdan.madism.org/~manao/
#  * requires yv12 input
#
# Usage is FastLineDarken(strength, luma_cap, threshold, thinning),
#   named parameters are supported eg FastLineDarken(thinning=0)
# 
# Note that you must import this avs into your script using import("...\FastLineDarken.avs")
#
# Parameters are:
#  strength (integer)  - Line darkening amount, 0-256. Default 48. Represents the _maximum_ amount
#                        that the luma will be reduced by, weaker lines will be reduced by
#                        proportionately less.
#  luma_cap (integer)  - value from 0 (black) to 255 (white), used to stop the darkening
#                        determination from being 'blinded' by bright pixels, and to stop grey
#                        lines on white backgrounds being darkened. Any pixels brighter than
#                        luma_cap are treated as only being as bright as luma_cap. Lowering
#                        luma_cap tends to reduce line darkening. 255 disables capping. Default 191.
#  threshold (integer) - any pixels that were going to be darkened by an amount less than
#                        threshold will not be touched. setting this to 0 will disable it, setting
#                        it to 4 (default) is recommended, since often a lot of random pixels are
#                        marked for very slight darkening and a threshold of about 4 should fix
#                        them. Note if you set threshold too high, some lines will not be darkened
#  thinning (integer)  - optional line thinning amount, 0-256. Setting this to 0 will disable it,
#                        which is gives a _big_ speed increase. Note that thinning the lines will
#                        inherently darken the remaining pixels in each line a little. Default 24.
#
# Changelog:
#  1.3  - added ability to thin lines, now runs much slower unless thinning=0. Changed the defaults (again)
#  1.2  - huge speed increase using yv12lutxy =)
#       - weird darkening issues gone (they were caused by yv12layer)
#       - show option no longer available due to optimizations. Use subtract() instead
#  1.1  - added luma_cap option
#  1.0  - initial release
#


function FastLineDarkenMOD( clip c, int "strength", int "luma_cap", int "threshold", int "thinning") 
{
## parameters ##
str 	= string(default(strength, 48) /128.)
lum 	= string(default(luma_cap, 191))
thr 	= string(default(threshold, 4))
thinning = default(thinning,24)
thn 	= string(thinning /16.)

## filtering ##
exin	= c.mt_expand().mt_inpand()
diff 	= mt_lutxy(c,exin,yexpr="y "+lum+" < y "+lum+" ? x "+thr+" + > x y "+lum+" < y "+lum+" ? - 0 ? 127 +",uexpr="x",vexpr="x",u=2, v=2)
linemask= mt_lut(diff.mt_inpand(),"x 127 - "+thn+" * 255 +").mt_convolution("1 1 1","1 1 1",y=3,u=0,v=0)
thick 	= mt_lutxy(c, exin, yexpr="y "+lum+" < y "+lum+" ? x "+thr+" + > x y "+lum+" < y "+lum+" ? - 0 ? "+str+" * x +",uexpr="x",vexpr="x",u=2, v=2)
thin 	= mt_lutxy(c.mt_expand(),diff,yexpr="x y 127 - "+str+" 1 + * +",u=2, v=2)

return (thinning == 0) ? thick : mt_merge(thin,thick,linemask,y=3,u=2,v=2)
}
I had it for quite some time
Terranigma is offline   Reply With Quote
Old 11th May 2007, 18:56   #9  |  Link
Alain2
Registered User
 
Join Date: May 2005
Posts: 236
You have toon as well to try if you want : http://forum.doom9.org/showthread.ph...light=toon+0.8
Alain2 is offline   Reply With Quote
Old 11th May 2007, 19:07   #10  |  Link
check
phjbdpcrjlj2sb3h
 
check's Avatar
 
Join Date: Sep 2005
Location: Western Australia
Posts: 1,692
I'm afraid any copy I might have had was lost in the great hard drive crash of 2007-05-05 . The copy above looks similar, if not the same as what I had though.
check is offline   Reply With Quote
Old 11th May 2007, 19:20   #11  |  Link
Unearthly
Encoder in Training
 
Unearthly's Avatar
 
Join Date: Mar 2007
Location: Massachusetts
Posts: 37
Does FasterLineDarken have any quality differences compared to FastLineDarken? Or is it simply more optimized?
Unearthly is offline   Reply With Quote
Old 11th May 2007, 20:28   #12  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,390
It's just a change from MaskTools v1 to MaskTools v2. The speed gain comes mostly from v2's mt_in-/expand(), which are much faster than in-/expand() of v1. And a bit comes of v2's mt_convolution, wich is faster than v1's yv12convolution has been.
(BTW, when using thinning, a tiny bit more speed could be squeezed by replacing mt_convolution("1 1 1","1 1 1",y=3,U=0,V=0) with RemoveGrain(20,-1). Same operation, but faster.)

Regarding functionality, both versions should be identical.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)

Last edited by Didée; 11th May 2007 at 20:30.
Didée is offline   Reply With Quote
Old 30th October 2007, 10:16   #13  |  Link
legionator2
Leecher
 
legionator2's Avatar
 
Join Date: Aug 2007
Location: Vietnam
Posts: 19
Hello there. I'm new here. I have a problem with the FastLineDarken and FastLineDarkenMod. It's about the thinning parameter. The result is pretty good if I set it to 0. But when I set it to a greater number than 0, the entire video will look terrible like this. I don't know why. I'm using AVISynth 2.5.7 and MaskTools 1.58. Is there a way to solve this problem?

Last edited by legionator2; 30th October 2007 at 10:36.
legionator2 is offline   Reply With Quote
Old 30th October 2007, 10:38   #14  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,390
Seems that FastLineDarkenMOD() still is not correct ...

Code:
function FastLineDarkenMOD( clip c, int "strength", int "luma_cap", int "threshold", int "thinning") 
{
## parameters ##
str 	= string(default(strength, 48) /128.)
lum 	= string(default(luma_cap, 191))
thr 	= string(default(threshold, 4))
thinning = default(thinning,24)
thn 	= string(thinning /16.)

## filtering ##
exin	= c.mt_expand().mt_inpand()
diff 	= mt_lutxy(c,exin,yexpr="y "+lum+" < y "+lum+" ? x "+thr+" + > x y "+lum+" < y "+lum+" ? - 0 ? 127 +",uexpr="x",vexpr="x",u=2, v=2)
linemask= mt_lut(diff.mt_inpand(),"x 127 - "+thn+" * 255 +").mt_convolution("1 1 1","1 1 1",y=3,u=0,v=0)
thick 	= mt_lutxy(c, exin, yexpr="y "+lum+" < y "+lum+" ? x "+thr+" + > x y "+lum+" < y "+lum+" ? - 0 ? "+str+" * x +",uexpr="x",vexpr="x",u=2, v=2)
thin 	= mt_lutxy(c.mt_expand(U=2,V=2),diff,yexpr="x y 127 - "+str+" 1 + * +",u=2, v=2)

return (thinning == 0) ? thick : mt_merge(thin,thick,linemask,y=3,u=2,v=2)
}
The change in red makes thinning work correctly.
(Or alternatively, "U=4,V=4" in the last mt_merge line.)

Replacing the green code with ".RemoveGrain(20,-1)" gives a little speed boost.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 30th October 2007, 10:51   #15  |  Link
legionator2
Leecher
 
legionator2's Avatar
 
Join Date: Aug 2007
Location: Vietnam
Posts: 19
Thank you Didée. Now it worked correctly.
legionator2 is offline   Reply With Quote
Old 5th October 2012, 18:38   #16  |  Link
Jenyok
Warm and fuzzy
 
Join Date: Apr 2010
Location: Moscow, Russia
Posts: 201
Anybody, please, put code of function FastLineDarkenMOD2(...)
Thanks for advice.
__________________
Warm and fuzzy (white and fluffy)

Last edited by Jenyok; 5th October 2012 at 19:09.
Jenyok is offline   Reply With Quote
Old 5th October 2012, 19:03   #17  |  Link
mastrboy
Registered User
 
Join Date: Sep 2008
Posts: 287
Code:
function FastLineDarkenMOD2( clip c, int "strength", int "luma_cap", int "threshold", int "thinning")
{
## parameters ##
str     = string(default(strength, 48) /128.)
lum     = string(default(luma_cap, 191))
thr     = string(default(threshold, 4))
thinning = default(thinning,24)
thn     = string(thinning /16.)
 
## filtering ##
exin    = c.mt_expand().mt_inpand()
diff    = mt_lutxy(c,exin,yexpr="y "+lum+" < y "+lum+" ? x "+thr+" + > x y "+lum+" < y "+lum+" ? - 0 ? 127 +",uexpr="x",vexpr="x",u=2, v=2)
linemask= mt_lut(diff.mt_inpand(),"x 127 - "+thn+" * 255 +").mt_convolution("1 1 1","1 1 1",y=3,u=0,v=0)#".RemoveGrain(20,-1)" gives a little speed boost.
thick   = mt_lutxy(c, exin, yexpr="y "+lum+" < y "+lum+" ? x "+thr+" + > x y "+lum+" < y "+lum+" ? - 0 ? "+str+" * x +",uexpr="x",vexpr="x",u=2, v=2)
thin    = mt_lutxy(c.mt_expand(U=2,V=2),diff,yexpr="x y 127 - "+str+" 1 + * +",u=2, v=2)
 
return (thinning == 0) ? thick : mt_merge(thin,thick,linemask,y=3,u=2,v=2)
}
__________________
(i have a tendency to drunk post)
mastrboy is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:00.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.