encoding patches