encode: fix some bugs.

Signed-off-by: Zhong Cong <congx.zhong@intel.com>
encode: some new add, need to be review.

Signed-off-by: Zhong Cong <congx.zhong@intel.com>