Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 5th August 2010, 03:47   #1  |  Link
-Vit-
Registered User
 
Join Date: Jul 2010
Posts: 448
QTGMC Deinterlacing Script (v3.32)

QTGMC is a very high quality deinterlacer for YV12 or YUY2 input, originally developed from TempGaussMC_beta2. It has a range of new features for the highest quality output and a convenient presets system to select processing speed. As well as interlaced input, it can also process progressive material for removal of interlacing or other shimmering artefacts. Extensive instructions on how to use all the settings are provided with the script.

Main Downloads
Thanks to SubJunk for filehost-free mirrors!

QTGMC v3.32 + English Instructions (mirror1 | mirror2)
Latest: v3.30:Speed-ups for many presets and a bug-fix in MVTools. v3.31: A minor bug fix. v3.32: A couple more minor tweaks and fixes. Used Windows line breaks.

Plugins Package (mirror1 | mirror2)
All the required plugin files for the script - follow the instructions inside. Individual plugin / source code links below.

Modded Plugins Package (mirror1 | mirror2)
Same as above, but these plugins contain threading fixes that can improve stability under MT.

There is also a new plugin pack using the updated Avisynth 2.6 interface available for testing.

Plugin Notes
For YUY2 input you must use mt_masktools-25.dll. Although not strictly 'correct' mt_masktools-25.dll can be used with SEt's Avisynth 2.6MT for mulithreaded usage.
If you get this error: "There is no function named RemoveGrain" then replace your RemoveGrainSSE2.dll with the version in this zip file
If you use EEDI3 you may need the Visual C++ 2010 Redistributable



Other Downloads

Spanish instructions (v3.32) (mirror)
Thanks Overdrive80!

Presets Detail (v3.32): Compared to "Faster" | Compared to "Medium" | Noise Presets
Thanks nhope!

Previous Version of QTGMC (v3.25)

________

Basic Usage

Install AviSynth and copy the plugins from the plugin package to the correct locations. Then to use QTGMC, write a script like this:
Code:
YourSource("yourfile")    # DGDecode_mpeg2source, FFVideoSource, AviSource, whatever your source requires
QTGMC( Preset="Slow" )
SelectEven()              # Add this line to keep original frame rate, leave it out for smoother doubled frame rate
Save this script with an ".avs" extension. You can now use it as an AVI source for encoding.

The "Preset" used selects sensible settings for a given encoding speed. Choose a preset from:
"Placebo", "Very Slow", "Slower", "Slow", "Medium", "Fast", "Faster", "Very Fast", "Super Fast", "Ultra Fast" & "Draft"
The default preset is "Slower", which is very close to the TempGaussMC_beta2 defaults

Don't be obsessed with running at the slowest possible settings. HD content especially doesn't need that precision and it will be very slow. More modest settings will give good speed and you may not even be able to tell the quality difference.

There are many settings to tweak the behavior of the script, full details are provided in the documentation that comes with the script. For example, to speed up processing and reduce sharpness a little:
Code:
QTGMC( Preset="Very Fast", Sharpness=0.75 )
________

Multi-Threaded Usage

QTGMC is very demanding on your system so for best performance try using it multi-threaded:
- Download SEt's latest 2.6MT version of avisynth. Do not use other MT versions as they have bugs.
- Copy the avisynth.dll from SEt's package over the one that is already in your SysWOW64 / System32 folder.
- You must also download either the modded plugin pack or the updated-interface plugin pack from the top of this post (*carefully* follow the instructions inside).

You need to tweak multi-threaded scripts to suit your system. Here is a basic template - read and follow the comments carefully and provide the values noted (you cannot use this code just as it is):
Code:
SetMemoryMax(M)  # Optional line. See below for value M
SetMTMode(3, X)  # See below for value X, could try 5 instead of 3 for non-standard source-filter/avisynth combinations
YourSource("yourfile")  # DGDecode_mpeg2source, FFVideoSource, AviSource, whatever your source requires
SetMTMode(2)
QTGMC( Preset="Slow", EdiThreads=Y ) # Choose preset based on overall speed/quality you want. See below for value Y
Distributor() # This line may or may not be necessary, try removing it and see if you get more speed
Setting X
- Start at the number of logical cores in your machine (note: with HyperThreading enabled, logical cores = 2x physical cores)
- If it crashes, decrease 1 at a time
- Otherwise increase 1 at a time until CPU usage just reaches 100%, don't go too far or it will slow down.
- On very slow settings you may not be able to reach 100% CPU before running out of memory and getting crashes. You can get round this by splitting your video and running several simultaneous encoding processes each with several threads, you're on your own with that though...

