SClavc is an Avisynth 2.5 plugin, intended to allow access to libavcodec's scene-change metrics.

Note: It is separated into two dlls (SceneChange.dll and SceneChange-lavc.dll)
because of compiler issues. libavcodec wants GCC, while Avisynth wants MSVC.
Just make sure that SceneChange-lavc.dll is somewhere that can be found.
Your avs plugin directory may not be such a location. In that case, add it
your $PATH.


Example:

LoadPlugin("SceneChange.dll")
AVISource(...)
SClavc()



Options:
SClavc(string log, string preset, int dia, int predia, int preme, 
       int cmp, int subcmp, bool v4mv)

log:
	default: none
	A file name in which to write lavc's 2pass stats.
	Whether or not log is specified, the stats are also output via OutputDebugString()

preset:
	"lavc default": lavc defaults, which are very fast and not great for compression.
		dia=1, predia=1, preme=1, cmp=0, subcmp=0, v4mv=false
	"fast": curently equivalent to
		dia=1, predia=1, preme=1, cmp=1, subcmp=1, v4mv=true
	"slow": A decent set for encoding, but maybe not the best for this
			purpose. currently equivalent to
		dia=1, predia=-3, preme=2, cmp=2, subcmp=2, v4mv=true
	default: "fast"

The following options are identical to the options of the same name in mencoder.

dia:
	motion search diamond size
	range: [-99,-1] or [1,6]
	positive => EPZS diamond
	negative => shape-adaptive diamond

predia:
	motion search prepass
	same values as dia

preme:
	when to use the prepass
	0 => never
	1 => only after I-frames
	2 => always

cmp:
	motion search comparison function
	useful values: (there are others, but I've never found them to help)
	0 => absolute difference (fast)
	1 => squared difference (fast), tends to generate more I-blocks
	2 => Hadamard transform (medium), usually the best compression for anime
	3 => DCT (slow)

subcmp:
	subpixel comparison function
	same values as cmp

v4mv:
	allow 4 motion vectors per macroblock




Each stats line looks like this:
  in:20 out:20 type:2 q:236 itex:18180 ptex:25956 mv:514 misc:13097 fcode:1 bcode:4 mc-var:8434 var:170502 icount:887;

in:     frame number
out:    frame number after reordering B-frames
type:   1 => I, 2 => P, 3 => B, 4 => S
        (You should only see I and P in logs generated by SClavc)
q:      Lagrange multiplier (approximately proportional to quantizer)
itex:   total bits taken by I-blocks in this frame
ptex:   total bits taken by P-blocks
mv:     total bits taken by motion vectors
misc:   total bits taken by other things (headers, block types, QP, ...)
fcode:  forward MV resolution
bcode:  backward MV resolution (for B-frames)
var:    a measure of the picture's complexity
mc-var: the same complexity, after motion-compensation
icount: the number of macroblocks encoded as I

