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 Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd April 2003, 20:51   #1  |  Link
trbarry
Registered User
 
trbarry's Avatar
 
Join Date: Oct 2001
Location: Gainesville FL USA
Posts: 2,092
New FillMargins() filter

I just released a little quick and dirty filter for Avisynth 2.5 that will fill the margins of a clip without having to change the dimensions. Sometimes you have a few pixels of black border or garbage at the edge of the screen and you don't want to crop because you need a multiple of 16 or whatever. My local ABC station has recently been like this. But this looks ugly and doesn't compress well.

The FillMargins(left, top, right, bottom) filter will fill in these margins with the contents of the outer edges of the unfilled area. It's for Avisynth 2.5 YV12 only but doesn't require any special processor, or any numeric multiples. See:

www.trbarry.com/Readme_FillMargins.txt and
www.trbarry.com/FillMargins.zip (source & dll)

This is pretty fast already but will probably go more than 10x faster once Avisynth is fixed so MakeWriteable doesn't need to copy the entire buffer each time.

BTW, FillMargins may likely be a poor mans version of Simon Walters more versatile BorderControl. But I didn't know about that one until I was half done, so I finished it anyway. Mines just a simple one function filter.

Please post any bugs.

- Tom
trbarry is offline   Reply With Quote
Old 2nd April 2003, 22:27   #2  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
There is probably something I don't get, but what does this filter do, that LetterBox() doesn't?
The MMX optimizations sound nice though.

Btw, MakeWritable doesn't copy data since some time before 2.5.1 - so if your frame isn't referenced anywhere else it is simply returned as is.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 2nd April 2003, 22:55   #3  |  Link
trbarry
Registered User
 
trbarry's Avatar
 
Join Date: Oct 2001
Location: Gainesville FL USA
Posts: 2,092
Quote:
There is probably something I don't get, but what does this filter do, that LetterBox() doesn't?
The MMX optimizations sound nice though.
Sh0dan -

I have no idea.

I never heard of LetterBox, or BorderControl, before yestterday. I just had some garbage on the edge of my image so I wrote an mmx filter for it. This is actually why I was asking about MakeWriteable a couple months ago but sometimes it takes awhile before I get around to stuff.

Two months of procrastinating and about 2 hours of coding.

- Tom
trbarry is offline   Reply With Quote
Old 2nd April 2003, 22:56   #4  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
ok! Just thought I was missing something
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 2nd April 2003, 22:59   #5  |  Link
trbarry
Registered User
 
trbarry's Avatar
 
Join Date: Oct 2001
Location: Gainesville FL USA
Posts: 2,092
Sh0dan -

Actually I just looked up Letterbox and it is different. Letterbox puts in a solid border of some color, default zero.

FillMargins extends the pixel color of the extended edge so it may compress better and you can't see the border if it's not very large.

- Tom

edit: Like this

LetterBox:

00000
0abc0
0def0
00000

FillMargins:

aabcc
aabcc
ddeff
ddeff

Last edited by trbarry; 2nd April 2003 at 23:02.
trbarry is offline   Reply With Quote
Old 2nd April 2003, 23:01   #6  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
oh - there was something I was missing - good to know!
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 2nd April 2003, 23:47   #7  |  Link
seewen
Registered User
 
Join Date: Jun 2002
Posts: 250
In the HelpFile it's written :

FillMargins(left, top, right, bottom)

But it seems to be :

FillMargins(NOTHING, top, LEFT, bottom)


Bye

P.S.
It works great for little black borders..
seewen is offline   Reply With Quote
Old 3rd April 2003, 05:20   #8  |  Link
trbarry
Registered User
 
trbarry's Avatar
 
Join Date: Oct 2001
Location: Gainesville FL USA
Posts: 2,092
Quote:
But it seems to be :

FillMargins(NOTHING, top, LEFT, bottom)
seewen -

Thanks for pointing that out.

Everybody please download v 1.0.1 which features a free cure for dyslexic input parms.

Same loc: www.trbarry.com/FillMargins.zip .

- Tom
trbarry is offline   Reply With Quote
Old 3rd April 2003, 12:44   #9  |  Link
seewen
Registered User
 
