Log in

View Full Version : Anti-aliasing script


Pages : [1] 2

SpikeSpiegel
5th October 2004, 12:18
function antialiasing(clip orig,int "th_luma",int "th_croma",string "type",int "aath") {

# "th_luma" & "th_croma" are the edge detection thres.: lower values=more edges filtered
# "type" is the matrix used for edge detection: with "sobel" (default) only the
# hi-contrast edges, where artefacts are more noticeable, are filtered. If you want
# to test other matrices, read the MaskTools Guide for more info.
# "aath" = anti-aliasing strenght (default should be fine)

th_luma = Default(th_luma, 20)
th_croma = Default(th_croma, 20)
type = Default(type, "sobel")
aath = Default(aath, 48)
ox = orig.width
oy = orig.height
dx = orig.width * 2
dy = orig.height * 2
clp = orig.IsYV12() ? orig : orig.ConvertToYV12()

a=clp
b=clp.Lanczos4Resize(dx,dy).TurnLeft().SangNom(aa=aath).TurnRight().SangNom(aa=aath) \
.LanczosResize(ox,oy)
c=clp.EdgeMask(th_luma,th_luma,th_croma,th_croma,type)
MaskedMerge(a,b,c)

}

Hi!

This filter is meant for good quality clips with soft antialiasing (like DVs);
thanks to MaskTools' functions, a strong AA-filter (Sangnom) is applied only where it's needed without producing artefacts typical of this filter.

Requires:
-MaskTools
-SangNom

Let me know what do you think about it!

P.S. Thanks to Didée, mf, scharfis_brain and Soulhunter (in alphabetical order) for their help!

EDIT1: Ooops! Now, with Lanczos4Resize instead of PointResize, there's no definition loss nor artefacts.
...and now SangNom's config. is aviable
EDIT2: Credits
EDIT3: Fixed a typo, erased a useless option, more info added.

Didée
5th October 2004, 16:29
Did a quick comparison of some methods. I post the script as well, in case I've made an error in the hurry ...

http://img15.exs.cx/img15/3225/some_anti_aliasing_methods2.jpg

script:
mpeg2source()
crop(much)
orig=last
ox=last.width
oy=last.height
jaggy=orig.separatefields().selecteven()
SangN=jaggy.antialiasing().lanczosresize(ox,oy)
SangNSS=jaggy.lanczosresize(ox,oy).antialiasing()
tom=jaggy.tomsmocomp(1,-1,0)
tomSS=jaggy.lanczosresize(ox,oy).tomsmocomp(1,-1,1).lanczosresize(ox,oy)
trit=orig.tdeint(mode=0,order=1,field=1,mthreshL=-1,mthreshC=-1,type=1)
tritSS=jaggy.pointresize(ox,oy).tdeint(mode=0,order=1,field=1,mthreshL=-1,mthreshC=-1,type=1)
dble=jaggy.pointresize(ox,oy).tdeint(mode=0,order=1,field=1,mthreshL=-1,mthreshC=-1,type=1)
\ .tomsmocomp(1,-1,1).lanczosresize(ox,oy)
dbleS=dble.LimitedSharpen(ss_x=2.0,ss_y=1.0,Smode=3,strength=200,Lmode=2,overshoot=1)

# without the dreadful subtitle commands:
stackvertical(
\ stackhorizontal(jaggy.lanczosresize(ox,oy).subtitle(jaggystr,size=12),orig),
\ stackhorizontal(SangN,SangNSS),
\ stackhorizontal(tom,tomSS),
\ stackhorizontal(trit,tritSS),
\ stackhorizontal(dble,dbleS) )

return last

edit: better placing of cropped area.

SpikeSpiegel
5th October 2004, 18:53
Originally posted by Didée
Did a quick comparison of some methods. I post the script as well, in case I've made an error in the hurry ...

