PDA

View Full Version : Is this script already as optimized as can be?


shoopdabloop
12th July 2009, 12:25
Or can it be optimized more with no visible difference?

Here's a 7z containing an unprocessed sample, a processed clip of the sample, and the script:
http://www.megaupload.com/?d=4OTM5OL0

the unprocessed sample isn't technically unprocessed; i loaded an AVS with a simple AviSource of the source and a KillAudio into VDM, took a sample of it, and re-encoded it with a dvsd codec (cedocida) very similar to the original (sony dv) because i wasn't sure how to get a sample otherwise. but the post-script output looks identical when operating on the original source compared to the provided sample. (the provided one is compressed with xvid, however)

and just in case you just want to look at the script, here it is:

#filters used:
#MT, removegrain, nnedi2, motionprotectedfps, mvtools2, fft3dfilter, gradfun2dbmod, warpsharp (2003), and depan

AviSource("filmlook sample - unprocessed.avi").AssumeBFF()
MT("removegrain()",0,splitvertical=true,overlap=4)
nnedi2(field=-2)
motionprotectedfps(239.76)
b = selectevery(10, 1)
selectevery(10, 0)
Merge(b)
#the merging of the two slightly different points in time simulates a 1/48 shutter speed from the original 1/60
LanczosResize(752,500)
MT("""
super = MSuper()
bv2 = MAnalyse(super,isb=true, delta=2)
bv1 = MAnalyse(super,isb=true, delta=1)
fv1 = MAnalyse(super,isb=false,delta=1)
fv2 = MAnalyse(super,isb=false,delta=2)
MDegrain2(super,bv1,fv1,bv2,fv2)
""",0,overlap=4)
MT("fft3dfilter()",0,splitvertical=true,overlap=4)
MT("gradfun2dbmod()",0,splitvertical=true,overlap=4)
MT("warpsharp(64)",0,overlap=4)
mdata = DePanEstimate(trust=0)
DePanStabilize(data=mdata,dxmax=12,dymax=12,mirror=12)
Crop2(720,356)
#simply a shorthand for Crop(16,72,-16,-72)
AddBorders(0,62,0,62)
ColorYUV(levels="TV->PC")
#final output: 720x480 23.976p

neuron2
12th July 2009, 16:17
What do you mean by "optimized"?

Nightshiver
12th July 2009, 18:29
I suppose he wants it to encode faster. But essentially for that, you need a better computer, as you are already using MT to make things go quicker.

