GOUT Anti-aliasing :: 1 > 3

  • Reply
  • Print
Arnie.d's avatar
GOUT Anti-aliasing
I wanted to make anamorphic versions of the GOUT and in the process I've been experimenting with some avisynth filters (EEDI2/limitedsharpenfaster) to remove the terrible "jaggies" without introducing too much side effects and loosing too much sharpness. Although the results are far from perfect I think the picture quality is a bit better. Here are some results (bottom pictures are filtered):
http://img526.imageshack.us/img526/290/1ata6.jpg
http://img526.imageshack.us/img526/6537/1byc9.jpg
http://img526.imageshack.us/img526/9143/2ado2.jpg
http://img526.imageshack.us/img526/6047/2bfl2.jpg
http://img526.imageshack.us/img526/3083/3anq5.jpg
http://img526.imageshack.us/img526/4664/3bgg4.jpg
http://img526.imageshack.us/img526/9286/4aei0.jpg
http://img526.imageshack.us/img526/8896/4bxu2.jpg
http://img526.imageshack.us/img526/9283/5afn1.jpg
http://img526.imageshack.us/img526/6121/5bet1.jpg
Fez: I am so excited about Star Whores.
Hyde: Fezzy, man, it's Star Wars.
Arnie.d's avatar
GOUT Anti-aliasing
No, I'm not upscaling. I took screenshots of 720 x 480 material at 200% in virtualdubMPEG so the detail would be a bit more visible. Removegrain is used in limted sharpen. I only found out about EEDI2 today so I just used the standard settings. Something called "AAA" used before EEDI2 should give better result or so I read but I have no idea what .dll is required for AAA.

I resized before using limited sharpen but it should not be necessary as limited sharpen can be used to risize but I didn't look into that yet.

One of the bad side effects I noticed is that the stars in the star field are a bit less bright.

Sorry about the big pictures but if I used thumbnails a side to side comparison would be more difficult.

Here's the script I used:




LoadPlugin("DGDecode.dll")
MPEG2Source("[2]_VTS_03_1.m2v.pulldown.d2v")

loadplugin("eedi2.dll")
Loadplugin("mt_masktools.dll")
Loadplugin("warpsharp.dll")
Loadplugin("removegrain.dll")

Crop(0,102,0,-104,align=true)

EEDI2().TurnRight().EEDI2().TurnLeft()

Lanczos4resize(720,360)

