fast implementations of min max tree for interactive image