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. |
2nd April 2003, 20:51 | #1 | Link |
Registered User
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 |
2nd April 2003, 22:27 | #2 | Link |
Retired AviSynth Dev ;)
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 |
2nd April 2003, 22:55 | #3 | Link | |
Registered User
Join Date: Oct 2001
Location: Gainesville FL USA
Posts: 2,092
|
Quote:
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 |
|
2nd April 2003, 22:59 | #5 | Link |
Registered User
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. |
3rd April 2003, 05:20 | #8 | Link | |
Registered User
Join Date: Oct 2001
Location: Gainesville FL USA
Posts: 2,092
|
Quote:
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 |
|
4th April 2003, 13:51 | #10 | Link |
Registered User
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 |
4th April 2003, 18:26 | #11 | Link |
Registered User
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. |
5th April 2003, 04:59 | #12 | Link |
Registered User
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. |
5th April 2003, 07:10 | #13 | Link |
Registered User
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 |
5th April 2003, 11:06 | #14 | Link |
Simply me
Join Date: Aug 2002
Location: Lancashire, England
Posts: 610
|
__________________
http://www.geocities.com/siwalters_uk/fnews.html |
24th April 2003, 13:14 | #15 | Link |
Retired AviSynth Dev ;)
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;
__________________
Regards, sh0dan // VoxPod Last edited by sh0dan; 24th April 2003 at 13:42. |
|
|