Packing of the func of encoding

Wenyuan finished packing of the func of encoding