(implements the backward and forward transforms in the encoder) original patch by Wayne Chen (datoudatou at gmail dot com) Change-Id: Ic00f3bffcdf7a924f043006728735c810ee47a57