Encoder optimization