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 27th September 2007, 22:09   #61  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
The -2 was indeed a typo, it should have been -1.

Quote:
Originally Posted by IanB
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.
Here is basically how it works. In the first stage a small ann takes in some surrounding pixels and predicts whether or not cubic interpolation will be close to the true pixel value (basically a two class classifier). If it thinks it is then cubic is used. Otherwise, the point is matched up to the closest of 64 cluster prototypes. The pixel is then fed to the ann for that cluster prototype (there is a separate ann for each cluster prototype), which predicts (outputs) the missing pixel value using surrounding pixels as input (more this time than for the first stage classification). In this way no single ann has to learn to approximate the entire input->output space mapping, only a small piece of it. CMAES is used to find the weights for these anns (instead of a more usual training method like gradient descent, lev-mar, etc...). In the second stage CMAES is minimizing squared error.
tritical is offline   Reply With Quote
Old 28th September 2007, 18:53   #62  |  Link
Mtz
Registered User
 
Mtz's Avatar
 
Join Date: Sep 2003
Location: On The Beach
Posts: 713
I made a small test on a DV source and I said: WOW!

Reasons:

Original:


Nnedi:



Original (the camera was moving left-right or right-left):


Nnedi:


Cedocida encode & Nnedi:



Original (the camera was moving left-right or right-left and up-and-down):


Nnedi:


Cedocida encode & Nnedi:


enjoy,
Mtz

Last edited by Mtz; 28th September 2007 at 23:26.
Mtz is offline   Reply With Quote
Old 28th September 2007, 20:56   #63  |  Link
Terranigma
*Space Reserved*
 
Terranigma's Avatar
 
Join Date: May 2006
Posts: 953
mtz, are those nnedi examples using just the nnedi filter, or as an external interpolator such as using nnedi with yadifmod?

Btw, those results are awesome!
Terranigma is offline   Reply With Quote
Old 28th September 2007, 23:23   #64  |  Link
Mtz
Registered User
 
Mtz's Avatar
 
Join Date: Sep 2003
Location: On The Beach
Posts: 713
I used:
AVISource("I:\MiniDV\My Video-04\InterlacedSonyDCRHC96__DV.avi")
AssumeBFF()
nnedi()

The sample is at the bottom of this page.

enjoy,
Mtz

Last edited by Mtz; 29th September 2007 at 00:04.
Mtz is offline   Reply With Quote
Old 4th October 2007, 19:19   #65  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,565
Quote:
Originally Posted by Revgen View Post
Okay I've now looked at MVBob and MCBob, and it appears that NNEDI makes a definite difference on edges. With EEDI2 the edges display something I call "blur bubbles" on straight lines. Replacing EEDI2 with NNEDI seems to greatly reduce if not eliminate these artifacts.
Would you mind posting the two functions, please?
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 4th October 2007, 20:06   #66  |  Link
Terranigma
*Space Reserved*
 
Terranigma's Avatar
 
Join Date: May 2006
Posts: 953
Quote:
Originally Posted by Boulder View Post
Would you mind posting the two functions, please?
You can grab both modded bobbers here.

Last edited by Terranigma; 6th October 2007 at 00:33. Reason: updated link
Terranigma is offline   Reply With Quote
Old 4th October 2007, 20:43   #67  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,565
Thanks
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 4th October 2007, 22:38   #68  |  Link
ficofico
Registered User
 
Join Date: Nov 2006
Posts: 146
Quote:
Originally Posted by Terranigma View Post
You can grab both modded bobbers here
Thanks for upload....... for me mcbob works well, mvbob... no, there's some problem.
ficofico is offline   Reply With Quote
Old 4th October 2007, 22:42   #69  |  Link
Terranigma
*Space Reserved*
 
Terranigma's Avatar
 
Join Date: May 2006
Posts: 953
Quote:
Originally Posted by ficofico View Post
for me mcbob works well, mvbob... no, there's some problem.
What kind of problem? It runs just fine here.
Make sure you have all the prerequisites.
I didn't include any of them for either scripts since that's only what boulder asked for.

Last edited by Terranigma; 4th October 2007 at 22:44.
Terranigma is offline   Reply With Quote
Old 5th October 2007, 11:45   #70  |  Link
2Bdecided
Registered User
 
Join Date: Dec 2002
Location: Yorkshire, UK
Posts: 1,673
I've finally jumped in with this.

NNEDI seems to have different strengths from EEDI2 - another useful tool - thank you tritical!

However, I'm having problems with mcbob downloaded from Terranigma's link. The "old" EEDI2 MCBob_v03c works beautifully, but MCBob_v03u isn't right. It doesn't crash, and I get sensible output, but the deinterlacing is bad - on every second field (so bottom field on TFF content) moving diagonals look close to plain old bob() - much worse than v03c, and worse than NNEDI on its own. On the frame generated from top fields, it's not horrible, but not great – those bobbles on diagonals that nnedi reportedly avoided are present, whereas they aren't there with v03c.

