View Full Version : Port of MPlayer Yadif deinterlace filter (C-Plugin)
Fizick
3rd April 2007, 19:16
I do not like deinterlace but i try lo learn C-plugin creation again :)
As an exercise I ported MPlayer Yadif (Yet Another DeInterlacing Filter).
http://www.mplayerhq.hu
http://guru.multimedia.cx/deinterlacing-filters/
It is well MMX assembler opimized but with GNU GCC inline compiler.
Assembler porting is hard task. That is why I use Avisynth C plugin interface and MinGW.
But I have an another question. How to create Avisynth C plugins with Microsoft compiler?
Generaly it does not produce correct function name avisynth_c_plugin_init@4.
MSVC (6,7,8) produces underscored _avisynth_c_plugin_init@4 instead,
and it is not possible to use LoadCPlugin command.
I use avisynth_c.h file from Avisynth 2.5.7 distrib.
The only workaround I found is to use yadif.def file for link:
LIBRARY yadif.dll
EXPORTS
avisynth_c_plugin_init@4=_avisynth_c_plugin_init@4
This way I produce yadif.dll with both _avisynth_c_plugin_init@4 and avisynth_c_plugin_init@4 functions. :)
Is it the only way (besides hex editing of DLL)?
Fizick
4th April 2007, 21:05
I found some bug in v0.1 (parity-related).
Released new v0.2 today.
Mug Funky
5th April 2007, 05:04
coolies. i'll try this one out over easter. if it's faster/more robust than leakkerneldeint i might just make it my preferred one for fast processing :)
Pookie
5th April 2007, 13:56
On a 1080i source
Yadif(mode=0) = 29.97fps
Yadif(mode=1) = 29.97fps
I'll check it again to make sure.
As always, thanks for the plugin Fizick :)
Fizick
5th April 2007, 19:58
yes, not all my plugins are slow :)
But it seems, that all fast of them were originally developed by some other (great) people (like Tom Barry, 'Kassandro', Michael Niedermayer)
:)
akupenguin
6th April 2007, 03:18
Yadif(mode=0) = 29.97fps
Yadif(mode=1) = 29.97fps
Yes, it doubles the number of frames but forgets to set the framerate accordingly.
Fizick
6th April 2007, 04:18
Yes, I forget about it.
use assumefps :)
Fizick
6th April 2007, 21:09
Fixed bugs with bob-fps and finally with parity in v0.3
scharfis_brain
7th April 2007, 00:12
hmm this seems to become my preferred filter for quick and dirty conversions.
so far as I could conclude form looking at the results for ióne minute, I think it has the following impementations:
- edi-interpolation similar to tomsmocomp
- temporal motion masking over 5 fields in temporal
- soft motion masking, i.e. no hard thresholding
tritical
7th April 2007, 01:57
You're pretty close for only a minute of watching... pseudo code for what it does (Fizick correct me if I'm wrong, I only glanced at the source code):
temporal sequence of pixels (trying to create pixel 'x'):
c h
a f k
d x i
b g l
e j
int p0 = (c+h)/2;
int p1 = f;
int p2 = (d+i)/2;
int p3 = g;
int p4 = (e+j)/2;
int tdiff0 = abs(d-i);
int tdiff1 = (abs(a-f)+abs(b-g))/2;
int tdiff2 = (abs(k-f)+abs(g-l))/2;
int diff = max3(tdiff0,tdiff1,tdiff2);
int spatial_pred = edi_value;
if (mode < 2)
{
int max = max3(p2-p3,p2-p1,min(p0-p1,p4-p3));
int min = min3(p2-p3,p2-p1,max(p0-p1,p4-p3));
diff = max3(diff,min,-max);
}
if (spatial_pred > p2 + diff)
spatial_pred = p2 + diff;
if (spatial_pred < p2 - diff)
spatial_pred = p2 - diff;
x = spatial_pred;
edi_value is determined by:
trying to create pixel 'x' from neighboring lines:
a b c d e f g
x
h i j k l m n
int spatial_pred = (d+k)/2;
int spatial_score = abs(c-j)+abs(d-k)+abs(e-l);
int score = abs(b-k)+abs(c-l)+abs(d-m);
if (score < spatial_score)
{
spatial_pred = (c+l)/2;
spatial_score = score;
score = abs(a-l)+abs(b-m)+abs(c-n);
if (score < spatial_score)
{
spatial_pred = (b+m)/2;
spatial_score = score;
}
}
score = abs(d-i)+abs(e-j)+abs(f-k);
if (score < spatial_score)
{
spatial_pred = (e+j)/2;
spatial_score = score;
score = abs(e-h)+abs(f-i)+abs(g-j);
if (score < spatial_score)
{
spatial_pred = (f+i)/2;
spatial_score = score;
}
}
Mug Funky
7th April 2007, 02:28
ooh, this is a very sensitive deinterlacer - it'll pick up an interlaced fade in over 200 fields without passing through combs, but it'll also leave static stuff static. it's also more than twice as fast as tdeint and doesn't require vinverse afterward to guard against stray combs.
i might just plop this into my generic standards converter and see what kind of speedup it gives me.
[edit]
btw, i seem to only be able to load it with Load_Stdcall_plugin, as opposed to loadcplugin. not a big deal, but for a while i was quite confused :|
DSP8000
7th April 2007, 04:57
To my eyes this deinterlacer does a very good job, works better than TDeint, faster too. Very simple parameters. Bob mode works well.
scharfi, would you recommend this deinterlacer for quick crop, resize, denoise, reinterlace. I use TDeint for now, simple Bob seems like is blurring too much.
LoadCPlugin works for me.
Thanks for the plugin Fizick :)
tateu
7th April 2007, 22:27
Yes, thanks...this looks like it is going to be my new standard deinterlacer. And the latest 0.3 version fixed my problem with bottom field first clips.
Terka
9th April 2007, 12:00
cant load
LoadPlugin("C:\Program Files\AviSynth\plugins\yadif.dll")
do i need some more dlls?
Fizick
9th April 2007, 12:05
Terka,
more reading of doc is required...
scharfis_brain
9th April 2007, 17:57
fizick, could you alter yadif in a way so it has an additional parameter like TDeint's edeint?
so we could use its pretty good motionmasking with kernel or eedi2 interpolation.
Fizick
9th April 2007, 20:44
scharfis_brain,
No.
Yadif is yadif. Let's not slowdown it.
scharfis_brain
9th April 2007, 22:53
why slowdown?
if the external clip is not given it still will run the max. speed....
ChiDragon
10th April 2007, 02:33
Looks like a nice deinterlacer, but the order=-1 setting is still using the wrong parity with v0.3 for me, and like Mug Funky said it will only load with Load_stdcall_plugin. Also, not a big deal, but the HTML file is missing the CSS since it points to a location that doesn't exist on my computer...
Fizick
10th April 2007, 04:53
ChiDragon,
probably LoadCplugin is overrided by some other old C plugin and LoadPlugin("avisynth_c.dll") command in your system?
Load_stdcall_plugin command was introduced in Avisynth for such case.
order=-1 is wrong with TFF or BFF clip?
ChiDragon
10th April 2007, 06:25
I see, I didn't know that avisynth_c.dll was no longer necessary. It's a TFF vid.
tateu
10th April 2007, 07:16
It's a TFF vid.
Did you add AssumeTFF() before deinterlacing? If you did not, AviSynth is probably treating your video as BFF. Order = -1 works fine here for both TFF and BFF, if I set the parity of the script correctly.
IanB
10th April 2007, 12:51
avisynth_c.dll will still be needed for any older C plugins linked against it.
C plugins linked directly against the core avisynth.dll (i.e Yadif, etc) do not need it.
ChiDragon
10th April 2007, 23:36
It's already seen as TFF, tateu, since it's an MPEG2 with DGDecode. Info() confirmed this.
tateu
11th April 2007, 00:25
It's already seen as TFF, tateu, since it's an MPEG2 with DGDecode. Info() confirmed this.
Yes, you are absolutely correct. Sorry about that. I always use AssumeTFF or BFF in my scripts and I did not check what happens when I leave it out.
If Parity = "Top Field First" then yadif works incorrectly.
If Parity = "Assumed Top Field First" then yadif works correctly.
ChiDragon
11th April 2007, 03:44
I see why... Yadif is using "IsTFF" instead of the GetParity function. Looking at the source for the Info filter it seems that Is_FF is only set by the Assume_FF function (that's how Info checks whether it is "_ Field First" or "Assumed _ Field First"). So everything that isn't explicitly set with Assume returns as BFF.
Fizick
11th April 2007, 04:52
Thanks. Open source is good thing :)
(Mplayer uses "TFF" and "parity" different way than avisynth. It is source of this mess.)
Terka
11th April 2007, 13:21
readed the doc again, but still cant find why cant load
LoadPlugin("C:\Program Files\AviSynth\plugins\yadif.dll")
Leak
11th April 2007, 13:25
readed the doc again, but still cant find why cant load
LoadPlugin("C:\Program Files\AviSynth\plugins\yadif.dll")
Which part of
Implemented as Avisynth C-plugin (not regular Avisynth plugin).
Must be loaded with Load_Stdcall_plugin("yadif.dll") or LoadCplugin("yadif.dll"). Do not use autoloading.
straight from the documentation (http://avisynth.org.ru/yadif/yadif.html) is so hard to understand? :confused:
Terka
11th April 2007, 13:38
sorry:stupid:
Fizick
11th April 2007, 17:45
Released Yadif version 0.4:
Finally (!) fixed bug with wrong used parity for TFF without AssumeTFF.
Removed limitation on frames pitches equality.
about avisynth.css file: place it to upper level folder of plugins dir, for example to "C:\Avisynth 2.5\"
(Field parity is still strange thing in Avisynth. For example, why FlipVertical does not change it automatically?)
Fizick
11th April 2007, 18:25
Some speed test with PAL DVD source, null encoder codec:
avs2avi.exe yadif.avs -o n -c null
Tomsmocomp(-1,5,0) - 59.32 fps
LealKernelDeint(1) - 51.80 fps
Yadif() - 40.30 fps
TDeint() - 16.40 fps
(AthlonXP 2040MHz, SDR Dimm)
jeffy
11th April 2007, 22:36
Some speed test with PAL DVD source, null encoder codec:
avs2avi.exe yadif.avs -o n -c null
Tomsmocomp(-1,5,0) - 59.32 fps
LealKernelDeint(1) - 51.80 fps
Yadif() - 40.30 fps
TDeint() - 16.40 fps
(AthlonXP 2040MHz, SDR Dimm)
Could you please share your sample source file and script, if at all possible? If yes, what version of avs2avi did you use? Thank you in advance, I... I like it!
Fizick
12th April 2007, 04:34
script:
load_stdcall_plugin("yadif.dll")
mpeg2source("g:\vts_06_1.d2v")
yadif()
avs2avi v1.39
source - (PAL DVD 720x576, 25)
It is not encoding example. It is speed test.
LoRd_MuldeR
12th April 2007, 15:10
btw, i seem to only be able to load it with Load_Stdcall_plugin, as opposed to loadcplugin. not a big deal, but for a while i was quite confused :|
No, you are not :)
LoadPlugin results in "Not a valid Avisynth 2.5 Plugin" error message. Load_Stdcall_Plugin works fine.
Boulder
12th April 2007, 16:31
Notice the tiny c in Mug Funky's loadcplugin ;)
And thanks, Fizick, I really have to donate for this and MVTools as soon as my paycheck arrives.
Fizick
12th April 2007, 18:50
(May be I am wrong) Avisynth support 4 types of plugins:
1. Regular plugins. Use LoadPlugin(...)
2. VirtualDub plugins. Use LoadVirtualDubPlugin(...)
3. Vfapi plugins. Use LoadVFapiPlugin(...)
4. Avisynth_C plugins with two subtypes:
4.1 Original Kevin Atkinson C-interface plugin. (It use C language calling syntax internally). Use LoadCPlugin(...) (note C symbol in word!)
You must firsly load Avisynth_C interface by LoadPlugin("avisynth_c.dll").
4.2 Updated (new) C-interface plugin. (It use stdcall calling syntax internally). Use Load_Stdcall_plugin(...) or LoadCPlugin(...).
Such plugins are not need in avisynth_c.dll anymore (since v2.5.6? avisynth has core function LoadCPlugin).
So, If you need in some old Avisynth_C plugin, for example SmartDecimate, you must firstly load Avisynth_C.dll.
This Avisynth_C.dll has function LoadCPlugin which will override core Avisynth function with the same name LoadCPlugin.
In this case, LoadCPlugin command will load old-style C-plugin only.
Load_Stdcall_plugin will NOT overrided, and may be used in any case with new C-plugins (like Yadif).
(In my opinion, it is not very good. LoadCPlugin word could be removed fom core or reserved for old-style C-plugins only.
But we have what we have now).
Advice for users: use Load_stdcall_plugin(...) for new C-plugins, and LoadCPlugin(...) for old C-plugins.
Advice for developers of C-plugins: use stdcall type, new avisynth_c.h header and avisynth.lib library provided with avisynth 2.5.7. It works. Tested and approved :)
LoRd_MuldeR
12th April 2007, 19:23
Fizick, did you ever think of porting this to Avidemux, too?
Avidemux has a new Plugin interface now for 'External' filters, but I didn't see any of them yet.
Yadif would be a nice one to have :)
g3power
13th April 2007, 00:01
Fizick, Michael recommends using mcdeint in conjuction with yadif. Do you plan to add mcdeint to your port?
LoRd_MuldeR
13th April 2007, 00:08
Fizick, Michael recommends using mcdeint in conjuction with yadif. Do you plan to add mcdeint to your port?
Did you ever try mcDeint in MPlayer/Mencoder/Avidemux ???
It's slooooooooooooooooooooooooooooow and I can't get satisfactory quality out of it...
g3power
13th April 2007, 00:55
Yes. I did that just a few hours ago. It was slow (aprox. 1-2 fps). The quality was very good, though.
I have been experimenting with 50i->50p for a few month now. The best way I have found until now seems to be Apple Compressor with deinterlacing quality set to better or best. This uses optical flow and is quite slow on both my G5 and Intel machine. It takes about 25x real-time.
With quality set to "fast" (5x real-time) there are very annoying horizontal temporal artefacts in a very short piece of the footage with a barn in the background made out of wooden planks and the camera on a tripod. The same applies to all other methods I have tried.
As the best method I have found to remove the strong video noise from the footage is to use fizick's great fft3d set to an insanely high strength I was looking for a way to get 50i->50p right in AviSynth...
LoRd_MuldeR
13th April 2007, 18:56
Yadif is now available in Avidemux too, thanks to the work of Fizick and Mean:
http://forum.doom9.org/showthread.php?p=988615#post988615
:thanks:
LoRd_MuldeR
15th April 2007, 11:50
This post is from Avidemux Board and might be of interest:
In Fizick version there is maybe a bug
Original
if (n< (&p->vi)->num_frames)
next = avs_get_frame(p->child, n+1); // get next frame
else
next = avs_get_frame(p->child, (&p->vi)->num_frames-1); // get last frame
I think it should be
if (n< (&p->vi)->num_frames-1) <<<<===
next = avs_get_frame(p->child, n+1); // get next frame
else
next = avs_get_frame(p->child, (&p->vi)->num_frames-1); // get last frame
ChiDragon
15th April 2007, 23:47
Yeah it should be num_frames-1, since a clip with only frame 0 has num_frames=1, one with frames numbered 0-999 has num_frames=1000, etc. Weird that the actual GetFrame call is correct while the If is wrong. :P
Fizick
16th April 2007, 04:47
yes, but Avisynth has internal protection anyway (IMO).
Here is a little more serious problem - processing must be modified for very first and very last frame. May be in some time I will update it.
MuLTiTaSK
16th April 2007, 23:46
DGindex reported my source field order as top and frame rate as 29,97fps i have field operation set to honor pulldown flags so would my script deinterlace my clip and keep the same frame rate i really want to give this filter a try i been hearing so many good things about it i read the manual and think i got it right i just want to make sure with the pros first before i waste a bunch of hours i hope someone can help me thanks in advance :)
http://i10.tinypic.com/2w1xenn.png
SetMTMode(2)
Load_Stdcall_plugin("C:\Program Files\AviSynth 2.5\plugins\yadif.dll")
DGDecode_mpeg2source("G:\CAPS\funny budlight clips.mpg",info=3)
ColorMatrix(hints=true,interlaced=true)
yadif(order=1)
crop( 6, 0, -20, -54)
LanczosResize(640,432) # Lanczos (Sharp)
Fizick
17th April 2007, 04:41
Script is look correct (you may omit order=1 parameter - yadif can get field parity from DGGecode)
But I do not know about MT compatibility.
Yes, Yadif is for real video interlaced sources.
For another case (real NTSC FILM source with puldown) use another deinterlacer (IVTC).
Yadif is new (Avisynth) filter,
so please post your results here.
MuLTiTaSK
17th April 2007, 15:39
Script is look correct (you may omit order=1 parameter - yadif can get field parity from DGGecode)
But I do not know about MT compatibility.
Yes, Yadif is for real video interlaced sources.
For another case (real NTSC FILM source with puldown) use another deinterlacer (IVTC).
Yadif is new (Avisynth) filter,
so please post your results here.
thanks for replying Fizick i changed my script after reading your
post i played it in MPC & VDubMod it looked good and was very fast i'am impressed so far i'am gonna encode some clips with it and post some results on here thanks for porting this gem into
the Avisynth world :thanks:
SetMTMode(2)
Load_Stdcall_plugin("C:\Program Files\AviSynth 2.5\plugins\yadif.dll")
DGDecode_mpeg2source("H:\yadif_tests\funny_budlight_clips.mpg")
yadif()
crop( 8, 0, -20, -54)
LanczosResize(640,432) # Lanczos (Sharp)
#denoise
Fizick
17th April 2007, 20:13
v0.5 fixed the bug
ChiDragon
17th April 2007, 22:35
if (n>0)
prev = avs_get_frame(p->child, n-1); // get previous frame
else if ((&p->vi)->num_frames > 0)
prev = avs_get_frame(p->child, 1); // next frame
else
prev = avs_get_frame(p->child, 0); // cur 0 frame for one-frame clip
if (n < (&p->vi)->num_frames - 1)
next = avs_get_frame(p->child, n+1); // get next frame
else if ((&p->vi)->num_frames > 1)
next = avs_get_frame(p->child, (&p->vi)->num_frames - 2); // prev frame
else
next = avs_get_frame(p->child, 0); // cur 0 frame for one-frame clip
Not saying it's wrong, but why are you getting next for prev and prev for next instead of current for both when there's an out-of-bounds access?
Also shouldn't "else if ((&p->vi)->num_frames > 0)" be "> 1" to check for a 1-frame clip? i.e. wouldn't "(&p->vi)->num_frames > 0" always return 1 if the clip has video at all?
Fizick
18th April 2007, 04:41
ChiDragon,
1. I like results with prev instead of current.
2. Oopps! it is bug. Fixed in new release (same version number 0.5).
Terranigma
18th April 2007, 22:34
I'll do some tests with this deinterlacer. I've read the document over at your homepage, and what piqued my interest is that it's an adaptive deinterlacer and mode 1. I'll let you know what I think of it when I get a chance. :)
Video Dude
25th April 2007, 05:03
Thanks for the port Fizick.
This deinterlace filter is great. I am seeing no motion artifacts and hardly any jagged edges. And the speed is real time or faster on my machine.
:thanks:
HeadBangeR77
25th April 2007, 11:40
Excellent plugin for those with slower PCs, like me for instance ;)
I've just had a quick look at it and encoded a few short samples.
:thanks:
chipzoller
28th April 2007, 05:06
Really great (and fast) plugin for straightforward deinterlacing. Thank you, fizick!
WorBry
30th April 2007, 11:31
I like it too and am now using it to generate a 50p feed for ConvertMCfps, Scharfis_Brains standards conversion routine.
However, for rendering 50p material (intended for playback at 50p) I see it is quite susceptible to the 'bobby shimmers' (i.e. vertical jitter of (relatively) static areas) as also are TDeint, SecureBob and to a lesser degree MVBob. MCBob of course does a marvellous job in this department.
I was wondering if there is any simple way of correcting for this (i.e. along the lines of a vertical pixel shift on alternate frames) without screwing up the motion?
Also, as an MPlayer plugin I note that Yadif is often used in combination with MCDeint and some report superior results. I wonder if Fizick (or someone) might consider porting MCDeint to AVISynth too?
Edit: Seems the same question was asked earlier this thread:
Fizick, Michael recommends using mcdeint in conjuction with yadif. Do you plan to add mcdeint to your port?
to which Lord Mulder commented:
Did you ever try mcDeint in MPlayer/Mencoder/Avidemux ???
It's slooooooooooooooooooooooooooooow and I can't get satisfactory quality out of it...
Havent used AVIdemux myself, but I'll give it a whirl. Lord Mulder, do you have a link for the Yadif plugin itself? I cant get at the AVIDemux 2.4 build (2934) that you link to above as I do not have a 'Proper Web Browser' :)
Edit2: OK, got myself a proper browser and dowloaded build 2994 (with yadif included). Tried a few tests with some home DV clips. Yadif 3:0 or 1:0 + MCDeint 2:0:10. Very slow (even slower than MCBob) and quality nothing to write home about.
LoRd_MuldeR
30th April 2007, 18:04
Havent used AVIdemux myself, but I'll give it a whirl. Lord Mulder, do you have a link for the Yadif plugin itself? I cant get at the AVIDemux 2.4 build (2934) that you link to above as I do not have a 'Proper Web Browser' :)
You can get latest Avidemux build here:
http://www.razorbyte.com.au/avidemux/2.4/SVN/2994/avidemux_2.4_r2994_win32.exe
Yadif filter is built-in, no Plugin needed for Avidemux :cool:
Or did you mean the Avisynth plugin? You can get it form Fizick's site:
http://avisynth.org.ru/fizick.html
And get grid of IE :devil: :p
WorBry
1st May 2007, 06:24
Lord Mulder,
Edit2: OK, got myself a proper browser and dowloaded build 2994 (with yadif included). Tried a few tests with some home DV clips. Yadif 3:0 or 1:0 + MCDeint 2:0:10. Very slow (even slower than MCBob) and quality nothing to write home about.
I'm now Opera'tic :p
Chainmax
1st May 2007, 06:27
WorBry, do you think a small addon to the comparison in the "plain deinterlace..." thread with TDeint+TMM and Yadif could be made?
WorBry
1st May 2007, 09:42
I still have the source test (interlaced) clips but I'm pretty sure I deleted all of the de-interlaced encodes and the frame shots from them :rolleyes: Silly of me I know, but I was desparate for disc space. I could probably do it over again when I have a mo, probably just taking the grabs from the AVS output rather than encoding.
BTW - Whats TMM?
Chainmax
1st May 2007, 16:36
TMM is a helper function for TDeint that tritical made from McBob's smart thresholding. You can read all about it in the "TDeint & TIVTC" thread's last couple of pages.
WorBry
2nd May 2007, 07:31
TMM is a helper function for TDeint that tritical made from McBob's smart thresholding. You can read all about it in the "TDeint & TIVTC" thread's last couple of pages.
Looks interesting. I see Tritical is putting together a deinterlacer comparison that will doubtless provide more meaningful analysis than could be achieved by me posting a few frame grabs and metrics and inviting comment. Hopefully he'll include some frame shots also (??????).
I'll leave it there as at this point I usually get reminded that this is a AVISynth developmental, not usage forum :)
Tried the filter the other day. Nice effort. Very few motion artifact.
But I still much prefer MoComp2 video deinterlace filter of DScaler4 inside FFDShow. The picture looks much sharper and much less deinterlacing artifact (jaggies), though there is some minor motion artifact in high contrast edge in motion.
regards,
Li On
Fizick,
I just donated to you this morning. Now I get to ask questions guilt free. :)
In the docs for Yadif you list that the "Top two and bottom two lines are not processed" under the limitations section. Is this something that you are going to fix? I realize that most people don't mind this becasue this area usually ends up in the overscan of the TV and is never seen.
But I am creating anamorphic DVD's and when viewed on a standard TV using the special 16:9 mode the top and bottom of the video is shown.
What I've done so far is to use a feature built into HC Encoder to blank the top 2 and bottom 2 lines off the video (MASK_SHIFT). This works but doesn't leave a clean edge since I guess HCEnc crops this before encoding and so this edge gets blurred.
Here's my current AviSynth script I'm using to clean up video captured from an analog Sony TRV85 Hi8 camcorder (S-VIDEO) using my ATI AIW 9600 and VirtualDub 1.7.1 w/Huffy codec. If you want to know more about my system and capturing procedure, check here:
http://forum.doom9.org/showthread.php?p=974315
Load_Stdcall_plugin("C:\Program Files\AviSynth 2.5\plugins\yadif.dll")
AviSource("disney.avi")
Crop(0,2,0,-8,True)
ConvertToYV12(interlaced=true)
yadif(mode=1,order=1)
HDRAGC(coef_gain=.5,max_gain=.8,min_gain=0,black_clip=.1,reducer=2)
Deen("a2d",2,10,12)
FFT3DGPU(sigma=3, bt=3, bw=32, bh=32, ow=16, oh=16, sharpen=0.5)
LanczosResize(704,480)
assumetff()
separatefields().selectevery(4,0,3).weave()
AddBorders(8, 0, 8, 0, $000000)
FadeIn2(55)
FadeIo2(55)
And then my settings for HC Encoder:
*BITRATE 8691
*MAXBITRATE 9624
*FRAMES 0 122880
*PROFILE best
*AUTOGOP 18
*DC_PREC 10
*INTERLACED
*TFF
*CLOSEDGOPS
*BIAS 5
*MASK_SHIFT 2 2 0
*MATRIX mpeg
Anyway, I guess I'm just wondering if I could be fixing those top and bottom lines a better way? And of course, I'll take ANY advice about my script or process.
FYI, I'm getting 6fps average. Specs of my system can be seen in my sig.
In the docs for Yadif you list that the "Top two and bottom two lines are not processed" under the limitations section. Is this something that you are going to fix? I realize that most people don't mind this becasue this area usually ends up in the overscan of the TV and is never seen.
You could mirror the top and bottom of your video, then deinterlace, then crop off the excess. At least that's how LeakKernelDeint handles the top and bottom rows.
I.e. if you have rows 0 to 479, you'd create an image like this:
2
1
0
1
2
3
...
477
478
479
478
477
then deinterlace that and chop off two lines at the top and bottom after deinterlacing. That will still not process the first and last two lines (which are chopped off again anyway), but give a better edge in the process.
Should be doable via Crop, FlipVertical and StackVertical...
np: Adult. - I Feel Worse When I'm With You (Why Bother?)
You could mirror the top and bottom of your video, then deinterlace, then crop off the excess.
Thanks for the tip... I think I get what you are saying, but it would take me 3 days to figure out how to do it correctly and then what would it do to my encode times, which are already pretty poor at 6fps? Although I know many of you are at 1fps. Too many good filters out there now...have to use them all. :)
puddy
Thanks for the tip... I think I get what you are saying, but it would take me 3 days to figure out how to do it correctly and then what would it do to my encode times, which are already pretty poor at 6fps?
Uh... deinterlacing 4 lines more then chopping them off again shouldn't really impact your overall encode time by more than 0.1 FPS...
np: Gui Boratto - Chromophobia (Chromophobia)
You could mirror the top and bottom of your video, then deinterlace, then crop off the excess.
Should be doable via Crop, FlipVertical and StackVertical...
I guess I just don't understand how to do it using the commands you've suggested. Maybe I'll tackle it when I've got more energy. But thank you for the suggestion. :)
foxyshadis
9th May 2007, 23:45
Off-topic ffdshow posts moved back to ffdshow thread (http://forum.doom9.org/showthread.php?t=120465).
Fizick
10th May 2007, 00:01
puddy,
I will look to this border lines. but as maximum I can implement somewhat similar to Leak's suggestion.
as for script, here is script draft:
top=crop(0,1,width,2).flipvertical
bottom=crop(0,height-3,width,height-2).flipvertical
stackvertical(top,last,bottom)
yadif()
crop(0,2,width,-2)
but odd cropping is not for YV12,
yuy2 will fine
Didée
10th May 2007, 01:08
# s = 2 # YUY2
s = 4 # YV12
pointresize( width,height+(s*2), 0,-s, width,height+(s*2) )
yadif()
crop(0,s,-0,-s)
puddy
10th May 2007, 03:37
# s = 2 # YUY2
s = 4 # YV12
pointresize( width,height+(s*2), 0,-s, width,height+(s*2) )
yadif()
crop(0,s,-0,-s)
I get it now. :)
Thank you so much...
puddy
WorBry
15th May 2007, 10:18
If anyone is interested, the Yadif-AVISynth plugin works quite nicely in FFDshow (Leak's 'AVISynth' build).
http://forum.doom9.org/showthread.php?p=1003507#post1003507
tateu
16th May 2007, 21:33
the Yadif-AVISynth plugin works quite nicely in FFDshow (Leak's 'AVISynth' build).
Ooh, thanks for the tip. I am onsite now for a live event where I capture with a custom version of VirtualDub-Mpeg2 via SDI with an Osprey 560 SD capture card. I normally deinterlace with FFDshow's Tomsmocomp, scale the video to 870x652 (square pixels) and display it on an LED sign. Tomsmocomp did a decent job, but was not as clean as I would have liked (a little blurry and still areas of the picture were processed too much and appeared jagged).
I just installed the aforementioned FFDshow build with yadif (order=0, mode=0), set the Osprey card to capture in I420, and it is working beautifully...about as good as I could have hoped for.
Fizick
31st May 2007, 20:27
Released Yadif Version 0.7 (31.05.2007)
Processing of first and last lines by spatial average or duplicate (requested by puddy).
puddy
1st June 2007, 15:29
Released Yadif Version 0.7 (31.05.2007)
Processing of first and last lines by spatial average or duplicate (requested by puddy).
I haven't had a chance to try it yet, but thank you.
puddy
Delerue
6th June 2007, 21:11
I'm trying to use this script, but is hard to me to understand how. There's no 'readme', no installation steps and no examples in this page (http://avisynth.org.ru/yadif/yadif.html). I'm trying with this, but no sucess:
LoadCplugin("C:\Arquivos de programas\AviSynth\plugins\yadif.dll")
source=ffdshow_source()
yadif(mode=1,order=1)
The .dll are running, but there's an error in the 'yadif' syntax. What you mean by 'clip' here: Yadif (clip, int "mode", int "order") ?
Any help would be great.
Thanks.
krieger2005
6th June 2007, 21:17
In your case clip means "source" (source=...). yadif(source,mode=1,...) should do the trick.
Delerue
6th June 2007, 21:51
In your case clip means "source" (source=...). yadif(source,mode=1,...) should do the trick.
I tried with this:
LoadCplugin("C:\Arquivos de programas\AviSynth\plugins\yadif.dll")
yadif(source=fullpathofthevideo,mode=1,order=1)
And this:
LoadCplugin("C:\Arquivos de programas\AviSynth\plugins\yadif.dll")
yadif(source=ffdshow_source(),mode=1,order=1)
Same error. :(
ChiDragon
6th June 2007, 21:55
You didn't use what krieger2005 said...
LoadCplugin("C:\Arquivos de programas\AviSynth\plugins\yadif.dll")
source=ffdshow_source()
yadif(source,mode=1,order=1)
Delerue
6th June 2007, 22:07
Hmmm... I tried only with this (and didn't work):
LoadCplugin("C:\Arquivos de programas\AviSynth\plugins\yadif.dll")
yadif(source,mode=1,order=1)
Now worked. Thanks a lot.
manolito
6th June 2007, 22:12
The Yadif manual says that Yadif needs Avisynth 2.57. Any specific 2.57 feature Yadif needs which earlier Avisynth versions don't have?
The reason I am asking is that I have been using Yadif with Avisynth 2.56a for some time now without any problems. Am I asking for trouble?
Cheers
manolito
Fizick
7th June 2007, 05:08
But I use avisynth_c.h and avisynth.lib files from Avisynth v2.5.7.
I did not test v2.5.6.
After your testing it seems that changes are not important for yadif.
ficofico
13th June 2007, 22:29
a very great plugins for dv source imho. Appreciate.
LoRd_MuldeR
15th June 2007, 14:49
Hi. I got a question regarding Yadif and Gauss Smooth: Chroma noise is a very nasty problem with analog sources. So I like to apply Gauss Smooth on Chroma only, as it reduces the Chroma noise greatly, works pretty fast and doesn't effect Sharpness in a visible way. The problem is interlaced material! If I put the Gauss Smooth filter after the Deinterlacing filter (Yadif in this case), which I guess is the "safe" method, the results are not so nice. It seems deinterlacing amplifies the Chroma noise significantly. So the Chroma noise should be killed before Deinterlacing.
Now I wonder if it is "okay" to put the Gauss Smooth filter (remember: Chroma only) before the Yadif filter. The problem that concerns me is that this method would smooth lines from one field together with lines from the other field. This might destroy the interlaced structure and could probably hurt the deinterlacing process. Nevertheless I'm not sure if it will have a negative effect on the way Yadif works.
Any information/suggestions are welcome...
chipzoller
15th June 2007, 16:18
Have you tested yadif in this manner? In my tests where I applied gauss smooth on chroma interlaced material then sent to yadif, the results were pretty good, better in fact that smoothing after deinterlacing. I'm curious to hear if you've attempted it in this manner and your results.
Fizick
15th June 2007, 18:14
LoRd_MuldeR,
IMO, this question it is not specific for Yadif.
There are general rule for usage of spatial filters with interlaced sources: SeparateFields, filter, weave.
But may be with different setting for vertical and horizontal.
I do not know about Gauss Smooth.
Please ask in another thread.
LoRd_MuldeR
15th June 2007, 18:36
Have you tested yadif in this manner? In my tests where I applied gauss smooth on chroma interlaced material then sent to yadif, the results were pretty good, better in fact that smoothing after deinterlacing. I'm curious to hear if you've attempted it in this manner and your results.
Yes, and I cannot see major problems at the first look...
LoRd_MuldeR,
IMO, this question it is not specific for Yadif.
There are general rule for usage of spatial filters with interlaced sources: SeparateFields, filter, weave.
But may be with different setting for vertical and horizontal.
I do not know about Gauss Smooth.
Please ask in another thread.
Sorry if I posted in the wrong thread. I only thought there might be a Yadif-specific answer to my question. Of course I'm aware that spatial filters should not be applied on interlaced video. So I tied StackFields -> GaussSmooth -> UnStackFields first. Unfortunately that method doesn't seem to work very well. Applying GaussSmooth directly on the interlaced source seems to reduce the Chroma noise much better ...
akapuma
17th June 2007, 09:14
Hello,
I have a problem with newer versions of yadif.
To playback DVB, I'm using the DVBViewer pro. MPEG2-Decoder is ffdshow. Now, I tried to use yadif as deinterlacer with this method:
http://forum.gleitz.info/showpost.php?p=336102&postcount=15
LoadCPlugin instead of Load_Stdcall_plugin don't works fine on my computer.
After starting the DVBViewer, all versions of yadif works fine. But I have a problem, if I change the channel (even with same resolution).
If I use yadif 0.6 or 0.7, the DVBViewer and/or my computer hangs. yadif 0.5 works fine.
Best regards
akapuma
Fizick
17th June 2007, 13:08
akapuma,
I can not reproduce the error, but try new version 0.8.
;)
hank315
17th June 2007, 15:10
Hi Fizick,
I also had trouble using version 06 and 07, they wouldn't run stable.
Running HCenc in debug mode with the yadif plugin showed:
First-chance exception at 0x7c96df51 in hc022.exe: 0xC0000005: Access violation reading location 0xbaadf005.
First-chance exception at 0x7c96df51 in hc022.exe: 0xC0000005: Access violation reading location 0xbaadf005.
First-chance exception at 0x7c96df51 in hc022.exe: 0xC0000005: Access violation reading location 0xbaadf005.
First-chance exception at 0x7c96df51 in hc022.exe: 0xC0000005: Access violation reading location 0xbaadf005.
First-chance exception at 0x7c96df51 in hc022.exe: 0xC0000005: Access violation reading location 0xbaadf005.
First-chance exception at 0x7c96df51 in hc022.exe: 0xC0000005: Access violation reading location 0xbaadf005.
First-chance exception at 0x7c96df51 in hc022.exe: 0xC0000005: Access violation reading location 0xbaadf005.
First-chance exception at 0x7c96df51 in hc022.exe: 0xC0000005: Access violation reading location 0xbaadf005.
First-chance exception at 0x7c96df51 in hc022.exe: 0xC0000005: Access violation reading location 0xbaadf005.
First-chance exception at 0x7c96df51 in hc022.exe: 0xC0000005: Access violation reading location 0xbaadf005.
First-chance exception at 0x7c96df51 in hc022.exe: 0xC0000005: Access violation reading location 0xbaadf005.
First-chance exception at 0x7c96df51 in hc022.exe: 0xC0000005: Access violation reading location 0xbaadf005.
Always the same 12 access violations, this behaviour started with version 06.
The new 08 release seems to have solved it, no more access violations, running stable again.
(Looking at the changes, the 12 errors pretty much match the 12 free commands;))
Thanks to Michael and yourself for this nice (and fast) de-interlacer.
Fizick
17th June 2007, 15:20
Yes, it were free()
v0.6 an 0.7 worked fine with YUY2 sources I usually use.
akapuma
17th June 2007, 16:17
akapuma,
I can not reproduce the error, but try new version 0.8.
;)Thank you very much, 0.8 works fine.
Best regards
akapuma
halsboss
28th June 2007, 02:51
In my tests where I applied gauss smooth on chroma interlaced material then sent to yadif, the results were pretty good, better in fact that smoothing after deinterlacing.
Any chance of sample code on how you did this before feeding it into Yadif ? eg even/odd processing or fold, etc.
ronnylov
18th July 2007, 11:30
Yadif craches at seeking when I try feed it with YUY2 format and using yadif(mode=1). What happens is that I can open the avs in virtualdub but as soon as I try to move the seeking slider VirtualDub disappears from the desktop. However feeding the same video in YV12 format does not cause the crash. In this case the source was YV12 and then converted to YUY2 so I just moved the YUY2 conversion after yadif in my script so it did not matter but I still want to resport this behaviour. My source was a 1440x1080i HDV file opened via MPEG2Source and then converted to YUY2.
scharfis_brain
21st July 2007, 10:03
My source was a 1440x1080i HDV file opened via MPEG2Source and then converted to YUY2.
This is not the right way to do.
Always deinterlace a source video in its native colourspace. And then do the conversion to the other colourspace after deinterlacing.
ronnylov
21st July 2007, 14:46
OK but should yadif not work in YUY2 too?
I can try an analoge capture in native YUY2 format and see what happens.
scharfis_brain
21st July 2007, 16:07
of course, it should work with YUY2, too.
But the correct way to treat interlaced contents is to leave them unconverted chroma-wise.
Fizick
22nd July 2007, 18:42
ronnylov,
try new version 0.9
Razorholt
8th August 2007, 19:45
I wanted to combine TFM+Yadif and I came up with that code:
AssumeBFF()
deint = yadif()
tfm(order=0,field=1,PP=6,clip2=deint)
tdecimate(hybrid=1)
Spline36Resize(1440,608)
undot().cnr2()
BicubicResize(480,352)
Is it correct?
Thanks,
- Dan
foxyshadis
9th August 2007, 05:21
I don't think that would work properly in all cases, though for the most part it would, because order and field should normally be the same. (And normally, there's no need to specify either.) yadif is good enough that it might not create artifacts either way, though.
Razorholt
9th August 2007, 05:29
Gotcha! Thanks a lot foxyshadis.
salehin
14th August 2007, 17:10
Using DGIndex I get the folllowing info (cf. attahced image). [Please ignore th fps. I ran the the preview only for a few seconds.]
In MeGUI, using the analyse option from script editor, i get the following deinterlacing option (i've added the full script below).
# deblocking, LSF, soothe
# Set DAR in encoder to 37 : 20. The following line is for automatic signalling
global MeGUI_darx = 37
global MeGUI_dary = 20
DGDecode_mpeg2source("G:\Temp\Elements of Dynamic Optimization 1080i.ts",cpu=4)
edeintted = last.AssumeBFF().SeparateFields().SelectEven().EEDI2(field=-1)
TDeint(order=0,full=false,edeint=edeintted)
crop( 2, 0, -2, -10)
dull = last.Spline36Resize(1280,720)
sharp = dull.LimitedSharpenFaster(dest_x=1280,dest_y=720,Strength=80)
Soothe(sharp,dull,40)
Can you please advise me what code should use to employ Yadif if this specific source.
Thanks a lot :)
foxyshadis
14th August 2007, 18:51
Swap
edeintted = last.AssumeBFF().SeparateFields().SelectEven().EEDI2(field=-1)
TDeint(order=0,full=false,edeint=edeintted)
with
Yadif()
and it should work fine.
Atak_Snajpera
15th August 2007, 00:39
I would say Yadif(order=0)
Boulder
15th August 2007, 03:38
No need for that, MPEG2Source will already set the field order flag.
juhu
22nd August 2007, 12:13
Hi.
I switched from tdeint to yadif as a bobber, to transcode stuff with mrestore (v2) in order to speed up things a bit.
although it worked fine, RAM occupation constantly increases during the whole encoding and is really gigantic after some time
ie a simple
yadif(mode=1).mrestore()
applied on a ntsc ->pal transcoded vob culminates with 1.7 GB of ram occupation for a 110mn film
as I don't have a fixed size swap file and didn't do anything else during encoding, there was no crash, but still, I assume there's something wrong there?
as far as I can tell, I didn't notice similar behavior with
tdeint(mode=1).mrestore()
so I tend to think it's a problem on yadif side
Fizick
22nd August 2007, 15:49
juhu,
it is important, I will inverstigate it.
but can you provide some simpler (without mrestore) script with memory leakage?
Fizick
28th August 2007, 16:19
juhu,
it it not yadif fault.
Bob() gives same memory leakage (about 1000 bytes per frame) here, please post report to mrestore or other thread.
salehin
7th September 2007, 00:33
Swap
edeintted = last.AssumeBFF().SeparateFields().SelectEven().EEDI2(field=-1)
TDeint(order=0,full=false,edeint=edeintted)
with
Yadif()
and it should work fine.
Tried but I'm getting two different errors:
1. When LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\yadif.dll") is not added (, which I suspect is not required), I get the following error:
Script Error: there is no function named "Yadif"
2. If I add the loadplugin(...) line, then I get an error with some junk symbols and it direct towards the loadplugin(...) line of the avs script
I dropped the yadif.dll file into my plugins folder under AviSynth directory. I am using MeGUI 0.2.6.1005 and AsiSynth 2.5.7. I suspect I am missing something. Can anyone please advise
Thanks :)
Atak_Snajpera
7th September 2007, 00:48
LoadCPlugin() not LoadPlugin()!
salehin
7th September 2007, 11:16
LoadCPlugin() not LoadPlugin()!
Thanks a lot, Atak_Snajpera. It's working now :)
zdark
20th September 2007, 06:23
Thanks for plug, I solved my problem with enterlaced!!!
DVD - Show Yanni 2006 :P
BeNooL
22nd September 2007, 14:43
anyone wanna port this to ffdshow ?
scharfis_brain
22nd September 2007, 16:57
no need to!
just use the avisynth section of ffdshow!
Fizick
22nd September 2007, 19:41
BeNooL,
I do not know anybody working on the porting, so you may do it. ;)
Delerue
23rd September 2007, 19:48
no need to!
just use the avisynth section of ffdshow!
Yeah! I confirm this. Works perfectly.
bauerhorscht
18th December 2007, 23:24
Hi!
I want to use Yadif with FFDShow and libmpeg2 for watching live satellite TV and recorded mpeg2 stuff also.
Using the following three lines I get a very nice picture:
LoadCPlugin("C:\Program Files\AviSynth 2.5\plugins\yadif.dll")
AssumeTFF()
Yadif (mode=1,order=-1)
BUT after a while or particularly after entering and leaving the OSD of DVBViewer (my TV app), I MAY get a scrumbled picture, i.e. all movements start to jitter terribly combined with horizontal und vertical tearing. To stop this I need to switch to the next channel and then back.
Is there a mistake in my script?
Thanks a lot!
Bauerhorscht
Fizick
19th December 2007, 20:13
Your script is correct.
But error may be related not to yadif.
Please do same test with some other deinterlacer, for example TomsMoComp
bauerhorscht
20th December 2007, 01:39
You're right. It's the same with other deinterlacers. I tried Dscaler's Greedy 2 Frame and after half an hour jittering started.
Any idea what to do?
scharfis_brain
20th December 2007, 01:42
replace assumetff() with assumebff()
IanB
20th December 2007, 02:29
I take this is not regular Avisynth. FFmpeg internal scripting ?? or ...
You are probably running close to the wind CPU wise, and when you fall behind you overrun the video capture buffers and things fall apart from there.
Fizick
20th December 2007, 06:38
If it is not related to Yadif and Avisynth, probably it is problem with ffdshow or DVBViewer or your channel. Try ask in other (correspondent) thread
bauerhorscht
20th December 2007, 23:14
IanB, yes it's FFDShow internal scipting. Anyhow, you made me try the MT plugin (I got an X2 4000+) and I haven't had jittering now for a while.
But it seems, the picture is split horizontally (for being processed by the two threads?) and it isn't reassembled properly. Not very bad, but sometimes one can see the split.
It's the following script I use now:
LoadCPlugin("C:\Program Files\AviSynth 2.5\plugins\yadif.dll")
AssumeTFF()
MT("Yadif (mode=1,order=-1)",2)
And jittering still may start after leavin the OSD AND as I haven't mentioned, after switching from fullscreen to window mode and vice versa.
@scharfis: assumebff() causes immediate jittering.
@Fizick: It obviously occurs on every channel. Still gotta try without DVBViewer.
IanB
21st December 2007, 01:32
... it isn't reassembled properly. Not very bad, but sometimes one can see the splitTry either overlap=2 or splitvertical=true, either should fix the problem, one may be faster than the other.
overlap int = 0
- number of pixel to add at the top and bottom border or left and right border. Increase this if you see artifacts where the frame is split.
splitvertical bool = false
- if true the frame are cut vertical(and the filter is allowed to change the height) else it is cut horizontal(and the filter is allowed to change the width).
Delerue
21st December 2007, 07:11
Try either overlap=2 or splitvertical=true, either should fix the problem, one may be faster than the other.
Weird... The script that bauerhorscht uses doesn't seem to fuction always here. There's a intermittent bug that makes the usage difficult. The error reports that 'AssumeTFF' has invalid arguments. I pasted exactly this on the FFDShow Avisynth tab:
LoadCplugin("C:\Arquivos de programas\AviSynth\plugins\yadif.dll")
AssumeTFF()
MT("Yadif (mode=1,order=-1)",2)
Also, I don't get the idea of the 'overlap=2' and 'splitvertical bool = false' commands. Where do I have to put it exactly?
I'm using FFDShow 1703 from _xxl, MPC last build from clsid with MT 0.7, and I can make Mvtools works in dual-thread, for example.
Thanks
talen9
21st December 2007, 11:04
You could try to use a different version of FFDshow ... where "different" could mean even a less recent (and, maybe, more stable) version , if you're using any "tryout" or beta version.
IanB
21st December 2007, 11:34
Also, I don't get the idea of the 'overlap=2' and 'splitvertical bool = false' commands. Where do I have to put it exactly?There is documentation that comes with the MT pluggin, you could always try reading it. RTFM!
Each thread process half plus 2 extra lines to avoid boundary problems with some filters....
MT("Yadif (mode=1,order=-1)",2, overlap=2)
Split the work into left and right halves instead of top and bottom halves....
MT("Yadif (mode=1,order=-1)",2, splitvertical=false)
Delerue
21st December 2007, 13:46
You could try to use a different version of FFDshow ... where "different" could mean even a less recent (and, maybe, more stable) version , if you're using any "tryout" or beta version.
I already tried three different versions. :(
There is documentation that comes with the MT pluggin, you could always try reading it. RTFM!
Well, I read the first page of the MT thread, and I don't get it. You know, I always think that we need examples of all the commands. Also, I already used the commands you told me right now, but I got script errors. That's why I'm asking you. Thanks a lot, man. I'll check deeper.
vcmohan
22nd December 2007, 04:24
unable to access the plugin for download
Delerue
22nd December 2007, 05:59
unable to access the plugin for download
No problem for me here: http://avisynth.org.ru/yadif/yadif09.zip
vcmohan
23rd December 2007, 03:10
Yes. Now I got it.
Vesi
2nd January 2008, 18:21
DGindex reported my source field order as top and frame rate as 23,976fps
http://maxupload.com/img/5960E6BF.png
Now when i am doing analyse with MeGUI, MeGUI suggest this type of work for me with TIVTC
http://maxupload.com/img/3FE5F257.png
Now I want to use yadif in my rip. Should I cahnge the source type to Interlaced and Deinterlacer yadif? And field order to Top field first?
as I am new to this filter i will do reading on this for sure, and I have bit problems with deinterlacing part, so I need help here. Thanks in advance
Delerue
3rd January 2008, 06:04
IanB, I finally discovered the problem with Yadif + MT. If you use it with FFDShow Avisynth tab, you have to check the 'Add ffdshow video source' option. But, this option crashes MPC if you use a MVTools script. Do you know how to use MVTools scripts without the 'source=ffdshow_source()' line? Or maybe a way to use Yadif without the 'Add ffdshow video source' option; I tried 'MT("Yadif (source,mode=1,order=-1)",2)' without sucess.
I also found that if you use a MVTools script with Yadif at the same time you can uncheck the 'Add ffdshow video source' option, and everything works perfectly (well, besides the CPU death, hehehe). Example:
SetMtmode(1,5)
source=ffdshow_source()
SetMTMode(2)
LoadPlugin("C:\arquivos de programas\avisynth\plugins\mvtools.dll")
backward_vec = source.MVAnalyse(blksize=16, isb = true, pel=2, search=2, idx=1)
forward_vec = source.MVAnalyse(blksize=16, isb = false, pel=2, search=2, idx=1)
source.MVFlowFps(backward_vec, forward_vec, num=2*FramerateNumerator(source), \
den=FramerateDenominator(source), mask=1, idx=1)
distributor()
LoadCplugin("C:\Arquivos de programas\AviSynth\plugins\yadif.dll")
AssumeTFF()
MT("Yadif (mode=1,order=-1)",2)
Thanks
;)
Didée
3rd January 2008, 11:50
@ Delerue: Perhaps try without the distributor() call? >Hint< (http://forum.doom9.org/showthread.php?p=1080974#post1080974)
Delerue
3rd January 2008, 18:32
Didée, I already tried only this, but without sucess:
LoadCplugin("C:\Arquivos de programas\AviSynth\plugins\yadif.dll")
AssumeTFF()
MT("Yadif (mode=1,order=-1)",2)
The 'distributor()' call is there (in the other script) in order to make the MVTools script works.
Thanks anyway.
drunken_clam
22nd July 2008, 09:27
Hi, i'm using Yadif through mplayer/mencoder, i know this thread is avisynth related but maybe the problem also appears there or somebody has an idea what the problem is:
Here is the link to my post in the "PC Hard & Software" section:
http://forum.doom9.org/showthread.php?t=139703
leeperry
30th May 2009, 13:45
hi there,
atm I'm using Yadif(multithreaded on 4 threads) in the Avisynth filter of ffdshow to get double framerate on progressive content(23.976fps@48Hz mostly).
it works amazingly well! talk about perfect Trimension
except that it was really meant for deinterlacing in the first place, so credits look interlaced and blinking...
is there any way you could offer a plain and simple framerate doubler mode? so it doesn't do any deinterlace at all...just interpolate frames(which it does amazingly well :eek: )
thanks!
scharfis_brain
30th May 2009, 15:09
don't cross-post, please:
http://forum.doom9.org/showthread.php?t=147421&
Delerue
30th May 2009, 15:09
hi there,
atm I'm using Yadif(multithreaded on 4 threads) in the Avisynth filter of ffdshow to get double framerate on progressive content(23.976fps@48Hz mostly).
it works amazingly well! talk about perfect Trimension
except that it was really meant for deinterlacing in the first place, so credits look interlaced and blinking...
is there any way you could offer a plain and simple framerate doubler mode? so it doesn't do any deinterlace at all...just interpolate frames(which it does amazingly well :eek: )
thanks!
Try MVTools (http://avisynth.org.ru/mvtools/mvtools2.html) with the following script:
setMTMode(2,6)
source=ffdshow_source()
LoadPlugin("C:\MVTOOLS_PLUGIN_PATH\mvtools2.dll")
super = source.MSuper(pel=1)
backward_vec = MAnalyse(super, blksize=8, overlap=0, dct=1, isb = true, search=2, searchparam=2)
forward_vec = MAnalyse(super, blksize=8, overlap=0, dct=1, isb = false, search=2, searchparam=2)
source.MFlowFps(super, backward_vec, ThSCD1=350, blend=false, forward_vec, num=2*FramerateNumerator(source), \
den=FramerateDenominator(source))
distributor()
You'll have to use it in the FFDShow AviSynth tab and with AviSynth MT (http://forum.doom9.org/showthread.php?t=144852) (in order to have multi-threading). Also, you can play with the number '6' (number of threads) in the first line; here with a dual-core CPU, '3' is the magic number, although you may think that is '2'. Ah! And remember to always have a Buffer after (in the FFDShow) with values at least equal to the number of threads.
Good luck!
leeperry
30th May 2009, 17:17
don't cross-post, please:
http://forum.doom9.org/showthread.php?t=147421&
I didn't crosspost, I'm asking the plugin coder if he could modify it so it'd only do progressive double framerate w/o any combing artifacts.
Try MVTools (http://avisynth.org.ru/mvtools/mvtools2.html) with the following script:
thanks, I'll look into it! hopefully it won't need to me to specify the framerate...I really need something fully automatic that'll do 2X whatever i's 23.976/24/25/29.97/30 :)
scharfis_brain
30th May 2009, 17:25
I really need something fully automatic that'll do 2X whatever i's 23.976/24/25/29.97/30
I think that is shown in the documentation of mvtools.
you just have to double the framerate numerator!
I'm asking the plugin coder if he could modify it so it'd only do progressive double framerate w/o any combing artifacts.
That won't be possible, cause it is not meant to do it. It is a deinterlacer. any deinterlacer will exhibit artifact.
You could even use Selectevery(1,0,0) to double the framerate with the same effect on the motion like yadif.
leeperry
30th May 2009, 19:46
You could even use Selectevery(1,0,0) to double the framerate with the same effect on the motion like yadif.
I just tried, it's not smooth at all..it's constantly hiccuping.
YADIF is actually fast to do double framerate and very smooth, too bad combing/jaggies occur.
I've found out through google that Didée did a 2X framerate script, might give a go at that...I'm quite a fan of his scripts ^^
but I'm afraid all these script would be slower than YADIF :o
scharfis_brain
31st May 2009, 01:52
didée's script most probably is a more complex version of the scripts suggested to you before.
Delerue
31st May 2009, 02:13
thanks, I'll look into it! hopefully it won't need to me to specify the framerate...I really need something fully automatic that'll do 2X whatever i's 23.976/24/25/29.97/30 :)
That's what this line does:
num=2*FramerateNumerator(source)
;)
But bear in mind that this script is REALLY heavy. You won't be able to use it with HD videos, I guarantee. Yadif only recreates half of a frame, but MFlowFPS recreates a new whole frame.
vampiredom
14th June 2009, 10:18
Hi --
I was reading this thread and now I'm a bit confused: Does Yadif() have any known issues when running with SetMTMode(2)?
Sorry if this has been answered already, but I was having trouble finding this exact information through searches.
Thanks.
Fizick
12th August 2009, 20:58
Version 1.1 (06.08.2009)
Added faster SSE2 (and some SSSE3) custom optimization by H.Yamagata from ffdshow-tryout. Compiled with GCC versions above 4.1.
Added a little faster MMX conversion for YUY2 format.
Added planar hacked YUY2 color format (compatible with SSETools by Kassandro).
Version 1.2 (07.08.2009)
A little faster SSEMMX conversion for YUY2 format.
Version 1.3 (12.08.2009)
Added "opt" parameter for manual selecting of CPU optimization.
Fixed bug in SSE2/SSE3 code (from ffdshow), now results should be same as C/iSSE.
Version 1.4 (13.08.2009)
Enabled SSEMMX YUY2 conversion for forced SSE2/SSSE3 opt.
Version 1.5 (16.08.2009)
Fixed detection of SSSE3 (thanks to Shingo Harada for bug report for Athlon).
Please test and post
XhmikosR
12th August 2009, 21:01
Hi. Where can I download the new version? Your site still has v0.9.
Thank you.:)
EDIT:
It seems that by manually changing the link I can download v1.3 (http://avisynth.org.ru/yadif/yadif13.zip).
canTsTop
25th August 2009, 13:06
for my cpu AMD Athlon II X2 250 http://www.cpu-world.com/CPUs/K10/AMD-Athlon%20II%20X2%20250%20-%20ADX250OCK23GQ%20%28ADX250OCGQBOX%29.html
version 0.9 is faster then 1.5
0.9 - 27.41 fps
1.5 - 22.71 fps
avs script:
dss2("atk_sample_0.ts")
Trim(26, 899)
Crop(16, 16, -16, -16)
Yadif(order=1)
BilinearResize(640,480)
Fizick
25th August 2009, 21:36
Please report your results with various "opt" parameter (0,1,2,3).
canTsTop
25th August 2009, 22:13
opt=0 - 23.09 fps
opt=1 - 22.80 fps
opt=2 - 23.12 fps
opt=3 - 23.01 fps
version 0.9 - 27.70 fps
Fizick
25th August 2009, 23:18
try v1.6 (blind fix, I do not have such CPU around)
canTsTop
26th August 2009, 11:12
It works, with version 1.6 i get 28.53 fps
Thank You
burfadel
26th August 2009, 11:53
I keep getting directed to this page:
http://ifastnet.com/notify/2.php
When trying to get to http://avisynth.org.ru
Is it just temporarily down? I'd love to try out v1.6!
AVIL
26th August 2009, 15:26
Hi,
I've download the plugin without problems. Could be malware.
burfadel
26th August 2009, 17:03
I just tried again and it worked! I think the site might have been down for a short while thats all :) I was probably a little impatient to try it since I was about to start an encode! Its great to see Fizick ported those changes over, I was waiting for someone to do that ever since the changes showed in the ffdshow changelog. An earlier YADIF discussion in another thread about this didn't lead anyway (well I guess it possibly did...), but I didn't know anything had been done about it as this thread got lost in amongst the new post threads!
@Fizick :)
Just wondering whether you could update your first post and the thread title? Thanks!
If you change it to reflect the new version number and SSE2/SSSE3 inclusion etc it should grab a few more peoples attention!
Thanks for the updates, its much appreciated by everyone! (and more once they realise they exist ;))
Fizick
26th August 2009, 18:01
i do not see any reason to change first post or title. history must be preserved.
But I updated my site news.
SSE2 gain is no so big.
SSSE3 gain is not visible (only one instruction is used really).
It is possible to port my SSE2 bug fix back to ffdshow, but seems developers waiting for H.Yamagata :)
http://forum.doom9.org/showthread.php?p=1314061#post1314061
and maybe it is a time to implement some Tritical's suggestions to improve yadif quality without speed decreasing.
Mr VacBob
30th August 2009, 07:21
Rather than ffdshow, it would be nice to port them back to mplayer and then to ffdshow from there. That way the original filter has all the optimizations and a Michael review.
Fizick
30th August 2009, 19:10
Mr VacBob,
if you need it, try contact Michael. But he was not very excited by first (no my) suggestion ;)
http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2008-November/058981.html
Atak_Snajpera
30th August 2009, 20:24
Yadif in ffdshow is multithreaded but avisynth plugin is still single threaded. Any reason why?
Fizick
30th August 2009, 21:41
several reasons
Atak_Snajpera
30th August 2009, 22:04
Too bad. Yadif MT would a major leap in performance. :(
Fizick
31st August 2009, 00:21
it should perfectly work with MT filter with small overlap.
So why reinvent the wheel
burfadel
31st August 2009, 03:31
Just for info, YADIF works perfectly fine on mine with SetMTmode (1,4) (4 = quad core), with SetMTmode (1,x) being the fastest MT mode (where x should be equal to system cores/parallel threads). If you have to use a SetMTmode of 3 or higher then its not really beneficial, unless its:
Source...()
SetMTMode(1,4)
Filter...()
Filter2...()
SetMTMode(3,4)
Filter3...()
SetMTMode(1,4)
Filter4...()
Where Filter3...() requires SetMTmode(3) for stability.
BigDid
31st August 2009, 20:20
several reasons
it should perfectly work with MT filter with small overlap...
Hi,
I have tried MT() with overlap of 4 or 8: MT("""yadif(movie,1)""",2,8); not working,
error message being something like "Invalid arguments to function "MT"..."
I am no avisynth expert so I may be missing something, but if confirmed, I would appreciate to have the possibility to use MT().
:thanks:
Did
Adub
31st August 2009, 20:53
Have out tried using named parameters? Like MT("""blah""",overlap=8)?
buzzqw
31st August 2009, 21:07
any possibility to make a yadif a standard plugin and not a loadCplugin ?
(yes, i know, silly request)
BHH
Gavino
31st August 2009, 21:20
I have tried MT() with overlap of 4 or 8: MT("""yadif(movie,1)""",2,8); not working,
error message being something like "invalid arguments to MT..."
The filter string passed to MT should not include a clip.
Do it this way:
MT(movie, """yadif(1)""",2,8)
or
movie.MT("""yadif(1)""",2,8)
Fizick
31st August 2009, 21:57
Yes, such possibility exists. You should port GCC inline ASM macros to inline VC, MASM or NASM, and make appropriate interface changes.
BigDid
31st August 2009, 22:54
The filter string passed to MT should not include a clip.
Do it this way:
MT(movie, """yadif(1)""",2,8)
or
movie.MT("""yadif(1)""",2,8)
Hi,
Both ways are working. Also tried with overlap=4, seems/* to be working. Thanks.
* not at home, so no good source or PC to test...
Did
vlada
19th September 2009, 00:42
Hi, I tried to use Yadif. But in VirtualDub I only get black video and this message in status bar:
Avisynth read error: CAVIStreamSynth: System exception - Illegal instruction at 0x1bf277d
If I remove Yadif from the script, everything works fine. Do you have any idea what might be wrong?
Fizick
19th September 2009, 06:31
http://avisynth.org/mediawiki/Troubleshooting#Reporting_bugs_.2F_Asking_for_help
~Revolution~
21st September 2009, 05:01
I have this material that is semi-interlaced 25fps PAL progressive material. Do I just do Yadif(mode=1,order=1).ChangeFPS(25) with multiple trim functions in the parts that there is interlacing present?Also because I saw no field-blending in the source I didn't use srestore() instead of ChangeFPS(25).
Gavino
21st September 2009, 09:27
Do I just do Yadif(mode=1,order=1).ChangeFPS(25) with multiple trim functions in the parts that there is interlacing present?
Use Yadif(mode=0, order=1) without the need for ChangeFPS.
If you have a lot of sections, you might find it easier to use ApplyRange (http://avisynth.org/mediawiki/ApplyRange) or ReplaceFramesSimple (http://avisynth.org/stickboy/RemapFrames.zip) instead of multiple trims.
~Revolution~
22nd September 2009, 00:46
Use Yadif(mode=0, order=1) without the need for ChangeFPS.
If you have a lot of sections, you might find it easier to use ApplyRange (http://avisynth.org/mediawiki/ApplyRange) or ReplaceFramesSimple (http://avisynth.org/stickboy/RemapFrames.zip) instead of multiple trims.
I read the readme for ReplaceFramesSimple but I don't quite understand how to use it :confused: I'm still sort of a n00b but not a total n00b :). Thanks for your help :)
~Revolution~
22nd September 2009, 18:08
Plz help ^ :thanks:
Gavino
22nd September 2009, 19:49
You should
a) be more patient
b) try using "Search", I recall a number of examples posted fairly recently.
Anyway, the idea is you apply Yadif once to the whole clip and then select from that the frames you need to replace in the original. Example:
...
deint = Yadif(mode=0, order=1)
ReplaceFramesSimple(deint, mappings="[100 200] [400 600]")
would replace frames 100-200 and 400-600 with the corresponding deinterlaced frames.
~Revolution~
23rd September 2009, 17:46
I'm sorry fo being a bit impatient :o . On the other hand your example makes perfect sense. :thanks: :)
vlada
23rd September 2009, 18:46
Hi, I tried to use Yadif. But in VirtualDub I only get black video and this message in status bar:
Avisynth read error: CAVIStreamSynth: System exception - Illegal instruction at 0x1bf277d
If I remove Yadif from the script, everything works fine. Do you have any idea what might be wrong?
Here are some more details: Avisynth 2.58, Yadif 1.6, any resolution, YV12 colorspace, VD 1.8.6, but I get the same error in MPC-HC too.
A sample script that causes the error:
LoadCPlugin("E:\yadif\yadif.dll")
Version()
ConvertToYV12()
Yadif()
The address at the end of the error message (0x1bf277d) is changing.
Fizick
24th September 2009, 19:04
vlada, what is your CPU?
Try different "opt" options.
vlada
24th September 2009, 22:15
My CPU is a P4. I'll try it tomorrow, thanks for the advice.
vlada
7th October 2009, 11:50
My CPU is a P4. I'll try it tomorrow, thanks for the advice.
Yes, changing opt to 0, 1 or 2 solves the problem. It seems that the auto detection of SSE instructions availability is incorrect. Is this a trivial bug or would it be difficult to fix it?
I need the filter to work on as many computer types as possible with the same script. Would using "opt = 0" be a good temporal solution or would it be to slow? What about forgetting about anything below P4 and using "opt = 2"? Would it be a better choice?
Fizick
7th October 2009, 17:26
vlada, the bug with autodetecting of SSSE3 must be fixed.
Please provide your result (first screen screen) of CPUZ http://www.cpuid.com/cpuz.php
Can anybody confirm P4 bug?
tritical
7th October 2009, 19:05
Fizick, do you use env->GetCPUFlags() function to detect SSSE3? If so, there is a bug in avisynth 2.5.8 (and maybe earlier 2.5.x releases, I don't know off hand when ssse3 check was added) in detection of SSSE3/SSE4.1/SSE4.2. The bit checking from return of cpuid is off by one bit. It will sometimes result in false positives. IanB fixed it in late June, but no official 2.5 branch releases have been made incorporating it. The latest 2.6 branch release should be ok. I ended up adding code to my filter to do the check so that it would work with older versions.
Fizick
7th October 2009, 21:18
I know about error in env->GetCPUFlags(), and I use my home-made addition to it in Yadif :)
But probably it has own bug :(
vlada, try new v1.7
vlada
8th October 2009, 16:29
1.7 works for me. Thanks a lot for the quick fix, Fizick.
zyrill
22nd November 2009, 23:17
as soon as I load yadif, either explicitly with LoadCplugin("yadif.dll") or implicitly with Yadif() i get the attached output.
btw: I run Win7pro 64bit - maybe that's the problem? The 64bit? Avisynth version is 2.58 and yadif version is 1.7.
oddball
16th July 2010, 05:58
I am trying to use Yadif in realtime playback using ffdshow and notice that with both the internal Yadif and external plugin using the fastest mode (I set it to yadif()) I get bits of detail dropped out of things like fine lines. It makes fine lines look like they have been drawn with a pencil rather than a pen if you know what I mean?
I tried a couple of different modes but they made things look uglier or were just too slow for my E6600 OC'd to keep up with on a 1280x720 upscale setting using ffdshow resizer. At present I have not really found a satisfactory way to upscale and deinterlace DVD's in realtime. The closest I have found is the internal median deinterlace as it seems to interfere the least with progressive frames.
I guess I need a more powerful CPU/GPU combo.
burfadel
7th December 2010, 16:58
I see SSE2 and SSSE3 optimisation updates have just been committed in ffmpeg, any chance of them being utilised in the avisynth version?
http://git.ffmpeg.org/?p=ffmpeg;a=commitdiff;h=9a4c5a77ee7455da186b5a8e0fcffe120cf213d0
I don't know what relevance these other changes have:
http://git.ffmpeg.org/?p=ffmpeg;a=commitdiff;h=4fbe76287af32212aa17209c9c459743fac4ccf5
http://git.ffmpeg.org/?p=ffmpeg;a=commitdiff;h=9adb3db27d6ec3245ae651859fc972ae6478b5e0
http://git.ffmpeg.org/?p=ffmpeg;a=commitdiff;h=ee61e6e26d502e053e000679a1661be0fd43d958
Of course, the avisynth version of FFdshow revision 2352 YADIF would be nice too (multithreading) :)
I think a multithreaded YADIF with the updated SSE2/SSSE3 optimsations etc would be nice when working with 1080i video!
IanB
7th December 2010, 22:01
as soon as I load yadif, either explicitly with LoadCplugin("yadif.dll") or implicitly with Yadif() i get the attached output.
btw: I run Win7pro 64bit - maybe that's the problem? The 64bit? Avisynth version is 2.58 and yadif version is 1.7.
The output display has the rows skewed. This is a bug in the player you are using, where the width is incorrectly assumed to be some multiple of some power of 2, usually 16.
Unfortunately the image you posted has been cropped and resized after skewing, which makes reversing the skew to see the error text very difficult.
Anyway part of the error text is :-
"Script error: there is no function named Yadif"
"avs, line 3)"
the rest is to badly scrambled to read.
Use VirtualDub when debugging script errors, it correctly works with all width output and has an Avisynth Error handler that will display the error text in a message box.
Fizick
9th December 2010, 21:35
burfadel, ffmeg SSE2 and SSSE3 optimisation is same as already used in ffdshow and (besides multithreading) in Avisynth yadif.
I am not sure, that ffmeg yadif has same bug (regression) as older ffdshow
http://sourceforge.net/tracker/?func=detail&aid=2836414&group_id=173941&atid=867362
what is the macro for xmm in ffmpeg?
PSHUF(MM"3", MM"2")
burfadel
10th December 2010, 03:10
I did see it was very similar, but not quite exact, which is why I thought there were some refinements... maybe its just like you said, they used an older implementation, with the differences being the things that were refined and used in FFDshow
NoX1911
18th May 2011, 20:14
Edit: Resolved. Read my next post.
Hallo,
the picture shows two consecutive frames created with yadif 1.7, avisynth 2.6 (25Jan2011). The chrominance channel is off by one frame in normal modes and alternates (chrom +1, -1) in double-frame modes. Depending on TFF/BFF the chrominance channel is off by -1 or +1 but never +0.
Source video is HuffYUV/YV12 (FFmpeg variant/FFDShow).
Any ideas what's wrong?
LoadCPlugin("yadif.dll")
AviSource("capture.avi")
AssumeTFF
Yadif(mode=1, order=1)
http://www.abload.de/thumb/untitled-1mqlh.jpg (http://www.abload.de/img/untitled-1mqlh.jpg)
Didée
18th May 2011, 20:44
The capture is 704x480? But you seem to be a PAL user, hence I would suppose the)capture to be 7xx*576. See those combing artifacts all over the place? Those should not be there in the first place.
So, most probably your raw capture is already faulty. Try replacing "Yadif(..)" with a simple "bob()". If the result shows a problem, then the capture is bad.
Please describe your setup. How did you capture the video, and what video standard is actually used by the Xbox?
NoX1911
18th May 2011, 21:00
Looks like its not Yadif related at all, other deinterlacers create the same temporal chrominance offset as well. Its something else. Never mind, sorry.
The video is PAL60. Everything's fine there (720x480+PAL chrom).
Edit: It was a color conversion fault. Adding pixel_type="YUY2" (for AviSource) fixed the problem.
cweb
24th August 2011, 10:51
Hi, I tried to use Yadif. But in VirtualDub I only get black video and this message in status bar:
Avisynth read error: CAVIStreamSynth: System exception - Illegal instruction at 0x1bf277d
If I remove Yadif from the script, everything works fine. Do you have any idea what might be wrong?
Experimenting a bit, I found that specifying the 64 bit yadif's path
Loadcplugin("c:\apps\avisynth2\plugins 64\yadif.dll")
meant that it loads successfully.
You have to place the path for your 64 bit plugins of course.
cweb
27th April 2012, 12:16
I noticed that Yadif won't load using the latest beta 2.6 avisynth (32 bit). I was wondering if it's something others have experienced...
NoX1911
6th September 2012, 04:58
You have to load it explicitly with 'Loadcplugin'. Works for me (32Bit, Avisynth v2.60 25.May.2011).
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.