A quantum molecular dynamics study of proton diffusion in SrTiO3 and CaTiO3