Refactor setChannelGlobalMinMax() logic

This change should start decreasing the total upload time when uploading an image with a large number of channels.

/cc @jburel