digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Avisynth Scripting (http://www.digitalfaq.com/archives/avisynth/)
-   -   Avisynth: Trying out LimitedSharpen() (http://www.digitalfaq.com/archives/avisynth/13762-avisynth-limitedsharpen.html)

incredible 09-01-2005 08:58 AM

Funny, ... Im at work so I had to dig for it in the forums as its in my avsiynths plugins folder as permanent available avsi.

Seems there are 2 diff. versions in the outside!
Boulder, do you know which one is more recent?
(anyway someone should try by himself and see which result is better *lol)
Code:

function LRemoveDust(clip input, int _mode, int "limit")
{
limit=default(limit,4)
repmode = 2
clensed = Clense(input)
rep=Repair(clensed, input, mode=repmode)
rg = RemoveGrain(rep, mode=_mode)
rd=TemporalRepair(rg, rep)
return LimitChange(rd, input, limit, limitU=255)
}

EDIT: I figured it out: The version above is for SSE in general capable CPUs (usage of LimitChange), the version posted by Gamma is for NON SSE capable CPUs.

@ Phil
LRemovedust is one of the best denoisers I know IF the aspect "spedd in relation to denoising" counts.
BUT be careful as you should tweak the modes and limits as it could erase Details significantly.
(see Boulders post above)

People say its as good as pixiedust but for shure hughinnnngggg faster, For me Pixiedust is still a tiny bit better.




I also found a fast version of LimitedSharpen at the Gleitz board from Didée. Well NO masks and also other things have been pulled out.
("schnell" means "fast" in german ;) )

Code:

# LimitedSharpen()
#
# A multi-purpose sharpener by DidÈe
#
function LS_schnell_schnell( clip clp,
 \                      float "ss_x",  float "ss_y",    int "dest_x", int "dest_y",
 \                      int  "Smode",  int  "strength", int  "radius" )
{
ox = clp.width
oy = clp.height
ss_x =    default( ss_x, 1.5 )
ss_y =    default( ss_y, 1.5 )
dest_x =  default( dest_x, ox )
dest_y =  default( dest_y, oy )
Smode =    default( Smode, 3 )
strength = Smode==1
 \      ? default( strength, 160 )
 \      : default( strength, 100 )
strength = Smode==2&&strength>100 ? 100 : strength
radius =  default( radius, 2 )
#radius =  round( radius*(ss_x+ss_y)/2)  #  If it's you, Mug Funky - feel free to activate it again 

xxs=round(ox*ss_x/8)*8
yys=round(oy*ss_y/8)*8

clp.isYV12() ? clp : clp.converttoyv12()

ss_x != 1.0 || ss_y != 1.0 ? last.lanczosresize(xxs,yys) : last
tmp = last

dark_limit  = tmp.inpand()
bright_limit = tmp.expand()

minmaxavg    = yv12lutxy(bright_limit,dark_limit,yexpr="x y + 2 /")

Str=string(float(strength)/100.0)
normsharp = Smode==1 ? tmp.unsharpmask(strength,radius,0)
 \        : Smode==2 ? tmp.sharpen(float(strength)/100.0)
 \        :            yv12lutxy(tmp,minmaxavg,yexpr="x x y - "+Str+" * +",U=2,V=2)

repair(normsharp,tmp,mode=1)

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

clp.isYV12() ? last
 \          : lanczosresize(clp, dest_x,dest_y).mergeluma(last.converttoyuy2())

 return last
}
#


You should really use it in combination with TemporalRepair as it prevents the output from heavy spatialfilter resulted artifacts.

orig = Mpeg2Source()
filtered = orig. LS_schnell_schnell(.........)
TemporalRepair(Filtered, orig)

In case of Heavy Temporal filtering and avoiding its artifacts...

orig = Mpeg2Source()
filtered = orig. TemporalFilterXYZ()
Repair(Filtered, orig, repmode=x)

Dialhot 09-01-2005 08:59 AM

Thanks. The "mode" parameter made me think this was into RemoveGrain but I did not understood it was a an external function using RemoveGrain.

I have to find now where is "LimitChange" :D

Note: funny that this function is so smart. Looking at it it seems to be done by someone that wanted to try all functions from RemoveGrain together :).

