Thread: Type of sources
View Single Post
Old 6th August 2011, 08:11   #5  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
Let me explain what is done here for the second sample: I first used a plain Bob() to analyse the fields, to check if some were blended or repeated. I deduced we have a regular 3:2 pattern with field blending instead of combing. The clean frames look actually clean (no residual blending from the other frames). The reconstituted frame I called x2345 was blended with x01 in fields 2 and 3 and x67 in fields 4 and 5. But the blending is weird: instead of being fixed or more or less progressive along the Y axis, it follows a sine-like curve! And this blending curve is reversed for each second field. I really don't know why it was telecined this way.

I loaded the bobbed video in a software showing the pixel coordinates under the mouse cursor (Aegisub) and tried to find the sine characteristics, namely the zero-crossings to identify the phase and frequency. Zero-crossing happens where vertical features look almost static when you switch quickly between fields 2 and 3 or 4 and 5. I wrote down the Y positions (first one at 32) and deduced their average distance (82). This eventually gave the blending mask formula:
m = sin (pi * (Y - 32/480) / (82/480)) * 128 + 128
with Y in range 0-1. This is what is written in RPN in the mt_lutspa. The mask was applied during telecine like in a standard mt_merge, with source pictures swapped for each field.

So I just tried to invert the blending:
blend = source1 + (source2 - source1) * (m/256)
=>
source2 = (blend + source1 * ((m/256) - 1)) / (m/256)
But when source1 weight is low, the result is pure garbage, so I tried to select the best parts of each field pair with the blend mask again.

Finally, both results for frame x2345 are averaged to reduce the most prominent artifacts.

For the first sample, the .d2v probably has information about parity change, but I don't know how QTGMC handles it. So if it don't work out of the box, you'll have to trim (or use ReplaceFramesSimple with one QTGMC instance per field parity).
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding

Last edited by cretindesalpes; 6th August 2011 at 08:23. Reason: typos
cretindesalpes is offline   Reply With Quote