Add gitignore, Makefile. Optimize encode and pack.