script:
mpeg2source()
crop(much)
orig=last
ox=last.width
oy=last.height
jaggy=orig.separatefields().selecteven()
SangN=jaggy.antialiasing().lanczosresize(ox,oy)
SangNSS=jaggy.lanczosresize(ox,oy).antialiasing()
tom=jaggy.tomsmocomp(1,-1,0)
tomSS=jaggy.lanczosresize(ox,oy).tomsmocomp(1,-1,1).lanczosresize(ox,oy)
trit=orig.tdeint(mode=0,order=1,field=1,mthreshL=-1,mthreshC=-1,type=1)
tritSS=jaggy.pointresize(ox,oy).tdeint(mode=0,order=1,field=1,mthreshL=-1,mthreshC=-1,type=1)
dble=jaggy.pointresize(ox,oy).tdeint(mode=0,order=1,field=1,mthreshL=-1,mthreshC=-1,type=1)
\ .tomsmocomp(1,-1,1).lanczosresize(ox,oy)
dbleS=dble.LimitedSharpen(ss_x=2.0,ss_y=1.0,Smode=3,strength=200,Lmode=2,overshoot=1)

# without the dreadful subtitle commands:
stackvertical(
\ stackhorizontal(jaggy.lanczosresize(ox,oy).subtitle(jaggystr,size=12),orig),
\ stackhorizontal(SangN,SangNSS),
\ stackhorizontal(tom,tomSS),
\ stackhorizontal(trit,tritSS),
\ stackhorizontal(dble,dbleS) )

return last

edit: better placing of cropped area.

Hi!

I've already done a few tests (always with a deinterlaced DV) with TomsMoComp(x,1,1), but results weren't really encouraging:
with original resolution it removes almost all artefacts, but details are blurred; vice-versa with double height (good definition, but too much alias).

On the contrary, TDeint+doubleheight works quite well: results are similiar to "antialiasing", but there's a little definition loss.

Anyway, give a try to antialias (the last "version") with a hi-medium resolution source: this script is meant for good quality movies, that why it didn't perform well with the WB sample.

Bulletproof
6th October 2004, 03:18
Looks promising but it would be really great if someone could figure out how faroujda's DCDI method works to create an avisynth plugin. I personally own 3 devices with the DCDI chip for deinterlacing and it is pretty amazing when it comes to deinterlacing, it really eliminates jaggies good and keeps alot of resolution, here is an example:

http://www.av-outlet.com/images/help/dcdi-flag.jpg

It's not that great of a sample but if you've seen DCDI in action you will see that there is nothing that can beat it right now (I think so anyway). More detailed explination here: http://www.av-outlet.com/en-us/dept_335.html

