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. |
19th March 2015, 21:03 | #1 | Link |
Registered User
Join Date: Jun 2006
Posts: 452
|
TDeintMod : need some help
I'm looking for a good deinterlacer that is faster and "lighter" than QTGMC.
I came to the ported TDeint called TDeintMod (https://github.com/HomeOfVapourSynth...ynth-TDeintMod ) The example on this page : Code:
import vapoursynth as vs import functools core = vs.get_core() clip = Whatever def conditionalDeint(n, f, orig, deint): if f.props._Combed: return deint else: return orig deint = core.tdm.TDeintMod(clip, order=1, edeint=core.nnedi3.nnedi3(clip, field=1)) combProps = core.tdm.IsCombed(clip) clip = core.std.FrameEval(clip, functools.partial(conditionalDeint, orig=clip, deint=deint), combProps) clip.set_output() What does this functools.partial exactly do ? I don't fully understand how this script works. Can anyone explain this script to me ? Like why does ConditionalDeint(n, f, orig, deint) need 4 arguments when we use only 3 of them ? (f, orig and Deint) , and "n" appears to be never used... ? Has anyone a better or more comprehensive way to do this ? This example should work for the same output rate as the input. How about double rate (bobbing) ? Can this script be adapted for double rate output ? Just letting NNEDI3 output double rate by setting "field=3" option won't obviously work, as the "edeint" clip will have double rate which doesn't match anymore. Last edited by Pat357; 20th March 2015 at 00:28. |
20th March 2015, 03:55 | #2 | Link | |
Guest
Posts: n/a
|
Functools documentation:
Quote:
|
|
20th March 2015, 11:34 | #3 | Link |
unsigned int
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
|
It may help to read the documentation for the FrameEval filter too.
I'm not sure how helpful it is, but here's a picture: For every frame n requested from FrameEval, it requests the corresponding frame from IsCombed (combProps), then passes said frame to the conditionalDeint() function, along with the frame number n, and the two arguments given to functools.partial(), orig and deint. IsCombed examines the frame and attaches the "_Combed" property, with the value of 0 or 1. The conditionalDeint() function then looks at that property and returns either orig or deint. FrameEval then takes the clip returned by conditionalDeint() and requests frame n from it, then returns that frame. A better way to do this would be to make TDeintMod examine the "_Combed" property on its own, without involving Python and FrameEval. That's up to the author of TDeintMod, though.
__________________
Buy me a "coffee" and/or hire me to write code! |
20th March 2015, 13:04 | #4 | Link |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
|
What is the source material? If it's truly interlaced you probably should process all of it and skip the FrameEval stuff.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
20th March 2015, 13:35 | #5 | Link | |
Excessively jovial fellow
Join Date: Jun 2004
Location: rude
Posts: 1,100
|
Quote:
Let's say you have a function that takes two arguments, a and b: Code:
def a_function(a, b): do something with a and b Code:
new_function = functools.partial(a_function, a_value_for_a) In VS this is sometimes useful for passing a function as an argument to another function with extra parameters passed along. Last edited by TheFluff; 20th March 2015 at 13:39. |
|
20th March 2015, 16:58 | #6 | Link | |
unsigned int
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
|
Quote:
You could use fmUnordered and only request frames from edeint when they're needed: Code:
if (activationReason == arInitial) { // request n from IsCombed() } else if (activationReason == arAllFramesReady) { if ((intptr_t)(*frameData) == 1) { // get n from edeint and return it } else { // get n from IsCombed() if (!_Combed) // return n else // request n from edeint *frameData = (void *)1; } }
__________________
Buy me a "coffee" and/or hire me to write code! |
|
20th March 2015, 18:58 | #7 | Link |
Registered User
Join Date: Jun 2006
Posts: 452
|
Thanks for the for all your reactions !
After re-reading the things you all mentioned here, I think I now understands how it works. I can't accept it for myself to use a script that I don't fully understand :-) Thanks again to all ! |
Thread Tools | Search this Thread |
Display Modes | |
|
|