Join Date: Jun 2002
Posts: 250
It works much better now
seewen is offline   Reply With Quote
Old 4th April 2003, 13:51   #10  |  Link
Shayne
Registered User
 
Shayne's Avatar
 
Join Date: Jan 2002
Location: northern canada
Posts: 215
Why just yv12 color space i capture in YUY2?

Would be nice not to have to convert back and forth so much and my capture card has the same black bands as you mention,

Thanks for all ur work and great filters

PS I would love to see all your filters posted to a web page so we could check if we are up to date and whats new.

Peace
Shayne is offline   Reply With Quote
Old 4th April 2003, 18:26   #11  |  Link
trbarry
Registered User
 
trbarry's Avatar
 
Join Date: Oct 2001
Location: Gainesville FL USA
Posts: 2,092
"Why just yv12 color space i capture in YUY2?"

Shayne -

This was just a quick & dirty, and I was lazy (selfish) since I use almost all YV12 now. I guess if there was any real demand I could pretty easily do a YUY2 version.

But check out BorderControl(). I believe it can do the same thing with the right parms and was first designed for VHS caps so it might even be better suited for what you are doing.

- Tom

Last edited by trbarry; 4th April 2003 at 18:29.
trbarry is offline   Reply With Quote
Old 5th April 2003, 04:59   #12  |  Link
Shayne
Registered User
 
Shayne's Avatar
 
Join Date: Jan 2002
Location: northern canada
Posts: 215
I never really looked at addbourders before but i see how it can helpful when multiples of 8 are required to crop to move black boulders around.

Maybe i misunderstood but i thought FillMargins does not move the frame around but fills black borders by interp or distortion.
Shayne is offline   Reply With Quote
Old 5th April 2003, 07:10   #13  |  Link
trbarry
Registered User
 
trbarry's Avatar
 
Join Date: Oct 2001
Location: Gainesville FL USA
Posts: 2,092
I was recommending BorderControl, not AddBorders.

FillMargins just fills the margins by taking the outer most pixel (that is not in the margin) and using that as a fill color from there to the edge.

If you were to use AddBorders it's likely the entire frame would have to be copied to a new larger locatation. FillMargins can leave the frame where it is and just fill in the small margins, much faster.

- Tom
trbarry is offline   Reply With Quote
Old 5th April 2003, 11:06   #14  |  Link
Si
Simply me
 
Si's Avatar
 
Join Date: Aug 2002
Location: Lancashire, England
Posts: 610
@Shayne

BorderControl is another plugin available here
regards
Simon
Si is offline   Reply With Quote
Old 24th April 2003, 13:14   #15  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
When using "FillMargins(0,0,2,0)" I get a green pixel topleft - seems like a bug. Also it seems like there is garbage on the left side (even when converting to RGB before output).

Edit: Using:
Code:
int	  Roffs = (fRightW)
			? row_size - fRightW -1 
			: 0;
Seems to solve it (-1 inserted)
__________________
Regards, sh0dan // VoxPod

Last edited by sh0dan; 24th April 2003 at 13:42.
sh0dan is offline   Reply With Quote
Old 24th April 2003, 15:22   #16  |  Link
trbarry
Registered User
 
trbarry's Avatar
 
Join Date: Oct 2001
Location: Gainesville FL USA
Posts: 2,092
Arrrrrg! My life has been plagued by OBO errors.

But I think you are correct.

- Tom
trbarry is offline   Reply With Quote
Old 29th April 2003, 17:46   #17  |  Link
wotef
Registered User
 
wotef's Avatar
 
Join Date: Apr 2002
Posts: 272
just what i needed for a cap i did last night!


but i seemed to get better results, specifically, a less conspicuous border result with bordercontrol's "smear", than with fillmargin's method
wotef is offline   Reply With Quote
Old 6th March 2011, 17:31   #18  |  Link
Forteen88
Herr
 
Forteen88's Avatar
 
Join Date: Apr 2009
Location: North Europe
Posts: 222
Thanks, but I wonder, is there a FillMargins for x64?
Forteen88 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 07:39.


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