Atomic-scale mechanisms for magnetostriction in CoFe2O4 and La0.5Sr0.5CoO3 oxides determined by differential x-ray absorption spectroscopy