Full waveform inversion and joint migration inversion with an automatic directional total variation constraint