<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://avisynth.nl/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://avisynth.nl/index.php?action=history&amp;feed=atom&amp;title=Cdeint</id>
		<title>Cdeint - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://avisynth.nl/index.php?action=history&amp;feed=atom&amp;title=Cdeint"/>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php?title=Cdeint&amp;action=history"/>
		<updated>2026-05-14T08:24:54Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.24</generator>

	<entry>
		<id>http://avisynth.nl/index.php?title=Cdeint&amp;diff=1346&amp;oldid=prev</id>
		<title>Admin: 1 revision</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php?title=Cdeint&amp;diff=1346&amp;oldid=prev"/>
				<updated>2013-05-19T22:03:48Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 22:03, 19 May 2013&lt;/td&gt;
			&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://avisynth.nl/index.php?title=Cdeint&amp;diff=1345&amp;oldid=prev</id>
		<title>Wilbert at 21:17, 18 May 2013</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php?title=Cdeint&amp;diff=1345&amp;oldid=prev"/>
				<updated>2013-05-18T21:17:36Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
Bad telecined sources with blended fields seems to be normal in my country. The possible solutions for this problems are really rare. For example matchbob or tdeint(mode=1, tryweave=true) with unblend and a decimater or the the great but totally complex function restore24. So I tried to create a alternative for restore24 and this is the result.&lt;br /&gt;
&lt;br /&gt;
Discussion can be found [http://forum.doom9.org/showthread.php?t=95924 here].&lt;br /&gt;
&lt;br /&gt;
== Function ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Cdeint(clip clp, clip &amp;quot;bob&amp;quot;, int &amp;quot;bmode&amp;quot;, float &amp;quot;nlv&amp;quot;, float &amp;quot;hv&amp;quot;) &lt;br /&gt;
{&lt;br /&gt;
###### PREPARATION ######&lt;br /&gt;
global noisel = default(nlv,0)&lt;br /&gt;
global x = default(hv,0.9)&lt;br /&gt;
&lt;br /&gt;
ord = clp.getparity() ? 1 : 0&lt;br /&gt;
tmpp = isyv12(clp) ? clp.leakkernelbob(order=ord, sharp=false, twoway=false, threshold=5).duplicateframe(0) : &lt;br /&gt;
\	clp.leakkernelbob(order=ord, sharp=false, twoway=false, threshold=5).duplicateframe(0).ConvertToYV12()&lt;br /&gt;
one = tmpp.crop(8,8,-8,-8)&lt;br /&gt;
two = tmpp.crop(8,8,-8,-8).BilinearResize(640,352)&lt;br /&gt;
three = tmpp.crop(8,8,-8,-8).BilinearResize(352,192)&lt;br /&gt;
&lt;br /&gt;
global testclip = (bmode==1 ? one : (bmode==3 ? three : two))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
###### FRAMES FOR BLENDPARAMETERS ######&lt;br /&gt;
global combing_n0 = testclip.selecteven()&lt;br /&gt;
global combing_n1 = testclip.selectodd()&lt;br /&gt;
global combing_n2 = combing_n0.trim(1,0)&lt;br /&gt;
global combing_n3 = combing_n1.trim(1,0)&lt;br /&gt;
&lt;br /&gt;
###### POSSIBLE OUTPUTS ######&lt;br /&gt;
out = bob.selecteven()&lt;br /&gt;
out_1 = bob.selectodd()&lt;br /&gt;
&lt;br /&gt;
###### Conditional Function Chain, evaluated from bottom to top (!) ######&lt;br /&gt;
c99=ConditionalFilter(clp, out_1, out, &amp;quot;btest/Min(combl_0, combl_1)&amp;quot;, &amp;quot;lessthan&amp;quot;, &amp;quot;btest_2/Min(combl_1, combl_2)&amp;quot;) &lt;br /&gt;
&lt;br /&gt;
c9=FrameEvaluate(c99, &amp;quot;global btest_2 = LumaDifference(blendmade_test, blendpic_test) - (0.8 * noisel)&amp;quot;)&lt;br /&gt;
c8=FrameEvaluate(c9, &amp;quot;Evaluate_test()&amp;quot;)&lt;br /&gt;
c7=FrameEvaluate(c8, &amp;quot;global blendl_test = combl_1 &amp;lt; combl_2 ? 0.5 * Exp(x * Log(combl_1 / combl_2)) :&lt;br /&gt;
	\	1 - 0.5 * Exp(x * Log(combl_2 / combl_1))&amp;quot;)&lt;br /&gt;
c6=FrameEvaluate(c7, &amp;quot;global btest = LumaDifference(blendmade, blendpic) - (0.8 * noisel)&amp;quot;)&lt;br /&gt;
c5=FrameEvaluate(c6, &amp;quot;Evaluate()&amp;quot;)&lt;br /&gt;
c4=FrameEvaluate(c5, &amp;quot;global blendl = combl_0 &amp;lt; combl_1 ? 0.5 * Exp(x * Log(combl_0 / combl_1)) :&lt;br /&gt;
	\	1 - 0.5 * Exp(x * Log(combl_1 / combl_0))&amp;quot;)&lt;br /&gt;
c3=FrameEvaluate(c4, &amp;quot;global combl_2 = LumaDifference(combing_n2, combing_n3) - noisel&amp;quot;)		&lt;br /&gt;
c2=FrameEvaluate(c3, &amp;quot;global combl_1 = LumaDifference(combing_n1, combing_n2) - noisel&amp;quot;)      &lt;br /&gt;
c1=FrameEvaluate(c2, &amp;quot;global combl_0 = LumaDifference(combing_n0, combing_n1) - noisel&amp;quot;)      &lt;br /&gt;
return(c1) &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# (running inside of the Conditional Environment)&lt;br /&gt;
&lt;br /&gt;
function Evaluate() &lt;br /&gt;
{&lt;br /&gt;
vid = testclip.selecteven()&lt;br /&gt;
vid_1 = vid.trim(1,0)&lt;br /&gt;
&lt;br /&gt;
global blendmade = MergeLuma(vid,vid_1,blendl)&lt;br /&gt;
global blendpic = testclip.selectodd()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function Evaluate_test() &lt;br /&gt;
{&lt;br /&gt;
vid_2 = testclip.selectodd()&lt;br /&gt;
vid_3 = vid_2.trim(1,0)&lt;br /&gt;
&lt;br /&gt;
global blendmade_test = MergeLuma(vid_2,vid_3,blendl_test)&lt;br /&gt;
global blendpic_test = testclip.selecteven().trim(1,0)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function Min(float a, float b)&lt;br /&gt;
{&lt;br /&gt;
temp = a &amp;lt; b ? a :b&lt;br /&gt;
return(temp)&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LoadPlugin(&amp;quot;C:\program_me\dgmpgdec\DGDecode.dll&amp;quot;)&lt;br /&gt;
LoadPlugin(&amp;quot;C:\program_me\filters\TIVTC.dll&amp;quot;)&lt;br /&gt;
LoadPlugin(&amp;quot;C:\program_me\filters\FDecimate.dll&amp;quot;)&lt;br /&gt;
#LoadPlugin(&amp;quot;C:\program_me\filters\TDeint.dll&amp;quot;)&lt;br /&gt;
LoadPlugin(&amp;quot;C:\program_me\filters\leakkerneldeint.dll&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#AVISource(&amp;quot;D:\video\inu\[Ingow] Pirates Of Japan (Trailer).avi&amp;quot;)&lt;br /&gt;
#OpenDMLSource(&amp;quot;C:\Dokumente und Einstellungen\Benutzername\Eigene Dateien\Eigene Videos\film.avi&amp;quot;)&lt;br /&gt;
#DirectShowSource(&amp;quot;D:\video\inu\[Ingow] Pirates Of Japan (Trailer).avi&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
MPEG2Source(&amp;quot;D:\dvd.d2v&amp;quot;,cpu=4)&lt;br /&gt;
&lt;br /&gt;
#trim(0,0)&lt;br /&gt;
&lt;br /&gt;
crop(8,8,-8,-8)&lt;br /&gt;
&lt;br /&gt;
ord = last.getparity() ? 1 : 0&lt;br /&gt;
a = leakkernelbob(order=ord, sharp=true, twoway=true, threshold=7)&lt;br /&gt;
			&lt;br /&gt;
&lt;br /&gt;
deint = Cdeint(bob=a, bmode=2, nlv=0)&lt;br /&gt;
&lt;br /&gt;
tfm(order=-1, mode=0, cthresh=6, MI=64, display=false, mChroma=true, slow=false, pp=2, clip2=deint)&lt;br /&gt;
&lt;br /&gt;
fdecimate(rate=23.976,threshold=1.0,metrics=false) 	# or another decimater&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:External filters]]&lt;/div&gt;</summary>
		<author><name>Wilbert</name></author>	</entry>

	</feed>