Didée
6th October 2004, 10:25
Originally posted by SpikeSpiegel
Anyway, give a try to antialias (the last "version") with a hi-medium resolution source: this script is meant for good quality movies, that why it didn't perform well with the WB sample.
Erh, sorry. If the quality of that sample is not sufficient for your script, then your script is useless. The given sample is perfectly valid (It's the original PAL trailer of HPII, in full resolution. I just cropped down to an 'interesting' area).
In fact, most sources that do need antialiasing will be of not-so-impressing quality to start with - most probably they'll be of lower quality than the sample I used. And just discarding one field from a progressive sequence, as I did here, is a good simulation of common aliasing problems (capturing only one field, dumb bobbing, one field useless due to fieldblending, etc. pp.)


However, your script has a couple of issues that could be improved:


1.
You're offering the aa threshold for sangnom, but it is not used in the script. Your call of SangNom should read

SangNom(order,aath)


2.
Chroma probably is just passed through (it IS on that P-III I'm sitting at right now).
Better would be:

c=edgemask(...).FitY2UV()

I've found that in many cases, it's better to use the luma edges for chroma also, insted of creating edges on chroma directly.

If you prefer to use "native" chroma edges, then you must still write

c=edgemask(... , Y=3,U=3,V=3)

Else, you won't get any edges on the chroma planes at all (as in your posted script).

Finally, you should write

MaskedMerge(a,b,c, Y=3,U=3,V=3)

AFAIK, MaskedMerge's default is to leave chroma alone, unless one specifies U|V=3.


3.
As it is typical for EDI resamplers, SangNom too delivers an output that is spatially shifted from the input. This would not be a big issue ... if you would create the edgemask on the shifted frame. But you are creating it on the not-shifted input, and apply it later on the shifted output. That's not ideal. So, the declaration of "c" better should read

c=b.edgemask( .. ) ..


Below script addresses abovementioned issues, and includes these additional changes:

- added "HQedge" [bool]. It's slower, reckognizes edges better, is more robust against noise ... and perhaps is not suited at all for this application. So, it's just for testing & playing.
- normal edgemask is created on the original sized frame. HQedgemask is created on the (for sangnom) double-sized frame.

Without much testing:
function antialiasing( clip orig, int "th_luma", int "th_croma", string "type", int "order", int "aath", bool "HQedge")
{

# "th_luma" and "th_croma" affect directly the edge detection: higher values = more edges filtered
# set "order = 0" for Top Field First; order = 1 --> Bottom Field First
# aath = anti-aliasing strenght (default should be fine)


th_luma = Default(th_luma, 20)
th_croma = Default(th_croma, 20)
type = Default(type, "sobel")
order = Default(order, 1)
aath = Default(aath, 48)
HQedge = Default(HQedge, false)
ox = orig.width
oy = orig.height
dx = orig.width * 2
dy = orig.height * 2

orig.convertToYV12()
a=last
b=lanczos4Resize(dx, dy).TurnLeft().SangNom(order,aath).TurnRight().SangNom(order,aath)

# native chroma edges:
#c=b.lanczosresize(ox,oy).EdgeMask(0, th_luma, 0, th_croma, type,Y=3,U=3,V=3)

# use luma edges for chroma:
c=b.lanczosresize(ox,oy).EdgeMask(0, th_luma, 0, th_croma, type,Y=3,U=1,V=1).FitY2UV()

d= logic( b.DEdgeMask(0,255,0,255,"5 10 5 0 0 0 -5 -10 -5", divisor=4,Y=3,U=1,V=1)
\ ,b.DEdgeMask(0,255,0,255,"5 0 -5 10 0 -10 5 0 -5", divisor=4,Y=3,U=1,V=1)
\ ,"max").greyscale.levels(0,0.8,128,0,255,false).FitY2UV().lanczosresize(ox,oy)
b=b.lanczosresize(ox,oy)

HQedge ? MaskedMerge(a,b,d,Y=3,U=3,V=3) : MaskedMerge(a,b,c,Y=3,U=3,V=3)
}
Just some suggestions.

SpikeSpiegel
6th October 2004, 18:36
@ Didée:

Thanks for your help, as you may have noticed (the 1st error was quite exemplifying :o ) I didn't pay too much attention on the creation of the script itself (that needs MUCH improving), rather I wanted to give an idea, i.e.:

For aliasing is present only on edges, why we should filter the entire frame?

And the main reason of filtering only what needs it (edges), in this case, is not speed gain (...and you should know why ;) ), but to keep max definition.
Obviously, using a bad-quality source (where there's something more than simple alias), there's no need of this, that's why I wrote that it's more suiteg for medim-good quality stuff (even if this reduces the possible applications).

Anyway the EdgeDetection is tuned for sharp vids, then, if you are testing with mpeg2 samples, you should increase the threshold.

Now I don't have much free time, but asap I'll test HQedge and the other settings!


P.S. I don't see any difference between:

c=edgemask( .. )

and

c=b.edgemask( .. ).FitY2UV()

:confused:

Soulhunter
6th October 2004, 19:59
Hmm...

Anti-aliasing via SangNom seems to work !!!

Source

http://img83.exs.cx/img83/6343/Source.png

SangNom

http://img83.exs.cx/img83/3789/Sagnom.png

Think the edge-detection is the culprit ???

-> Range is not wide enough...


Btw, I thought the purpose is simple aliasing reduction !?!

But it seems you wanna use it to reduce interlace-leavings... :rolleyes:


Bye

Soulhunter
6th October 2004, 20:24
And it works very good @ anime/toon sources !!!

Sample with bad aliasing...

Source

http://img83.exs.cx/img83/5109/Source_DBGT_01.png

SangNom

http://img83.exs.cx/img83/7342/SangNom_DBGT_01.png


Bye

SpikeSpiegel
6th October 2004, 20:49
Originally posted by Soulhunter
Anti-aliasing via SangNom seems to work !!!

Hi!

Did you use only SangNom or the anti-alias script?

Originally posted by Soulhunter
Btw, I thought the purpose is "simple" anti-aliasing !?!

But it seems you wanna use it for interlace-leavings...

No, absolutely not, as you can see in the Didée's test, it doesn't work properly with interlace-leavings; anyway, some adaptive deinterlace filters may produce aliasing, that can be easily erased with a script like this, but only if there aren't other kinds of imperfections.

Soulhunter
6th October 2004, 21:06
Originally posted by SpikeSpiegel

Did you use only SangNom or the anti-alias script?

For the samples above Ive simply used the stuff mf told me... ;)

LanczosResize(X*2,Y*2).TurnLeft().SangNom().TurnRight().SangNom().LanczosResize(X,Y)


Bye

scharfis_brain
6th October 2004, 21:11
try

pointResize(X*2,Y*2).TurnLeft().SangNom().TurnRight().SangNom().LanczosResize(X,Y)

Soulhunter
6th October 2004, 22:14
Originally posted by scharfis_brain
try

pointResize(X*2,Y*2).TurnLeft().SangNom().TurnRight().SangNom().LanczosResize(X,Y)

Uhm, actually this is what mf told me... :D

before = last
PointResize(width*2, height*2)
ConvertToYUY2()
TurnLeft()
ConvertToYV12()
SangNom()
ConvertToYUY2()
TurnRight()
ConvertToYV12()
SangNom()
LanczosResize(width/2, height/2)
MergeChroma(before)


Sorry n' Bye

Soulhunter
6th October 2004, 23:54
Ok, a small update...

Source

http://img83.exs.cx/img83/5109/Source_DBGT_01.png

Lanczos->SangNom->Lanczos

http://img83.exs.cx/img83/7342/SangNom_DBGT_01.png

PointResize->SangNom->Lanczos

http://img83.exs.cx/img83/9470/SangNom_PointResizeLanczos.png

Lanczos->SangNom->Bilinear

http://img83.exs.cx/img83/5355/SangNom_LanczosBilinear.png

Lanczos->SangNom->Bilinear->Unfilter(50,50)

http://img83.exs.cx/img83/8154/SangNom_LanczosBilinearUnfilter50.png


Imo the PointResize sample is sharp but shows still some aliasing as the Lanczos sample... :(

The Bilinear/Unfilter sample looks same sharp but has near like no aliasing left !!!

#################################################################

X = 320 # Resolution width
Y = 240 # Resolution height

A = 50 # Unfilter value A
B = 50 # Unfilter value B

#################################################################

AviSource("C:\MovieBackups\Source.avi").ConverttoYV12()

#################################################################

Before = Last

LanczosResize(X*2,Y*2)

ConvertToYUY2()

TurnLeft()

ConvertToYV12()

SangNom()

ConvertToYUY2()

TurnRight()

ConvertToYV12()

SangNom()

BilinearResize(X,Y)

Unfilter(A,B)

MergeChroma(Before)

#################################################################


But I dunno how to make a function out of this... :o

AnimeAntiAliasing: AAA(X,Y,A,B)


Bye

Didée
7th October 2004, 12:13
What's that, Soulhunter?

A brigade of inbetween "ConvertTo...ConvertTo...ConvertTo...", and in the end, the unprocessed original chroma is copied back. Perhaps one should throw some lsresize()'s in the mix, to make those NOPs even more valuable :D

However, making a function out of that is pretty simple:

You just have to /*whisper...whisper...whisper*/, that's all :p

Soulhunter
7th October 2004, 14:43
# _______________________________________________________
#
# SAA | Simple Antialiasing
# _______________________________________________________
#
# Simplicity by Soulhunter... \m\ ^_^ /m/
# _______________________________________________________
#
#
# Requirements:
#
# SangNom.dll
# 100GHz CPU
#
#

Function SAA(Clip Clp,Int"SS",Bool"CP")
{

OX = Clp.Width
OY = Clp.Height
SS = Default(SS,2)
CP = Default(CP,True)


Clp = Clp.IsYV12() ? Clp : Clp.ConvertToYV12()

Clp.PointResize(OX*SS,OY*SS).SangNom().TurnRight()
\ .SangNom().TurnLeft().BilinearResize(OX,OY)

CP ? Last : MergeChroma(Clp)

Return(Last)

}


Bye

SpikeSpiegel
8th October 2004, 19:07
Originally posted by Didée
As it is typical for EDI resamplers, SangNom too delivers an output that is spatially shifted from the input. This would not be a big issue ... if you would create the edgemask on the shifted frame. But you are creating it on the not-shifted input, and apply it later on the shifted output. That's not ideal. So, the declaration of "c" better should read

c=b.edgemask( .. ) ..

There's still a great problem:
this way, the base clip is still in the original position, then, overlaying base & overlay clip (shifted), I get artefacts as well (=alias on one side of edges).

If the SangNom's "shift vector" is (1,1) (as it seems to be), I should use something like:


orig = clip.ConvertToRGB()
clp = orig.crop(0,1,-1,0).addborders(0,1,1,0).ConvertToYV12()
shift = orig.crop(1,0,0,-1).addborders(0,1,1,0).ConvertToYV12()

...

a= clp
b= shift.Lanczos4Resize(dx, dy).TurnLeft()...
c= clp.EdgeMask(0, th_luma, 0, th_croma, ....)


But, if I wrote "There's still a great problem", there must be a reason ;) :
actually the "shift vector" shouldn't have integer components (it's more like (1/2,1/2) ), then...I don't see any solution! :scared:

