add decoder algorithms and update sliding in encoder