Log in

View Full Version : Port of MPlayer Yadif deinterlace filter (C-Plugin)


Pages : 1 [2] 3 4

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 :)

psme
9th May 2007, 10:43
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

puddy
9th May 2007, 15:36
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.

Leak
9th May 2007, 16:01
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?)

puddy
9th May 2007, 16:07
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

Leak
9th May 2007, 17:07
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)

puddy
9th May 2007, 17:11
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