EDIT1: fixed crop&addborders

scharfis_brain
8th October 2004, 19:18
I don't see any solution!

upsize using with something better than pointresize to 2x & 2y.

then shift by the desired vector and to a point-downsize to the original resolution.

SpikeSpiegel
9th October 2004, 09:45
Originally posted by scharfis_brain
I don't see any solution!

upsize using with something better than pointresize to 2x & 2y.

then shift by the desired vector and to a point-downsize to the original resolution.

I've already tried something like this with (1/2,1/2--> too much) and then with (1/4,1/4--> closer):

ox = clip.width
oy = clip.height
qx = clip.width * 4
qy = clip.height * 4
orig = clip.ConvertToRGB()
clp = orig.Lanczos4Resize(qx, qy).crop(0,1,-1,0).addborders(0,1,1,0).ConvertToYV12().LanczosResize(ox, oy)
shift = orig.Lanczos4Resize(qx, qy).crop(1,0,0,-1).addborders(0,1,1,0).ConvertToYV12().LanczosResize(ox, oy)

...but still I can't find the right vector (that maybe has different components, like (x,y) ) and the speed loss is already excessive.
I suppose that a fast "shiftVector()" plugin doesn't already exist, isn't it?

Didée
9th October 2004, 15:39
Originally posted by SpikeSpiegel
I suppose that a fast "shiftVector()" plugin doesn't already exist, isn't it?
No, alas not.

