Wavefield extrapolation and prestack depth migration in anelastic inhomogeneous media