Merge "Moving mode encodings from common to encoder + cleanup."