amzirc: refactor the dynamic encoding selector