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 14th April 2010, 19:35   #1  |  Link
pbristow
Registered User
 
pbristow's Avatar
 
Join Date: Jun 2009
Location: UK
Posts: 263
Constrained searches for MVTools / MAnalyse

Hi!

Prompted by the recent discussions about converting anaglyph images to other formats, I've been experimenting with the use of MVTools to synthesize the missing colour data for each eye of a Blue/Yellow anaglyph video (Blue/Yellow? Yeah, it's crazy, but that's how they did it! Nearly all the image info is on the yellow side, natch...)

Anyway, I've found that some problems occur due to Manalyse mistakenly assigning vectors well away from the horizontal. Since the images I've got are well aligned vertically, I just need to force MAnalyse to only search along the x-axis, and ignore the y-axis. (This should also speed up the MAnalyse pass quite a lot! )

While I'm at it, for another use I've got in mind, it would be handy to have a vertical-only search too (for detecting and fixing vertical jitter on bad VHS rips).

So I've taken the plunge and looked at the sources for MVTools, and here's what I think I need to add:

1. In MVAnalyse.cpp, in the switch(st) block of code, add the following cases:

Code:
	case 6 :
		searchType = HORIZONTAL;
		nSearchParam = ( stp < 1 ) ? 1 : stp;
		break;
	case 7 :
		searchType = VERTICAL;
		nSearchParam = ( stp < 1 ) ? 1 : stp;
		break;
2. In PlaneOfBlocks.cpp,

Code:
//After:
            if ( searchType & UMHSEARCH )
                UMHSearch(nSearchParam, bestMV.x, bestMV.y);

//Insert:
            if ( searchType & HORIZONTAL )
		HorizontalSearch();

            if ( searchType & VERTICAL )
		HorizontalSearch();
and

Code:
//After:
	if ( searchType & UMHSEARCH )
		UMHSearch(nSearchParam, bestMV.x, bestMV.y);
//Add:
	if ( searchType & HORIZONTAL )
		HorizontalSearch();

	if ( searchType & VERTICAL )
		HorizontalSearch();
And finally:
Code:
//After the big chunk of code that goes:

void PlaneOfBlocks::UMHSearch(int i_me_range, int omx, int omy) // radius
{
	*** LOADS OF STUFF HERE ***
}



//Add:

void PlaneOfBlocks::HorizontalSearch(int r, int s, int mvx, int mvy) // width = 2*r + 1, step=s
{ 
// Examine a horizontal line working outward from (mvx, mvy) 
	int i;

// work along a line from -r to +r
	for ( i = 1; i < r; i+=s ) // 
	{
        CheckMV(mvx + i, mvy);
        CheckMV(mvx - i, mvy);
	}
}

void PlaneOfBlocks::VerticalSearch(int r, int s, int mvx, int mvy) // width = 2*r + 1, step=s
{ 
// Examine a horizontal line working outward from (mvx, mvy) 
	int i;

// work along a line from -r to +r
	for ( i = 1; i < r; i+=s ) // 
	{
        CheckMV(mvx, mvy+ i);
        CheckMV(mvx, mvy+ i);
	}
}
Now the obvious thing for me to do is to throw this code into a scratch copy of the source files and run a build and find out what I've missed. Only... I don't have a working compiler here at present. Is there any kind soul interested enough in this run an experienced eye over my code, and run me a test build?

And would folks be interested in seeing these two search types added to MVTools2?
pbristow is offline   Reply With Quote
Old 16th April 2010, 19:48   #2  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
yes. it may be done
__________________
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 16th April 2010, 23:04   #3  |  Link
pbristow
Registered User
 
pbristow's Avatar
 
Join Date: Jun 2009
Location: UK
Posts: 263
Hi!

Of all the plugins to cut my teeth on as a plugin modifier, I just *had* to pick the most complex (and powerful) of the lot... MVTools2! But, after a day of wrangling I've finally managed to the compiler and Platform SDK talking to each other correctly on this machine, and after a couple of false starts I've got these two new search modes working.

Thanks to their simplicity, they run really fast, too! This is the first time I can remember ever mo-comping 3 minutes of video in less than 5 minutes, let alone de-anaglyphing it to a pretty watchable cross-view version.

I'll happily post my tweaked sources and binary here and some samples of input/output here, but I need to get some sleep first. (Hopefully when I wake up, it won't all turn out to have been a dream... ) Expect an update sometime on Sunday.
pbristow is offline   Reply With Quote
Old 17th April 2010, 14:57   #4  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
posted VerticalSearch has a bug:

CheckMV(mvx, mvy- i);
CheckMV(mvx, mvy+ i);
__________________
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 26th March 2011, 00:06   #5  |  Link
pbristow
Registered User
 
pbristow's Avatar
 
Join Date: Jun 2009
Location: UK
Posts: 263
Just a note here, for anyone who stumbles across this thread in future, that pure horizontal and vertical searches have now been added to the official builds of MVTools2, as search types 6 and 7. (Thanks again, Fizick! )
pbristow is offline   Reply With Quote
Reply

Tags
de-anaglyph, de-jitter, manalyse, mvtools

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


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