Kuwahara filter optimizations