local otsu: optimizations using primitive long