Move two functions to encoder

As they are used by encoder only.

Change-Id: I7b1e6955b218aba66fe156523521a8121c9a84a4
5 files changed