What have I broken? I assume all plug-ins are OK since mcbob v03c works beautifully.

I can post samples and screen shots if it's not an obvious/known error.

Cheers,
David.
2Bdecided is offline   Reply With Quote
Old 5th October 2007, 12:59   #71  |  Link
krieger2005
Registered User
 
krieger2005's Avatar
 
Join Date: Oct 2003
Location: Germany
Posts: 377
If the problem is not NNEDI why discussing in the Thread of NNEDI?
krieger2005 is offline   Reply With Quote
Old 5th October 2007, 13:53   #72  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,394
Well, the problem is about correct usage of NNEDI, so it does fit here somehow.

Wrong:
Code:
Function nnEDIbob(clip Input)
	{
            [...]
	    GetParity(Input) ? Input.SeparateFields().nnEDI(dh=true,Field = 1) : Input.SeparateFields().nnEDI(dh=true,Field = 0)
	    AssumeFrameBased()
	    GetParity(Input) ? AssumeTFF() : AssumeBFF()
	}
NNEDI has slightly different operating modes compared to EEDI2, hence you can not just replace EEDI2 -> NNEDI in all circumstances.

Correct:
Code:
Function nnEDIbob(clip Input)
	{
            [...]
	    Input.SeparateFields()
	    GetParity(Input) ? Interleave( SelectEven().nnEDI(dh=true,Field = 1), SelectOdd().nnEDI(dh=true,Field = 0) )
	     \               : Interleave( SelectEven().nnEDI(dh=true,Field = 0), SelectOdd().nnEDI(dh=true,Field = 1) )
	    AssumeFrameBased()
	    GetParity(Input) ? AssumeTFF() : AssumeBFF()
	}
It would be less irritating if modes -2...3 were working the same way in EEDI2 and NNEDI, agreed.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)

Last edited by Didée; 5th October 2007 at 13:56.
Didée is offline   Reply With Quote
Old 5th October 2007, 15:04   #73  |  Link
Terranigma
*Space Reserved*
 
Terranigma's Avatar
 
Join Date: May 2006
Posts: 953
Quote:
Originally Posted by Didée View Post
Well, the problem is about correct usage of NNEDI, so it does fit here somehow.

Wrong:
Code:
Function nnEDIbob(clip Input)
	{
            [...]
	    GetParity(Input) ? Input.SeparateFields().nnEDI(dh=true,Field = 1) : Input.SeparateFields().nnEDI(dh=true,Field = 0)
	    AssumeFrameBased()
	    GetParity(Input) ? AssumeTFF() : AssumeBFF()
	}
NNEDI has slightly different operating modes compared to EEDI2, hence you can not just replace EEDI2 -> NNEDI in all circumstances.

Correct:
Code:
Function nnEDIbob(clip Input)
	{
            [...]
	    Input.SeparateFields()
	    GetParity(Input) ? Interleave( SelectEven().nnEDI(dh=true,Field = 1), SelectOdd().nnEDI(dh=true,Field = 0) )
	     \               : Interleave( SelectEven().nnEDI(dh=true,Field = 0), SelectOdd().nnEDI(dh=true,Field = 1) )
	    AssumeFrameBased()
	    GetParity(Input) ? AssumeTFF() : AssumeBFF()
	}
Thanks Didee for pointing that out.
Quote:
Originally Posted by Didée View Post
It would be less irritating if modes -2...3 were working the same way in EEDI2 and NNEDI, agreed.
Yes, I fully agree.

---
Link Updated.
Terranigma is offline   Reply With Quote
Old 5th October 2007, 20:13   #74  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
Code:
Function nnEDIbob(clip Input)
	{
	    Input.SeparateFields()
	    GetParity(Input) ? Interleave( SelectEven().nnEDI(dh=true,Field = 1), SelectOdd().nnEDI(dh=true,Field = 0) )
	     \               : Interleave( SelectEven().nnEDI(dh=true,Field = 0), SelectOdd().nnEDI(dh=true,Field = 1) )
	    AssumeFrameBased()
	    GetParity(Input) ? AssumeTFF() : AssumeBFF()
	}
much simpler:
Code:
Function nnEDIbob(clip Input)
	{
	    Input.nnedi(field=-2)
	}
Quote:
Originally Posted by Didée
It would be less irritating if modes -2...3 were working the same way in EEDI2 and NNEDI, agreed.
They do work the same way... the only difference is that you don't have to call separatefields() or separatefields().selecteven()/selectodd() before nnedi.