But you can take either GeneralConvolution() or MaskTool's DEdgeMask(), together with pen & paper, and produce the frame shifts yourself through an operation on a 3x3 kernel:
0 0 1
0 2 0
0 0 0
with normalization 3 gives a shift of 1/3 to the upper right.
Since this is simple bilinear sampling, you'll loose sharpness as well. Perhaps upsample first to 2x with lanczos, shift by 2x of the initial target vector, and downsize back.

SpikeSpiegel
10th October 2004, 13:10
Originally posted by Didée
No, alas not.

But you can take either GeneralConvolution() or MaskTool's DEdgeMask(), together with pen & paper, and produce the frame shifts yourself through an operation on a 3x3 kernel:
0 0 1
0 2 0
0 0 0
with normalization 3 gives a shift of 1/3 to the upper right.
Since this is simple bilinear sampling, you'll loose sharpness as well. Perhaps upsample first to 2x with lanczos, shift by 2x of the initial target vector, and downsize back.

Good idea, but there is another solution:
throw away PointResize.

The "culprit" wasn't SangNom: using lanczos4resize to upsize, there's no shift at all.

Thanks anyway, this method is really faster and I'm sure it will be useful in other situations.

joshbm
10th October 2004, 21:49
I tried to use your script... It's waaaay slow under 1 fps (lucky if it hits 1) with my Deinterlacer before that (usually get around 8-9fps with my entire script and 29-33 fps with just the deinterlacer).

