digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Avisynth Scripting (http://www.digitalfaq.com/archives/avisynth/)
-   -   RemoveBorders filter for Avisynth [Readme] (http://www.digitalfaq.com/archives/avisynth/14680-removeborders-filter-avisynth.html)

kvcd.net Archives 10-28-2012 08:04 AM

RemoveBorders filter for Avisynth [Readme]
 
RemoveBorders - An Avisynth filter for removing black borders

By Ross Thomas <ross@grinfinity.com>

There is no copyright on this code, and there are no conditions on its distribution or use. Do with it what you will.

We all know (and, possibly, love) the AddBorders filter. Here's its conceptual opposite: instead of adding black borders to the clip, this filter removes existing black borders. It's as simple as that.

In order to more accurately determine what is a border and what isn't, RemoveBorders looks at a number of sample frames spread throughout the clip. It then uses the most common values it saw for each edge (i.e. the modal average) and crops the frame correspondingly.

Usage
Code:

RemoveBorders(clip clip, int luma_threshold, int samples, int round_width, int round_height)
ParameterMeaningDefault
clipSpecifies the clip to affect.last
luma_thresholdPixels on the edges of the frame within this threshold will be considered part of the border. Any pixel above this threshold means "the border ends here".60
samplesSpecifies the number of sample frames to inspect while determining border sizes. Since this is done upon initialization, using too high a number can cause a significant delay before the clip starts playing.5
round_width, round_heightThe filter will ensure that the final width and height of the frame are multiples of these values.4

Known Issues
- No Avisynth 2.5/YV12 version yet. That's coming next release.
- No MMX optimization. The YUY2 version doesn't really need it, but the YV12 version will.

To-Do
- A "show" mode to display pre- and post-processing frame size, detected borders, etc.
- Perhaps add FitCD-esque functionality.

History
- 0.1 - First release. Alpha code. Danger, Will Robinson!

Download here: http://www.digitalfaq.com/archives/a...h-filters.html


All times are GMT -5. The time now is 01:45 AM  —  vBulletin © Jelsoft Enterprises Ltd

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.