PDA

View Full Version : How can I optimize this code?


shoopdabloop
19th April 2009, 23:39
I was trying to make a 60i->24p+simulated motion blur script for half an hour, and I could only get it to work like this:

loadcplugin("c:\program files\avisynth 2.5\plugins\yadif.dll")
loadplugin("c:\program files\avisynth 2.5\plugins\mvtools2.dll")
source = AviSource("Tape 2 - Clip 012.avi").ConvertToYV12().AssumeBFF().Yadif(1).RemoveGrain().Blur(0.16)
super = source.MSuper()
mvbw = MAnalyse(super,isb=true)
mvfw = MAnalyse(super,isb=false)
source.MFlowFps(super,mvbw,mvfw,num=24000,den=1001)

super2 = last.MSuper()
bv = MAnalyse(super,isb=true)
fv = MAnalyse(super,isb=false)
last.MFlowBlur(super2,bv,fv,blur=20)

I'm getting ~6 fps output. Is there any way I can make it faster?

Also, if the original footage was filmed with 1/60 shutter speed, what blur value should I input into MFlowBlur if I want it to look like it was filmed with 1/48 shutter speed?

Adub
20th April 2009, 01:01
If you have a dual core cpu, you could use MT Avisynth.

shoopdabloop
20th April 2009, 02:32
How would I run MFlowFps and MFlowBlur multithreaded? SetMTMode?

Sagekilla
20th April 2009, 03:13
There's not much you can do. Unless you're willing to sacrifice some quality, you can't really make it faster.

Edit: Yes, you would use SetMTMode if you want to use MT. MVtools 2 supports multithreading nicely with SetMTMode, unlike the last (depreciated) version. Be sure to put your SMM() call ALL the way at the top of your script.

shoopdabloop
20th April 2009, 03:15
Yeah, I'm sticking with simple Yadif() 30p, because the crazy slow speed and artifacts of MFlowFps and MFlowBlur just aren't worth it.

Sagekilla
20th April 2009, 15:10
I'm not surprised at all you're getting artifacts like that: You're doing frame rate conversion on an -interlaced- source. No good! I didn't notice this at first. I thought it was 60p -> 24p.

Try doing yadif -> 24p + motion blur instead.