It's definately *not* my computer specs:

3.2 Ghz P4
1 GB ram
300+ gb storage
etc.

Regards,
Josh

ChronoCross
11th October 2004, 19:38
not suprising.....it is designed for mfspeed. Make sure that you have the latest versions of the dll's. Try a simple script like

Source
Deinterlace
AAA(640,480) ///anti-aliasing script

and see what speeds you get. if it's still 0-1fps with your pc specs then you should try a different version of the dll's...sometimes older dll's run faster(don't ask me why). if it's not that then there might be another culprit behind the slow speed.

Q: do you have HT technology?


EDIT: I almost forgot to add that I can't even encode with that script. my weak A** machine can't handle it lol. This one might be the all time slowest script I have ever used...even worse than mftoon.

Soulhunter
11th October 2004, 21:57
Originally posted by ChronoCross

This one might be the all time slowest script I have ever used...even worse than mftoon.

Wow, think I gonna keep this quote... :D


Thanks n' Bye

ChronoCross
11th October 2004, 23:53
Originally posted by Soulhunter
Wow, think I gonna keep this quote... :D


Thanks n' Bye

sweet. no joke though I can't test this on a more than 10 second clip...it's bad enough that it takes an hour per pass for that lol. but the results were what I wanted but until I get a new machine I couldn't even begin to do full episode tests.

at least with mftoon I got a solid 1-2fps lol. but good job on this script

Soulhunter
12th October 2004, 00:58
Originally posted by ChronoCross

but good job on this script

Thank Didée, he explained me how to write this script... ;)


Bye

joshbm
12th October 2004, 03:55
Originally posted by ChronoCross
Q: do you have HT technology?


Yes. I was somewhat impressed with the results of the script, but when the script takes hours to render seconds I'm definately not at all remotely interested.

:p

ChronoCross
12th October 2004, 07:19
try disabling HT by going into the taskmanger while encoding and right clicking on the vdubmod process. That might make a difference from what I've read in other threads.

SpikeSpiegel
12th October 2004, 18:03
Originally posted by ChronoCross
EDIT: This one might be the all time slowest script I have ever used...even worse than mftoon.
...then, I suppose you haven't already used antialiasing():

if you're REALLY lucky you can get 15, 20...even 25SPF (=Seconds Per Frame ) :D

ChronoCross
12th October 2004, 22:23
Originally posted by SpikeSpiegel
...then, I suppose you haven't already used antialiasing():

if you're REALLY lucky you can get 15, 20...even 25SPF (=Seconds Per Frame ) :D

lol either way both scripts are too slow for me to implement on my current rig.

Didée
13th October 2004, 08:18
ChronoChross, SpikeSpiegel:

