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
to your $PATH.


Example:

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



Options:
SClavc(string log, string preset, int dia, int predia, int preme, 
       int mbcmp, 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, mbcmp=0, cmp=0, subcmp=0, v4mv=false
	"fast": curently equivalent to
		dia=1, predia=1, preme=1, mbcmp=2, 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=-1, preme=2, mbcmp=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 (larger is slow and better)
	   -1    => special shape-adaptive diamond
	negative => shape-adaptive diamond
	I don't recommend any values other than 1 or -1 for sclavc.
	(-1 is slightly better and slightly slower than 1.)

predia:
	motion search prepass
	same values as dia

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

mbcmp:
	macroblock comparison function, decides whether to encode a block as I vs P
	useful values: (there are others, but I've never found them to help)
	0 => absolute difference (fast)
	1 => squared difference (medium)
	2 => Hadamard transform (slow), usually the best compression for anime
	3 => DCT (slower)

cmp:
	motion search comparison function
	same values as mbcmp

subcmp:
	subpixel motion comparison function
	same values as mbcmp

v4mv:
	allow 8x8 motion blocks, in addition to the default 16x16 blocks




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:  log2( max forward MV length )
bcode:  log2( max backward MV length )
var:    a measure of the picture's complexity
mc-var: the same complexity, after motion-compensation
icount: the number of macroblocks encoded as I