Boulder 09-01-2005 09:09 AM

These are the ones that I use:

Code:

function LRemoveDust_YUY2(clip input, int clmode, int "limit")
{
clmode=default(clmode,17)
limit=default(limit,2)
repmode = 2
clensed = Clense(input, grey=true)
rep = Repair(clensed, input, mode=repmode, modeU=-1)
rg = RemoveGrain(rep, mode=clmode, modeU=-1)
return LimitChange(rg, input, limit, limitU=255)
}

function LRemoveDust_YV12(clip input, int clmode, int "limit")
{
limit=default(limit,2)
clmode=default(clmode,17)
repmode = 2
clensed = Clense(input)
rep = Repair(clensed, input, mode=repmode)
rg = RemoveGrain(rep, mode=clmode)
return LimitChange(rg, input, limit)
}

I've ditched the TemporalRepair part as that's not necessary with mode 17. LimitChange can be found in the latest SSETools plugin, which is in the RemoveGrain v0.9 package.

The YV12 one is for stuff that's originally YV12. The YUY2 version is for my YUY2 captures, process chain is
Code:

AVISource()
org=last
ConverttoYV12()
LRemoveDust(17,2)
ConverttoYUY2()
MergeChroma(org)


GFR 09-02-2005 06:29 AM

Quote:

Originally Posted by Boulder
Uh, I'm often confused as well :lol:

I'd say look for removedirt, removegrain, avstimer, avsrecursion and ssetools (under construction) - add the word in www.xxx.de.tf.

As his documenting style is very verbose, I guess he decided to make separate domains for each one. One single page with all the links would have been really great, maybe I should ask him to do that.

Nowadays I use Didée's LTSMC for my analog captures so I haven't had to keep up with all the different plugins, IIRC that one uses RemoveGrain and SSETools from kassandro's plugins. kassandro's forum is a good place for information, and he's also very positive towards any new ideas - as you can see from RemoveGrain, which contains ~30 modes already 8O

Hi Boulder,

Do you have some suggested settings for LTSMC (like for VHS camcorders or TV captures)?

How does it compare to LRemoveDust (for captures)? I have used LRemoveDust(4,2) for VHS camcorder works OK for me.

Perhaps we should split this to the capture forum, or start a new thread here at optimal scripts.

Boulder 09-02-2005 07:02 AM

Quote:

Originally Posted by GFR
Perhaps we should split this to the capture forum, or start a new thread here at optimal scripts.

http://www.kvcd.net/forum/viewtopic.php?t=16106

Boulder 09-06-2005 10:06 AM

Check out Soothe() , another fine function from Didée :D

Designed to be used after sharpeners, especially LimitedSharpen.

http://forum.doom9.org/showthread.php?t=99679

Dialhot 09-11-2005 03:29 PM

Quote:

Originally Posted by incredible
Quote:

Originally Posted by Boulder
I've got this one : http://home.arcor.de/kassandro/Remov...emoveGrain.rar (RemoveGrain v1.0 prerelease) and the last SSETools from the official RemoveGrain v0.9 package. Confusing, huh 8O

thanks! Ill have a look at it, even I think its the one Im also working with.

Inc,

Did you fix the alignment problem finally ? If yes, how ?
Because I'm suffering the same problem on a P4 : with ConvertToYUY2().ConvertToYV12() the script needs 4 minutes to encode a 100 second sample, but without it is took... 30 minutes 8O

Edit: Forget. I solved it using "true" in the Crop line and avisynth 2.5.6RC1.

Note: concerning results you are right, this is definitely better than RemoveGrain().Deen() for the same speed and almost the same filesize !

incredible 09-11-2005 05:10 PM

I even used crop(....., align=true) but did not help in my case.
Only when 2x supersampling like done in LS() ... then no CspaceConversion is needed, so it defenitely has something to do with alignment in memory.

