optimized computation of cross corr function