Monk_Zero
10th January 2013, 07:19
I'll start by saying I'm still an ignorant novice who is figuring out I've been doing things wrong with Avisynth scripts all the time so there's tons of room to improve, so any suggestions are more than welcome no matter how basic.
I've been refining a script I used on a single threading machine for my new multithreading laptop (hardly a powerhouse) and it's highlighted areas for improvement. I fixed lots of them but I've run across one that seems wrong but I can't fix it.
SetMemoryMax(512)
SetMTMode(5,4)
PluginPath = "C:\Program Files (x86)\MeGUI\tools\avisynth_plugin\"
AviSource("C:\New folder\Suburban 07.avi")
Crop(6, 0, -8, -0, align=true)
AssumeTFF()
TDecimate()
SelectEven()
SetMTMode(2)
ConvertToYV12(interlaced=true)
QTGMC(Preset="Slow")
LanczosResize(640,480)
Distributor()
My source is interlaced NTSC television capped via SVideo at 720x480 YUY2 4:2:2 with Lagarith and usually movies so I bring them down to 23.976. Everything works with multithreading so far (near 100% utilization now during both first and second pass encoding in MeGUI, which is a great improvement). But I'm running into a huge performance hit from Crop that doesn't seem right to me. When in the script, Crop applies a 25% hit in the overall frames per second almost exactly. Using the above script as a baseline:
Above script with Crop(6, 0, -8, -0, align=true) commented out
First pass 17.35 fps
Second pass 15.60 fps
Above script with Crop(6, 0, -8, -0)
First pass 13.02 fps
Second pass 11.14 fps
Full original script with Crop(6, 0, -8, -0, align=true)
First pass 13.10 fps
Second pass 11.11 fps
Above script but with Distribution() commented out
First pass 14.59 fps
Second pass 12.96 fps
It seems like a problem for a function like Crop to have such a large impact. Cropping should reduce my overall workload by giving me a smaller frame to work with but that just isn't the case. I've also tried placing it after SetMTMode(2) and in other various locations and the performance hit is slightly worse but otherwise negligible. Unfortunately, cropping is necessary as you can see I've got a blue line and junk on the sides of many captures and several will be letterboxed so it's a necessity most of the time. I'd really like to have the non-Crop speed if I can because it makes a real difference if doing a full movie.
Is there a way to use Crop() so I don't get such a large performance hit? Alternately, is there a way to use one of my other functions to get the same end result of cropping the image but without the huge performance hit? Or is there another style of Crop function I could use?
Also, it's become clear to me that TDecimate() and SelectEven() seem redundant. Which one is more appropriate? I can remove either of them and I can't really see a difference and the performance hit is negligible. I'd really like the cleanest script I can get though so if I can get rid of a step I'd like to.
And, I'd definitely recommend tips that would make either my script more efficient or make my end result look better. Here's a small example source and the end result in mkv format.
Source: http://www.mediafire.com/?0fycjpnher9qztf (audio is out of sync, which is expected and something I correct later)
Encode: http://www.mediafire.com/?lbaax93ntad9vio
Thanks!
I've been refining a script I used on a single threading machine for my new multithreading laptop (hardly a powerhouse) and it's highlighted areas for improvement. I fixed lots of them but I've run across one that seems wrong but I can't fix it.
SetMemoryMax(512)
SetMTMode(5,4)
PluginPath = "C:\Program Files (x86)\MeGUI\tools\avisynth_plugin\"
AviSource("C:\New folder\Suburban 07.avi")
Crop(6, 0, -8, -0, align=true)
AssumeTFF()
TDecimate()
SelectEven()
SetMTMode(2)
ConvertToYV12(interlaced=true)
QTGMC(Preset="Slow")
LanczosResize(640,480)
Distributor()
My source is interlaced NTSC television capped via SVideo at 720x480 YUY2 4:2:2 with Lagarith and usually movies so I bring them down to 23.976. Everything works with multithreading so far (near 100% utilization now during both first and second pass encoding in MeGUI, which is a great improvement). But I'm running into a huge performance hit from Crop that doesn't seem right to me. When in the script, Crop applies a 25% hit in the overall frames per second almost exactly. Using the above script as a baseline:
Above script with Crop(6, 0, -8, -0, align=true) commented out
First pass 17.35 fps
Second pass 15.60 fps
Above script with Crop(6, 0, -8, -0)
First pass 13.02 fps
Second pass 11.14 fps
Full original script with Crop(6, 0, -8, -0, align=true)
First pass 13.10 fps
Second pass 11.11 fps
Above script but with Distribution() commented out
First pass 14.59 fps
Second pass 12.96 fps
It seems like a problem for a function like Crop to have such a large impact. Cropping should reduce my overall workload by giving me a smaller frame to work with but that just isn't the case. I've also tried placing it after SetMTMode(2) and in other various locations and the performance hit is slightly worse but otherwise negligible. Unfortunately, cropping is necessary as you can see I've got a blue line and junk on the sides of many captures and several will be letterboxed so it's a necessity most of the time. I'd really like to have the non-Crop speed if I can because it makes a real difference if doing a full movie.
Is there a way to use Crop() so I don't get such a large performance hit? Alternately, is there a way to use one of my other functions to get the same end result of cropping the image but without the huge performance hit? Or is there another style of Crop function I could use?
Also, it's become clear to me that TDecimate() and SelectEven() seem redundant. Which one is more appropriate? I can remove either of them and I can't really see a difference and the performance hit is negligible. I'd really like the cleanest script I can get though so if I can get rid of a step I'd like to.
And, I'd definitely recommend tips that would make either my script more efficient or make my end result look better. Here's a small example source and the end result in mkv format.
Source: http://www.mediafire.com/?0fycjpnher9qztf (audio is out of sync, which is expected and something I correct later)
Encode: http://www.mediafire.com/?lbaax93ntad9vio
Thanks!