code reconstruction for encoder