Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 3rd April 2007, 19:16   #1  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
Port of MPlayer Yadif deinterlace filter (C-Plugin)

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)?
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.

Last edited by Fizick; 5th April 2007 at 19:47.
Fizick is offline   Reply With Quote
Old 4th April 2007, 21:05   #2  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
I found some bug in v0.1 (parity-related).
Released new v0.2 today.
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 5th April 2007, 05:04   #3  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
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
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 5th April 2007, 13:56   #4  |  Link
Pookie
Registered User
 
Join Date: Apr 2005
Posts: 1,339
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
Pookie is offline   Reply With Quote
Old 5th April 2007, 19:58   #5  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
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)
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 6th April 2007, 03:18   #6  |  Link
akupenguin
x264 developer
 
akupenguin's Avatar
 
Join Date: Sep 2004
Posts: 2,392
Quote:
Originally Posted by Pookie View Post
Yadif(mode=0) = 29.97fps
Yadif(mode=1) = 29.97fps
Yes, it doubles the number of frames but forgets to set the framerate accordingly.
akupenguin is offline   Reply With Quote
Old 6th April 2007, 04:18   #7  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
Yes, I forget about it.
use assumefps
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 6th April 2007, 21:09   #8  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
Fixed bugs with bob-fps and finally with parity in v0.3
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 7th April 2007, 00:12   #9  |  Link
scharfis_brain
brainless
 
scharfis_brain's Avatar
 
Join Date: Mar 2003
Location: Germany
Posts: 3,653
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
__________________
Don't forget the 'c'!

Don't PM me for technical support, please.
scharfis_brain is offline   Reply With Quote
Old 7th April 2007, 01:57   #10  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
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'):
Code:
  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:

Code:
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;
   }
}
tritical is offline   Reply With Quote
Old 7th April 2007, 02:28   #11  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
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 :|
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 7th April 2007, 04:57   #12  |  Link
DSP8000
Doom9 Member
 
DSP8000's Avatar
 
Join Date: Sep 2003
Location: Australia
Posts: 210
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
DSP8000 is offline   Reply With Quote
Old 7th April 2007, 22:27   #13  |  Link
tateu
Registered User
 
Join Date: Jan 2002
Location: Los Angeles, CA USA
Posts: 132
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.
tateu is offline   Reply With Quote
Old 9th April 2007, 12:00   #14  |  Link
Terka
Registered User
 
Join Date: Jan 2005
Location: cz
Posts: 704
cant load
LoadPlugin("C:\Program Files\AviSynth\plugins\yadif.dll")
do i need some more dlls?
Terka is offline   Reply With Quote
Old 9th April 2007, 12:05   #15  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
Terka,
more reading of doc is required...
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 9th April 2007, 17:57   #16  |  Link
scharfis_brain
brainless
 
scharfis_brain's Avatar
 
Join Date: Mar 2003
Location: Germany
Posts: 3,653
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.
__________________
Don't forget the 'c'!

Don't PM me for technical support, please.
scharfis_brain is offline   Reply With Quote
Old 9th April 2007, 20:44   #17  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
scharfis_brain,
No.
Yadif is yadif. Let's not slowdown it.
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 9th April 2007, 22:53   #18  |  Link
scharfis_brain
brainless
 
scharfis_brain's Avatar
 
Join Date: Mar 2003
Location: Germany
Posts: 3,653
why slowdown?
if the external clip is not given it still will run the max. speed....
__________________
Don't forget the 'c'!

Don't PM me for technical support, please.
scharfis_brain is offline   Reply With Quote
Old 10th April 2007, 02:33   #19  |  Link
ChiDragon
Registered User
 
ChiDragon's Avatar
 
Join Date: Sep 2005
Location: Vancouver
Posts: 600
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...
ChiDragon is offline   Reply With Quote
Old 10th April 2007, 04:53   #20  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
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?
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:52.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.