Cython-optimised 2D bincount.