Moving mode encodings from common to encoder + cleanup.

Change-Id: I248ccb1532e2cd95314d0b95108f2c2e71cf084f
7 files changed