seperate encoding and scaling from the same thread