Electronic structure of BaPbO3 and Ba2PbO4