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 18th September 2007, 09:42   #41  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
In terms of the basic operation, EEDI2 and NNEDI do the same thing. They just get there in different ways... EEDI2 copies every line of the input frame to every other line of the output frame and then interpolates the missing pixels. NNEDI just starts by throwing out every other line of the input frame and interpolates the missing pixels.

Algorithmically, NNEDI is a computational intelligence approach using artifical neural networks and clustering. Whereas EEDI2 uses a vector matching method to create a direction map, does some processing of the direction map, and then does linear interpolation along the determined directions. The main advantage of NNEDI is that it isn't limited to outputting the average of two pixels (one from the line above and one from the line below) like EEDI2 is. This allows it to handle conditions that EEDI2's interpolation can't, and is also the reason it can eliminate what Revgen called "Blur Bubbles," which EEDI2 produces. Atm, there are still some things EEDI2 handles better, but I'm confident NNEDI can best it on those things as well. There is still a lot of experimenting to be done as far as NNEDI is concerned.

Quote:
Should I stop using EEDI2 and start using pointresize.NNEDI?
You should use whichever one looks best to you .
tritical is offline   Reply With Quote
Old 18th September 2007, 22:59   #42  |  Link
Chainmax
Huh?
 
Chainmax's Avatar
 
Join Date: Sep 2003
Location: Uruguay
Posts: 3,103
tritical, I used EEDI2 mostly for antialiasing and picture improvement on blocky sources (reconnecting edges). How do you expect NNEDI to behave on such cases? Also, does pointresize have a final image quality advantage over other resizing methods when pairing it with NNEDI or is it just a processing speed choice?
__________________
Read Decomb's readmes and tutorials, the IVTC tutorial and the capture guide in order to learn about combing and how to deal with it.

Last edited by Chainmax; 18th September 2007 at 23:01.
Chainmax is offline   Reply With Quote
Old 19th September 2007, 09:58   #43  |  Link
yup
Registered User
 
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 854
Hi tritical!

Can I use this plugin for calculation pelclip for MVAnalyse(MVTools plugin)? Where need use src_left=0.25 and src_top=0.25, in first pointresize or second?
Advice right way.

With kind regards yup.
yup is offline   Reply With Quote
Old 19th September 2007, 23:28   #44  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
Quote:
Originally Posted by Chainmax
tritical, I used EEDI2 mostly for antialiasing and picture improvement on blocky sources (reconnecting edges). How do you expect NNEDI to behave on such cases? Also, does pointresize have a final image quality advantage over other resizing methods when pairing it with NNEDI or is it just a processing speed choice?
I would expect nnedi to work pretty much the same as EEDI2, but there is only one way to find out. Pointresize is the only resizing method that will work because the original pixels need to be kept intact. Basically, you just need a method that will copy the existing rows of pixels to every other line (even lines if field=1 or odd lines if field=0) of the height doubled input into nnedi. The point resize method copies to both, so it works for both field=0/1.

Quote:
Originally Posted by yup
Can I use this plugin for calculation pelclip for MVAnalyse(MVTools plugin)? Where need use src_left=0.25 and src_top=0.25, in first pointresize or second?
If I understand the documentation correctly, mvtools actually wants a shifted clip (left/up). So you can use the code from the first post, but with field set so that the image always ends up shifted left and up:

Code:
function nnediresize2x(clip c, bool pY, bool pU, bool pV)
{
	v = c.nnedi(dh=true,Y=pY,U=pU,V=pV,field=1).turnleft()
	v = v.nnedi(dh=true,Y=pY,U=pU,V=pV,field=0).turnright()
	return v
}

function nnediresize_YUY2(clip c)
{
	cy = c
	cu = c.utoy()
	cv = c.vtoy()
	cy = nnediresize2x(cy,true,false,false)
	cu = nnediresize2x(cu,true,false,false)
	cv = nnediresize2x(cv,true,false,false)
	return ytouv(cu,cv,cy)
}

function nnediresize_YV12(clip c)
{
	return nnediresize2x(c,true,true,true)
}
Call either nnediresize_YUY2 or nnediresize_YV12 depending on the colorspace, or you could make a wrapper function which checks the colorspace and chooses the right one automatically.

Last edited by tritical; 21st September 2007 at 00:27.
tritical is offline   Reply With Quote
Old 20th September 2007, 06:21   #45  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
Hint: To double the height fast
Code:
Interleave(last,last).AssumeFieldBased().Weave()
IanB is offline   Reply With Quote
Old 20th September 2007, 06:51   #46  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
That's actually faster than pointresize? o.O?

