changed FWT , Decode &  Encode methods to work depending on the file format