Setting Y
- Start with 1 for stability. In some cases increasing this value can give some speed up - try increasing it gradually. However, this setting has much less effect than X.

Setting M
- Running out of memory is the main problem with multithreaded avisynth so this line is important, especially for HD processing.
- For SD try leaving the line out first as it might just work.
- Then try using the SetMemoryMax line with values of M from 400-1200 or so. The default value is usually 512, so start around 700-900 and experiment from there.
- Don't just set the largest value because you're actually setting a memory balance (between avisynth cache and filter requirements)
- You can use *much* larger values (up to 2000 or more) if your encoding application is "Large Address Aware". So you are strongly advised to try the next step along with larger values of M
- Download this tool to check/set your encoding application as "Large Address Aware". You must point the tool at the exe file of your encoder, e.g. vdub.exe. Be careful since some encoding GUIs call out to other exe files for the actual encoding, for example MeGUI uses x264.exe or ffmpeg.exe from inside its "tools" folder. Some common examples: VirtualDub (vdub.exe) is not large address aware, "ffmpeg.exe" is often not large address aware, "x264.exe" is already large address aware.
- With a large address aware encoder, I often set M in the 1200-1600 range.
- Finally, you can reduce the memory needs of the encode by running 2 passes: in the first pass use QTGMC to encode to a temporary lossless file (I suggest huffyuv), then in the second pass encode your lossless file to your final format (e.g. h264). The temporary file will be huge, 100-200GB per hour for 1080p.

Notes
QTGMC is fine with SetMTMode(...), but the older MT(...) function will cause visual problems so don't use that.
Multi-threading crashes can be frustrating - they're usually due to memory problems (each thread uses more memory). However, most people can find a repeatedly stable memory balance for their system, and then the speed increases can be considerable. So tweak carefully starting with moderate settings.

Speed Guidance
On my i7 930@3.7Ghz I get from 24fps to 210+fps at 720x480 YV12 across the presets ("Placebo" to "Ultra Fast") using tweaked multi-threaded scripts as described below. It's about 7 times slower at 1920x1080. Obviously adding source-match, noise-bypass, motion-blur or other extras will make things slower. If you get poor speeds by comparison then check the instructions above, try tweaking the values. Make sure you're using correct plugins, try a different source filter, or a different encoding GUI. Don't use overkill settings. Upgrade your system.

________

Full Plugin List

This is a full list of all the plugins use by QTGMC. For convenience, you can get all of these in the Plugin Package at the top of this post. The source code for several of the plugins can be found in these links.

Core plugins
- MVTools2 (2.5.11.2 or above)
- MaskTools v2 (recommend 2.0a48 or above)
- NNEDI3 (recommend 0.9.4 or above for speed)
- RemoveGrain + Repair (extract only the SSE2 versions, some SSE3 versions have a bug and give no real benefit)
- SSE2Tools for YUY2 support (take only SSE2Tools.dll from this zip - do not take the SSE3 version nor the RemoveGrain or Repair dlls)

Additional plugins depending on settings
- [NNEDI2, NNEDI, EEDI3, EEDI2, TDeInt] - if selected directly or via a source-match preset
- Yadif - for Preset="Ultra Fast" or if selected directly (this plugin cannot be autoloaded, it must be loaded in the calling script)
- VerticalCleaner - for SVThin or lossless modes
- AddGrainC (or here) - for Preset="Placebo" or NoiseDeint="Generate" selected for noise processing
- FFT3DFilter - if selected for noise processing
- dfttest - if selected for noise processing
** For FFT3DFilter and ddftest you also need the FFTW3 library (main page / windows zips). On Windows the file needed for both is libfftw3f-3.dll. However for FFT3DFilter, it needs to be called FFTW3.dll, so you will need two copies and rename one. On Windows put the files in your System32 or SysWow64 folder (which depends on your OS and the version of AviSynth that you're running)

________

Notes

Comparison with TGMC
The default behaviour of QTGMC is almost identical to TempGaussMC_beta2 with particular settings. All the important defaults are effectively identical (including sharpness). However, some lesser settings have different defaults and some settings operate a little differently. There is a dedicated section on the comparison with TGMCb2 in the instructions.

Finally
Thanks go to Didée for the script from where this began, and to all the plugin scripters/coders involved too...

-Vit-

[The link at the top of the post will work if the attachment below is pending]
Attached Files
File Type: zip QTGMC-3.32.zip (37.0 KB, 3560 views)

Last edited by -Vit-; 7th April 2012 at 12:29. Reason: Mirrors, link to new plugin pack, large address aware, MT advice
-Vit- is offline  
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:44.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.