What are you guys doing?

Just now I'm sitting at a P3 800MHZ. Feeding a 720*432 source (but w/o any deinterlacing, just applying the plain AA functions), AntiAliasing() is running @ 1.1 fps (HQedge) resp. 1.8 fps (sobel). AAA() is running @ 2 fps with everything turned on.

On more recent machines, these functions should run in the range of 4~10 fps.

Are you talking of some other script(s) than those posted in this thread?

ChronoCross
13th October 2004, 09:09
negative Didée. I tried both. the AAA mainly and it barely ran.....this is what the script looks like when I use it

NTSC Material

MPEG2Source("blah.d2v")
Telecide(Order=1,Guide=1).Decimate(cycle=5)
crop(numbers inside)
AAA()

that's it. 0fps-1fps barely. my setup isn't exactly good....please note that it's a intel mobile pentium 3 with it running most of the vob's off a USB 2.0 External Drive.

my average encoding speed is 8fps.
my max encoding speed ever(no filters) 24fps
mftoon speed 1-2fps
AAA speed 0-1fps

lamer_de
24th October 2004, 20:24
Hm, works pretty well:

http://s04.imagehost.org/0070/source_jpg.t.jpg (http://s04.imagehost.org/view.php?image=/0070/source.jpg)http://s04.imagehost.org/0070/anti-aliased_jpg.t.jpg (http://s04.imagehost.org/view.php?image=/0070/anti-aliased.jpg)

However, I had to use two instances of the filter to get rid of the aliasing, so it indeed run pretty sluggish (arund 1-2fps on athlon xp 1700). The high sharpening value of 50 caused edge halos though, so different sources might need different sharpening values.

CU,
lamer_de

LB
25th October 2004, 21:49
Originally posted by lamer_de
Hm, works pretty well:

http://s04.imagehost.org/0070/source_jpg.t.jpg (http://s04.imagehost.org/view.php?image=/0070/source.jpg)http://s04.imagehost.org/0070/anti-aliased_jpg.t.jpg (http://s04.imagehost.org/view.php?image=/0070/anti-aliased.jpg)

However, I had to use two instances of the filter to get rid of the aliasing, so it indeed run pretty sluggish (arund 1-2fps on athlon xp 1700). The high sharpening value of 50 caused edge halos though, so different sources might need different sharpening values.

CU,
lamer_de

To eliminate the halos try

AAA()
AAA()
HQDering(255)
HQDering(100)

Working friggin amazing, but haha I think I get negative fps speed.

lamer_de
26th October 2004, 12:55
It's way easier to just tone down the sharpening values when using AAA if you get halos :p Where's the point in sharpening when it creates so much artifacts you need a smoother to get rid of it? As I said, Soulhunters values which he made the standard seem to work ok for his sources or if only one instance of AAA is used. But yeah, HQDering does it's job on removing halos, although I like BlindDeHalo() better for that purpose. Often a bit harder to set up correctly, though.

The screenshots I posted were made with Unfilter values of 7 respectively 5 for the second instance.

CU,
lamer_de

You Know
25th April 2006, 23:34
is possible crate a dll filter for avisynth for antialias using directX function? I do not know if is possible apply directx function out the 3d poligon contex, for example on images or images loaded as texture on rectangle of (XXX, YYY) size.


should be more more fastest than a CPU implementation

foxyshadis
25th April 2006, 23:58
fft3dgpu does just that, so it's obviously possible. (Actually I don't know if it uses opengl or directx, but it's the same general idea.) As long as you pull in one or more frames and push one back out, you can do anything you can write in C++ to it (or C, or Delphi, etc). You might want to start from the fft3dgpu code if you intend to write something like that.

Ramromulus
29th August 2006, 04:46
Could someone post an example usage for SAA(), I can't seem to get it to work, avisynth keeps giving me invalid arguments or no such function.

Boulder
29th August 2006, 05:25
Do you have the SangNom and MaskTools v1.5.x dlls in your plugins folder?