Kassandro gots his own forum (link above on the removedirt site).
Till now im a bit busy and I didnt go further tweaking LS() or LRemovedust() ... so someone could ask there or lets wait till I have time.

The ColorQualityloss of that nonsense CspaceConversion can be restored by using mergechroma() as the luma wont be touched - not in the conversion, neither by LRemovedust().

OrigChroma = last
ConverttoYUY2().ConverttoYV12()
LRemovedust(17,x)
MergeChroma(OrigChroma)

Anyhow, these routines even if not touching the chromaquality finally do use unneeded Routines/CPU-power, so that really should be discussed at Kassandros Board.

gamma 12-16-2005 01:15 PM

For the ones interested, there's a new version of LS(), which incorporates a new smode (smode=4), different approach to the "soft" option and yes, it's faster!

get it here:
http://forum.doom9.org/attachment.php?attachmentid=5007

All I can say is 8O

BTW you will need the latest removegrain package (1.0), otherwise you'll get an error that mode 19 isn't available.

Look what's smode4 got in store for us...

http://www.digitalfaq.com/archives/error.gif
http://www.digitalfaq.com/archives/error.gif

No tweaked settings. IMO is the second picture a bit overdone, so the defaults are a bit strong.

rds_correia 12-26-2005 03:18 PM

Nice end results gamma.
Could you please point us to the right thread @ D9 where you found this modded LS() ?
TIA
Cheers

supermule 12-26-2005 10:32 PM

Btw, which movie are these clippings from, seems interesting, gotta see it :)

gamma 12-27-2005 01:10 AM

Quote:

Originally Posted by rds_correia
Nice end results gamma.
Could you please point us to the right thread @ D9 where you found this modded LS() ?
TIA
Cheers

Thanks. The whole thread is here: http://forum.doom9.org/showthread.ph...limitedsharpen
Look at page 11 for the new version. A few pages further the latest removegrain package is linked. Of course credits to Inc for spotting this in the first place :wink:

gamma 12-27-2005 01:12 AM

Quote:

Originally Posted by supermule
Btw, which movie are these clippings from, seems interesting, gotta see it :)

It's Blade Trinity, and yes, you gotta see this :D

Dialhot 12-27-2005 03:57 AM

The direct links :
http://forum.doom9.org/showthread.ph...909#post731909
http://forum.doom9.org/showthread.ph...098#post732098

(LS() was few lines before, it is now a complete programm :))

rds_correia 12-27-2005 05:34 AM

Hi guys,
Thanks for the links :D.
Cheers

Prodater64 12-28-2005 12:54 PM

Could somebody explain the whole process with examples.
I didn't understand nothing.

rds_correia 12-28-2005 01:28 PM

Which post did you find problems understanding?
We're talking about LimitedSharpen() which is in fact a function like ADS, slicer, etc.
LimitedSharpen or simply LS() is especially good for encoding non-Anamorphic sources to Anamorphic targets.
Other than that we just talked about where we can read about it in D9 with more detail.
If you're still missing something, Luis, just ask us again but try to give us a hint on what you're not understanding so that we can help ;-).
Cheers

Prodater64 12-28-2005 03:36 PM

Quote:

Originally Posted by rds_correia
Which post did you find problems understanding?
We're talking about LimitedSharpen() which is in fact a function like ADS, slicer, etc.
LimitedSharpen or simply LS() is especially good for encoding non-Anamorphic sources to Anamorphic targets.
Other than that we just talked about where we can read about it in D9 with more detail.
If you're still missing something, Luis, just ask us again but try to give us a hint on what you're not understanding so that we can help ;-).
Cheers

I did read that Inc said that is hard to find out the parameters.
I would want to know if there are some basic parameter as, i.e. LRemoveDust(17,2).

rds_correia 12-28-2005 03:46 PM

Quote:

Originally Posted by Prodater64
I would want to know if there are some basic parameter as, i.e. LRemoveDust(17,2).

I see.
I'd like to know that myself too.
I think LS() is too complex.
And maybe even experienced scripters like Phil, Andrej, Boulder, Kwag, etc have hard times configuring this function.
Let's see if some of them gives us a hint ;-).