function LimitedSharpenFaster( clip clp,
\ float "ss_x", float "ss_y",
\ int "dest_x", int "dest_y",
\ int "Smode" , int "strength", int "radius",
\ int "Lmode", bool "wide", int "overshoot", int "undershoot",
\ int "soft", int "edgemode", bool "special",
\ int "exborder" )
{
ox = clp.width
oy = clp.height

Smode = default( Smode, 3 )
ss_x = (Smode==4)
\ ? default( ss_x, 1.25)
\ : default( ss_x, 1.5 )
ss_y = (Smode==4)
\ ? default( ss_y, 1.25)
\ : default( ss_y, 1.5 )
dest_x = default( dest_x, ox )
dest_y = default( dest_y, oy )
strength = (Smode==1)
\ ? default( strength, 160 )
\ : default( strength, 100 )
strength = (Smode==2&&strength>100) ? 100 : strength
radius = default( radius, 2 )
Lmode = default( Lmode, 1 )
wide = default( wide, false )
overshoot = default( overshoot, 1)
undershoot= default( undershoot, overshoot)
softdec = default( soft, 0 )
soft = softdec!=-1 ? softdec : sqrt( (((ss_x+ss_y)/2.0-1.0)*100.0) ) * 10
soft = soft>100 ? 100 : soft
edgemode = default( edgemode, 0 )
special = default( special, false )
exborder = default( exborder, 0)
#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
smx=exborder==0?dest_x:round(dest_x/Exborder/4)*4
smy=exborder==0?dest_y:round(dest_y/Exborder/4)*4

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

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

edge = mt_logic( tmp.mt_edge(thY1=0,thY2=255,"8 16 8 0 0 0 -8 -16 -8 4")
\ ,tmp.mt_edge(thY1=0,thY2=255,"8 0 -8 16 0 -16 8 0 -8 4")
\ ,"max") .mt_lut("x 128 / 0.86 ^ 255 *") #.levels(0,0.86,128,0,255,false)

tmpsoft = tmp.removegrain(11,-1)
dark_limit1 = tmp.mt_inpand()
bright_limit1 = tmp.mt_expand()
dark_limit = (wide==false) ? dark_limit1 : dark_limit1 .removegrain(20,-1).mt_inpand()
bright_limit = (wide==false) ? bright_limit1 : bright_limit1.removegrain(20,-1).mt_expand()
minmaxavg = special==false
\ ? mt_average(dark_limit1, bright_limit1)
\ : mt_merge(dark_limit,bright_limit,tmp.removegrain(11,-1),Y=3,U=-128,V=-128)

Str=string(float(strength)/100.0)
normsharp = Smode==1 ? unsharpmask(strength,radius,0)
\ : Smode==2 ? sharpen(float(strength)/100.0)
\ : Smode==3 ? mt_lutxy(tmp,minmaxavg,yexpr="x x y - "+Str+" * +")
\ : mt_lutxy(tmp,tmpsoft,"x y == x x x y - abs 16 / 1 2 / ^ 16 * "+Str+
\ " * x y - 2 ^ x y - 2 ^ "+Str+" 100 * 25 / + / * x y - x y - abs / * + ?")

OS = string(overshoot)
US = string(undershoot)
mt_lutxy( bright_limit, normsharp, yexpr="y x "+OS+" + < y x y x - "+OS+" - 1 2 / ^ + "+OS+" + ?")
mt_lutxy( dark_limit, last, yexpr="y x "+US+" - > y x x y - "+US+" - 1 2 / ^ - "+US+" - ?")

Lmode==1 ? mt_clamp(normsharp, bright_limit, dark_limit, overshoot, undershoot) : last

normal = last
zero = mt_clamp(normsharp, bright_limit, dark_limit, 0,0)

Lmode==3 ? mt_merge(normal,zero,edge.mt_inflate()) : normal

edgemode==0 ? last
\ : edgemode==1 ? mt_merge(tmp,last,edge.mt_inflate().mt_inflate().removegrain(11,-1),Y=3,U=1,V=1)
\ : mt_merge(last,tmp,edge.mt_inflate().mt_inflate().removegrain(11,-1),Y=3,U=1,V=1)

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

soft==0 ? last : mt_makediff(tmp,sharpdiff2)

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

ex=blankclip(last,width=smx,height=smy,color=$FFFFFF).addborders(2,2,2,2).coloryuv(levels="TV->PC")
\.blur(1.3).mt_inpand().blur(1.3).bicubicresize(dest_x,dest_y,1.0,.0)
tmp = clp.lanczosresize(dest_x,dest_y)

clp.isYV12() ? ( exborder==0 ? tmp.mergeluma(last)
\ : mt_merge(tmp,last,ex,Y=3,U=1,V=1) )
\ : ( exborder==0 ? tmp.mergeluma(last.converttoyuy2())
\ : tmp.mergeluma( mt_merge(tmp.converttoyv12(),last,ex,Y=3,U=1,V=1)
\ .converttoyuy2()) )

(edgemode!= -1) ? last : edge.lanczosresize(dest_x,dest_y).greyscale

return last
}

LimitedSharpenFaster()

addborders(0,60,0,60)
Fez: I am so excited about Star Whores.
Hyde: Fezzy, man, it's Star Wars.
Arnie.d's avatar
GOUT Anti-aliasing
Thanks for the suggestions. I know the dlls can be loaded automatically but when I started using avisynth that somehow didn't work. I'll try it again
Fez: I am so excited about Star Whores.
Hyde: Fezzy, man, it's Star Wars.
Arnie.d's avatar
GOUT Anti-aliasing
No, I use the NTSC version. But in my opinion the jaggies are just as worse in the NTSC version.

I have no idea what this turnleft/turnright stuff does. What do you mean by using it once, only use turnleft or turnright or just use "IDDE2()" and leave out all the turn stuff? Aren't jaggies like this always horizontal only? They are caused by the pulldown scanlines right?
Fez: I am so excited about Star Whores.
Hyde: Fezzy, man, it's Star Wars.
fffffff's avatar
GOUT Anti-aliasing
Arnie, that is great work. Wish I knew how to do this stuff so I could do my own.
looking for rare star wars videos
Arnie.d's avatar
GOUT Anti-aliasing
@ Darth Editous
I experimented a bit and I think you are right, eedi2() will do. Now a just have to adjust the noise filter and sharpen filters.

