Finish the code and unit for encoder of ssmp