Atak_Snajpera
12th July 2009, 22:02
MT("removegrain()",0,splitvertical=true,overlap=4)
nnedi2(field=-2)
MDegrain2(super,bv1,fv1,bv2,fv2)
""",0,overlap=4)


Why do you use three denoisers? fft3dfilter is enough. Also try GPU version. Replace nnedi2(field=-2) with Yadif deinterlacer. Quality will be better and speed will be alot faster.

shoopdabloop
13th July 2009, 05:56
quality will be better if i use yadif and take away mdegrain? i highly doubt that.

Atak_Snajpera
13th July 2009, 08:07
You don't need three denoisers! I does not make sense at all.

yadif
http://img188.imageshack.us/img188/6070/yadif2.png

nnedi2
http://img268.imageshack.us/img268/9713/nnedi2.png

Adub
13th July 2009, 23:03
I see artifacts in the floor for the Yadif version.

@shoopdabloop
quality will be better if i use yadif and take away mdegrain? i highly doubt that.
Read his post again. He never said that. What he says is that you only need to use one denoiser. Either only use MDegrain2, or only use FFT3DFilter/GPU, etc...
Personally, I like to use MCTemporalDenoise for my heavy filtering. However, you can usually achieve whatever effect you desire using only FFT3DFilter/GPU due to its ability to be tuned for specific noise frequencies.

As for the Yadif deinterlacer argument, I never did like Yadif myself. I always see artifacts whenever I use it. I never use NNEDI2 alone, only in combination with TFM/TDeint.

Atak_Snajpera
13th July 2009, 23:24
I see artifacts in the floor for the Yadif version.
I see ugly edges in nnedi2 version :)

http://img149.imageshack.us/img149/9713/nnedi2.png

nnedi2 as deinterlacer is useless. it deinterlaces whole picture intead of specific areas and it is slooooooowww as heeeeeelllll.....

Adub
13th July 2009, 23:55
Exactly why it's meant to be used with TFM/TDeint. NNEDI is used to generate the pixels sampled from by TDeint. I agree with you. NNEDI should not be used alone to deinterlace, but Yadif isn't flawless either. The way that NNEDI is used in standalone can introduce "stair stepping" aka aliasing. Which is why I use it as a sample platform, not final output.

However yadif has it's flaws as well, which mostly appear in the thresholds of edges:
http://www.mirror.adubvideo.net/yadif2.png

shoopdabloop
14th July 2009, 00:49
well, nnedi2 is my favorite deinterlacer because it has a nice balance between speed, smoothness, and realism, so i will try combining it with TDeint.
but my source is 100% interlaced, so will it really help much?

also, i will see what i can do about the denoisers.

Adub
14th July 2009, 01:35
Yes it will. Not TFM but TDeint will. TDeint (as can be guessed by the name) is also a deinterlacer. But one of the nice things about is that you can specify an external clip to be used for pixel sampling when deinterlacing a frame.

neuron2
14th July 2009, 03:41
but my source is 100% interlaced, so will it really help much? Yes, because the adaptive deinterlacers, such as TDeint(), affect only the combed parts of each frame.

neuron2
14th July 2009, 03:50
The general point stands.

i don't even think there are any points in my source where there is no visible combing Maybe you should actually look and see. :)

shoopdabloop
14th July 2009, 03:57
err, i was hoping no one had replied to that post when i deleted it.

you're talking about low-detail areas, correct? i didn't realize i had so many.

now, about the denoisers... i'm not sure how to get rid of one or two of them without losing visual quality... (i've already taken out removegrain)

neuron2
14th July 2009, 03:59
Not just that. I mean, in general, you should make a definitive determination about your video when deciding the appropriate treatment, not work using the "I think" approach. You're obviously concerned about quality, so spend some time on the analysis phase.

Anyway, a low-detail area won't be affected as much by a deinterlacer, i.e., detail loss will be less significant.

2Bdecided
14th July 2009, 10:11
For quite fast but quite good deinterlacing, try yadifmod + nnedi(2). Best of both worlds (hopefully).

Or leave temp gaus mc running overnight!

Cheers,
David.

Adub
14th July 2009, 17:45
Yeah, I would have to agree on the TempgaussMC option. However, it is unimaginably slow if you want to encode a DVD in a couple of hours.

m3mbran3
15th July 2009, 11:36
I see lots of mention of use of nnedi and TDeint, but how do these work together? can someone post an avisynth script snippet.
The reason I ask is because I have an interlaced PAL VHS source that I am deinterlacing using

AssumeTFF()
nnedi2(qual=3)

but would be keen to try out different methods, encoding time is not an issue for me.

edit: here is the rest of the script, pretty similar to shoopdabloop actually.

DGDecode_mpeg2source("C:\familyvids\xmas1989\Xmas 1989 to be trimmed.d2v", info=3, cpu=4)
ColorMatrix(hints=true, interlaced=true, threads=0)
ColorYUV(autowhite=true)
HDRAGC()

AssumeTFF()
nnedi2(qual=3)
crop( 12, 2, -12, -12)

mdata = DePanEstimate()
DePanStabilize(data=mdata, method=1, mirror=15)

TemporalDegrain(degrain=2)
Spline36Resize(720,576)
LSFmod(strength=80)

shoopdabloop
15th July 2009, 13:13
TDeint(edeint=nnedi2())

for bobbing:

TDeint(1,edeint=nnedi2(field=-2))