Shibblet 12-28-2005 07:19 PM

I am having three problems with LimitedSharpen().

1. It does clear up the image, and add some missing detail, however it adds edging and pixels to places that weren't really there before. So a stationary object in the background results in some flickering around the edges because of the sharpening from frame to frame.

2. By adding these extra pixeled areas, you are actually increasing the size of your encode. Which results in having to lower your quality level in order to make it fit in the same place it was before.

3. Older movies (which are problematic and noisy to begin with) seem to get a lot of edging issues from frame to frame.

Anybody else get these same results?

Dialhot 12-28-2005 08:48 PM

Quote:

Originally Posted by Shibblet
Anybody else get these same results?

You are just experiencing all the reasons why I always say that a sharpener should never be used. And the reason why I do not use any !

BTW, LS is a lot tweakable and you will probably find a way to limit the bad effects (that is the purpose of the function).

gamma 12-29-2005 02:51 AM

Quote:

Originally Posted by Shibblet
I am having three problems with LimitedSharpen().

1. It does clear up the image, and add some missing detail, however it adds edging and pixels to places that weren't really there before. So a stationary object in the background results in some flickering around the edges because of the sharpening from frame to frame.

2. By adding these extra pixeled areas, you are actually increasing the size of your encode. Which results in having to lower your quality level in order to make it fit in the same place it was before.

3. Older movies (which are problematic and noisy to begin with) seem to get a lot of edging issues from frame to frame.

Anybody else get these same results?

Well, I think your settings are too "strong".
Try this:

Code:

Lremovedust(4,1)
limitedsharpen(ss_x=1, ss_y=1, smode=3, strength=50, soft=20)

That works like a charm for most of my encodes. Also, play with the smode setting, try smode=4 for example. You can also try to add "wide=true".

BTW: on a test I did a while ago, the following syntax gave me a better
subjective picture, and a equal filesize than a lancosresize.
Code:

limitedsharpen(ss_x=2.0,ss_y=2.0, lmode=2, wide=true, strength=50, dest_x=..., dest_y=...)
The higher the supersampling is, the slower the encode becomes, but you can increase the strength without getting more artifacts.

rds_correia 12-29-2005 03:35 AM

Nice tips gamma.
Thanks :D.
BTW I find that LRemoveDust(17,2) softens too much for my taste.
I've been trying other methods and 17,1 seems to be much better for clean sources.
Tonight I'll try LS() more deeply too.
This thread http://www.kvcd.net/forum/viewtopic.php?t=16032 has some very good comparing scripts that really help (along with some test encodes) to get a better idea on how this works.
Cheers

Boulder 12-29-2005 04:24 AM

Don't forget to use Soothe() when you use LimitedSharpen, it'll fix some of the issues related to LS. See the link I posted earlier in this thread.

gamma 12-29-2005 04:36 AM

Quote:

Originally Posted by rds_correia
Nice tips gamma.
Thanks :D.

You're welcome :D

Quote:

Originally Posted by rds_correia
BTW I find that LRemoveDust(17,2) softens too much for my taste.
I've been trying other methods and 17,1 seems to be much better for clean sources.

