Defect structure of non-stoichiometric and aliovalently doped perovskite oxides