Ramromulus
29th August 2006, 05:37
yes im just unclear how to set the width and height function

Boulder
29th August 2006, 06:41
What's your script and what exact error message do you get?

legionator2
30th October 2007, 11:07
I have tested some anti-aliasing script. Here are some pics :

Source :
http://i23.servimg.com/u/f23/11/31/41/30/shot210.jpg

AAA(xres=1024, yres=576, xshrp=20, yshrp=20, us=1, ds=2, chroma=true) :
http://i23.servimg.com/u/f23/11/31/41/30/shot410.jpg

AntiAliasing(th_luma=20, th_croma=20) :
http://i23.servimg.com/u/f23/11/31/41/30/shot510.jpg

SAA():
http://i23.servimg.com/u/f23/11/31/41/30/shot310.jpg

SAA()
SAA()
http://i23.servimg.com/u/f23/11/31/41/30/shot111.jpg

It seems like the SAA() script of Soulhunter gave the best result here. :) It even got rid of the halos, though the video looks a bit more blurry. It's a very nice function, but all of the anti-aliasing scripts seems to be slow like hell. I wonder if there's an equivalent method, but faster than this.

foxyshadis
30th October 2007, 16:44
You can get some low-budget anti-aliasing with TIsophote, or Lanczos4Resize(width*2,height*2).BilinearResize(width,height), but they don't look nearly as good as the slower methods.

*.mp4 guy
31st October 2007, 21:33
frfun7(1.01, 256, 256) Will give some very powerful, relatively quick antialiasing, but it blurs alot.

Soulhunter
1st November 2007, 17:58
frfun7(1.01, 256, 256) Will give some very powerful, relatively quick antialiasing, but it blurs alot.
A hint to write a "FRFun7@EdgesOnly" AA function? ;]


Thx n' Bye

*.mp4 guy
2nd November 2007, 00:35
Nah, I actually already tried that, its not neccesarily any better or faster then other aproaches, once you take care of certain dificulties (mainly all the extra blur, which can cause problems with masking), which is why I never mentioned it before; Of coarse thats not to say someone else coudn't do a better job then me at it and make it competitive. It is, however, usefull without masking, on already "ruined" sources where you need extremely strong antialiasing.

jethro
2nd November 2007, 23:37
A hint to write a "FRFun7@EdgesOnly" AA function? ;]


Thx n' Bye

Yes, edges like in msharpen mask with adjustable detection...

Socio
18th March 2008, 13:24
I tried SAA and antialiasing they are indeed hella slow and got me thinking;

If video games can use the antialiasing features on video cards, in some cases even be forced to, could there not be a way for Avisynth to do the same and deinterlacing as well for that matter.

The speed increases alone would be phenomenal I would think.

Dark Shikari
18th March 2008, 15:09
I tried SAA and antialiasing they are indeed hella slow and got me thinking;

If video games can use the antialiasing features on video cards, in some cases even be forced to, could there not be a way for Avisynth to do the same and deinterlacing as well for that matter.

The speed increases alone would be phenomenal I would think.Antialiasing on video cards relies on being able to render many samples per pixel and average them. You can't do this when you aren't rendering 3D graphics; when you're just using an ordinary input image, there's no real way to render more samples.

Socio
20th March 2008, 00:45
Antialiasing on video cards relies on being able to render many samples per pixel and average them. You can't do this when you aren't rendering 3D graphics; when you're just using an ordinary input image, there's no real way to render more samples.

Maybe one could have it take samples from 30 frames ahead and 30 frames back to get enough samples but that would probably require a lot more ram for that data and make it slower than the AA scripts we have now.

scharfis_brain
20th March 2008, 01:26
that's what is called temporal super resolution (TSR).
This also had been discussed here several years ago

http://forum.doom9.org/showpost.php?p=808013&postcount=19

http://forum.doom9.org/showthread.php?t=81868&highlight=tsr