iOS implementation of Octree Quantization of a GIF image