controller encode decode