Migration and velocity analysis by wavefield extrapolation