@ fffffff
Thanks. But it is really not that difficult. I'm only applying what other people have come up with.
Fez: I am so excited about Star Whores.
Hyde: Fezzy, man, it's Star Wars.
schorman13's avatar
GOUT Anti-aliasing
Can you post the final script when you're done?
"We see things they'll never see" -Oasis
Arnie.d's avatar
GOUT Anti-aliasing
At the moment I'm trying someting with pixiedust (noise filter), eedi2 (to remove the jaggies) and 2 sharpening filters (limitedsharpenfaster for overall sharpening and fft3d for edge enhacement). Well, it's not a final version, schorman13 but here's what I have so far:


Loadplugin("dgdecode.dll")
MPEG2Source("Star Wars.d2v")

converttoyuy2
Loadplugin("loadpluginex.dll")
loadplugin("dustv5.dll")
PixieDust(limit=1)

loadplugin("eedi2.dll")
Crop(6,102,-2,-104,align=true)
eedi2()

loadplugin("fft3dfilter.dll")
FFT3DFilter(bt=-1, sharpen=0.6)

Loadplugin("mt_masktools.dll")
Loadplugin("warpsharp.dll")
Loadplugin("removegrain.dll")
LimitedSharpenFaster(dest_x=720,dest_y=360)

Addborders(0,60,0,60)
Converttorgb


I included the loading of the plugins in the script so you know what dlls are required.
Fez: I am so excited about Star Whores.
Hyde: Fezzy, man, it's Star Wars.
g-force's avatar
GOUT Anti-aliasing
Holy...! that looks great!

-G
ThrowgnCpr's avatar
GOUT Anti-aliasing
the improvement on r2 and 3po is great
skyjedi2005's avatar
GOUT Anti-aliasing
even the processed one still has the motion blur on the rebel trooper running.

was that intentional in the filming?

or is it another part of the ugly dvnr?

the major problems as know on the pre special edition star wars films is the dirt and grain evidant in the scenes especially shot in tunisia that have sand and grit literally on the film.

" A special effect without a story is a pretty boring thing" - George Lucas

There is only 1 Star Wars Trilogy.  1977-1983. 

Arnie.d's avatar
GOUT Anti-aliasing
I used virtualdubMpeg to make the screenshots, the images are to bright and I don't know how to change it (when I press play the brightness is normal).

This is without grain/noise removal:
http://img521.imageshack.us/img521/3636/x0000mn0.jpg

With pixiedust at "limit=1":
http://img253.imageshack.us/img253/7045/x20000vz9.jpg
Fez: I am so excited about Star Whores.
Hyde: Fezzy, man, it's Star Wars.
Marvolo's avatar
GOUT Anti-aliasing
Could someone post the filters MVDegrain2 and MVAnalyse that are being used to do this? I have looked, but can not find them. If someone could post them it would be great!


Marvolo's avatar
GOUT Anti-aliasing
Thanks.


Byakko's avatar
GOUT Anti-aliasing
EEDI2().TurnRight().EEDI2().TurnLeft() is indeed one of the best antialiasing filters on the Avisynth side. For extreme cases, preceding it with AAA() (it's an avisynth function, you need AAA.avs, UnFilter.dll and SangNom.dll) produces awesome results, but the problem with AAA() is that it blurs the picture too much.

Moth3r, good call using MVDeGrain2, it's an awesome denoiser. By the way, you can increase its effectiveness if you feed its MVAnalyse portion a denoised input in this manner:

source=last
denoised=YOUR_DENOISER
backward_vec2 = MVAnalyse(denoised,isb = true, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1)
backward_vec1 = MVAnalyse(denoised,isb = true, delta = 1, pel = 2, overlap=4, sharp=1, idx = 1)
forward_vec1 = MVAnalyse(denoised,isb = false, delta = 1, pel = 2, overlap=4, sharp=1, idx = 1)
forward_vec2 = MVAnalyse(denoised,isb = false, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1)
MVDegrain2(source,backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400,idx=2)

(my preferred denoiser is DeGrainMedian FWIW)

I never heard of horizontal aliasing though, are you sure it's not dotcrawl?
¡¡Movie studios and TV networks are teh suck!!
Arnie.d's avatar
GOUT Anti-aliasing
Like these lines?
http://img211.imageshack.us/img211/9601/0000oa6.jpg
Fez: I am so excited about Star Whores.
Hyde: Fezzy, man, it's Star Wars.
Members reading this topic: None