;+
;write avi file
;+
PRO AviPut, avi_id, frame, image, RootDir = rootDir

	COMPILE_OPT IDL2

	IF N_Elements(avi_id) NE 9 THEN Message, 'NO CORRECT AVI_ID'
	IF N_Elements(image) NE avi_id[0]/8*avi_id[1]*avi_id[2] THEN Return
	IF Size(image, /Type) NE 1 THEN image = Byte(image)

	error = Call_External(rootDir+'\resource\avi\avi.dll', 'avi_put', $
					avi_id, Long(frame), image)
	IF error THEN Print, 'no product'+Strtrim(String(frame),2)+'frame'
	avi_id[3] = avi_id[3]+1

END