Fastest of all would seem to be the way eedi2 does it internally, which is just copying every line of source into every other line of output. (With suitable simd, which eedi2 doesn't have.) I'm not actually much concerned about speed, as the overhead of making and keeping a copy of something in cache that's just going to be thrown right away. (I use it for biiiiiiiiig stuff.) I guess MakeWriteable would prevent that.
foxyshadis is offline   Reply With Quote
Old 20th September 2007, 07:35   #47  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
Yes internally doing a BitBlt(..., dest_pitch*2, ....) would be twice as fast as the weave I suggested, which does the above blit twice.

The resizer core does struggle to do a point-resize efficently, it stupidly goes through the full motion, multiplying every pixel by 1 in a loop of 1 cycle.
IanB is offline   Reply With Quote
Old 20th September 2007, 07:45   #48  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
I could add the option to make nnedi do it internally, which would be the fastest. However, it really wont make a noticeable difference since nnedi runs more than 100 times slower than pointresize. On my laptop pointresize 720x480 -> 720x960 runs ~260-280 fps. interleave()/weave() 720x480 -> 720x960 runs ~500-600 fps. nnedi on 720x960 input runs ~1.25 fps. Even on my quadcore the ratio is still > 100 times slower (6 fps vs 750 for point and 1100 for interleave/weave).
tritical is offline   Reply With Quote
Old 21st September 2007, 00:30   #49  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
nnedi v1.3. foxyshadis's argument about the cache and ram usage in general convinced me to add an option to internally do the needed copying for doubling the height... so no need to call pointresize anymore. I was also using a separate filter to pad the frames prior to nnedi, and then invoking crop afterwards. That has been done away with as well. I also discovered a bug in the yuy2 padding code, which resulted in occasionally incorrect (+-3) interpolated chroma values at the left and right hand sides of the image.

I updated the code in the first post to use the new 'dh' option instead of pointresize.
tritical is offline   Reply With Quote
Old 21st September 2007, 15:12   #50  |  Link
Terranigma
*Space Reserved*
 
Terranigma's Avatar
 
Join Date: May 2006
Posts: 953
Thanks a lot tritical for the speedy changes
Terranigma is offline   Reply With Quote
Old 21st September 2007, 22:33   #51  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
Code:
field -
      Possible settings:
...
         -1 = same rate, uses avisynth's internal parity value
...
      Default:  -1  (int)
Which field is kept odd or even?

Code:
dh -
...
      Default:  false  (int)  <-  (bool)
Wouldn't it have been simpler to fold double height mode into extra settings for field? And maybe name field as mode?

Code:
Y, U, V -
      These control whether or not the specified plane is processed.  Set to true to
      process or false to ignore.
What state are the unprocessed planes left? Copied, zerod, trashed, ...?


Also are you going to discuss the nitty gritty of the algorithm or are you constrained because you are doing your thesis?
IanB is offline   Reply With Quote
Old 22nd September 2007, 02:29   #52  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
Quote:
Originally Posted by IanB
Which field is kept odd or even?
If field is set to -1 then nnedi calls child->GetParity(0) during initilization. If it returns true then field is set to 1. If it returns false then field is set to 0. If field is set to -2 then the same thing happens, but instead of setting field to 1 or 0 it sets field to 3 or 2.

Quote:
Originally Posted by IanB
Wouldn't it have been simpler to fold double height mode into extra settings for field? And maybe name field as mode?
dh could have been rolled into 4 extra values for field, but I went with adding dh instead. field could be renamed mode... I named it field because eedi2 has the same parameter with the same values.

Quote:
Originally Posted by IanB
What state are the unprocessed planes left? Copied, zerod, trashed, ...?
Unprocessed planes are left trashed.

Quote:
Originally Posted by IanB
Also are you going to discuss the nitty gritty of the algorithm or are you constrained because you are doing your thesis?
I'm not going to discuss the full details just yet. I have talked to my advisor about using it for my thesis, and he said that it would be ok. So I will probably use it for that.

I'll try and update the readme tommorrow sometime... thanks for pointing out areas lacking complete descriptions.

Also, if anyone is willing to donate cpu time again, network training for version 2 has started. Same irc channel as before (#editrain on irc.freenode.net)... files are in same directory on my website as before. Based on previous experience, I would say an x2 or core 2 duo is probably the minimum processor to complete the optimization runs in a reasonable amount of time. I'm also looking into offloading some processing onto the gpu, which should speed things up a good bit.

Last edited by tritical; 22nd September 2007 at 02:31.
tritical is offline   Reply With Quote
Old 23rd September 2007, 13:47   #53  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
Results are very impressive. I had a look at some of the math you link to, and it seems like another case of "Math I'll never be able to understand", just like FFT math.

Anyway, this is very interesting. I'm thinking it could be very useful for a Bayer Grid de-mosaic, which has very similar problems compared to deinterlacing.

I hope the source will be available at some point. Keep up the good work!
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 26th September 2007, 21:00   #54  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
One (probably stupid) question:

When I want to use nnedi with TDeint or Yadifmod, do I have to use the same syntax as for EEDI2

Code:
AssumeTFF (or BFF)
interp = separatefields().selecteven().nnedi(field=1,dh=true)
yadifmod(edeint=interp)
or can I use

Code:
AssumeTFF (or BFF)
interp = nnedi()
yadifmod(edeint=interp)
I tried both, and the result (and the speed) looked pretty much the same to me.

And one small request:
While playing with different deinterlacers I found it very annoying to have two Yadif plugins with almost the same functionality, one does autoload, the other one doesn't. Is it possible to make one consolidated build of Yadif which has the "edeint" parameter, but which uses its own spatial interpolation when the edeint parameter is not specified (just like TDeint)?

Cheers
manolito
manolito is offline   Reply With Quote
Old 27th September 2007, 06:03   #55  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
separatefields().selecteven().nnedi(field=-1,dh=true)

and

nnedi()

are equivalent. The second should be faster, but the speed difference probably wouldn't be enough to notice. As far as adding internal interpolation to yadifmod, I personally think yadif's default interpolation is far too artifact prone. So I probably wouldn't add exactly the same method that Fizick's filter uses. At the very least it would include capping the prediction to the max/min +-2 of the vertical neighbors.

Last edited by tritical; 27th September 2007 at 21:50.
tritical is offline   Reply With Quote
Old 27th September 2007, 06:17   #56  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
Quote:
Originally Posted by sh0dan View Post
... I had a look at some of the math you link to, and it seems ...
I must have missed this, anyone got a post reference.

Quote:
I hope the source will be available at some point. Keep up the good work!
I second that emotion
IanB is offline   Reply With Quote
Old 27th September 2007, 08:00   #57  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
Quote:
Originally Posted by IanB View Post
I must have missed this, anyone got a post reference.
http://forum.doom9.org/showthread.ph...00#post1038500

You might also spend some time at wikipedia:

http://en.wikipedia.org/wiki/Artificial_neural_network
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 27th September 2007, 13:16   #58  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
Thx!

So if I guess correctly, you classify and examine a stack of images to build a tables of how "the world" works. To do the interpolation you assume the target image is a member of "the world" with every 2nd line missing. You then search your table for "a good/best match" and insert the missing lines based on that instance of experience. This should be extensible for general times N upsizing by assuming N-1 of N lines are missing and need insertion.

Also I suspect with a little lateral thinking, the tables of how "the world" works, could be adapted to analyze interlaced images to classify the area that are static (good experience match) from those that have motion (bad experience match).....
IanB is offline   Reply With Quote
Old 27th September 2007, 16:02   #59  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
@ tritical
Quote:
separatefields().selecteven().nnedi(field=-2,dh=true)

and

nnedi()

are equivalent.
field=-2? Typo? Nnedi won't let me do that, it insists on field being 0 or 1 if dh=true is used. Also would not make much sense IMO because I need a same rate nnedi clip.

Cheers
manolito

Last edited by manolito; 27th September 2007 at 18:03.
manolito is offline   Reply With Quote
Old 27th September 2007, 16:41   #60  |  Link
Terranigma
*Space Reserved*
 
Terranigma's Avatar
 
Join Date: May 2006
Posts: 953
Quote:
Originally Posted by manolito View Post
@ tritical

field=-2? Typo?
I believe so. I believe he meant -1, as it refers to the parity
Field=-2 should only be used in double-rate deinterlacing, like when using yadifmod with mode 1.
Terranigma is offline   Reply With Quote
Reply

Tags
deinterlace, nnedi

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 23:05.


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