create temporary buffer for fftshift only once
calculate shift offset once, and don't clear buf