move encoder code to its own subdirectory