# DeBlock_Int function: properly deblock an interlaced source
# Written by MrC (December 2012)
# from Didée and Manolito inputs (http://forum.doom9.org/showthread.php?p=934083)
# Following AviSynth plugins are required in the same folder:
#   DGDecode.dll	    more info @ http://neuron2.net/dgmpgdec/dgmpgdec.html

LoadPlugin("DGDecode.dll")

Function DeBlock_Int(clip IS, int "quant", int "aOffset", int "bOffset", bool "mmx", bool "isse")
{
	par = GetParity(IS)
	SeparateFields(IS)
	PointResize(width(IS),height(IS))
	Deblock(quant, aOffset, bOffset, mmx, isse)
	AssumeFrameBased()
	SeparateFields()
	Merge(SelectEven(), SelectOdd())
	par ? AssumeTFF() : AssumeBFF()
	Weave()
 
	Return Last
}