If I remember correctly, the first number (in this case 17) is the Removegrain-mode the function calls. (please, somebody correct me if i'm wrong). Looking at the documentation of removegrain, mode 2 or 5 are the least "destructive" for the details. So lremovedust(5,1) for example should give a good result also.

Boulder 12-29-2005 06:59 AM

Modes 1,2 and 5 are not as effective so I wouldn't recommend using them in LRD. Mode 17 also preserves thin lines better than those mentioned. Using a limit of 1 should be enough to keep the details but press down the noise and grain.

Prodater64 12-29-2005 07:41 AM

I would wish to know how about the crop/resize to transform not anamorphic to anaporphic with LS()?
That is not mentioned in any place here!!!
How must i to do it?
Or is it that the function will do it automatically?

Boulder 12-29-2005 08:43 AM

FitCD will handle the maths.

Prodater64 12-29-2005 12:56 PM

Quote:

Originally Posted by Boulder
FitCD will handle the maths.

You mean that i must to load the non anamorphic source, and set the target as anamporphic and that is all?

Dialhot 12-29-2005 01:14 PM

Exactly.

gamma 12-30-2005 04:56 AM

Just for pointers, a fast version of LS() is obtained this way:

read this: http://forum.doom9.org/showpost.php?...&postcount=339

Then download this:
http://people.pwf.cam.ac.uk/mg262/po...t_03Dec05B.dll
and this:
http://people.pwf.cam.ac.uk/mg262/po...penFaster.avsi
and this:
http://manao4.free.fr/masktools-v2.0a13.zip

Then load limitedsupport and masktools 2.0a as plugins, and import the limitedsharpenfaster routine. Call the function with:

Code:

LimitedsharpenFaster(.....)
When using lremovedust at the same time be aware that you'll still be needing the old version of masktools (v1.5.x). This is because the internal names for the filters have changed. Loading both versions at the same time works perfectly.

Using this faster LS() i went from CCE encode speed with the same clip from 0,28 to 0,81. Results are exactly the same as the original LS(), at least for my eyes. :D

supermule 02-01-2006 02:06 AM

the limited support dll is no longer available for download, can you upload it pls.

Also reading so many posts is confusing, can someone post a final fast version of limitedsharpen(in avsi format) with all required plugins and a limitedsharpen(parameter).

Boulder 02-01-2006 02:28 AM

Read what I answered you just a while ago :roll:

Dialhot 02-01-2006 03:33 AM

Quote:

Originally Posted by supermule
the limited support dll is no longer available for download, can you upload it pls.

I did not test yet but it is supposed to be included in last masktool so this dll is not needed anymore.

Racer99 02-01-2006 12:33 PM

If it isn't you can try just checking the root, there are couple of versions there.

http://people.pwf.cam.ac.uk/mg262/posts/

supermule 02-01-2006 11:36 PM

I found the dll and tested it also, doesnt suit my taste so I will keep it for later.

gamma 02-02-2006 03:12 AM

Quote:

Originally Posted by supermule
I found the dll and tested it also, doesnt suit my taste so I will keep it for later.

What do you mean? You'll won't be needing the dll anymore as it is packaged in the latest masktools.

supermule 02-02-2006 05:11 AM

the .dll is part of the tool download now.

Limitedsharpenfaster() sharpened enough to create artifacts and is still slower. So I will stick with the conventional sharpeners for now.

I am currently trying Rsharpen and denoisesharpen, they look promising.

Dialhot 02-02-2006 07:28 AM

Quote:

Originally Posted by supermule
I am currently trying Rsharpen and denoisesharpen, they look promising.

Never heard about them. Please open a toppic on them is there is something interresting to know.

Edit: oups. Just saw that you already did that.
http://www.kvcd.net/forum/viewtopic.php?p=123781#123781

Dialhot 02-16-2006 03:50 AM

To summurize a little :

LimitedSharpenFaster to replace LimitedSharpen is a lot faster !

With LS() I encoded in 0.53x for a half DVD resolution (352*480). For the same source and the same script but using LSF() I encode at 0.80x for a SVCD resolution (480*480).

You simply need RemoveGrain upper to version 0.9 (so 1.0 ios good) and Masktool above 2.0a20.

http://home.arcor.de/kassandro/Remov...emoveGrain.rar
http://manao4.free.fr/masktools-v2.0a27.zip

LFS() is delivered as an avsi file in the masktool zip.

Quote:

Originally Posted by supermule
Limitedsharpenfaster() sharpened enough to create artifacts

These artifacts should be removed by Soothe().
http://forum.doom9.org/showthread.php?t=99679

Note : I dit not have time to test Soothe().

Thanks to Boulder and the guys that did that :)


All times are GMT -5. The time now is 09:33 AM  —  vBulletin © Jelsoft Enterprises Ltd

Site design, images and content © 2002-2026 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2026 Jelsoft Enterprises Ltd.