GIFnets: An end-to-end neural network based GIF encoding framework