Dmitry Timoshkov wrote:
"Vitaly Budovski" vbudovski@gmail.com wrote:
Now that you got rid of sqrt calls usage of float numbers internally doesn't look justified (to me) anymore.
Only because in this instance it is used with integer data. It doesn't need to be limited to just integer values. Besides, what would be gained by changing it to integers as you suggest?
What would be gained is an additional speed. Since this code is supposed to be used to handle palette/color data there is no need to use floats at all.
As I explained previously, this algorithm makes no assumptions about the data that is being queried. Just because in this case (patch 3) we are working with RGB colour data doesn't mean it is limited to only that. It will work with *any* values, as long as you can provide an appropriate distance function. For this reason, I do not think that limiting the distances to integer values makes much sense. Getting rid of the square root has some benefit because it is generally an expensive operation. I do not think that getting rid of floats would give any noticeable performance improvements.