EEDIbob() could be simplified as well:
Code:
Function EEDIbob(clip Input, int "maxd")
	{
	    GetParity(Input) ? Input.SeparateFields().EEDI2(Field = 3, maxd = maxd) : Input.SeparateFields().EEDI2(Field = 2, maxd = maxd)
	    AssumeFrameBased()
	    GetParity(Input) ? AssumeTFF() : AssumeBFF()
	}
to

Code:
Function EEDIbob(clip Input, int "maxd")
	{
	    Input.SeparateFields().EEDI2(Field = -2, maxd = maxd)
	}
Just make sure you're using at least v0.9.1 of eedi2, the original didn't call vi.SetFieldBased(false).

Last edited by tritical; 5th October 2007 at 20:32.
tritical is offline   Reply With Quote
Old 6th October 2007, 00:32   #75  |  Link
Terranigma
*Space Reserved*
 
Terranigma's Avatar
 
Join Date: May 2006
Posts: 953
Thanks tritical for making things simpler and faster
I updated the bobbers once again, hopefully this'll be the last time :P
With mcbob, I switched the default interpolater with nnedi, changed mtnmode to 1, renamed Vinverse to VinverseD (D = Didée. Seriously Didée, I hope you're ok with this), and included triticals' much faster vinverse dynamic library file. Grab it here or from the link above.
Terranigma is offline   Reply With Quote
Old 16th October 2007, 10:14   #76  |  Link
2Bdecided
Registered User
 
Join Date: Dec 2002
Location: Yorkshire, UK
Posts: 1,673
I've always wondered with EEDI2, and this may apply even more to NNEDI...

When I use it to re-size, I call NNEDI twice, with turnright and turnleft after each call. Sometimes I do the whole process twice (so calling NNEDI four times - twice for each dimension).

Would it be possible / better if NNEDI worked in 2-D to start with, so it doubled in each dimension in one pass? I'm not worried about speed, but worried that the current two-pass method forces NNEDI to interpolate from what's already 50% interpolated data. I'm guessing that if it interpolated in 2-D in one pass, it would use only "real" data as a source for interpolation in both dimensions.


Second (easier?) question: with or without the above modification, could it be told to interpolate more than one pixel in a given dimension? I know for interlaced content, it's always 1-in-2 pixels "missing". However, when I process other things, sometimes it's 2-in-3 pixels missing (meaning I only have 1-in-3 pixels available). For now, I just call NNEDI twice, but it would be neater (and avoid interpolating from interpolation again!) if I could call it with a parameter to do 2x (like now), or 3x, or 4x etc interpolation.


I'm not asking or expecting you to do this tritical (I know you're busy), but if either part is easy/possible and you're updating NNEDI at any time anyway, please think about it. It might make it an even more interesting academic project!

Cheers,
David.
2Bdecided is offline   Reply With Quote
Old 16th October 2007, 10:38   #77  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,171
Yes, TurnLeft/Right by the nature of the algorithm are slow. They violate the "never look down" rule for fast processing. You either read the src across and write the dest down or vide versa.
IanB is offline   Reply With Quote
Old 16th October 2007, 13:14   #78  |  Link
MfA
Registered User
 
Join Date: Mar 2002
Posts: 1,075
Slow is a relative term, on a modern computer it shouldn't take more than a msec to transpose a SD yv12 frame from cache even with the naive C implementation in Avisynth (on mine it takes nearly 2, but that stuff ain't modern). Just a drop in the bucket really.

A bigger problem to me seems that processing U/V planes without data from the Y plane is a bit dodgy.

Last edited by MfA; 16th October 2007 at 14:41.
MfA is offline   Reply With Quote
Old 16th October 2007, 13:27   #79  |  Link
2Bdecided
Registered User
 
Join Date: Dec 2002
Location: Yorkshire, UK
Posts: 1,673
It's not speed I'm worried about (though if it makes it faster, great!) - it's accuracy. With turnright turnleft NNEDI is being given it's own output to work from - surely it would be better if we could avoid this?

Cheers,
David.
2Bdecided is offline   Reply With Quote
Old 16th October 2007, 14:39   #80  |  Link
Leak
ffdshow/AviSynth wrangler
 
Leak's Avatar
 
Join Date: Feb 2003
Location: Austria
Posts: 2,441
Quote:
Originally Posted by 2Bdecided View Post
It's not speed I'm worried about (though if it makes it faster, great!) - it's accuracy. With turnright turnleft NNEDI is being given it's own output to work from - surely it would be better if we could avoid this?
That's the way all other resizers in AviSynth work - scaling in two dimensions is done by scaling in one first and then scaling the result in the other.

Also, NNEDI is designed (or rather, trained) to interpolate between image's odd or even lines (which is about the same as doubling the height) - scaling in both directions would need a total rewrite and probably a lot more training.
__________________
now playing: [artist] - [track] ([album])
Leak 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 22:30.


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