AVS AutoCrop, IIRC, then for TOP edge only.
Code:
Starts with Top Limit Cursor about mid frame,
For Sample Frame of SAMPLES frames
Scanning inwards from Top edge towards Top Limit Cursor,
if at least Z number of consecutive raster lines luma average above some theshold then
Move Top Limit Cursor outwards to that outer raster line and move on to next frame in SAMPLES.
At end of SAMPLES frames, Top Limit Cursor is the result for top image edge. [above it is border]
Detected image grows over SAMPLES frames, whatever is left outside of detection is border.
Z number of consecutive raster lines, avoids noise.
EDIT:
Avs AutoCrop uses default SAMPLES=5, RoboCrop uses default SAMPLES=40,
Not sure, think autocrop uses Z=3, RoboCrop Z=4.
AutoCrop fixed threshold. RoboCrop is auto thresholded via Min Luma over SAMPLES frames [+ threshold], [Or fixed threshold].
Autocrop defaults can make major [overcrop] mistakes.
EDIT: AutoCrop/RoboCrop both clip global scanners, ie do not detect dynamic changing borders, outermost border detectors.